I solved observations in class.bootstrap.php and sysGeneric.php

This commit is contained in:
Paula V. Quispe
2015-03-31 15:29:15 -04:00
parent 055082cec2
commit e270844edf
2 changed files with 20 additions and 9 deletions

View File

@@ -399,7 +399,7 @@ class Bootstrap
// Detect by creating a temporary file // Detect by creating a temporary file
// Try to use system's temporary directory as random name // Try to use system's temporary directory as random name
// shouldn't exist // shouldn't exist
$temp_file = tempnam(G::encryptOld(uniqid(rand(), true)), ''); $temp_file = tempnam(Bootstrap::encryptOld(uniqid(rand(), true)), '');
if ($temp_file) { if ($temp_file) {
$temp_dir = realpath(dirname($temp_file)); $temp_dir = realpath(dirname($temp_file));
unlink($temp_file); unlink($temp_file);
@@ -1077,7 +1077,7 @@ class Bootstrap
$mtime = date('U'); $mtime = date('U');
$gmt_mtime = gmdate("D, d M Y H:i:s", $mtime) . " GMT"; $gmt_mtime = gmdate("D, d M Y H:i:s", $mtime) . " GMT";
header('Pragma: cache'); header('Pragma: cache');
header('ETag: "' . G::encryptOld($mtime . $filename) . '"'); header('ETag: "' . Bootstrap::encryptOld($mtime . $filename) . '"');
header("Last-Modified: " . $gmt_mtime); header("Last-Modified: " . $gmt_mtime);
header('Cache-Control: public'); header('Cache-Control: public');
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 30 * 60 * 60 * 24) . " GMT"); //1 month header("Expires: " . gmdate("D, d M Y H:i:s", time() + 30 * 60 * 60 * 24) . " GMT"); //1 month
@@ -1090,7 +1090,7 @@ class Bootstrap
} }
if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) { if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
if (str_replace('"', '', stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])) == G::encryptOld($mtime . $filename)) { if (str_replace('"', '', stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])) == Bootstrap::encryptOld($mtime . $filename)) {
header("HTTP/1.1 304 Not Modified"); header("HTTP/1.1 304 Not Modified");
exit(); exit();
} }
@@ -1216,7 +1216,7 @@ class Bootstrap
$mtime = date('U'); $mtime = date('U');
} }
$gmt_mtime = gmdate("D, d M Y H:i:s", $mtime) . " GMT"; $gmt_mtime = gmdate("D, d M Y H:i:s", $mtime) . " GMT";
header('ETag: "' . G::encryptOld($mtime . $filename) . '"'); header('ETag: "' . Bootstrap::encryptOld($mtime . $filename) . '"');
header("Last-Modified: " . $gmt_mtime); header("Last-Modified: " . $gmt_mtime);
header('Cache-Control: public'); header('Cache-Control: public');
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 60 * 10) . " GMT"); // ten header("Expires: " . gmdate("D, d M Y H:i:s", time() + 60 * 10) . " GMT"); // ten
@@ -1234,7 +1234,7 @@ class Bootstrap
$mtime = date('U'); $mtime = date('U');
} }
$gmt_mtime = gmdate("D, d M Y H:i:s", $mtime) . " GMT"; $gmt_mtime = gmdate("D, d M Y H:i:s", $mtime) . " GMT";
header('ETag: "' . G::encryptOld($mtime . $filename) . '"'); header('ETag: "' . Bootstrap::encryptOld($mtime . $filename) . '"');
header("Last-Modified: " . $gmt_mtime); header("Last-Modified: " . $gmt_mtime);
header('Cache-Control: public'); header('Cache-Control: public');
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 90 * 60 * 60 * 24) . " GMT"); header("Expires: " . gmdate("D, d M Y H:i:s", time() + 90 * 60 * 60 * 24) . " GMT");
@@ -1246,7 +1246,7 @@ class Bootstrap
} }
if (isset($_SERVER ['HTTP_IF_NONE_MATCH'])) { if (isset($_SERVER ['HTTP_IF_NONE_MATCH'])) {
if (str_replace('"', '', stripslashes($_SERVER ['HTTP_IF_NONE_MATCH'])) == G::encryptOld($mtime . $filename)) { if (str_replace('"', '', stripslashes($_SERVER ['HTTP_IF_NONE_MATCH'])) == Bootstrap::encryptOld($mtime . $filename)) {
header("HTTP/1.1 304 Not Modified"); header("HTTP/1.1 304 Not Modified");
exit(); exit();
} }
@@ -1276,7 +1276,7 @@ class Bootstrap
$checkSum .= md5_file($file); $checkSum .= md5_file($file);
} }
} }
return G::encryptOld($checkSum . $key); return Bootstrap::encryptOld($checkSum . $key);
} }
/** /**
@@ -2922,5 +2922,16 @@ class Bootstrap
} }
return false; return false;
} }
/**
* encryptOld
*
* @param string $string
*
* @return md5($string)
*/
public function encryptOld ($string)
{
return md5($string);
}
} }

View File

@@ -151,7 +151,7 @@ if (file_exists($requestFile)) {
header ( 'Pragma: cache' ); header ( 'Pragma: cache' );
$mtime = filemtime ( $requestFile ); $mtime = filemtime ( $requestFile );
$gmt_mtime = gmdate ( "D, d M Y H:i:s", $mtime ) . " GMT"; $gmt_mtime = gmdate ( "D, d M Y H:i:s", $mtime ) . " GMT";
header ( 'ETag: "' . G::encryptOld ( $mtime . $requestFile ) . '"' ); header ( 'ETag: "' . Bootstrap::encryptOld ( $mtime . $requestFile ) . '"' );
header ( "Last-Modified: " . $gmt_mtime ); header ( "Last-Modified: " . $gmt_mtime );
header ( 'Cache-Control: public' ); header ( 'Cache-Control: public' );
$userAgent = strtolower ( $_SERVER ['HTTP_USER_AGENT'] ); $userAgent = strtolower ( $_SERVER ['HTTP_USER_AGENT'] );
@@ -165,7 +165,7 @@ if (file_exists($requestFile)) {
} }
} }
if (isset ( $_SERVER ['HTTP_IF_NONE_MATCH'] )) { if (isset ( $_SERVER ['HTTP_IF_NONE_MATCH'] )) {
if (str_replace ( '"', '', stripslashes ( $_SERVER ['HTTP_IF_NONE_MATCH'] ) ) == G::encryptOld ( $mtime . $requestFile )) { if (str_replace ( '"', '', stripslashes ( $_SERVER ['HTTP_IF_NONE_MATCH'] ) ) == Bootstrap::encryptOld ( $mtime . $requestFile )) {
header ( "HTTP/1.1 304 Not Modified" ); header ( "HTTP/1.1 304 Not Modified" );
} }
} }