Skip to content

Commit a26adf1

Browse files
committed
Removing old code and version bumping
Getvar requires PHP 5.4, so magic quotes ALWAYS returns false. MD5 hashing is no longer recommended. Application should use its own hashing system. SQL Safe is no longer supplied. Application should use database specific input escaping.
1 parent 0f410e0 commit a26adf1

File tree

1 file changed

+1
-30
lines changed

1 file changed

+1
-30
lines changed

getvar.php.inc

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@
44
define('_GETVAR_BASIC', 0 << 0);
55
define('_GETVAR_NOGET', 1 << 0);
66
define('_GETVAR_NOPOST', 1 << 1);
7-
define('_GETVAR_SQLSAFE', 1 << 2);
87
define('_GETVAR_HTMLSAFE', 1 << 3);
98
define('_GETVAR_URLSAFE', 1 << 4);
109
define('_GETVAR_NOTRIM', 1 << 5);
1110
define('_GETVAR_NODOUBLE', 1 << 6);
1211
define('_GETVAR_BREAK', 1 << 7);
1312
define('_GETVAR_NULL', 1 << 8);
1413
define('_GETVAR_CURRENCY', 1 << 9);
15-
define('_GETVAR_MD5BIN', 1 << 29);
16-
define('_GETVAR_MD5', 1 << 30);
17-
define('_GETVAR_HTML_SQL', _GETVAR_SQLSAFE | _GETVAR_HTMLSAFE);
1814

1915

2016

@@ -464,11 +460,6 @@ class getvar implements ArrayAccess {
464460
//IF NO VALUE, RETURN
465461
if ($value === NULL) return $value;
466462

467-
//STRIP SLASHES IF MAGIC QUOTES ARE ENABLED
468-
if (get_magic_quotes_gpc()) {
469-
$value = stripslashes($value);
470-
}
471-
472463
//CONVERT NON BREAKING SPACE CHARACTER
473464
if (($flags & _GETVAR_BREAK) == 0) {
474465
$value = str_replace("\xC2\xA0", ' ', $value);
@@ -489,16 +480,6 @@ class getvar implements ArrayAccess {
489480
$value = preg_replace('/^[\$\s\x{A2}-\x{A5}\x{20A0}-\x{20CF}\x{10192}]+/u', '', $value);
490481
}
491482

492-
//CONVERT TO MD5 CHECKSUM (BINARY)
493-
if (($flags & _GETVAR_MD5BIN) > 0) {
494-
$value = md5($value, true);
495-
}
496-
497-
//CONVERT TO MD5 CHECKSUM
498-
if (($flags & _GETVAR_MD5) > 0) {
499-
$value = md5($value);
500-
}
501-
502483
//CLEAN OUT HTML SPECIAL CHARACTERS
503484
if (($flags & _GETVAR_HTMLSAFE) > 0) {
504485
$value = htmlspecialchars($value, ENT_QUOTES);
@@ -509,15 +490,6 @@ class getvar implements ArrayAccess {
509490
$value = rawurlencode($value);
510491
}
511492

512-
//PREVENT SQL INJECTION
513-
if (($flags & _GETVAR_SQLSAFE) > 0) {
514-
if (!empty($this->pudl)) {
515-
$value = $this->pudl->escape($value);
516-
} else {
517-
$value = @mysql_real_escape_string($value);
518-
}
519-
}
520-
521493
return $value;
522494
}
523495

@@ -592,11 +564,10 @@ class getvar implements ArrayAccess {
592564

593565

594566
public $default;
595-
public $pudl = NULL;
596567
private $rawget = NULL;
597568
private $rawpost = NULL;
598569
private $rawjson = NULL;
599570
private $type = NULL;
600-
public static $version = 'Getvar 2.8.0';
571+
public static $version = 'Getvar 2.8.2';
601572

602573
}

0 commit comments

Comments
 (0)