<commit_before><?php

class Addontools extends MY_Controller {

    function __construct()
    {
        parent::__construct();
    }

    public function show()
    {
        $loggedin = $this->j_auth->logged_in();
        if (!$loggedin)
        {
            if (!$this->input->is_ajax_request())
            {
                redirect('auth/login', 'location');
                return;
            }
            else
            {
                set_status_header(403);
                echo 'No session';
                return;
            }
        }
        $data['titlepage'] = 'Tools';
        $data['content_view'] = 'tools/list_view';
        $this->load->view('page', $data);
    }

    public function msgdecoder()
    {
        $loggedin = $this->j_auth->logged_in();
        if (!$loggedin)
        {
            if (!$this->input->is_ajax_request())
            {
                redirect('auth/login', 'location');
                return;
            }
            else
            {
                set_status_header(403);
                echo 'No session';
                return;
            }
        }

        if ($this->input->is_ajax_request() && $this->input->post())
        {
            $encodedmsg = trim($this->input->post('inputmsg'));

            if (empty($encodedmsg))
            {
                echo lang('error_noinput');
                return;
            }

            $isurl = parse_url($encodedmsg, PHP_URL_QUERY);
            if (!empty($isurl))
            {
                $encodedmsg = $isurl;
            }

            $arr = array();
            $query = parse_str($encodedmsg, $arr);
            if (array_key_exists('SAMLResponse', $arr))
            {
                $encodedmsg = $arr['SAMLResponse'];
            }
            elseif (array_key_exists('SAMLRequest', $arr))
            {
                $encodedmsg = $arr['SAMLRequest'];
            }
            elseif (array_key_exists('LogoutRequest', $arr))
            {
                $encodedmsg = $arr['LogoutRequest'];
            }
            elseif (array_key_exists('LogoutResponse', $arr))
            {
                $encodedmsg = $arr['LogoutResponse'];
            }
            else
            {

                $encodedmsg = rawurldecode(stripslashes($encodedmsg));
            }



            $decodedmsg = jSAMLDecoder($encodedmsg);
            echo htmlspecialchars($decodedmsg);
            return;
        }

        $data['titlepage'] = 'SAML decoder';
        $data['content_view'] = 'tools/msgdecoder_view';
        $this->load->view('page', $data);
    }

  

}
<commit_msg>allow to set public access to specified addons<commit_after><?php

class Addontools extends MY_Controller {

    function __construct()
    {
        parent::__construct();
    }

    public function show()
    {
        $loggedin = $this->j_auth->logged_in();
        if (!$loggedin)
        {
            if (!$this->input->is_ajax_request())
            {
                redirect('auth/login', 'location');
                return;
            }
            else
            {
                set_status_header(403);
                echo 'No session';
                return;
            }
        }
        $data['titlepage'] = 'Tools';
        $data['content_view'] = 'tools/list_view';
        $this->load->view('page', $data);
    }

    public function msgdecoder()
    {
        $publicAccess = FALSE;
        $access = $this->config->item('addontools');
        if(!empty($access) && is_array($access) && isset($access['msgdecoder']) && $access['msgdecoder'] === TRUE)
        {
            $publicAccess = TRUE;
        }
        $loggedin = $this->j_auth->logged_in();
        if (!$loggedin && !$publicAccess)
        {
            if (!$this->input->is_ajax_request())
            {
                redirect('auth/login', 'location');
                return;
            }
            else
            {
                set_status_header(403);
                echo 'No session';
                return;
            }
        }

        if ($this->input->is_ajax_request() && $this->input->post())
        {
            $encodedmsg = trim($this->input->post('inputmsg'));

            if (empty($encodedmsg))
            {
                echo lang('error_noinput');
                return;
            }

            $isurl = parse_url($encodedmsg, PHP_URL_QUERY);
            if (!empty($isurl))
            {
                $encodedmsg = $isurl;
            }

            $arr = array();
            $query = parse_str($encodedmsg, $arr);
            if (array_key_exists('SAMLResponse', $arr))
            {
                $encodedmsg = $arr['SAMLResponse'];
            }
            elseif (array_key_exists('SAMLRequest', $arr))
            {
                $encodedmsg = $arr['SAMLRequest'];
            }
            elseif (array_key_exists('LogoutRequest', $arr))
            {
                $encodedmsg = $arr['LogoutRequest'];
            }
            elseif (array_key_exists('LogoutResponse', $arr))
            {
                $encodedmsg = $arr['LogoutResponse'];
            }
            else
            {

                $encodedmsg = rawurldecode(stripslashes($encodedmsg));
            }



            $decodedmsg = jSAMLDecoder($encodedmsg);
            echo htmlspecialchars($decodedmsg);
            return;
        }

        $data['titlepage'] = 'SAML decoder';
        $data['content_view'] = 'tools/msgdecoder_view';
        $this->load->view('page', $data);
    }

  

}

{'fraction_non_alphanumeric': 0.1366258111031002, 'fraction_numerical': 0.0021629416005767843, 'mean_word_length': 1.329554995801847, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, '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': '3621117', 'n_tokens_mistral': 1573, 'n_tokens_neox': 1499, 'n_words': 233}