Commit e18478b75afe5a2fa2a1ca8e7930c99581c93fe7

Authored by Caroline Salib
1 parent e79feac7
Exists in master

Ajustado functions deprecadas do PHP;

portabilis/ieducar#167
ieducar/intranet/include/clsBancoPgSql.inc.php
... ... @@ -398,28 +398,26 @@ abstract class clsBancoSQL_
398 398 // Alterações de padrão MySQL para PostgreSQL
399 399 if ($reescrever) {
400 400 // Altera o Limit
401   - $this->strStringSQL = eregi_replace( "LIMIT[ ]{0,3}([0-9]+)[ ]{0,3},[ ]{0,3}([0-9]+)", "LIMIT \2 OFFSET \1", $this->strStringSQL );
  401 + $this->strStringSQL = preg_replace( "/LIMIT[ ]{0,3}([0-9]+)[ ]{0,3},[ ]{0,3}([0-9]+)/i", "LIMIT \2 OFFSET \1", $this->strStringSQL );
402 402  
403 403 // Altera selects com YEAR( campo ) ou MONTH ou DAY
404   - $this->strStringSQL = eregi_replace( "(YEAR|MONTH|DAY)[(][ ]{0,3}(([a-z]|_|[0-9])+)[ ]{0,3}[)]", "EXTRACT( \1 FROM \2 )", $this->strStringSQL );
  404 + $this->strStringSQL = preg_replace( "/(YEAR|MONTH|DAY)[(][ ]{0,3}(([a-z]|_|[0-9])+)[ ]{0,3}[)]/i", "EXTRACT( \1 FROM \2 )", $this->strStringSQL );
405 405  
406 406 // Remove os ORDER BY das querys COUNT()
407 407 // Altera os LIKE para ILIKE (ignore case)
408   - $this->strStringSQL = eregi_replace(" LIKE ", " ILIKE ", $this->strStringSQL);
  408 + $this->strStringSQL = preg_replace("/ LIKE /i", " ILIKE ", $this->strStringSQL);
409 409  
410   - $this->strStringSQL = eregi_replace("([a-z_0-9.]+) +ILIKE +'([^']+)'", "to_ascii(\\1) ILIKE to_ascii('\\2')", $this->strStringSQL);
411   -
412   - $this->strStringSQL = eregi_replace("fcn_upper_nrm", "to_ascii", $this->strStringSQL);
  410 + $this->strStringSQL = preg_replace("/fcn_upper_nrm/i", "", $this->strStringSQL);
413 411 }
414 412  
415 413 $temp = explode("'", $this->strStringSQL);
416 414  
417 415 for ($i = 0; $i < count($temp); $i++) {
418   - // Ignora o que está entre aspas
  416 + // Ignora o que está entre aspas
419 417 if (! ($i % 2)) {
420   - // Fora das aspas, verifica se há algo errado no SQL
421   - if (eregi("(--|#|/\*)", $temp[$i])) {
422   - $erroMsg = 'Proteção contra injection: ' . date( "Y-m-d H:i:s" );
  418 + // Fora das aspas, verifica se há algo errado no SQL
  419 + if (preg_match("/(--|#|\/\*)/", $temp[$i])) {
  420 + $erroMsg = 'Proteção contra injection: ' . date( "Y-m-d H:i:s" );
423 421 echo "<!-- {$this->strStringSQL} -->";
424 422 $this->Interrompe($erroMsg);
425 423 }
... ...
ieducar/intranet/include/funcoes.inc.php
... ... @@ -67,7 +67,7 @@ function calculoIdade($diaNasc, $mesNasc, $anoNasc)
67 67 function idFederal2int($str)
68 68 {
69 69 $id_federal = str_replace(".", "", str_replace("-", "", str_replace("/", "", $str)));
70   - return ereg_replace("^0+", "", $id_federal);
  70 + return preg_replace("^0+", "", $id_federal);
71 71 }
72 72  
73 73 function int2CPF($int)
... ...