diff --git a/editor/include/editing.inc.php b/editor/include/editing.inc.php index b3eccaab..521f29c4 100644 --- a/editor/include/editing.inc.php +++ b/editor/include/editing.inc.php @@ -19,7 +19,7 @@ function email_header($header) { * @return bool */ function send_mail($email, $subject, $message, $from = "", $files = array()) { - $eol = (DIRECTORY_SEPARATOR == "/" ? "\n" : "\r\n"); // PHP_EOL available since PHP 5.0.2 + $eol = PHP_EOL; $message = str_replace("\n", $eol, wordwrap(str_replace("\r", "", "$message\n"))); $boundary = uniqid("boundary"); $attachments = ""; diff --git a/plugins/drivers/clickhouse.php b/plugins/drivers/clickhouse.php index 7ec86fdc..02ed758e 100644 --- a/plugins/drivers/clickhouse.php +++ b/plugins/drivers/clickhouse.php @@ -15,7 +15,7 @@ if (isset($_GET["clickhouse"])) { 'method' => 'POST', 'content' => $this->isQuerySelectLike($query) ? "$query FORMAT JSONCompact" : $query, 'header' => 'Content-type: application/x-www-form-urlencoded', - 'ignore_errors' => 1, // available since PHP 5.2.10 + 'ignore_errors' => 1, 'follow_location' => 0, 'max_redirects' => 0, )))); diff --git a/plugins/drivers/elastic5.php b/plugins/drivers/elastic5.php index f3c69130..b0ec3226 100644 --- a/plugins/drivers/elastic5.php +++ b/plugins/drivers/elastic5.php @@ -21,7 +21,7 @@ if (isset($_GET["elastic5"])) { 'method' => $method, 'content' => $content !== null ? json_encode($content) : $content, 'header' => $content !== null ? 'Content-Type: application/json' : array(), - 'ignore_errors' => 1, // available since PHP 5.2.10 + 'ignore_errors' => 1, 'follow_location' => 0, 'max_redirects' => 0, )))); diff --git a/plugins/drivers/simpledb.php b/plugins/drivers/simpledb.php index 02d3d4f0..a028bf33 100644 --- a/plugins/drivers/simpledb.php +++ b/plugins/drivers/simpledb.php @@ -391,22 +391,6 @@ if (isset($_GET["simpledb"])) { function last_id() { } - function hmac($algo, $data, $key, $raw_output = false) { - // can use hash_hmac() since PHP 5.1.2 - $blocksize = 64; - if (strlen($key) > $blocksize) { - $key = pack("H*", $algo($key)); - } - $key = str_pad($key, $blocksize, "\0"); - $k_ipad = $key ^ str_repeat("\x36", $blocksize); - $k_opad = $key ^ str_repeat("\x5C", $blocksize); - $return = $algo($k_opad . pack("H*", $algo($k_ipad . $data))); - if ($raw_output) { - $return = pack("H*", $return); - } - return $return; - } - function sdb_request($action, $params = array()) { $adminer = adminer(); $connection = connection(); @@ -422,11 +406,11 @@ if (isset($_GET["simpledb"])) { $query .= '&' . rawurlencode($key) . '=' . rawurlencode($val); } $query = str_replace('%7E', '~', substr($query, 1)); - $query .= "&Signature=" . urlencode(base64_encode(hmac('sha1', "POST\n" . preg_replace('~^https?://~', '', $host) . "\n/\n$query", $secret, true))); + $query .= "&Signature=" . urlencode(base64_encode(hash_hmac('sha1', "POST\n" . preg_replace('~^https?://~', '', $host) . "\n/\n$query", $secret, true))); $file = @file_get_contents((preg_match('~^https?://~', $host) ? $host : "http://$host"), false, stream_context_create(array('http' => array( 'method' => 'POST', // may not fit in URL with GET 'content' => $query, - 'ignore_errors' => 1, // available since PHP 5.2.10 + 'ignore_errors' => 1, 'follow_location' => 0, 'max_redirects' => 0, ))));