diff --git a/ecrire/inc/agenda.php b/ecrire/inc/agenda.php index 738da659402a2c7495d2d2b350c44107c5e313a7..3c47cccd8df62ee6386b532f1ddc39af08b6631f 100644 --- a/ecrire/inc/agenda.php +++ b/ecrire/inc/agenda.php @@ -84,7 +84,7 @@ function calendrier_href($script, $annee, $mois, $jour, $type, $fin, $ancre, $im $moi = preg_match("/exec=" . _request('exec') .'$/', $script); if ($img) $clic = http_img_pack($img, ($alt ? $alt : $titre), $c); // pas d'Ajax pour l'espace public pour le moment ou si indispo - if (_DIR_RESTREINT || !$moi || (_SPIP_AJAX !== 1 )) + if (!test_espace_prive() || !$moi || (_SPIP_AJAX !== 1 )) return http_href("$h$a", $clic, $titre, $style, $class, $evt); else { @@ -237,7 +237,7 @@ function http_calendrier_mois($annee, $mois, $jour, $echelle, $partie_cal, $scri $evt . '</table>' . http_calendrier_sans_date($annee, $mois, $evenements) . - (_DIR_RESTREINT ? "" : http_calendrier_aide_mess()); + (!test_espace_prive() ? "" : http_calendrier_aide_mess()); } // si la periore a plus de 31 jours, c'est du genre trimestre, semestre etc @@ -345,7 +345,7 @@ function http_calendrier_mois_sept($annee, $mois, $premier_jour, $dernier_jour,$ $ligne .= "\n\t\t<td style='height: 100px;' class='calendrier-td $fond bordure_claire_basse bordure_claire_$spip_lang_right" . ($ligne ? "" : " bordure_claire_$spip_lang_left") . "'>" . - (!_DIR_RESTREINT ? + (test_espace_prive() ? (calendrier_href($script,$annee_en_cours, $mois_en_cours, $jour, "jour", $finurl, $ancre, '', $jour, 'calendrier-helvetica16', '', $jour, "color: $couleur_texte") . http_calendrier_ics_message($annee_en_cours, $mois_en_cours, $jour, false)): http_calendrier_mois_clics($annee_en_cours, $mois_en_cours, $jour, $script, $finurl, $ancre)) . @@ -416,7 +416,7 @@ function http_calendrier_semaine($annee, $mois, $jour, $echelle, $partie_cal, $s $evt . "</table>" . $sd . - (_DIR_RESTREINT ? "" : http_calendrier_aide_mess()); + (!test_espace_prive() ? "" : http_calendrier_aide_mess()); } // http://doc.spip.org/@http_calendrier_semaine_navigation @@ -488,7 +488,7 @@ function http_calendrier_semaine_sept($annee, $mois, $jour, $echelle, $partie_ca for ($j=$jour; $j<$jour+7;$j++){ $v = mktime(0,0,0,$mois, $j, $annee); $total .= "\n<td class='calendrier-td'>" . - http_calendrier_ics($annee,$mois,$j, $echelle, $partie_cal, $largeur, $evt, $style, $class . ( (date("w",$v)==0 && !_DIR_RESTREINT) ? + http_calendrier_ics($annee,$mois,$j, $echelle, $partie_cal, $largeur, $evt, $style, $class . ( (date("w",$v)==0 && test_espace_prive()) ? " toile_claire" : ((date("Ymd", $v) == $today) ? " toile_blanche" : @@ -531,18 +531,18 @@ function http_calendrier_jour_noms($annee, $mois, $jour, $echelle, $partie_cal, global $spip_ecran; $finurl = "&echelle=$echelle&partie_cal=$partie_cal"; - $gauche = (_DIR_RESTREINT || ($spip_ecran != "large")); + $gauche = (!test_espace_prive() || ($spip_ecran != "large")); return "\n<tr><td class='calendrier-td-gauche'>" . ($gauche ? '' : http_calendrier_ics_titre($annee,$mois,$jour-1,$script, $finurl, $ancre)) . "</td><td colspan='5' class='calendrier-td-centre'>" . - (_DIR_RESTREINT ? '' : + (!test_espace_prive() ? '' : ("\n\t<div class='calendrier-titre'>" . http_calendrier_ics_message($annee, $mois, $jour, true) . '</div>')) . "</td><td class='calendrier-td-droit calendrier-arial10'> " . - (_DIR_RESTREINT ? '' : http_calendrier_ics_titre($annee,$mois,$jour+1,$script, $finurl, $ancre)) . + (!test_espace_prive() ? '' : http_calendrier_ics_titre($annee,$mois,$jour+1,$script, $finurl, $ancre)) . "</td></tr>"; } @@ -550,7 +550,7 @@ function http_calendrier_jour_noms($annee, $mois, $jour, $echelle, $partie_cal, function http_calendrier_jour_sept($annee, $mois, $jour, $echelle, $partie_cal, $script, $ancre, $evt){ global $spip_ecran; - $gauche = (_DIR_RESTREINT || ($spip_ecran != "large")); + $gauche = (!test_espace_prive() || ($spip_ecran != "large")); if ($partie_cal!= DEFAUT_PARTIE_R) return "<tr class='calendrier-verdana10'>" . @@ -564,7 +564,7 @@ function http_calendrier_jour_sept($annee, $mois, $jour, $echelle, $partie_cal, # afficher en reduction le tableau du jour suivant "\n<td class='calendrier-td-droit'>" . - (_DIR_RESTREINT ? '' : + (!test_espace_prive() ? '' : http_calendrier_ics($annee, $mois, $jour+1, $echelle, $partie_cal, 0, $evt)) . '</td>' . "\n</tr>"; @@ -589,7 +589,7 @@ function http_calendrier_jour_sept($annee, $mois, $jour, $echelle, $partie_cal, '</td>' . # afficher en reduction le tableau du jour suivant "\n<td class='calendrier-td-droit'>" . - (_DIR_RESTREINT ? '' : + (!test_espace_prive() ? '' : "<table width='100%'>". http_calendrier_mois_sept($annee, $mois, $jour+1, $jour+1,$evenements, $script, '', $ancre) ."</table>" @@ -1011,7 +1011,7 @@ function http_calendrier_navigation($annee, $mois, $jour, $echelle, $partie_cal, . $args_suiv . " " . $nom - . (_DIR_RESTREINT ? '' : aide("messcalen")) + . (!test_espace_prive() ? '' : aide("messcalen")) . "</div></div>" . http_calendrier_invisible($annee, $mois, $jour, $script, "&echelle=$echelle&partie_cal=$partie_cal", $ancre, $id); } @@ -1113,7 +1113,7 @@ function http_calendrier_agenda_rv ($annee, $mois, $les_rv, $fclic, $jour_semaine = date("w", mktime(1,1,1,$mois,1,$annee)); if ($jour_semaine==0) $jour_semaine=7; for ($i=1;$i<$jour_semaine;$i++) $ligne .= "\n\t<td></td>"; - $classe0 = !_DIR_RESTREINT ? "" : " bordure_foncee"; + $classe0 = test_espace_prive() ? "" : " bordure_foncee"; for ($j=1; (checkdate($mois,$j,$annee)); $j++) { $toile = ""; $nom = mktime(1,1,1,$mois,$j,$annee); @@ -1134,7 +1134,7 @@ function http_calendrier_agenda_rv ($annee, $mois, $les_rv, $fclic, $couleur = "black"; } else { if ($j == $jour_today AND $cemois) { - $toile = !_DIR_RESTREINT ? 'toile_foncee' : 'toile_gris_sombre'; + $toile = test_espace_prive() ? 'toile_foncee' : 'toile_gris_sombre'; $couleur = "white"; } else { if ($jour_semaine == 7) { diff --git a/ecrire/inc/auth.php b/ecrire/inc/auth.php index aa3675f6a92b8652d92befaf790e32fdd7d27a8b..db3124fde6741fb4eaab30fd35ba20525f6f8fdc 100644 --- a/ecrire/inc/auth.php +++ b/ecrire/inc/auth.php @@ -170,6 +170,7 @@ function inc_auth_dist() { // A noter : le premier appel a autoriser() a le bon gout // d'initialiser $GLOBALS['auteur_session']['restreint'], // qui ne figure pas dans le fichier de session + include_spip('inc/autoriser'); if (!autoriser('ecrire')) return $connect_statut; diff --git a/ecrire/inc/barre.php b/ecrire/inc/barre.php index 8a6dd73a9f59cf5b8ebe3f49ae91fa0cd8411128..f04dddb813615c46050f08a65e45267c91395e75 100644 --- a/ecrire/inc/barre.php +++ b/ecrire/inc/barre.php @@ -23,7 +23,7 @@ function bouton_barre_racc($action, $img, $help, $champhelp) { ."\" tabindex='1000'\ntitle=\"" . $a ."\"" - .(!_DIR_RESTREINT ? '' : "\nonmouseover=\"helpline('" + .(test_espace_prive() ? '' : "\nonmouseover=\"helpline('" .addslashes(str_replace(''',"'",$a)) ."',$champhelp)\"\nonmouseout=\"helpline('" .attribut_html(_T('barre_aide')) @@ -105,7 +105,7 @@ function afficher_barre($champ, $forum=false, $lang='') { $ret .= "</td>"; $col++; - if (!_DIR_RESTREINT) { + if (test_espace_prive()) { $ret .= "\n<td style='text-align:$spip_lang_right;' valign='middle'>"; $col++; // $ret .= " "; @@ -116,7 +116,7 @@ function afficher_barre($champ, $forum=false, $lang='') { $ret .= "</tr>"; // Sur les forums publics, petite barre d'aide en survol des icones - if (_DIR_RESTREINT) + if (!test_espace_prive()) $ret .= "\n<tr>\n<td colspan='$col'><input disabled='disabled' type='text' class='barre' id='barre_$num_barre' size='45' maxlength='100'\nvalue=\"".attribut_html(_T('barre_aide'))."\" /></td></tr>"; $ret .= "</table>"; diff --git a/ecrire/inc/documents.php b/ecrire/inc/documents.php index 375c8e3e0a6bac086327cf3471e2f9131b892cae..33c739152027a0914aa49a965e8feef813d736f4 100644 --- a/ecrire/inc/documents.php +++ b/ecrire/inc/documents.php @@ -173,7 +173,7 @@ function afficher_documents_colonne($id, $type="article",$script=NULL) { // seuls cas connus : article, breve ou rubrique if ($script==NULL){ $script = $type.'s_edit'; - if (_DIR_RESTREINT) + if (!test_espace_prive()) $script = parametre_url(self(),"show_docs",''); } $id_document_actif = _request('show_docs'); @@ -234,7 +234,7 @@ function afficher_documents_colonne($id, $type="article",$script=NULL) { $ret .= afficher_case_document($doc, $id, $script, $type, $deplier); } $ret .= "</div>"; - if (!_DIR_RESTREINT){ + if (test_espace_prive()){ $ret .= "<script src='"._DIR_JAVASCRIPT."async_upload.js' type='text/javascript'></script>\n"; $ret .= <<<EOF <script type='text/javascript'> diff --git a/ecrire/inc/editer_article.php b/ecrire/inc/editer_article.php index a3c83a84e1a1f3352044464fc7e5a176d1a48e85..e9cba3cd49239a10390e2ef50efa27a06054e832 100644 --- a/ecrire/inc/editer_article.php +++ b/ecrire/inc/editer_article.php @@ -102,7 +102,10 @@ function editer_article_texte($texte, $config, $aider) . "<textarea id='text_area' name='texte'$att_text>" . $texte . "</textarea>\n" - . (_DIR_RESTREINT ? '' : "<script type='text/javascript'><!--\njQuery(hauteurTextarea);\n//--></script>\n"); + . (test_espace_prive() + ? "<script type='text/javascript'><!--\njQuery(hauteurTextarea);\n//--></script>\n" + : '' + ); } // http://doc.spip.org/@editer_article_titre diff --git a/ecrire/inc/filtres_images.php b/ecrire/inc/filtres_images.php index c67d8a7cfa0342d091db0b233fc1ba140f7e3b99..dd4300ccf709d28dc6cbde907b4275ce4b6ecc8c 100644 --- a/ecrire/inc/filtres_images.php +++ b/ecrire/inc/filtres_images.php @@ -742,7 +742,7 @@ function process_image_reduire($fonction,$img,$taille,$taille_y,$force,$cherche_ // de l'image, de facon a tromper le cache du navigateur // quand on fait supprimer/reuploader un logo // (pas de filemtime si SAFE MODE) - $date = _DIR_RESTREINT ? '' : ('?date='.$date); + $date = test_espace_prive() ? ('?date='.$date) : ''; return image_ecrire_tag($image,array('src'=>"$logo$date",'width'=>$destWidth,'height'=>$destHeight)); } else diff --git a/ecrire/inc/joindre.php b/ecrire/inc/joindre.php index 68fb504792c5688daba9054c2420bfef464056e4..c68bfc513b15d11bcaee4a340dc3a1374c0a7ad8 100644 --- a/ecrire/inc/joindre.php +++ b/ecrire/inc/joindre.php @@ -26,7 +26,9 @@ function inc_joindre_dist($script, $args, $id=0, $intitule='', $mode='', $type=' $distant = ($mode == 'document' AND $type); $dir_ftp = ''; - if (!_DIR_RESTREINT AND !$vignette_de_doc AND $GLOBALS['flag_upload']) { + if (test_espace_prive() + AND !$vignette_de_doc + AND $GLOBALS['flag_upload']) { if($dir = determine_upload()) { // quels sont les docs accessibles en ftp ? $l = texte_upload_manuel($dir, '', $mode); @@ -84,7 +86,7 @@ function inc_joindre_dist($script, $args, $id=0, $intitule='', $mode='', $type=' return generer_action_auteur('joindre', (intval($id) .'/' .intval($id_document) . "/$mode/$type"), - (_DIR_RESTREINT)?$script:generer_url_ecrire($script, $args, true), + (!test_espace_prive())?$script:generer_url_ecrire($script, $args, true), "$iframe$debut$res$dir_ftp$distant$fin", " method='post' enctype='multipart/form-data' class='form_upload'"); } diff --git a/ecrire/inc/legender.php b/ecrire/inc/legender.php index 608f4c4294e4597ec21b7b5b24d1f04863cac06f..caf2bead6d0edff04cc8dca3e852c41cd2a04218 100644 --- a/ecrire/inc/legender.php +++ b/ecrire/inc/legender.php @@ -103,7 +103,7 @@ function inc_legender_dist($id_document, $document, $script, $type, $id, $ancre, . ($flag == 'ajax' ? ';display:block' : "") . "'"; - if (!_DIR_RESTREINT) + if (test_espace_prive()) $corps = ajax_action_post("legender", $id_document, $script, "show_docs=$id_document&id_$type=$id#legender-$id_document", $corps, _T('bouton_enregistrer'), $att_bouton, $att_span, "&id_document=$id_document&id=$id&type=$type&ancre=$ancre") . "<br class='nettoyeur' />"; else { @@ -132,7 +132,7 @@ function inc_legender_dist($id_document, $document, $script, $type, $id, $ancre, $action = redirige_action_auteur('documenter', "$s$id/$type/$id_document", $script, "id_$type=$id&type=$type&s=$s#$ancre"); } else { - if (!_DIR_RESTREINT) + if (test_espace_prive()) $action = ajax_action_auteur('documenter', "$s$id/$type/$id_document", $script, "id_$type=$id&type=$type&s=$s#$ancre", array($texte)); else{ $redirect = str_replace('&','&',$script); diff --git a/ecrire/inc/minipres.php b/ecrire/inc/minipres.php index b4f57ac3eda0ab5073b28c0cc68588f4802ac32f..c559bb7598badb24026ca0a1620ed4f0d606ae6c 100644 --- a/ecrire/inc/minipres.php +++ b/ecrire/inc/minipres.php @@ -64,11 +64,17 @@ function minipres($titre='', $corps="", $onload='') { if (!$titre) { http_status(403); - $titre = _request(_DIR_RESTREINT ? 'action' : 'exec'); + if (!$titre = _request('action') + AND !$titre = _request('exec') + AND !$titre = _request('page')) + $titre = '?'; + + $titre = htmlspecialchars($titre); + $titre = ($titre == 'install') ? _T('avis_espace_interdit') : $titre . ' : '. _T('info_acces_interdit'); - $corps = generer_form_ecrire('accueil', '','',_T('ecrire:accueil_site')); + $corps = generer_form_ecrire('accueil', '','',_T('public:accueil_site')); spip_log($GLOBALS['auteur_session']['nom'] . " $titre " . $_SERVER['REQUEST_URI']); } diff --git a/ecrire/inc_version.php b/ecrire/inc_version.php index 439fc0e82c2c3af7595a58611199bc4b2e3793a9..1167d381fecdf048174b83928faa460701be651e 100644 --- a/ecrire/inc_version.php +++ b/ecrire/inc_version.php @@ -396,7 +396,7 @@ if (@is_readable(_DIR_TMP."charger_plugins_options.php")){ define('_OUTILS_DEVELOPPEURS',true); // charger systematiquement inc/autoriser dans l'espace restreint -if (!_DIR_RESTREINT) +if (test_espace_prive()) include_spip('inc/autoriser'); // // Installer Spip si pas installe... sauf si justement on est en train @@ -408,7 +408,7 @@ OR _request('action') == 'converser' OR _request('action') == 'test_dirs')) { // Si on peut installer, on lance illico - if (!_DIR_RESTREINT) { + if (test_espace_prive()) { include_spip('inc/headers'); redirige_par_entete(generer_url_ecrire("install")); } else { @@ -428,7 +428,10 @@ OR _request('action') == 'test_dirs')) { // // si un buffer est deja ouvert, stop -if (_DIR_RESTREINT AND _request('action')===NULL AND $flag_ob AND strlen(ob_get_contents())==0 AND !headers_sent()) { +if (!test_espace_prive() +AND $flag_ob +AND strlen(ob_get_contents())==0 +AND !headers_sent()) { @header("Vary: Cookie, Accept-Encoding"); if ( diff --git a/ecrire/public.php b/ecrire/public.php index bd2a66ab396c2636fd8ae6830bfda98f34412356..c35a3116f530333e6f05b9d6fa965cbdbf7fd485 100644 --- a/ecrire/public.php +++ b/ecrire/public.php @@ -47,7 +47,7 @@ if (defined('_INC_PUBLIC')) { include_once _DIR_RESTREINT.'inc_version.php'; } else - die('stupid death...'); + die('inc_version absent ?'); // Est-ce une action ? @@ -64,6 +64,15 @@ if (defined('_INC_PUBLIC')) { exit; } +/* // Code experimental pour faire marcher ecrire/ a partir de spip.php + // pour tester decommenter et indiquer dans mes_options : + // define('_SPIP_ECRIRE_SCRIPT', '../spip.php'); + else if ($exec = _request('exec')) { + include _DIR_RESTREINT.'index.php'; + exit; + } +*/ + // cas normal, $fond defini dans le fichier d'appel // note : securise anti-injection par inc/utils.php else if (isset($fond)) { } @@ -73,7 +82,6 @@ if (defined('_INC_PUBLIC')) { $fond = $_GET['page']; // Securite if (strstr($fond, '/')) { - $_GET['action'] = $_GET['page']; // pour voir le nom include_spip('inc/minipres'); echo minipres(); exit; diff --git a/ecrire/public/cacher.php b/ecrire/public/cacher.php index fa85ee3c44fa6b585bf13370e2266018f156f40a..0a56724ab292a0716d72e22e5e9b6c053575058c 100644 --- a/ecrire/public/cacher.php +++ b/ecrire/public/cacher.php @@ -175,7 +175,7 @@ function public_cacher_dist($contexte, &$use_cache, &$chemin_cache, &$page, &$la // Mode auteur authentifie appelant de ecrire/ : il ne faut rien lire du cache // et n'y ecrire que la compilation des squelettes (pas les pages produites) // car les references aux repertoires ne sont pas relatifs a l'espace public - OR !_DIR_RESTREINT) { + OR test_espace_prive()) { $use_cache = -1; $lastmodified = 0; $chemin_cache = "";