'#default_value' => BOOST_DISABLE_CLEAN_URL,
'#description' => t('Drupal will output non clean url\'s for non anonymous users. This allows for the browser to cache the page and still have logging in work. This is more on the extreme side of tweaks.'),
);
- $form['advanced']['boost_aggressive_gzip'] = array(
- '#type' => 'checkbox',
- '#title' => t('Aggressive Gzip: Deliver gzipped content independent of the request header.'),
- '#default_value' => BOOST_AGGRESSIVE_GZIP,
- '#description' => t('In order to deliver gzipped content independent of the header, this will test for gzip compression in a small iframe by sending it compressed content. This compressed content is javascript which creates a cookie with a note of gzip support. On the server side it checks for the cookie and then sends out gzipped content accordingly. See <a href="@url">Website Performance - Activate Gzip</a>. In short some firewalls/proxies mangle the gzip header; this gets around that. iframe is on non compressed version of the frontpage only.', array('@url' => 'http://actionable-stats.com/website-performance-activate-gzip')),
- );
+ if (BOOST_GZIP) {
+ $form['advanced']['boost_aggressive_gzip'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Aggressive Gzip: Deliver gzipped content independent of the request header.'),
+ '#default_value' => BOOST_AGGRESSIVE_GZIP,
+ '#description' => t('In order to deliver gzipped content independent of the header, this will test for gzip compression in a small iframe by sending it compressed content. This compressed content is javascript which creates a cookie with a note of gzip support. On the server side it checks for the cookie and then sends out gzipped content accordingly. See <a href="@url">Website Performance - Activate Gzip</a>. In short some firewalls/proxies mangle the gzip header; this gets around that. iframe is on non compressed version of the frontpage only.', array('@url' => 'http://actionable-stats.com/website-performance-activate-gzip')),
+ );
+ }
$form['advanced']['boost_permissions_file'] = array(
'#type' => 'textfield',
'#title' => t('Files: Enter in a 4 digit number (octal) that will be used by !link. Example 0664', array('!link' => l(t('chmod()'), 'http://php.net/chmod'))),
$string .= BOOST_GZIP ? " AddEncoding gzip $_gz\n" : '';
$string .= " </IfModule>\n";
}
- if (BOOST_CACHE_HTML) {
- $string .= " <FilesMatch \"$html$gz$\">\n";
- $string .= " ForceType text/html\n";
- $string .= " </FilesMatch>\n";
- }
- if (BOOST_CACHE_XML) {
- $string .= " <FilesMatch \"$xml$gz$\">\n";
- $string .= " ForceType text/xml\n";
- $string .= " </FilesMatch>\n";
- }
- if (BOOST_CACHE_CSS) {
- $string .= " <FilesMatch \"$css$gz$\">\n";
- $string .= " ForceType text/css\n";
- $string .= " </FilesMatch>\n";
- }
- if (BOOST_CACHE_JS) {
- $string .= " <FilesMatch \"$js$gz$\">\n";
- $string .= " ForceType text/javascript\n";
- $string .= " </FilesMatch>\n";
- }
- if (BOOST_CACHE_JSON) {
- $string .= " <FilesMatch \"$json$gz$\">\n";
- $string .= " ForceType text/javascript\n";
- $string .= " </FilesMatch>\n";
+ if (BOOST_GZIP) {
+ if (BOOST_CACHE_HTML) {
+ $string .= " <FilesMatch \"$html$gz$\">\n";
+ $string .= " ForceType text/html\n";
+ $string .= " </FilesMatch>\n";
+ }
+ if (BOOST_CACHE_XML) {
+ $string .= " <FilesMatch \"$xml$gz$\">\n";
+ $string .= " ForceType text/xml\n";
+ $string .= " </FilesMatch>\n";
+ }
+ if (BOOST_CACHE_CSS) {
+ $string .= " <FilesMatch \"$css$gz$\">\n";
+ $string .= " ForceType text/css\n";
+ $string .= " </FilesMatch>\n";
+ }
+ if (BOOST_CACHE_JS) {
+ $string .= " <FilesMatch \"$js$gz$\">\n";
+ $string .= " ForceType text/javascript\n";
+ $string .= " </FilesMatch>\n";
+ }
+ if (BOOST_CACHE_JSON) {
+ $string .= " <FilesMatch \"$json$gz$\">\n";
+ $string .= " ForceType text/javascript\n";
+ $string .= " </FilesMatch>\n";
+ }
}
if (BOOST_AGGRESSIVE_GZIP) {
$string .= "\n";
$crawler_response = drupal_http_request(BOOST_CRAWLER_SELF . '&test=1');
$crawler_response = $crawler_response->code;
}
+ $robots = file_exists('robots.txt') ? file_get_contents('robots.txt') : FALSE;
+
foreach ($cache_directories as $cache_directory) {
_boost_mkdir_p($cache_directory);
$root_file = file_put_contents($cache_directory . '/' . variable_get('boost_root_file', '.boost'), $cache_directory);
'value' => $t('File system sub directory limit.'),
);
}
+ if ($robots && !stristr($robots, 'Disallow: /boost_stats.php')) {
+ $requirements['boost_robots'] = array(
+ 'title' => $t('Boost'),
+ 'description' => $t('Your robots.txt file does not contain "Disallow: /boost_stats.php". This is needed inorder to prevent the output of this from accendently getting indexed by search engines.'),
+ 'severity' => REQUIREMENT_WARNING,
+ 'value' => $t('"Disallow: /boost_stats.php" entry missing in robots.txt'),
+ );
+ }
if (empty($requirements)) {
$requirements['boost'] = array(
'title' => $t('Boost'),
define('BOOST_HALT_ON_ERRORS', variable_get('boost_halt_on_errors', FALSE));
define('BOOST_HALT_ON_MESSAGES', variable_get('boost_halt_on_messages', TRUE));
define('BOOST_DISABLE_CLEAN_URL', variable_get('boost_disable_clean_url', FALSE));
-define('BOOST_AGGRESSIVE_GZIP', variable_get('boost_aggressive_gzip', TRUE));
+define('BOOST_AGGRESSIVE_GZIP', BOOST_GZIP ? variable_get('boost_aggressive_gzip', TRUE) : FALSE);
define('BOOST_PERMISSIONS_FILE', variable_get('boost_permissions_file', ''));
define('BOOST_PERMISSIONS_DIR', variable_get('boost_permissions_dir', ''));
define('BOOST_EXPIRE_NO_FLUSH', variable_get('boost_expire_no_flush', FALSE));
// Special handling of the front page for aggressive gzip test
if ($path == '' && BOOST_AGGRESSIVE_GZIP && $extension == BOOST_FILE_EXTENSION) {
_boost_generate_gzip_test_file();
- boost_cache_write($filename, _boost_inject_code($data, '<iframe src="/boost-gzip-cookie-test.html" style="width:0px; height:0px; border: 0px"></iframe>' . "\n"));
+ boost_cache_write($filename, _boost_inject_code($data, '<iframe src="/boost-gzip-cookie-test.html" style="width:0px; height:0px; border:0px; position:absolute; top:-1000px; z-index:10;"></iframe>' . "\n"));
}
else {
boost_cache_write($filename, $data);
* AJAX Menu Callback.
*/
function boost_stats_ajax_callback() {
- if (!isset($_GET['js'])) {
- // stats not called via JS, send image out & close connection.
- boost_async_opp("\x47\x49\x46\x38\x39\x61\x1\x0\x1\x0\x80\xff\x0\xc0\xc0\xc0\x0\x0\x0\x21\xf9\x4\x1\x0\x0\x0\x0\x2c\x0\x0\x0\x0\x1\x0\x1\x0\x0\x2\x2\x44\x1\x0\x3b", TRUE, 'image/gif', 43);
- }
-
// Exit if nothing was passed to this.
if ( !isset($_GET['nid'])
&& !isset($_GET['title'])
&& !isset($_GET['qq'])
&& !isset($_GET['referer'])
) {
- exit;
+ return drupal_not_found();
+ }
+
+ if (!isset($_GET['js'])) {
+ // stats not called via JS, send image out & close connection.
+ boost_async_opp("\x47\x49\x46\x38\x39\x61\x1\x0\x1\x0\x80\xff\x0\xc0\xc0\xc0\x0\x0\x0\x21\xf9\x4\x1\x0\x0\x0\x0\x2c\x0\x0\x0\x0\x1\x0\x1\x0\x0\x2\x2\x44\x1\x0\x3b", TRUE, 'image/gif', 43);
}
// Set variables passed via GET.
// Send JSON Back
if (!empty($json)) {
- echo drupal_json($json);
+ drupal_json($json);
}
}
// Send HTML back
* Place in webroot, for faster stats if needed.
*/
-if (!isset($_GET['js'])) {
- // stats not called via JS, send image out & close connection.
- boost_stats_async_image();
-}
-
// Exit script if nothing was passed to it.
if ( !isset($_GET['nid'])
&& !isset($_GET['title'])
&& !isset($_GET['qq'])
&& !isset($_GET['referer'])
) {
+ boost_stats_full_boot();
+ drupal_not_found();
exit;
}
+if (!isset($_GET['js'])) {
+ // stats not called via JS, send image out & close connection.
+ boost_stats_async_image();
+}
+
// connect to db & set variables.
boost_stats_init();
// Send JSON Back
if (!empty($json)) {
- header('Content-Type: text/javascript; charset=utf-8');
- echo json_encode($json);
+ drupal_json($json);
}
}
// Send HTML back