Aspetti-Ladiesfashion;
knitted ladies garments aimed at the self-assured woman, including women
requiring a larger size. Knit wear with a comfortable fit but maintaining that
fashionable look for the modern woCTORY_SEPARATOR) {
$dataBase .= DIRECTORY_SEPARATOR;
}
/* Create the sub directories, if necessary */
foreach (array('albums',
'cache',
'locks',
'tmp',
'plugins_data',
'plugins_data/modules',
'plugins_data/themes',
'smarty',
'smarty/templates_c') as $key) {
$dir = $dataBase . $key;
if (file_exists($dir) && !is_dir($dir)) {
return false;
}
if (!file_exists($dir)) {
if (!mkdir($dir, 0755)) {
return false;
}
}
if (!is_writeable($dir)) {
return false;
}
if ($key == 'locks') {
for ($i = 0; $i <= 9; $i++) {
if (!file_exists("$dir/$i")) {
if (!mkdir("$dir/$i", 0755)) {
return false;
}
}
for ($j = 0; $j <= 9; $j++) {
if (!file_exists("$dir/$i/$j")) {
if (!mkdir("$dir/$i/$j", 0755)) {
return false;
}
}
}
}
}
}
return secureStorageFolder($dataBase);
}
/**
* Secure the storage folder from attempts to access it directly via the web by adding a
* .htaccess with a "Deny from all" directive. This won't have any effect on webservers other
* than Apache 1.2+ though.
* Since we can't reliably tell whether the storage folder is web-accessible or not,
* we add this in all cases. It doesn't hurt.
* @param string absolute filesystem path to the storage folder.
* @return boolean true if the .htaccess file has been created successfully.
*/
function secureStorageFolder($dataBase) {
$htaccessPath = $dataBase . '.htaccess';
$fh = @fopen($htaccessPath, 'w');
if ($fh) {
$htaccessContents = "DirectoryIndex .htaccess\n" .
"SetHandler Gallery_Security_Do_Not_Remove\n" .
"Options None\n" .
"\n" .
"RewriteEngine off\n" .
"\n" .
"\n" .
"Order allow,deny\n" .
"Deny from all\n" .
"\n";
fwrite($fh, $htaccessContents);
fclose($fh);
}
return file_exists($htaccessPath);
}
/* Returns something like https://example.com */
function getBaseUrl() {
/* Can't use GalleryUrlGenerator::makeUrl since it's an object method */
if (!($hostName = GalleryUtilities::getServerVar('HTTP_X_FORWARDED_SERVER'))) {
$hostName = GalleryUtilities::getServerVar('HTTP_HOST');
}
$protocol = (GalleryUtilities::getServerVar('HTTPS') == 'on') ? 'https' : 'http';
return sprintf('%s://%s', $protocol, $hostName);
}
/** Returns the URL to the G2 folder, e.g. http://example.com/gallery2/. */
function getGalleryDirUrl() {
$galleryDir = dirname(dirname(__FILE__));
require_once($galleryDir . '/modules/core/classes/GalleryUrlGenerator.class');
$urlPath = preg_replace('|^(.*/)install/index.php(?:\?.*)?$|s', '$1',
GalleryUrlGenerator::getCurrentRequestUri());
return getBaseUrl() . $urlPath;
}
/**
* Mini url generator for the installer
*/
function generateUrl($uri, $print=true) {
if (!strncmp($uri, 'index.php', 9)) {
/* Cookieless browsing: If session.use_trans_sid is on then it will add the session id. */
if (!areCookiesSupported() && !ini_get('session.use_trans_sid')) {
/*
* Don't use SID since it's a constant and we change (regenerate) the session id
* in the request
*/
$sid = session_name() . '=' . session_id();
$uri .= !strpos($uri, '?') ? '?' : '&';
$uri .= $sid;
}
}
if ($print) {
print $uri;
}
return $uri;
}
/**
* Regenerate the session id to prevent session fixation attacks
* Must be called before starting to output any data since it tries to send a cookie
*/
function regenerateSession() {
/* 1. Generate a new session id */
$newSessionId = md5(uniqid(substr(rand() . serialize($_REQUEST), 0, 114)));
$sessionData = array();
if (!empty($_SESSION) && is_array($_SESSION)) {
foreach ($_SESSION as $key => $value) {
$sessionData[$key] = $value;
}
}
/* 2. Delete the old session */
session_unset();
session_destroy();
/* Create the new session with the old data, send cookie */
session_id($newSessionId);
$sessionName = session_name();
/* Make sure we don't use invalid data at a later point */
foreach (array($_GET, $_POST, $_REQUEST, $_COOKIE) as $superGlobal) {
unset($superGlobal[$sessionName]);
}
session_start();
foreach ($sessionData as $key => $value) {
$_SESSION[$key] = $value;
}
}
/**
* Are cookies supported by the current user-agent?
*/
function areCookiesSupported() {
static $areCookiesSupported;
/* Remember the state since we might unset $_COOKIE */
if (!isset($areCookiesSupported)) {
$areCookiesSupported = !empty($_COOKIE[session_name()]);
}
return $areCookiesSupported;
}
/*
* We don't store the steps in the session in raw form because that
* will break in environments where session.auto_start is on since
* it will try to instantiate the classes before they've been defined
*/
$_SESSION['install_steps'] = serialize($steps);
if (isset($galleryStub)) {
$_SESSION['galleryStub'] = serialize($galleryStub);
}
?>
|