diff --git a/ecrire/inc_aide_index.php b/ecrire/inc_aide_index.php index 5c65e2556f1d6c302e55fb6fee042ec79ae460dd..578349515144b95625371a1ecf1a281142fd1906 100644 --- a/ecrire/inc_aide_index.php +++ b/ecrire/inc_aide_index.php @@ -58,13 +58,13 @@ function fichier_aide($lang_aide = '') { if (!$lang_aide) $lang_aide = $GLOBALS['spip_lang']; // fichier local ? - if (@file_exists($fichier_aide = "../AIDE/aide-$lang_aide-aide.html")) { + if (@file_exists($fichier_aide = _DIR_RACINE . "AIDE/aide-$lang_aide-aide.html")) { return array(spip_file_get_contents($fichier_aide), $lang_aide); } // fichier local ? si reduction ISO du code langue oc_prv_ni => oc else if (ereg("(.*)_", $lang_aide, $regs) - AND (@file_exists($fichier_aide = "../AIDE/aide-".$regs[1]."-aide.html"))) + AND (@file_exists($fichier_aide = _DIR_RACINE . "AIDE/aide-".$regs[1]."-aide.html"))) return array(spip_file_get_contents($fichier_aide), $regs[1]); // Aide internet @@ -237,7 +237,7 @@ function help_img($regs) { header("Content-Type: image/$ext"); if (@file_exists($img = _DIR_CACHE . 'aide-'.$cache)) { readfile($img); - } else if (@file_exists($img = '../AIDE/aide-'.$cache)) { + } else if (@file_exists($img = _DIR_RACINE . 'AIDE/aide-'.$cache)) { readfile($img); } else if ($help_server) { include_ecrire('inc_distant'); diff --git a/ecrire/inc_auth.php3 b/ecrire/inc_auth.php3 index 32ba8b2c5ab2f10753cb475001e31d54d2a1a575..cf8eefbe8c70e1c82caac3dc5aba20ff07f3e83a 100644 --- a/ecrire/inc_auth.php3 +++ b/ecrire/inc_auth.php3 @@ -10,11 +10,8 @@ * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * \***************************************************************************/ - -// if (!defined("_ECRIRE_INC_VERSION")) return; -define("_DIR_LOGIN", _DIR_RESTREINT ? "" : "../"); define("_DIR_LOGGED_IN", _DIR_RESTREINT ? "" : _DIR_RESTREINT_ABS); // diff --git a/ecrire/inc_barre_spip.php3 b/ecrire/inc_barre_spip.php3 index f9623c8473c6eac6cf49f5ef9e8a64b45f4586d6..708e669c6edcb459933736cce44e62c58bbbfdd3 100644 --- a/ecrire/inc_barre_spip.php3 +++ b/ecrire/inc_barre_spip.php3 @@ -42,7 +42,7 @@ function afficher_barre_spip($champ, $forum=false) { global $spip_lang, $spip_lang_right, $spip_lang_left; $ret = ($num_barre > 0) ? '' : - '<script type="text/javascript" src="' . _DIR_PREFIX1. 'spip_barre.js"></script>'; + '<script type="text/javascript" src="' . _DIR_RACINE. 'spip_barre.js"></script>'; $num_barre++; $champhelp = "document.getElementById('barre_$num_barre')"; diff --git a/ecrire/inc_distant.php b/ecrire/inc_distant.php index c5ef0813336ac9e43870b0ee74de46ad2a47c478..c022d69b03d78119217de35050efc6e4f1cb11e7 100644 --- a/ecrire/inc_distant.php +++ b/ecrire/inc_distant.php @@ -22,8 +22,8 @@ function copie_locale($source, $mode='auto') { // Si copie_locale() est appele depuis l'espace prive if (!_DIR_RESTREINT - AND strpos('../'.$source, _DIR_IMG) === 0) - return '../'.$source; + AND strpos(_DIR_RACINE . $source, _DIR_IMG) === 0) + return _DIR_RACINE . $source; $local = fichier_copie_locale($source); diff --git a/ecrire/inc_documents.php3 b/ecrire/inc_documents.php3 index 468324adb8afc1a2b0e1e6161fc264fa40c558a2..395a93b6a3ef7c8ec6dccd8bd2db8142813f255d 100644 --- a/ecrire/inc_documents.php3 +++ b/ecrire/inc_documents.php3 @@ -75,7 +75,7 @@ function document_vu($id_document=0) { // de la vignette -> c'est a ca que sert la variable $portfolio function image_pattern($vignette) { return "<img src='" - . (_DIR_RESTREINT ? '' : '../') + . _DIR_RACINE . $vignette['fichier']."' width='".$vignette['largeur']."' height='".$vignette['hauteur']."' @@ -93,8 +93,8 @@ function document_et_vignette($document, $url, $portfolio=false) { if (!$portfolio OR !($GLOBALS['meta']['creer_preview'] == 'oui')) { $image = image_pattern($vignette); } else { - $image = prive_lien_image_reduite ($vignette['largeur'], - $vignette['hauteur'], $vignette['fichier']); + include_ecrire("inc_logos"); + $image = reduire_image_logo((_DIR_RACINE . $vignette['fichier']), 120, 110); } } else if (strstr($GLOBALS['meta']['formats_graphiques'], $extension) AND $GLOBALS['meta']['creer_preview'] == 'oui') { @@ -508,16 +508,6 @@ function texte_upload_manuel($dir, $inclus = '') { } -// -// Retourne le lien HTML vers l'image reduite (pour l'espace prive) -// -function prive_lien_image_reduite ($largeur_vignette, $hauteur_vignette, $fichier_vignette) { - global $connect_id_auteur; - include_ecrire("inc_logos"); - - return reduire_image_logo('../'.$fichier_vignette, 120, 110); -} - // Bloc d'edition de la taille du doc (pour embed) function afficher_formulaire_taille($document, $type_inclus='AUTO') { diff --git a/ecrire/inc_forum.php3 b/ecrire/inc_forum.php3 index f1269b50d348bd7c00f226baf63e849478c65588..7b4c43b75df609c11a006026f1c0de3ff365601d 100644 --- a/ecrire/inc_forum.php3 +++ b/ecrire/inc_forum.php3 @@ -109,7 +109,7 @@ function boutons_controle_forum($id_forum, $forum_stat, $forum_id_auteur=0, $ref _T('lien_repondre_message'), generer_url_ecrire('iframe_action', "action=forum_admin&id=$id_forum&statut=$valider&redirect=", - "../forum", + _DIR_RACINE . 'forum', "$ref&id_forum=$id_forum&retour=" . urlencode(_DIR_RESTREINT_ABS . $link)), $logo, "creer.gif", 'right', 'non'); diff --git a/ecrire/inc_install.php b/ecrire/inc_install.php index d4d3b26ef830c5417b873f733610cb8dd8c98dfd..baabbc6149c2acd631983c55a396b2a359399e0d 100644 --- a/ecrire/inc_install.php +++ b/ecrire/inc_install.php @@ -761,9 +761,9 @@ function install_unpack() fin_admin($action); - if (@file_exists("../spip_loader" . _EXTENSION_PHP)) + if (@file_exists(_DIR_RACINE . "spip_loader" . _EXTENSION_PHP)) redirige_par_entete(generer_url_public("spip_loader"), "?hash=$hash&id_auteur=$connect_id_auteur"); - else if (@file_exists("../spip_unpack" . _EXTENSION_PHP)) + else if (@file_exists(_DIR_RACINE . "spip_unpack" . _EXTENSION_PHP)) redirige_par_entete(generer_url_public("spip_unpack"), "?hash=$hash&id_auteur=$connect_id_auteur"); else redirige_par_entete(generer_url_public("spip_loader"), "?hash=$hash&id_auteur=$connect_id_auteur"); diff --git a/ecrire/inc_logos.php3 b/ecrire/inc_logos.php3 index 8ad85b4f3034d875a11934ed38907fb92789474d..1e8fe6d983a6b926d31daf54441446a3e4f61036 100644 --- a/ecrire/inc_logos.php3 +++ b/ecrire/inc_logos.php3 @@ -10,14 +10,10 @@ * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * \***************************************************************************/ - -// if (!defined("_ECRIRE_INC_VERSION")) return; - function cherche_image_nommee($nom, $formats = array ('gif', 'jpg', 'png')) { - // _DIR_IMG contient deja le ../ dans ecrire (PREFIX1 - // if (ereg("^../",$nom)) $nom = substr($nom,3); + if (ereg("^" . _DIR_IMG, $nom)) { $nom = substr($nom,strlen(_DIR_IMG)); } @@ -31,15 +27,13 @@ function cherche_image_nommee($nom, $formats = array ('gif', 'jpg', 'png')) { reset($formats); while (list(, $format) = each($formats)) { - $d = _DIR_IMG . "$chemin$nom.$format"; - if (@file_exists($d)){ - return array(_DIR_IMG."$chemin", $nom, $format); + if (@file_exists(_DIR_IMG . "$chemin$nom.$format")){ + return array((_DIR_IMG . $chemin), $nom, $format); } } } - function decrire_logo($racine) { if ($img = cherche_image_nommee($racine)) { diff --git a/ecrire/inc_majbase.php3 b/ecrire/inc_majbase.php3 index 9fd55836f5c636bb6a00eb4b07871944ea294979..219893d2c36f0d6d86046ac146962407f2c70fab 100644 --- a/ecrire/inc_majbase.php3 +++ b/ecrire/inc_majbase.php3 @@ -368,7 +368,6 @@ function maj_base() { $num_img = $match[1]; $fichier = _DIR_IMG . $fichier; $taille = @filesize($fichier); - $fichier = substr('../', '', $fichier); $id_document = spip_abstract_insert("spip_documents", "(titre, id_type, fichier, mode, largeur, hauteur, taille)", "('image $largeur x $hauteur', $id_type, '$fichier', 'vignette', '$largeur', '$hauteur', '$taille')"); diff --git a/ecrire/inc_presentation.php3 b/ecrire/inc_presentation.php3 index 7cde0c0c986b1b39dec1795d6afe1c9f15b2a7af..bb355410c2b42594e303f0e553cf72cf20dd9fc0 100644 --- a/ecrire/inc_presentation.php3 +++ b/ecrire/inc_presentation.php3 @@ -2314,7 +2314,7 @@ function init_body($rubrique = "asuivre", $sous_rubrique = "asuivre") { if ($spip_ecran == "large") $largeur = 974; else $largeur = 750; - if (strlen($adresse_site)<10) $adresse_site="../"; + if (strlen($adresse_site)<10) _DIR_RACINE; $link = new Link; echo "\n<map name='map_layout'>"; diff --git a/ecrire/inc_spip_action_tourner.php b/ecrire/inc_spip_action_tourner.php index 5ff5909f1debf82277c94e04d0dbb845beb4e443..7bd0ae1e7c313f133d91bc5127688228b792374a 100644 --- a/ecrire/inc_spip_action_tourner.php +++ b/ecrire/inc_spip_action_tourner.php @@ -203,7 +203,7 @@ function inserer_vignette_base($image, $vignette) { else if ($type == "1") $format = 3; else return; - $vignette = str_replace('../', '', $vignette); + $vignette = str_replace(_DIR_RACINE, '', $vignette); spip_log("creation vignette($image) -> $vignette"); diff --git a/ecrire/inc_spip_style.php b/ecrire/inc_spip_style.php index 4532ed0765bd61a0cffc4d5a423add5af07efc28..23756de33b68d2d6b84cd2f29d7da9df32aaf421 100644 --- a/ecrire/inc_spip_style.php +++ b/ecrire/inc_spip_style.php @@ -118,7 +118,7 @@ select.fondl { .format_png { - behavior: url("<?php echo _DIR_PREFIX1; ?>win_png.htc"); + behavior: url("<?php echo _DIR_RACINE; ?>win_png.htc"); } @@ -272,7 +272,7 @@ a.icone26:hover { } a.icone26 img { vertical-align: middle; - behavior: url("<?php echo _DIR_PREFIX1; ?>win_png.htc"); + behavior: url("<?php echo _DIR_RACINE; ?>win_png.htc"); background-color: <?php echo $couleur_foncee; ?>; } a.icone26:hover img { @@ -378,7 +378,7 @@ a.icone26:hover img { .cellule48 a img { - behavior: url("<?php echo _DIR_PREFIX1; ?>win_png.htc"); + behavior: url("<?php echo _DIR_RACINE; ?>win_png.htc"); display: inline; margin: 4px; padding: 0px; diff --git a/ecrire/inc_urls.php3 b/ecrire/inc_urls.php3 index a8a5f163aff7e01aaa9670e19def4d6acc769fd9..f52be37de3ba9bb80b899d57c818799b572e8491 100644 --- a/ecrire/inc_urls.php3 +++ b/ecrire/inc_urls.php3 @@ -66,7 +66,7 @@ function generer_url_document($id_document) { return $row['fichier']; } else { if (($GLOBALS['meta']["creer_htaccess"]) != 'oui') - return '../' . ($row['fichier']); + return _DIR_RACINE . ($row['fichier']); else return generer_url_public('spip_action.php',"action=autoriser&arg=$id_document"); } } diff --git a/ecrire/inc_utils.php b/ecrire/inc_utils.php index 3007a9cd06daeb640dac646a3a2171e1713e2def..84c912c34795193cadbf6f3c813d0c2b98b1a9b2 100644 --- a/ecrire/inc_utils.php +++ b/ecrire/inc_utils.php @@ -519,13 +519,10 @@ function find_in_path ($filename, $path='AUTO') { $path = $GLOBALS['dossier_squelettes'].'/:'.$path; } - - $racine = (_DIR_RESTREINT ? '' : '../'); - // Parcourir le chemin foreach (split(':', $path) as $dir) { // Depuis l'espace prive, remonter d'un cran, sauf pour les absolus - $racine = ($dir[0] <> '/' && !_DIR_RESTREINT) ? '../' : ''; + $racine = ($dir[0]=='/') ? '' : _DIR_RACINE; if ($dir[0] == '.') $dir = ""; else if ($dir && $dir[strlen($dir)-1] <> '/') $dir .= "/"; $f = "$racine$dir$filename"; @@ -582,7 +579,7 @@ function generer_url_ecrire($script, $args="", $retour="", $retour_args="") { function generer_url_public($script, $args="", $retour="", $retour_args="") { if (!($site = $GLOBALS['meta']["adresse_site"])) - $site = '../'; + $site = _DIR_RACINE; $site .= (($site[strlen($site)-1] <> '/') ?'/':'') . $script; return generer_url_ecrire($site, $args, $retour, $retour_args); } diff --git a/ecrire/inc_version.php3 b/ecrire/inc_version.php3 index 29d909e72a02259d1bf35d762960df01776a7007..8426b46d57b57c385cf2fce753f7049ddc48f4b7 100644 --- a/ecrire/inc_version.php3 +++ b/ecrire/inc_version.php3 @@ -233,18 +233,13 @@ define_once('_LOGO_MAX_SIZE', 0); # poids en ko define_once('_LOGO_MAX_WIDTH', 0); # largeur en pixels define_once('_LOGO_MAX_HEIGHT', 0); # hauteur en pixels - +// les repertoires annexes define_once('_DIR_INCLUDE', _DIR_RESTREINT); -define_once('_DIR_PREFIX1', (_DIR_RESTREINT ? "" : "../")); -define_once('_DIR_PREFIX2', _DIR_RESTREINT); - -// les repertoires des logos, des documents joints, du CACHE et des sessions -define_once('_DIR_IMG', _DIR_PREFIX1 ."IMG/"); -define_once('_DIR_DOC', _DIR_PREFIX1 ."IMG/"); -define_once('_DIR_CACHE', _DIR_PREFIX1 ."CACHE/"); - -define_once('_DIR_SESSIONS', _DIR_PREFIX2 . "data/"); -define_once('_DIR_TRANSFERT', _DIR_PREFIX2 . "upload/"); +define_once('_DIR_IMG', _DIR_RACINE ."IMG/"); +define_once('_DIR_DOC', _DIR_RACINE ."IMG/"); +define_once('_DIR_CACHE', _DIR_RACINE ."CACHE/"); +define_once('_DIR_SESSIONS', _DIR_RESTREINT . "data/"); +define_once('_DIR_TRANSFERT', _DIR_RESTREINT . "upload/"); // les fichiers qu'on y met, entre autres,