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/TaskController.php
<?php

include_once "Controller.php";
include_once __DIR__ . "/../models/TaskModel.php";
include_once __DIR__ . "/../assets/libs/Helper.php";

class TaskController extends Controller {

    protected $id;
    protected $model;

    public function __construct($ui, $_L, $config, $_pd, $client_id = null) {
        parent::__construct($ui, $_L, $config, $_pd, $client_id);

        $this->ui->assign('_title', $this->_L['module imobles task'] . ' - ' . $this->config['CompanyName']);
        $this->ui->assign('_st', $_L['module imobles']);

        $this->model = new TaskModel();

        $this->id = $this->routes[3];

       
        $user = User::_info();
        //regra que remove arquivos antigos deixados na pasta tem do usuário
        if (!isset($_SESSION['files']['module_imobles/task/add'])) {
            if (is_dir('application/plugins/module_imobles/uploads/temp/' . $user->id . "/")) {
                $scan = scandir('application/plugins/module_imobles/uploads/temp/' . $user->id . "/");
                foreach ($scan as $file) {
                    if(is_file('application/plugins/module_imobles/uploads/temp/' . $user->id . "/" . $file))
                    unlink('application/plugins/module_imobles/uploads/temp/' . $user->id . "/" . $file);
                }
            }
            $_SESSION['files']['module_imobles/task/add'] = array();
        }
    }

    public function listAll() {

        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
            $filter['type'] = filter_var(_post('type'), FILTER_SANITIZE_STRING);
            $filter['module_imobles_task_category_id'] = filter_var(_post('module_imobles_task_category_id'), FILTER_SANITIZE_STRING);
            $_SESSION['filter']['module_imobles/task/listAll'] = $filter;
            r2(U . 'module_imobles/task/listAll');
        }



        $tasks = ORM::for_table('module_imobles_tasks')
                ->left_outer_join('module_imobles_task_category', 't.id = module_imobles_tasks.module_imobles_task_category_id', 't');

        $tasks->where_null('module_imobles_tasks.deleted_at');
        if (isset($_SESSION['filter']['module_imobles/task/listAll']['type']) && !empty($_SESSION['filter']['module_imobles/task/listAll']['type'])) {
            $tasks->where('t.type', $_SESSION['filter']['module_imobles/task/listAll']['type']);
            $this->ui->assign('typeSelected', array($_SESSION['filter']['module_imobles/task/listAll']['type']));
        } else {
            $this->ui->assign('typeSelected', array());
        }
        if (isset($_SESSION['filter']['module_imobles/task/listAll']['module_imobles_task_category_id']) && !empty($_SESSION['filter']['module_imobles/task/listAll']['module_imobles_task_category_id'])) {
            $tasks->where('t.id', $_SESSION['filter']['module_imobles/task/listAll']['module_imobles_task_category_id']);

            $c = ORM::for_table('module_imobles_task_category')->find_one($_SESSION['filter']['module_imobles/task/listAll']['module_imobles_task_category_id']);
            if ($c) {
                $this->ui->assign('categorySelected', $c);
            } else {
                $this->ui->assign('categorySelected', array());
            }
        } else {
            $this->ui->assign('categorySelected', array());
        }


        $tasks = $tasks->select_expr("module_imobles_tasks.id, module_imobles_tasks.title, t.name as name_category")
                        ->order_by_asc('module_imobles_tasks.sorder')->find_many();

        $this->ui->assign('task', $tasks);
        $this->ui->assign('_st', $this->_L['module imobles list task']);

