<?php define('PLAYER', true); date_default_timezone_set('America/Chicago'); // Autoloading spl_autoload_register('framework_autoload'); // Determine our absolute document root define('DOC_ROOT', realpath(dirname(__FILE__) . '/../')); // Global include files require DOC_ROOT . '/includes/inc.functions.php'; require DOC_ROOT . '/includes/inc.config.php'; require DOC_ROOT . '/vendor/autoload.php'; // Fix magic quotes if (get_magic_quotes_gpc()) { $_POST = fix_slashes($_POST); $_GET = fix_slashes($_GET); $_REQUEST = fix_slashes($_REQUEST); $_COOKIE = fix_slashes($_COOKIE); } function framework_autoload($class_name) { $filename = DOC_ROOT . '/includes/class.' . strtolower($class_name) . '.php'; if (file_exists($filename)) { require $filename; } }
/** * does the same as mkdir function on php5, except it's compatible with php4, * so folders are created recursive * * @param string $path * @param integer $mode * @return boolean */ function recursive_mkdir($path, $mode = 0777, $restriction_path = '/') { if (DIRECTORY_SEPARATOR == '/') { if (strpos($path, $restriction_path) !== 0) { return false; } // if } else { if (strpos(strtolower($path), strtolower($restriction_path)) !== 0) { return false; } // if } // if $start_path = substr($path, 0, strlen($restriction_path)); $allowed_path = substr($path, strlen($restriction_path)); $original_path = $path; $path = fix_slashes($allowed_path); $dirs = explode('/', $path); $count = count($dirs); $path = ''; for ($i = 0; $i < $count; ++$i) { if ($i == 0) { $path = $start_path; } // if if (DIRECTORY_SEPARATOR == '\\' && $path == '') { $path .= $dirs[$i]; } else { $path .= '/' . $dirs[$i]; } // if if (!is_dir($path) && !mkdir($path, $mode)) { return false; } // if } // if return is_dir($original_path); }