Home Files
Adminer
Execute Command
PHP Eval
Symlink
File Upload
Owner :
www-data
PHP Version
8.1.8
Disk Space
203.89 GB
Server Addr
171.9.3.2
Your IP
171.9.3.1
Edit File
File:
<?php class Listagens { function addCampos($array) { $i = 0; $n = 0; $f = 0; $campos = null; foreach ($array as $key => $value) { $i++; if (substr($value, 0, -1) == 'FILDBR') { $f = substr($value, -1); $value = 'FILDBR'; } switch ($value) { case 'CPFCNPJ': //MASCARA CPF - CNPJ $campos[] = "CASE (CHARACTER_LENGTH(".$key.")) WHEN '11' THEN CONCAT(SUBSTR(".$key.",1,3),'.***.***-',SUBSTR(".$key.",10,2)) WHEN '14' THEN CONCAT(SUBSTR(".$key.",1,2),'.',SUBSTR(".$key.",3,3),'.',SUBSTR(".$key.",6,3),'/',SUBSTR(".$key.",9,4),'-',SUBSTR(".$key.",13,2)) ELSE ' ' END as Campo".$i; break; case 'FONE': // TELEFONE COM ÍCONE $campos[] = "CONCAT('<i class=\"fa fa-phone-alt\"></i> ',".$key.") as Campo".$i; break; case 'MAIL': // EMAIL COM ÍCONE $campos[] = "CONCAT('<i class=\"fa fa-envelope\"></i> ',".$key.") as Campo".$i; break; case 'USER': // USER COM ÍCONE $campos[] = "CONCAT('<i class=\"fa fa-user\"></i> ',".$key.") as Campo".$i; break; case 'DATE': // DATA FORMATO DD/MM/YYY COM ÍCONE $campos[] = "CONCAT('<i class=\"fa fa-clock-o\"></i> ',DATE_FORMAT(".$key.",'%d/%m/%Y')) as Campo".$i; break; case 'DATETABLE': // DATA FORMATO DD/MM/YYY $campos[] = "DATE_FORMAT(".$key.",'%d/%m/%Y') as Campo".$i; break; case 'DATETABLE_BOLD': // DATA FORMATO DD/MM/YYY NEGRITO $campos[] = "CONCAT('<strong>',DATE_FORMAT(".$key.",'%d/%m/%Y'),'</strong>') as Campo".$i; break; case 'TIME': // HORA COM ÍCONE $campos[] = "CONCAT('<i class=\"fa fa-clock-o\"></i> ',".$key.") as Campo".$i; break; case 'NUMBER': // VALOR $campos[] = "CONCAT('',FORMAT(".$key.",2,'de_DE')) as Campo".$i; break; case 'NUMBERTABLE': // VALOR COM R$ $n++; $campos[] = "CONCAT('R$ ',FORMAT(COALESCE(".$key.", 0),2,'de_DE')) as CampoV".$n; break; case 'NUMBERTABLE_BOLD': // VALOR COM R$ NEGRITO $n++; $campos[] = "CONCAT('<strong>R$ ',FORMAT(COALESCE(".$key.", 0),2,'de_DE'),'</strong>') as CampoV".$n; break; case 'COLOR_LINE': // COR DA LINHA $campos[] = $key." as ColorLine"; break; case 'NULL': // ANULAR COLUNA $campos[] = "NULL as Campo".$i; break; case 'FILE': // ADD UM SEGUNDO BOTÃO NA TABELA $campos[] = $key." as File"; break; case 'FILDBR': // ADD UMA SEGUNDA LINHA $i = $i - 1; $campos[] = $key." as Campo".$i.$f; break; case 'GROUP': // ADD UMA SEGUNDA LINHA $campos[] = $key." as GRUPO"; break; default: $campos[] = "". $key." as Campo".$i; break; } } return $campos; } function Query ($sql,$smarty,$paginar,$campos_select = null,$query, $filter = null, $fields = null, $limit = null, $campos_consulta ,$campos_pesquisa = array(), $orderby = null, $arrayValue = null, $debug = null) { if ($campos_select == null) { $select = "SELECT SQL_CALC_FOUND_ROWS * "; } else { $select = "SELECT SQL_CALC_FOUND_ROWS ".implode(", ",$this->addCampos($campos_select)); } if ($filter != '' and $fields != '') { if ($fields != 'Todos' and $campos_pesquisa[$fields] != '') { $filtered[] = $campos_pesquisa[$fields]['campo']." LIKE :filter"; } else { foreach ($campos_pesquisa as $key => $value) { $campos_pesquisa_im[] = $value['campo']." LIKE :filter "; } if ($campos_pesquisa_im != '') { $filtered[] = "(". implode(" OR ", $campos_pesquisa_im) .")"; } } if ($filtered != '') { $arrayValue[':filter'] = "%".$filter."%"; $filtered = " AND ".implode(" AND ",$filtered); } } $consulta = $select.$query.$filtered.$orderby.$limit; if ($debug == 1) { var_dump($consulta); } $qr_list = $sql->consulta($consulta,$arrayValue); $paginar->num_total = $this->Contar($sql); $smarty->assign('filtered', $filter); $smarty->assign('filter', $filter); $smarty->assign('fields', $fields); $smarty->assign('campos_consulta', $campos_consulta); $smarty->assign('campos_pesquisa', $campos_pesquisa); $smarty->assign('num_total', $paginar->num_total); $smarty->assign('paginar', $paginar->paginar()); $smarty->assign('list', $qr_list->fetchAll(PDO::FETCH_OBJ)); return $paginar->num_total; } function QueryExport ($sql,$smarty,$paginar,$campos_select = null,$query, $filter = null, $fields = null, $limit = null, $campos_consulta ,$campos_pesquisa = array(), $orderby = null, $arrayValue = null, $debug = null) { if ($campos_select == null) { $select = "SELECT SQL_CALC_FOUND_ROWS * "; } else { $select = "SELECT SQL_CALC_FOUND_ROWS ".implode(", ",$this->addCampos($campos_select)); } $consulta = $select.$query.$filtered.$orderby; if ($debug == 1) { var_dump($consulta); } $qr_list = $sql->consulta($consulta,$arrayValue); $paginar->num_total = $this->Contar($sql); $smarty->assign('filtered', $filter); $smarty->assign('filter', $filter); $smarty->assign('fields', $fields); $smarty->assign('campos_consulta', $campos_consulta); $smarty->assign('campos_pesquisa', $campos_pesquisa); $smarty->assign('num_total', $paginar->num_total); $smarty->assign('paginar', $paginar->paginar()); $smarty->assign('list', $qr_list->fetchAll(PDO::FETCH_OBJ)); return $paginar->num_total; } function Contar ($sql) { $qrtotal = $sql->consulta("SELECT FOUND_ROWS() AS CONTAR"); $totalregistros = $sql->resultado($qrtotal); return $totalregistros['CONTAR']; } }