<commit_before><?php
namespace UliCMS\Backend;

use ActionRegistry;
use Settings;
use zz\Html\HTMLMinify;
use UliCMS\Security\PermissionChecker;

// This class renders a backend page
// if you set a model from a model
// you can get it with this code in your template
// $model = BackendPageRenderer::getModel();
class BackendPageRenderer
{

    private $action;

    private static $model;

    public function __construct($action, $model = null)
    {
        $this->action = $action;
        
        self::$model = $model;
    }

    public function getAction()
    {
        return $this->action;
    }

    public function setAction($action)
    {
        $this->action = $action;
    }

    public static function getModel()
    {
        return self::$model;
    }

    public static function setModel($model)
    {
        self::$model = $model;
    }

    public function render()
    {
        $permissionChecker = new PermissionChecker(get_user_id());
        if (Settings::get("minify_html")) {
            ob_start();
        }
        
        include "inc/ulicms_head.php";
        
        if (! is_logged_in()) {
            if (isset($_GET["register"])) {
                do_event("before_register_form");
                require_once "inc/registerform.php";
                do_event("after_register_form");
            } else if (isset($_GET["reset_password"])) {
                do_event("before_reset_password_form");
                require_once "inc/reset_password.php";
                do_event("before_after_password_form");
            } else {
                do_event("before_login_form");
                require_once "inc/loginform.php";
                do_event("after_login_form");
            }<commit_msg>add comment<commit_after><?php
namespace UliCMS\Backend;

use ActionRegistry;
use Settings;
use zz\Html\HTMLMinify;
use UliCMS\Security\PermissionChecker;

// This class renders a backend page
// if you set a model from a model
// you can get it with this code in your template
// $model = BackendPageRenderer::getModel();
class BackendPageRenderer
{

    private $action;

    private static $model;

    public function __construct($action, $model = null)
    {
        $this->action = $action;
        
        self::$model = $model;
    }

    public function getAction()
    {
        return $this->action;
    }

    public function setAction($action)
    {
        $this->action = $action;
    }

    public static function getModel()
    {
        return self::$model;
    }

    public static function setModel($model)
    {
        self::$model = $model;
    }

    // renders a backend page, outputs it and do events
    public function render()
    {
        $permissionChecker = new PermissionChecker(get_user_id());
        if (Settings::get("minify_html")) {
            ob_start();
        }
        
        include "inc/ulicms_head.php";
        
        if (! is_logged_in()) {
            if (isset($_GET["register"])) {
                do_event("before_register_form");
                require_once "inc/registerform.php";
                do_event("after_register_form");
            } else if (isset($_GET["reset_password"])) {
                do_event("before_reset_password_form");
                require_once "inc/reset_password.php";
                do_event("before_after_password_form");
            } else {
                do_event("before_login_form");
                require_once "inc/loginform.php";
                do_event("after_login_form");
            }
{'fraction_non_alphanumeric': 0.11177136389360498, 'fraction_numerical': 0.0, 'mean_word_length': 2.068576388888889, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '4819692', 'n_tokens_mistral': 1012, 'n_tokens_neox': 981, 'n_words': 222}