function stripslash_array(&$array)
{
    foreach ($array as $key => $value) {
        if (is_array($array[$key])) {
            stripslash_array($array[$key]);
        } else {
            $array[$key] = stripslashes($value);
        }
    }
}
/**
 * Recursively stripslash $array
 *
 * @param array $array
 *	The array to escape
 * @return array
 *	The same array, escaped
 */
function stripslash_array($array)
{
    foreach ($array as $key => $value) {
        if (is_array($value)) {
            $array[$key] = stripslash_array($value);
        } else {
            $array[$key] = stripslashes($value);
        }
    }
    return $array;
}
define('ARTICLES_PATH', DATA_PATH . 'articles/');
define('MINICHAT_PATH', DATA_PATH . 'minichat/');
define('NEWS_PATH', DATA_PATH . 'news/');
define('FILES_PATH', DATA_PATH . 'uploads/');
define('PAGES_PATH', DATA_PATH . 'pages/');
define('GALLERY_PATH', DATA_PATH . 'gallery/');
define('FORUM_PATH', DATA_PATH . 'forum/');
// Cookies
define('FOREVER_COOKIE', time() + 3600 * 24 * 365 * 5);
////////////////////////////////////////////////////////////////////////////////
// Loading modules                                                            //
////////////////////////////////////////////////////////////////////////////////
include_once SYSTEM_MODULES_PATH . 'load.php';
////////////////////////////////////////////////////////////////////////////////
// magic_quotes_gpc fix                                                       //
////////////////////////////////////////////////////////////////////////////////
if (ini_get('magic_quotes_gpc')) {
    stripslash_array($_POST);
    stripslash_array($_GET);
    stripslash_array($_COOKIE);
}
////////////////////////////////////////////////////////////////////////////////
// Loading modules                                                            //
////////////////////////////////////////////////////////////////////////////////
$em_dir = opendir(ENGINE_PATH);
while ($em = readdir($em_dir)) {
    if (substr($em, 0, 1) != '.' && is_file(ENGINE_PATH . $em)) {
        include_once ENGINE_PATH . $em;
    }
}
closedir($em_dir);