Example #1
0
 /**
  * unquoting data if 'magic_quotes_gpc' is turn on
  * Function unquotes data, if 'magic_quotes_gpc' is turn on
  * @param array $arr array of data to unquote
  */
 public static function unquote(&$arr)
 {
     if (!@ini_get('magic_quotes_gpc')) {
         return;
     }
     foreach ($arr as $index => $value) {
         if (is_array($arr[$index])) {
             SJB_HelperFunctions::unquote($arr[$index]);
         } else {
             $arr[$index] = stripslashes($arr[$index]);
         }
     }
 }
Example #2
0
 public static function prepareGlobalArrays()
 {
     // simulating turning off register_globals if it's on
     if (@ini_get("register_globals")) {
         $unset = array_keys($_ENV + $_GET + $_POST + $_COOKIE + $_SERVER + $_SESSION);
         foreach ($unset as $rg_var) {
             if (isset(${$rg_var})) {
                 unset(${$rg_var});
             }
         }
         unset($unset);
     }
     switch ($_SERVER['REQUEST_METHOD']) {
         case 'POST':
             $_REQUEST = $_POST;
             break;
         case 'GET':
             $_REQUEST = $_GET;
             break;
     }
     // turning of 'magic_quotes_runtime' (for outputting information)
     ini_set('magic_quotes_runtime', false);
     // unquoting request data if 'get_magic_quotes_gpc' is turned on
     if (ini_get('magic_quotes_gpc')) {
         SJB_HelperFunctions::unquote($_REQUEST);
         SJB_HelperFunctions::unquote($_POST);
         SJB_HelperFunctions::unquote($_GET);
     }
     //-- setting temp directory if there isn't available one
     $isCacheDirGood = false;
     foreach (array($_ENV, $_SERVER) as $tab) {
         foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $key) {
             if (isset($tab[$key])) {
                 if ($key == 'windir' || $key == 'SystemRoot') {
                     $dir = realpath($tab[$key] . '\\temp');
                 } else {
                     $dir = realpath($tab[$key]);
                 }
                 if (is_readable($dir) && is_writable($dir)) {
                     $isCacheDirGood = true;
                     break 2;
                 }
             }
         }
     }
     if ($isCacheDirGood === false) {
         $_SERVER['TMP'] = SJB_BASE_DIR . 'system/cache/';
     }
 }