X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=include%2Fdb.php;h=a70a1d87889ad4528141e966e4aee5711c2431b0;hb=30ac8d1f86bc4592e4fb38503b01de05f08c2aec;hp=0f4bf3708cadc8451cbbcccbb83ac0ae48845f86;hpb=82ac5311549e41893d1430c5090a1d1a925c0c20;p=tt-rss.git diff --git a/include/db.php b/include/db.php index 0f4bf370..a70a1d87 100644 --- a/include/db.php +++ b/include/db.php @@ -15,7 +15,7 @@ function db_connect($host, $user, $pass, $db) { $string .= " host=$host"; } - if (defined('DB_PORT')) { + if (defined('DB_PORT') && DB_PORT) { $string = "$string port=" . DB_PORT; } @@ -41,21 +41,13 @@ function db_connect($host, $user, $pass, $db) { } } -function db_escape_string($s, $strip_tags = true, $link = NULL) { +function db_escape_string($link, $s, $strip_tags = true) { if ($strip_tags) $s = strip_tags($s); if (DB_TYPE == "pgsql") { - if ($link) { - return pg_escape_string($link, $s); - } else { - return pg_escape_string($s); - } + return pg_escape_string($link, $s); } else { - if ($link) { - return mysql_real_escape_string($s, $link); - } else { - return mysql_real_escape_string($s); - } + return mysql_real_escape_string($s, $link); } }