aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2006-01-07 17:07:36 +0000
committerNils Adermann <naderman@naderman.de>2006-01-07 17:07:36 +0000
commitea96595e4f1ecf8fdbba39e173ffcd002d7786c6 (patch)
tree0af1e4b737e0a3d5e73d2102392037e0ea3d696e /phpBB
parentffa49ca9ca5d301a34986ce97b23a0ac49ac03be (diff)
downloadforums-ea96595e4f1ecf8fdbba39e173ffcd002d7786c6.tar
forums-ea96595e4f1ecf8fdbba39e173ffcd002d7786c6.tar.gz
forums-ea96595e4f1ecf8fdbba39e173ffcd002d7786c6.tar.bz2
forums-ea96595e4f1ecf8fdbba39e173ffcd002d7786c6.tar.xz
forums-ea96595e4f1ecf8fdbba39e173ffcd002d7786c6.zip
- array_combine replacement for PHP4
- properly send the charset git-svn-id: file:///svn/phpbb/trunk@5437 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/functions.php33
1 files changed, 32 insertions, 1 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index d360efa7d9..6b0b5d3642 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -144,6 +144,37 @@ function unique_id($extra = 0)
return uniqid(mt_rand(), true);
}
+if (!function_exists('array_combine'))
+{
+ /**
+ * A wrapper for the PHP5 function array_combine()
+ * @param array $keys contains keys for the resulting array
+ * @param array $values contains values for the resulting array
+ *
+ * @return Returns an array by using the values from the keys array as keys and the
+ * values from the values array as the corresponding values. Returns false if the
+ * number of elements for each array isn't equal or if the arrays are empty.
+ */
+ function array_combine($keys, $values)
+ {
+ $keys = array_values($keys);
+ $values = array_values($values);
+
+ $n = sizeof($keys);
+ if (!$n || !sizeof($values) || ($n != sizeof($values)))
+ {
+ return false;
+ }
+
+ $combined = array();
+ for ($i = 0; $i < $n; $i++)
+ {
+ $combined[$keys[$i]] = $values[$i];
+ }
+ return $combined;
+ }
+}
+
/**
* Get userdata
* @param mixed $user user id or username
@@ -1953,7 +1984,7 @@ function page_header($page_title = '')
if ($config['send_encoding'])
{
- header('Content-type: text/html; charset: ' . $user->lang['ENCODING']);
+ header('Content-type: text/html; charset=' . $user->lang['ENCODING']);
}
header('Cache-Control: private, no-cache="set-cookie", pre-check=0, post-check=0');
header('Expires: 0');