AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.216.59
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/leve/application/plugins/module_fleet/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/www/lrsys_apps/leve/application/plugins/module_fleet/controllers/alocation_vehicle.php
<?php
_auth();

$ui->assign('_application_menu', $routes['1']);
$ui->assign('_title', $_L['Module Fleets'] . ' - ' . $config['CompanyName']);
$action = $routes['2'];
$user = User::_info();
$ui->assign('user', $user);
$ui->assign('_st', $_L['Module Fleets']);
switch ($action) {
    case 'list':
        $alocation = new AlocationVehicle();
        $all = $alocation->allList();
        $ui->assign('alocation', $all);
//        $js_arr = array(
//            'numeric');
//        $assets_js = Asset::js($js_arr);
//        $ui->assign('xfooter', $assets_js . '<script type="text/javascript" src="' . $_pd . '/assets/js/vehicles-list.js"></script>');
//
//        //bottom bar com as informações
//        $total_value_market = 0;
//        foreach ($all as $v) {
//            $total_value_market+=$v['market_value'];
//            //  $tota
//        }
//        $bottomBar = array(
////            array('type'=>'monetary','info'=>$_L['Total Pending'],'value'=> 21),
////            array('type'=>'monetary','info'=>$_L['Total Paid'],'value'=> 11),
//            array('type' => 'monetary', 'info' => $_L['Fleets Current value of the fleet'], 'value' => $total_value_market),
//            array('type' => 'int', 'info' => $_L['Fleets Vehicles Total'], 'value' => count($all))
//        );
//        $ui->assign('bottomBar', $bottomBar);

        $ui->assign('_include', 'list-alocation');
        $ui->display('wrapper.tpl');

        break;

    case 'out':
        $ui->assign('title', $_L['Fleets Add New Alocation'] . ' - ' . $_L['Fleets Register Out']);
        $css_arr = array(
            'modal', 'ibilling/clockpicker/clockpicker',
            's2/css/select2.min', 'dp/dist/datepicker.min');
        $js_arr = array(
            's2/js/select2.min', 'ibilling/clockpicker/clockpicker',
            'modal', 'numeric', 'dp/dist/datepicker.min');
        $assets_css = Asset::css($css_arr);
        $assets_js = Asset::js($js_arr);
        $ui->assign('xheader', $assets_css);
        $ui->assign('xfooter', $assets_js . '<script type="text/javascript" src="' . $_pd . '/assets/js/alocation_out.js"></script>');


        $ui->assign('xjq', '
            $(\'.amount\').autoNumeric(\'init\', {
                   dGroup: ' . $config['thousand_separator_placement'] . ',
                   aPad: ' . $config['currency_decimal_digits'] . ',
                   pSign: \'' . $config['currency_symbol_position'] . '\',
                   aDec: \'' . $config['dec_point'] . '\',
                   aSep: \'' . $config['thousands_sep'] . '\'
           });   
           $(\'.integer\').autoNumeric(\'init\', {aSep: \'\', aDec: \'' . $config['dec_point'] . '\', mDec: 0, aSign: \' \', pSign: \'s\'});
        ');
        $ui->assign('jsvar', '
            _L[\'are_you_sure\'] = \'' . $_L['are_you_sure'] . '\';
             ib_lang = \'en\';
             ib_rtl = false;
             ib_calendar_first_day = 0;
             ib_date_format_picker = \'' . ib_js_date_format($config['df'], 'picker') . '\';
             ib_date_format_moment = \'' . ib_js_date_format($config['df']) . '\';
         ');

        $ui->assign('_include', 'alocation-out-form');
        $ui->display('wrapper.tpl');

        break;

    case 'out-post':
        //recebe o nome do segmento para adicionar no banco de dados
        $msg = "";
        $vehicle = _post('module_fleets_vehicle_id');
        if (trim($vehicle) == '') {
            $msg.= $_L['Fleets Vehicle'] . $_L['is required'];
        }
        $employee = _post('employee_id');
        if (trim($employee) == '') {
            $msg.= $_L['Employee'] . $_L['is required'];
        }
        $km_out = _post('km_out');
        if (trim($km_out) == '') {
            $msg.= $_L['Fleets Km Out'] . $_L['is required'];
        }
        $tank_out = _post('tank_out');
        if (trim($tank_out) == '') {
            $msg.= $_L['Fleets Tank Out'] . $_L['is required'];
        }
        $date = _postDate('date_out', $_c);
        if (trim($date) == '') {
            $msg.= $_L['Fleets Date out'] . $_L['is required'];
        }
        $time = _post('out_time');
        if (trim($time) == '') {
            $msg.= $_L['Fleets Hour out'] . $_L['is required'];
        }


        if ($msg == '') {

            $alocation = new AlocationVehicle();
            $novo = $alocation->create();
            $novo->module_fleets_vehicle_id = $vehicle;
            $novo->employee_id = $employee;
            $novo->km_out = $km_out;
            $novo->tank_out = $tank_out;
            $novo->date_out = $date . " " . $time;
            $novo->save();
            _log($_L['Fleets Alocation Vehicles Added Successfully'] . "[ID]: " . $novo->id, $user['fullname'], $user['id']);
            _notify($_L['Fleets Alocation Vehicles Added Successfully'], 's');
            echo $novo->id;
        } else {
            echo $msg;
        }
        break;

    case 'in':
        $a = new AlocationVehicle();
        $alocation = $a->getOne(intval($routes['3']));
        if ($alocation) {
            if($alocation->out==0){
                r2(U."module_fleet/alocation_vehicle/list/", 'e', $_L['Not permited']);
            }
            $ui->assign('title', $_L['Fleets Add New Alocation'] . ' - ' . $_L['Fleets Register In']);
            $css_arr = array(
                'modal', 'ibilling/clockpicker/clockpicker', 'dropzone/dropzone',
                's2/css/select2.min', 'dp/dist/datepicker.min');
            $js_arr = array(
                's2/js/select2.min', 'ibilling/clockpicker/clockpicker', 'dropzone/dropzone',
                'modal', 'numeric', 'dp/dist/datepicker.min');
            $assets_css = Asset::css($css_arr);
            $assets_js = Asset::js($js_arr);
            $ui->assign('xheader', $assets_css);
            $ui->assign('xfooter', $assets_js . '<script type="text/javascript" src="' . $_pd . '/assets/js/alocation_in.js"></script>');
            $ui->assign('alocation', $alocation);
            $ui->assign('employee', ORM::for_table('crm_accounts')->find_one($alocation->employee_id));
            $ui->assign('vehicle', ORM::for_table('module_fleets_vehicle')->find_one($alocation->module_fleets_vehicle_id));

            $ui->assign('xjq', '
            $(\'.amount\').autoNumeric(\'init\', {
                   dGroup: ' . $config['thousand_separator_placement'] . ',
                   aPad: ' . $config['currency_decimal_digits'] . ',
                   pSign: \'' . $config['currency_symbol_position'] . '\',
                   aDec: \'' . $config['dec_point'] . '\',
                   aSep: \'' . $config['thousands_sep'] . '\'
           });   
           $(\'.integer\').autoNumeric(\'init\', {aSep: \'\', aDec: \'' . $config['dec_point'] . '\', mDec: 0, aSign: \' \', pSign: \'s\'});
        ');

            $attach = ORM::for_table('module_fleets_alocation_vehicle_attach')->where('module_fleets_alocation_vehicle_id', $alocation->id)->find_many();
            $images = "";
            if (count($attach) > 0) {

                foreach ($attach as $i) {
                    //temporario 100 o tamanho
                    $images.=' { name: "' . $i->src . '", size: 100,url:"' . APP_URL . '/application/plugins/module_fleet/storage/img/alocation/' . $i->src . '" },';
                }
            } else {
                $images = "";
            }


            $ui->assign('jsvar', '
            _L[\'are_you_sure\'] = \'' . $_L['are_you_sure'] . '\';
             ib_lang = \'en\';
             ib_rtl = false;
             ib_calendar_first_day = 0;
             ib_date_format_picker = \'' . ib_js_date_format($config['df'], 'picker') . '\';
             ib_date_format_moment = \'' . ib_js_date_format($config['df']) . '\';
            _L[\'Remove\'] = \'' . $_L['Remove'] . '\';  
            _L[\'Select\'] = \'' . $_L['Select'] . '\';  
            _L[\'Cancel\'] = \'' . $_L['Cancel'] . '\';
            var existingFiles = [' . $images . '
        ];
         ');

            $ui->assign('_include', 'alocation-in-form');
            $ui->display('wrapper.tpl');
        } else {
            r2('ps/p-list', 'e', $_L['Not Found']);
        }
        break;

    case 'in-post':
        //recebe o nome do segmento para adicionar no banco de dados
        $msg = "";

        $km_in = _post('km_in');
        if (trim($km_in) == '') {
            $msg.= $_L['Fleets Km In'] . $_L['is required'];
        }
        $tank_in = _post('tank_in');
        if (trim($tank_in) == '') {
            $msg.= $_L['Fleets Tank In'] . $_L['is required'];
        }
        $date = _postDate('date_in', $_c);
        if (trim($date) == '') {
            $msg.= $_L['Fleets Date in'] . $_L['is required'];
        }
        $time = _post('in_time');
        if (trim($time) == '') {
            $msg.= $_L['Fleets Hour in'] . $_L['is required'];
        }


        if ($msg == '') {

            $alocation = new AlocationVehicle();

            //passa o id no getone()
            $edit = $alocation->getOne(intval(_post('id')));
            $edit->out = '0';
            $edit->km_in = $km_in;
            $edit->tank_in = $tank_in;
            $edit->date_in = $date . " " . $time;
            $edit->supply_value = _post("supply_value");
            $edit->supply_liters= _post("supply_lts");
            $edit->save();
            _log($_L['Fleets Alocation Vehicles Edited Successfully'] . "[ID]: " . $edit->id, $user['fullname'], $user['id']);
            _notify($_L['Fleets Alocation Vehicles Edited Successfully'], 's');
            echo $edit->id;
        } else {
            echo $msg;
        }
        break;

    case 'delete':
        $v = new Vehicle();
        //passa o id no getone()
        $d = $v->getOne(intval($routes[3]));
        if ($d) {
            $d->delete();
            _log($_L['Vehicle Deleted Successfully'] . " - " + $d->id, 'Admin', $user['id']);
            r2(U . 'module_fleet/vehicles/list/', 's', $_L['Fleets Vehicle Deleted Successfully']);
        } else {
            echo $_L['Not found'];
        }
        break;
    case 'attach':
        $uploader = new Uploader();
        $uploader->setDir('application/plugins/module_fleet/storage/img/alocation/');
        $uploader->sameName(false);
        $uploader->setExtensions(array('jpg', 'jpeg', 'png', 'gif', 'pdf'));  //allowed extensions list//
        if ($uploader->uploadFile('file') && isset($routes['3']) && $routes['3'] > 0) {   //txtFile is the filebrowse element name //
            $uploaded = $uploader->getUploadName(); //get uploaded file name, renames on upload//
            $file = $uploaded;
            $msg = $_L['Uploaded Successfully'];
            $success = 'Yes';

            $d = ORM::for_table('module_fleets_alocation_vehicle_attach')->create();
            $d->src = $uploaded;
            $d->module_fleets_alocation_vehicle_id = $routes['3'];
            $d->save();
            $id = $d->id;
            //descobre os tamnahos da imagem

            list($width, $height, $type, $attr) = getimagesize('application/plugins/module_fleet/storage/img/alocation/' . $uploaded);
            $image = new Image();
            $image->source_path = 'application/plugins/module_fleet/storage/img/alocation/' . $uploaded;
            $image->target_path = 'application/plugins/module_fleet/storage/img/alocation/' . $uploaded;
            //verifica se precisa redimensionar
            if ($width > $height && $width > 800) {
                $image->resize(800);
            } else if ($height > $width && $height > 800) {
                $image->resize(null, 800);
            }
        } else {//upload failed
            $file = '';
            $msg = $uploader->getMessage();
            $success = 'No';
            $id = '';
        }

        $a = array(
            'success' => $success,
            'msg' => $msg,
            'file' => $file,
            'id' => $id
        );

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

        echo json_encode($a);
        break;
    case 'delete-file':
        $name = _post('name');
        $d = ORM::for_table('module_fleets_alocation_vehicle_attach')->where("src", $name)->find_many();
        if (count($d) > 0) {
            $d[0]->delete();
            unlink('application/plugins/module_fleet/storage/img/alocation/' . $d[0]->src);
            $msg = $_L['Deleted Successfully'];
            $status = 'OK';
        } else {
            $msg = $_L['Not found'];
            $status = "ERROR";
        }
        $data = array(
            'status' => $status,
            'msg' => $msg,
        );
        header('Content-Type: application/json');
        echo json_encode($data);
        break;
        echo 'action not defined';
}
 

Anon7 - 2022
AnonSec Team