//include("301.php"); //if ($_SERVER["REMOTE_ADDR"]!="217.61.165.145") /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage * @package Mage * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ if (version_compare(phpversion(), '5.3.0', '<')===true) { echo '
Magento supports PHP 5.3.0 or newer. Find out how to install Magento using PHP-CGI as a work-around.
");
print_r($error);
}*/
// IP autorizzati a vedere il sito anche in manutenzione
$allowedIps = array(
'217.61.165.145',
);
// Recupero IP reale (dietro proxy)
// Prima HTTP_X_FORWARDED_FOR, altrimenti REMOTE_ADDR
$clientIp = '';
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
// Può contenere più IP separati da virgola
$parts = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$clientIp = trim($parts[0]);
} elseif (!empty($_SERVER['REMOTE_ADDR'])) {
$clientIp = $_SERVER['REMOTE_ADDR'];
}
// Se esiste il file maintenance.flag e l'IP non è tra quelli consentiti → mostra manutenzione
if (file_exists(__DIR__ . '/maintenance.flag') && !in_array($clientIp, $allowedIps, true)) {
header('HTTP/1.1 503 Service Unavailable');
header('Status: 503 Service Unavailable');
header('Retry-After: 3600'); // opzionale
// Pagina di manutenzione personalizzata (opzionale)
$maintenanceFile = __DIR__ . '/maintenance.html';
if (file_exists($maintenanceFile)) {
readfile($maintenanceFile);
} else {
echo 'Sito in manutenzione. Riprova più tardi.';
}
exit;
}
// Da qui in poi il normale bootstrap della tua applicazione
// require 'bootstrap.php';
// ...
/**
* Compilation includes configuration file
*/
define('MAGENTO_ROOT', getcwd());
$compilerConfig = MAGENTO_ROOT . '/includes/config.php';
if (file_exists($compilerConfig)) {
include $compilerConfig;
}
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
$maintenanceFile = 'maintenance.flag';
if (!file_exists($mageFilename)) {
if (is_dir('downloader')) {
header("Location: downloader");
} else {
echo $mageFilename." was not found";
}
exit;
}
if (file_exists($maintenanceFile)) {
include_once dirname(__FILE__) . '/errors/503.php';
exit;
}
require_once $mageFilename;
//Varien_Profiler::enable();
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
}
ini_set('display_errors', 1);
// Mage::setIsDeveloperMode(true);
umask(0);
/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
$mageRunCode='default';
Mage::run($mageRunCode, $mageRunType);