See if the .htaccess file uses the RewriteBase directive.

Paramètres

string $type: Either css or js.

Return value

bool FALSE if the ErrorDocument 404 statement is incorrect.

1 call to advagg_install_htaccess_errordocument()
advagg_install_check_via_http dans ./advagg.install
Make sure http requests to css/js files work correctly.

Fichier

./advagg.install, line 2846

Code

function advagg_install_htaccess_errordocument($type) {
    list($css_path, $js_path) = advagg_get_root_files_dir();
    if ($type === 'css') {
        $location = $css_path[1] . '/.htaccess';
    }
    if ($type === 'js') {
        $location = $js_path[1] . '/.htaccess';
    }
    $good = TRUE;
    // Get the location of the 404 error doc.
    if (is_readable($location)) {
        $htaccess = advagg_file_get_contents($location);
        $matches = array();
        $found = preg_match_all('/\\n\\s*ErrorDocument\\s*404\\s*(.*)/i', $htaccess, $matches);
        if ($found && !empty($matches[0])) {
            $matches[1] = array_map('trim', $matches[1]);
            $location = array_pop($matches[1]);
        }
    }
    else {
        return $good;
    }
    // If it's pointing to the wrong place or doesn't exist return FALSE.
    if (!empty($location) && $location !== "{$GLOBALS['base_path']}index.php") {
        $good = FALSE;
    }
    if (empty($location) && $GLOBALS['base_path'] !== '/') {
        $good = FALSE;
    }
    return $good;
}