/** * Returns the value escaped with mysql_real_escape_string. * * @param mixed $value * @return string * * @tag filter */ function getEscaped($value) { if (is_array($value)) { return Inspekt::_walkArray($value, 'getEscaped'); } elseif (!empty($value)) { global $CONFIG; if (isset($CONFIG['LINK_ID']) && $CONFIG['LINK_ID']) { return mysql_real_escape_string(htmlspecialchars($value, ENT_QUOTES), $CONFIG['LINK_ID']); } else { return mysql_real_escape_string(htmlspecialchars($value, ENT_QUOTES)); } } else { return $value; } }
/** * Escapes the value given with pg_escape_bytea, so it should be safe for passing to a PostgreSQL BYTEA column * * @param mixed $value * @param resource $conn the postgresql connection. If none is given, it will use the last link opened, per behavior of pg_escape_bytea * @return mixed * * @link http://php.net/manual/en/function.pg-escape-bytea.php */ public static function escPgSQLBytea($value, $conn = null) { static $connection; $connection = $conn; if (Inspekt::isArrayOrArrayObject($value)) { return Inspekt::_walkArray($value, 'escPgSQL'); } else { if (isset($connection)) { return pg_escape_bytea($connection, $value); } else { return pg_escape_bytea($value); } } }
/** * Returns the value escaped with mysql_real_escape_string. * * @param mixed $value * @return string * * @tag filter */ function getEscaped($value) { if (is_array($value)) { return Inspekt::_walkArray($value, 'getEscaped'); } elseif (!empty($value)) { if (get_magic_quotes_gpc()) { $value = stripslashes($value); } return mysql_real_escape_string($value); } else { return $value; } }
/** * Escapes the value given with pg_escape_bytea * * @param mixed $value * @param resource $conn the postgresql connection. If none is given, it * will use the last link opened, per behavior of pg_escape_bytea * @return mixed * * @link http://php.net/manual/en/function.pg-escape-bytea.php */ static public function escPgSQLBytea($value, $conn = null) { if (Inspekt::isArrayOrArrayObject($value)) { return Inspekt::_walkArray($value, 'escPgSQL'); } else { //might also check is_resource if pg_connection_status is too much if (isset($conn) && pg_connection_status($conn) === PGSQL_CONNECTION_OK) { return pg_escape_bytea($conn, $value); } else { return pg_escape_bytea($value); } } }
/** * Returns basename(value). * * @param mixed $value * @return mixed * * @tag filter * @static */ function noPath($value) { if (is_array($value)) { return Inspekt::_walkArray($value, 'noPath'); } else { return basename($value); } }