]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/security_functions.php
Deprecated config.php removed. Please wait for further commits with an included fall...
[mailer.git] / inc / libs / security_functions.php
index 536fa68aa8f25b6886581f1ae7dd1eee8b3b4d10..6e1084ce94a7c7181b4e5664ad049cb494260291 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Alle GET, POST und COOKIE-Daten sichern          *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
@@ -33,7 +38,7 @@
 
 // Some security stuff...
 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
        require($INC);
 }
 
@@ -85,7 +90,7 @@ if (!isset($_POST)) {
 // Generate arrays which holds the relevante chars to replace
 $GLOBALS['security_chars'] = array(
        // The chars we are looking for...
-       'from' => array("{", "}", "/", ".", "'", "$", "(", ")", '{--', '--}', "%", ";", "[", "]", ":", "--"),
+       'from' => array("{", "}", '/', '.', "'", "$", '(', ')', '{--', '--}', "%", ';', "[", "]", ':', "--"),
        // ... and we will replace to.
        'to'   => array(
                "{OPEN_ANCHOR2}",
@@ -115,7 +120,7 @@ $GLOBALS['url_chars'] = array(
        // Search for these secured characters
        'to'   => array("{SLASH}", "{DOT}", "{PER}", "{DBL_DOT}", "{COMMENT}"),
        // Replace with these characters
-       'from' => array("/", ".", "%", ":", "--")
+       'from' => array('/', '.', "%", ':', "--")
 );
 
 // Overworked security part:
@@ -137,7 +142,7 @@ if (is_array($_GET)) {
        }
 }
 
-if (basename($_SERVER['PHP_SELF']) != "install.php") {
+if (basename($_SERVER['PHP_SELF']) != 'install.php') {
        // And POST data
        foreach ($_POST as $seckey => $secvalue) {
                if (!is_array($secvalue)) {
@@ -158,15 +163,15 @@ if (!defined('_OB_CACHING')) {
        if (phpversion() >= '4.0.4pl1' && (strstr(getenv('HTTP_USER_AGENT'),'compatible') || (strstr(getenv('HTTP_USER_AGENT'), "Mozilla")))) {
                if ((extension_loaded('zlib')) && (function_exists('ob_start'))) {
                        // Start caching
-                       define('_OB_CACHING', "on");
+                       define('_OB_CACHING', 'on');
                        ob_start();
                } else {
                        // Extension not loaded or required function is missing
-                       define('_OB_CACHING', "404");
+                       define('_OB_CACHING', '404');
                }
        } else {
                // Old PHP version
-               define('_OB_CACHING', "old");
+               define('_OB_CACHING', 'old');
        }
 }
 
@@ -178,9 +183,9 @@ $SELF_DIR  = dirname($_SERVER['PHP_SELF']);
 $SELF_FILE = basename($_SERVER['PHP_SELF']);
 
 // Check for a .php inside the $SELF_DIR...
-while (ereg(".php", $SELF_DIR)) {
+while (ereg('.php', $SELF_DIR)) {
        // Correct the dirname
-       $SELF_DIR = substr($SELF_DIR, 0, (strpos($SELF_DIR, ".php") + 4));
+       $SELF_DIR = substr($SELF_DIR, 0, (strpos($SELF_DIR, '.php') + 4));
        // Rewrite filename...
        $SELF_FILE = basename($SELF_DIR);
        // ... and dirname
@@ -188,14 +193,14 @@ while (ereg(".php", $SELF_DIR)) {
 }
 
 // Put both together again and let's pray it is secured now...
-$_SERVER['PHP_SELF'] = $SELF_DIR."/".$SELF_FILE;
+$_SERVER['PHP_SELF'] = $SELF_DIR.'/'.$SELF_FILE;
 
 // Remove uneccessary variables
 unset($SELF_DIR);
 unset($SELF_FILE);
 
 // Security system loaded...
-define('__SECURITY', "1");
+define('__SECURITY', '1');
 
 //
 ?>