Permalink
Browse files

Update functions.php

apache_request_headers for nginx
  • Loading branch information...
1 parent c4e874a commit 43ffae6e0de07d496db70fdbbc57e7f8b8b15a1b @Dolbager Dolbager committed May 13, 2013
Showing with 15 additions and 0 deletions.
  1. +15 −0 include/functions.php
View
@@ -12,6 +12,21 @@
//
// Encodes the contents of $str so that they are safe to output on an (X)HTML page
+
+// For nginx
+if (!function_exists('apache_request_headers')) {
+ function apache_request_headers() {
+ foreach($_SERVER as $key=>$value) {
+ if (substr($key,0,5)=="HTTP_") {
+ $key=str_replace(" ","-",ucwords(strtolower(str_replace("_"," ",substr($key,5)))));
+ $out[$key]=$value;
+ }else{
+ $out[$key]=$value;
+ }
+ }
+ return $out;
+ }
+}
function forum_htmlencode($str)
{
return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');

0 comments on commit 43ffae6

Please sign in to comment.