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_billing/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/www/lrsys_apps/leve/application/plugins/module_billing/controllers/cost_center.php
<?php

_auth();
$dir = 'module_billing';

$ui->assign('_application_menu', $dir);
$ui->assign('_title', $_L['Billing Module'].' - '.$config['CompanyName']);
$action = $routes['2'];
$user = User::_info();

if($user['roleid'] != 0 && $user['roleid'] != 2) {
	exit('VOCÊ NÃO TEM PERMISSÃO PARA ACESSAR ESSA ÁREA.');
}
$ui->assign('user', $user);

switch ($action) {
	case 'list':
		$css_arr = array('modal');
		$assets_css = Asset::css($css_arr);
		$ui->assign('xheader', $assets_css);

		$js_arr = array('modal');
		$assets_js = Asset::js($js_arr);
		$ui->assign('xfooter', $assets_js .
			'<script type="text/javascript" src="' .$_pd. '/assets/js/cost_center.js"></script>');

		$cost_center = ORM::for_table('module_billing_cost_center')->find_many();
		$ui->assign('cost_center', $cost_center);

		$ui->assign('_st', $_L['Cost center']);
		$ui->assign('_include', 'cost_center_list');
		$ui->display('wrapper.tpl');

		

		break;

	case 'modal_add_cost_center':
		$ui->assign('_st', $_L['Add New Cost Center']);
		$ui->display($pl_path.'views/modal_add_cost_center.tpl');

		break;

	case 'modal_edit_cost_center':
		if(isset($routes['3'])) {
			$id = filter_var($routes['3'], FILTER_SANITIZE_NUMBER_INT);
		}

		(!isset($id)) ? r2(U.'module_billing/cost_center/list', 'e', $_L['Invalid ID']) : '';

		$cost_center = ORM::for_table('module_billing_cost_center')->find_one($id);
		$ui->assign('cost_center', $cost_center);

		$ui->assign('_st', $_L['Edit Cost Center']);
		$ui->display($pl_path.'views/modal_add_cost_center.tpl');

		break;

	case 'add_post':
		$id = filter_var(_post('id'), FILTER_SANITIZE_NUMBER_INT);
		$name = filter_var(_post('name'), FILTER_SANITIZE_STRING);

		// Validações de Backend
		($name == '') ? r2(U.'module_billing/cost_center/list', 'e', $_L['Name is Required']) : '';

		$cost_center_exists = ORM::for_table('module_billing_cost_center')->where('name', $name)->find_one();
		($cost_center_exists) ? r2(U.'module_billing/cost_center/list', 'e', $_L['Cost center already exists']) : '';

		// Editar
		if(((int) $id) > 0) {
			$cost_center = ORM::for_table('module_billing_cost_center')->find_one($id);
			$cost_center->name = $name;
			$cost_center->save();

			r2(U . 'module_billing/cost_center/list', 's', $_L['Cost center edited successfully']);
		}
		// Inserir
		else {
			$cost_center = ORM::for_table('module_billing_cost_center')->create();
			$cost_center->name = $name;
			$cost_center->save();

			r2(U . 'module_billing/cost_center/list', 's', $_L['Cost center added successfully']);
		}

		break;

	case 'ajax_add_post':
		$name = filter_var(_post('name'), FILTER_SANITIZE_STRING);

		// Validações
		($name == '') ? die('1') : '';

		$cost_center_exists = ORM::for_table('module_billing_cost_center')->where('name', $name)->find_one();
		($cost_center_exists) ? die($_L['Cost center already exists']) : '';

		$cost_center = ORM::for_table('module_billing_cost_center')->create();
		$cost_center->name = $name;
		$cost_center->save();

		die('0');

		break;

	case 'delete':
		$id = filter_var($routes['3'], FILTER_SANITIZE_NUMBER_INT);
		($id <= 0) ? r2(U . 'module_billing/cost_center/list', 'e', $_L['Invalid ID']) : '';

		$cost_center = ORM::for_table('module_billing_cost_center')->find_one($id);
		(!$cost_center) ? r2(U . 'module_billing/cost_center/list', 'e', $_L['Invalid ID']) : '';

		$cost_center->delete();

		r2(U . 'module_billing/cost_center/list', 's', $_L['Cost center deleted successfully']);

		break;

	case 'ajax-cost-center':
		$query = _post('term');
		if($query != '') {
			$query = filter_var($query, FILTER_SANITIZE_STRING);
		}

		$stmt = ORM::for_table('module_billing_cost_center')
			->order_by_asc('name');

		if($query != '') {
			$stmt->where_raw("name LIKE '%" . $query . "%'");
		}

		$cost_center = $stmt->find_array();

		header('Content-Type: application/json');
		echo json_encode($cost_center);

		break;

	default:
		echo 'action not defined';
}

Anon7 - 2022
AnonSec Team