        $this->ui->assign('jsvar', '
        _L[\'are_you_sure\'] = \'' . $this->_L['are_you_sure'] . '\';
        _L[\'Select\'] = \'' . $this->_L['Select'] . '\';
         ');

        $this->ui->assign('_include', 'task/list');
        $js_arr = array('s2/js/select2.min', '/../../../application/plugins/module_imobles/assets/js/task-list',);
        $assets_js = Asset::js($js_arr, 'v4');
        $this->ui->assign('xfooter', $assets_js);

        $css_arr = array('s2/css/select2.min');
        $assets_css = Asset::css($css_arr, "v4");
        $this->ui->assign('xheader', $assets_css);

        $this->ui->display('wrapper.tpl');
    }

    public function delete() {
        $task = $this->model->getOne(_post('id'));
        if ($task->defautl == 0) {
            $this->model->deleteTask($task);
            r2(U . 'module_imobles/Task/listAll', 's', $this->_L['delete_successful']);
        } else {
            r2(U . 'module_imobles/Task/listAll', 's', $this->_L['Not Permited']);
        }
    }

    public function reorder() {
        $taskS = ORM::for_table('module_imobles_tasks');
        $task = $taskS->order_by_asc('sorder')->find_many();

        $this->ui->assign('ritem', $this->_L['module imobles task']);
        $this->ui->assign('d', $task);
        $this->ui->assign('display_name', 'title');
        $this->ui->assign('xheader', '
        <link rel="stylesheet" type="text/css" href="' . APP_URL . '/ui/theme/' . $this->config['theme'] . '/css/liststyle.css"/>
        ');
        $help = new Helper();
        $this->ui->assign('xjq', $help->reorder('module_imobles_tasks'));
        $this->ui->display('reorder.tpl');
    }

    public function add() {
        // CARREGA CSS E JS'S
        $css_arr = array(
            's2/css/select2.min',
            'dropzone/dropzone',
            'modal',
            'redactor/redactor'
        );

        $js_arr = array(
            'modal',
            's2/js/select2.min',
            's2/js/i18n/' . lan(),
            'dropzone/dropzone',
            '/../../../application/plugins/module_imobles/assets/js/task-form',
            'redactor/redactor.min',
        );
//
        $assets_css = Asset::css($css_arr, "v3");
        $assets_js = Asset::js($js_arr, "v3");
        $this->ui->assign('xheader', $assets_css);
        $this->ui->assign('xfooter', $assets_js);
        $this->ui->assign('xfooter', $assets_js);

        $user = User::_info();

        $arrayimagesn = array();
        if (isset($_SESSION['files']['module_imobles/task/add'])) {
            $arrayimagesn = $_SESSION['files']['module_imobles/task/add'];
        } else {
            
        }
        $att = "";
        $attachs = "";
        if (count($arrayimagesn) > 0) {

            foreach ($arrayimagesn as $i) {
                //temporario 100 o tamanho
                $att .= '{id:"",file:"' . $i['src'] . '", name: "' . $i['name'] . '", size: 100,url:"' . $i['url'] . '" },';
                $attachs .= "," . $i['src'];
            }
        } else {
            $att = "";
        }
        $this->ui->assign('attachs', substr($attachs, 1));

        $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 Delete Attach?\'] = \'' . $this->_L['module imobles Delete Image?'] . '\';

        var existingFiles = [' . $att . '
        ];
       ');

        $this->ui->assign('task', json_decode(json_encode(array(
            "title" => "",
            "id" => "",
            "description" => "",
            "url" => "",
        ))));


        $this->ui->assign('typeForm', 'window');

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

    /**
     * Insert add to status diary
     */
    public function post() {
        try {
            $data = $_POST;
            $msg = '';

            // Verifico se preencheu o Empreendimento
            if (empty(_post('title'))) {
                $msg .= $this->_L['Title'] . $this->_L['is required'];
            }
            if (empty(_post('module_imobles_task_category_id'))) {
                $msg .= $this->_L['module imobles task_category name'] . $this->_L['is required'];
            }
            
            
            if (empty($msg)) {
                $data['new_imgs'] = array();
                //carrega primeiro as imagens já do ssitema
                if (isset($data['id']) && $data['id'] > 0) {
                    $task = $this->model->getOne($data['id']);
                    $arrayimagesn = json_decode($task->images, true);
                    if ($arrayimagesn)
                        foreach ($arrayimagesn as $a) {
                            $data['new_imgs'][] = array("src" => $a['src'], "name" => $a['name']);
                        }
                }


                if (isset($_SESSION['files']['module_imobles/task/add'])) {
                    $arrayimagesn = $_SESSION['files']['module_imobles/task/add'];
                    foreach ($arrayimagesn as $key => $a) {
                        $data['new_imgs'][] = array("src" => $a['src'], "name" => $a['name']);
                    }
                }



                if (isset($data['id']) && $data['id'] > 0) {
                    $task = $this->model->updateTask($data, $task);
                    _notify($this->_L['module imobles task'] . " " . $this->_L['Edited Successfull'], 's');
                } else {
                    $data['verified'] = 1;
                    $data['crawler_type_id'] = 4;
                    $task = $this->model->createTask($data);
                    _notify($this->_L['module imobles task'] . " " . $this->_L['Add Successfull'], 's');
                }
                if (isset($_SESSION['files']['module_imobles/task/add'])) {
                    $arrayimagesn = $_SESSION['files']['module_imobles/task/add'];

                    $dir = ('application/plugins/module_imobles/uploads/task/' . $task->id . "/");

                    if (!is_dir($dir)) {
                        mkdir($dir, 0777, $recursive = true);
                    }


                    $user = User::_info();
                    if ($arrayimagesn)
                        foreach ($arrayimagesn as $key => $a) {
                            rename('application/plugins/module_imobles/uploads/temp/' . $user->id . "/" . $a['src'], 'application/plugins/module_imobles/uploads/task/' . $task->id . "/" . $a['src']);
                        }
                    $_SESSION['files']['module_imobles/task/add'] = array();
                }
                $msg = 'OK';
            }
        } catch (Exception $ex) {
            echo ($ex->getMessage());
        }
        echo $msg;
    }

    /**
     * Show form to edit status exam
     */
    public function edit() {
        $this->id = $this->routes[3];

        if (empty($this->routes[3]) || !is_numeric($this->routes[3])) {
            die($this->_L['Id_Required']);
        }

        $task = $this->model->getOne($this->routes[3]);

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

        $this->ui->assign('task', $task);


        $c = ORM::for_table('module_imobles_task_category')->find_one($task->module_imobles_task_category_id);
        if ($c) {
            $this->ui->assign('module_imobles_task_category', $c);
        }

        $att = "";
        $attachs = '';
        $arrayimagesn = json_decode($task->images);
        if ($arrayimagesn) {
            foreach ($arrayimagesn as $i) {
                //temporario 100 o tamanho
                $att .= ' {id:"' . $task->id . '", file: "' . $i->src . '",name: "' . $i->name . '", size: 100,url:"' . APP_URL . '/application/plugins/module_imobles/uploads/task/' . $task->id . "/" . $i->src . '" },';
                $attachs .= "," . $i->name;
            }
        } else {
            $att = "";
        }
        $this->ui->assign('attachs', substr($attachs, 1));





        $this->ui->assign('_include', 'task/add');
        if (isset($this->routes[4]) && $this->routes[4] == 'modal') {
            $this->ui->assign('typeForm', 'modal');
            $this->ui->display('wrapper_clean.tpl');
        } else {

            $css_arr = array(
                's2/css/select2.min',
                'dropzone/dropzone',
                'modal',
                'redactor/redactor'
            );
    
            $js_arr = array(
                'modal',
                's2/js/select2.min',
                's2/js/i18n/' . lan(),
                'dropzone/dropzone',
                '/../../../application/plugins/module_imobles/assets/js/task-form',
                'redactor/redactor.min',
            );


            $assets_css = Asset::css($css_arr, 'v1');
            $assets_js = Asset::js($js_arr, 'v1');
            $this->ui->assign('xheader', $assets_css);
            $this->ui->assign('xfooter', $assets_js);
            $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 Delete Attach?\'] = \'' . $this->_L['module imobles Delete Image?'] . '\';

        var existingFiles = [' . $att . '
        ];
       ');
            $this->ui->assign('typeForm', 'window');
            $this->ui->display('wrapper.tpl');
        }
    }

    public function add_attach() {
        $uploader = new Uploader();
        $user = User::_info();

        $id = '';
        if (isset($this->routes['3']) && $this->routes['3'] > 0) {
            $dir = ('application/plugins/module_imobles/uploads/task/' . $this->routes['3'] . "/");
            $id = $this->routes['3'];
        } else {
            $dir = ('application/plugins/module_imobles/uploads/temp/' . $user->id . "/");
        }

        if (!is_dir($dir)) {
            mkdir($dir, 0777, $recursive = true);
        }
        $uploader->setDir($dir);

        $uploader->sameName(false);
        $uploader->setExtensions(array('jpg', 'jpeg', 'png', 'gif', 'pdf'));
        $uploader->setMaxSize(5);
        if ($uploader->uploadFile('file')) {
            $uploaded = $uploader->getUploadName();
            $file = $uploaded;
            $msg = "Envio concluído";
            $success = 'Yes';
            if (isset($this->routes['3']) && $this->routes['3'] > 0) {
                $d = ORM::for_table('module_imobles_tasks')->find_one($this->routes['3']);
                $arrayimagesn = json_decode($d->images, true);
                $arrayimagesn[] = array("src" => $uploaded, "name" => $uploader->getOldName());
                $d->images = json_encode($arrayimagesn);
                $d->save();
            } else {
                if (isset($_SESSION['files']['module_imobles/task/add'])) {
                    $arrayimagesn = $_SESSION['files']['module_imobles/task/add'];
                }
                $arrayimagesn[] = array("src" => $uploaded, "name" => $uploader->getOldName(), 'url' => APP_URL . "/" . $dir . $uploaded);
                $_SESSION['files']['module_imobles/task/add'] = $arrayimagesn;
            }
        } else {//upload failed
            $file = '';
            $msg = $uploader->getMessage();
            $success = 'No';
            $id = '';
        }

        $a = array(
            'success' => $success,
            'msg' => $msg,
            'file' => $file,
            'id' => $id,
            'url' => APP_URL . "/" . $dir . '/' . $file
        );

        header('Content-Type: application/json');

        echo json_encode($a);
    }

    public function delete_attach() {
        $user = User::_info();
        $id = _post('id');
        $file = _post('file');
        if (!empty($id)) {
            $dir = ('application/plugins/module_imobles/uploads/task/' . $id . "/");
            $d = ORM::for_table('module_imobles_tasks')->find_one($id);
            $arrayimagesn = json_decode($d->images);
            if ($arrayimagesn) {
                foreach ($arrayimagesn as $key => $a) {
                    if ($a->src == $file) {
                        unset($arrayimagesn[$key]);
                    }
                }
                $d->images = json_encode($arrayimagesn);
                $d->save();
            }
        } else {
            $arrayimagesn = array();
            if (isset($_SESSION['files']['module_imobles/task/add'])) {
                $arrayimagesn = $_SESSION['files']['module_imobles/task/add'];
            }
            if ($arrayimagesn) {
                foreach ($arrayimagesn as $key => $a) {
                    if ($a['src'] == $file) {
                        unset($arrayimagesn[$key]);
                    }
                }
                $_SESSION['files']['module_imobles/task/add'] = $arrayimagesn;
            }
            $dir = ('application/plugins/module_imobles/uploads/temp/' . $user->id . "/");
        }
        if (!empty($file)) {
            if (file_exists($dir . $file)) {
                unlink($dir . $file);
            }
            $msg = $this->_L['Deleted Successfully'];
            $status = 'Yes';
        }

        $data = array(
            'status' => $status,
            'msg' => $msg,
        );
        header('Content-Type: application/json');
        echo json_encode($data);
    }

}

Anon7 - 2022
AnonSec Team