summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-01-29 07:36:29 +0000
committerDries Buytaert <dries@buytaert.net>2006-01-29 07:36:29 +0000
commit81660bc6620531792db7c0e2e717ea0ca1ac4f33 (patch)
tree1d996a97c38859d02235887342d88a98296f41b8
parent5229f329ac458aca6d5d7505cc5be2f975928c83 (diff)
downloadbrdo-81660bc6620531792db7c0e2e717ea0ca1ac4f33.tar.gz
brdo-81660bc6620531792db7c0e2e717ea0ca1ac4f33.tar.bz2
- Patch #13148: fix problems with using relative path names! (Please document this change.)
-rw-r--r--includes/bootstrap.inc4
-rw-r--r--includes/common.inc15
-rw-r--r--includes/theme.inc14
-rw-r--r--themes/bluemarine/page.tpl.php5
-rw-r--r--themes/engines/phptemplate/phptemplate.engine2
-rw-r--r--themes/pushbutton/page.tpl.php10
6 files changed, 26 insertions, 24 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index c0139d06d..3ffd4dbc1 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -678,11 +678,13 @@ function _drupal_bootstrap($phase) {
switch ($phase) {
case DRUPAL_BOOTSTRAP_DATABASE:
- global $db_url, $db_prefix, $base_url;
+ global $db_url, $db_prefix, $base_url, $base_path;
$conf = array();
require_once './' . conf_init() .'/settings.php';
require_once './includes/database.inc';
// Initialize the default database.
+ $parts = parse_url($base_url);
+ $base_path = (isset($parts['path']) ? $parts['path'] . '/' : '/');
db_set_active();
break;
diff --git a/includes/common.inc b/includes/common.inc
index 6c195b8e0..9f82fe440 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -114,11 +114,10 @@ function drupal_set_html_head($data = NULL) {
* Retrieve output to be displayed in the head tag of the HTML page.
*/
function drupal_get_html_head() {
- global $base_url;
+ global $base_path;
$output = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
- $output .= "<base href=\"$base_url/\" />\n";
- $output .= theme('stylesheet_import', 'misc/drupal.css');
+ $output .= theme('stylesheet_import', $base_path .'misc/drupal.css');
return $output . drupal_set_html_head();
}
@@ -919,7 +918,7 @@ function url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE) {
return $path . $fragment;
}
- global $base_url;
+ global $base_url, $base_path;
static $script;
static $clean_url;
@@ -935,7 +934,7 @@ function url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE) {
$clean_url = (bool)variable_get('clean_url', '0');
}
- $base = ($absolute ? $base_url .'/' : '');
+ $base = ($absolute ? $base_url . '/' : $base_path);
// The special path '<front>' links to the default front page.
if (isset($path) && $path != '<front>') {
@@ -1134,13 +1133,15 @@ function drupal_add_link($attributes) {
* depends on the 'killswitch' inside it.
*/
function drupal_add_js($file) {
+ global $base_path;
static $sent = array();
+
if (!isset($sent['misc/drupal.js'])) {
- drupal_set_html_head('<script type="text/javascript" src="misc/drupal.js"></script>');
+ drupal_set_html_head('<script type="text/javascript" src="'. $base_path .'misc/drupal.js"></script>');
$sent['misc/drupal.js'] = true;
}
if (!isset($sent[$file])) {
- drupal_set_html_head('<script type="text/javascript" src="'. check_url($file) .'"></script>');
+ drupal_set_html_head('<script type="text/javascript" src="'. check_url($base_path . $file) .'"></script>');
$sent[$file] = true;
}
}
diff --git a/includes/theme.inc b/includes/theme.inc
index 3673e921c..1894d2a16 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -280,7 +280,7 @@ function theme_get_settings($key = NULL) {
* The value of the requested setting, NULL if the setting does not exist.
*/
function theme_get_setting($setting_name, $refresh = FALSE) {
- global $theme_key;
+ global $theme_key, $base_path;
static $settings;
if (empty($settings) || $refresh) {
@@ -298,11 +298,12 @@ function theme_get_setting($setting_name, $refresh = FALSE) {
}
if ($settings['toggle_logo']) {
+ $settings['logo'] = $base_path;
if ($settings['default_logo']) {
- $settings['logo'] = dirname($theme_object->filename) .'/logo.png';
+ $settings['logo'] .= dirname($theme_object->filename) .'/logo.png';
}
elseif ($settings['logo_path']) {
- $settings['logo'] = $settings['logo_path'];
+ $settings['logo'] .= $settings['logo_path'];
}
}
@@ -330,10 +331,12 @@ function theme_get_setting($setting_name, $refresh = FALSE) {
* drupal_set_html_head() to enforce the correct CSS cascading order.
*/
function theme_add_style($path = '', $media = 'all') {
+ global $base_path;
static $styles = array();
+
if ($path && !isset($styles["$media:$path"])) {
$style = new stdClass();
- $style->path = $path;
+ $style->path = $base_path. $path;
$style->media = $media;
$styles["$media:$path"] = $style;
}
@@ -511,9 +514,10 @@ function theme_links($links, $delimiter = ' | ') {
* A string containing the image tag.
*/
function theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) {
+ global $base_path;
if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path)))) {
$attributes = drupal_attributes($attributes);
- return '<img src="'. check_url($path) .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $image_attributes . $attributes .' />';
+ return '<img src="'. check_url($base_path. $path) .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $image_attributes . $attributes .' />';
}
}
diff --git a/themes/bluemarine/page.tpl.php b/themes/bluemarine/page.tpl.php
index f75ea826a..76e01fbcd 100644
--- a/themes/bluemarine/page.tpl.php
+++ b/themes/bluemarine/page.tpl.php
@@ -13,8 +13,8 @@
<table border="0" cellpadding="0" cellspacing="0" id="header">
<tr>
<td id="logo">
- <?php if ($logo) { ?><a href="./" title="Home"><img src="<?php print $logo ?>" alt="Home" /></a><?php } ?>
- <?php if ($site_name) { ?><h1 class='site-name'><a href="./" title="Home"><?php print $site_name ?></a></h1><?php } ?>
+ <?php if ($logo) { ?><a href="<?php print $base_path ?>" title="Home"><img src="<?php print $logo ?>" alt="Home" /></a><?php } ?>
+ <?php if ($site_name) { ?><h1 class='site-name'><a href="<?php print $base_path ?>" title="Home"><?php print $site_name ?></a></h1><?php } ?>
<?php if ($site_slogan) { ?><div class='site-slogan'><?php print $site_slogan ?></div><?php } ?>
</td>
<td id="menu">
@@ -41,7 +41,6 @@
<div class="tabs"><?php print $tabs ?></div>
<?php print $help ?>
<?php print $messages ?>
-
<?php print $content; ?>
</div>
</td>
diff --git a/themes/engines/phptemplate/phptemplate.engine b/themes/engines/phptemplate/phptemplate.engine
index e7ddc86a2..6aa99f7f2 100644
--- a/themes/engines/phptemplate/phptemplate.engine
+++ b/themes/engines/phptemplate/phptemplate.engine
@@ -140,6 +140,7 @@ function phptemplate_features() {
* into a pluggable template engine.
*/
function phptemplate_page($content) {
+ global $base_path;
/* Set title and breadcrumb to declared values */
if ($_GET['q'] == variable_get('site_frontpage', 'node')) {
@@ -185,6 +186,7 @@ function phptemplate_page($content) {
}
$variables = array(
+ 'base_path' => $base_path,
'breadcrumb' => theme('breadcrumb', drupal_get_breadcrumb()),
'closure' => theme('closure'),
'content' => '<!-- begin content -->' . $content . '<!-- end content -->',
diff --git a/themes/pushbutton/page.tpl.php b/themes/pushbutton/page.tpl.php
index 56faa28b4..0071c2dbb 100644
--- a/themes/pushbutton/page.tpl.php
+++ b/themes/pushbutton/page.tpl.php
@@ -14,25 +14,19 @@
<table id="primary-menu" summary="Navigation elements." border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td id="home" width="10%">
-
<?php if ($logo) : ?>
- <a href="<?php print url() ?>" title="Home"><img src="<?php print($logo) ?>" alt="Home" width="144" height="63" border="0" /></a>
+ <a href="<?php print $base_path ?>" title="Home"><img src="<?php print($logo) ?>" alt="Home" width="144" height="63" border="0" /></a>
<?php endif; ?>
-
</td>
<td id="site-info" width="20%">
-
<?php if ($site_name) : ?>
- <div class='site-name'><a href="<?php print url() ?>" title="Home"><?php print($site_name) ?></a></div>
+ <div class='site-name'><a href="<?php print $base_path ?>" title="Home"><?php print($site_name) ?></a></div>
<?php endif;?>
-
<?php if ($site_slogan) : ?>
<div class='site-slogan'><?php print($site_slogan) ?></div>
<?php endif;?>
-
</td>
-
<td class="primary-links" width="70%" align="center" valign="middle">
<?php print theme('links', $primary_links) ?>
</td>