From 720da3a25a93a194ee98720407fbc28de47158ef Mon Sep 17 00:00:00 2001 From: Cerdic <cedric@yterium.com> Date: Wed, 9 Aug 2006 22:21:44 +0000 Subject: [PATCH] un script pour appeler des squelettes depuis l'espace prive : ecrire/prive.php?page=xxxx l'url est generee avec generer_url_prive(script,args) --- .gitattributes | 1 + ecrire/inc/utils.php | 16 ++++++++++++++++ ecrire/prive.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 ecrire/prive.php diff --git a/.gitattributes b/.gitattributes index 36d18bc87b..32ecd53c2e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -444,6 +444,7 @@ ecrire/lang/spip_br.php -text ecrire/lang/spip_bs.php -text ecrire/lang/spip_cs.php -text ecrire/lang/spip_ru.php -text +ecrire/prive.php -text ecrire/rien.gif -text ecrire/safehtml/classes/HTMLSax3.php -text ecrire/safehtml/classes/HTMLSax3/Decorators.php -text diff --git a/ecrire/inc/utils.php b/ecrire/inc/utils.php index 69b11d115a..acf0f2482b 100644 --- a/ecrire/inc/utils.php +++ b/ecrire/inc/utils.php @@ -777,6 +777,22 @@ function generer_url_public($script, $args="", $no_entities=false) { return url_de_base() . $action; } +function generer_url_prive($script, $args="", $no_entities=false) { + + $action = 'prive.php'; + if ($script) + $action = parametre_url($action, 'page', $script, '&'); + + if ($args) + $action .= + (strpos($action, '?') !== false ? '&' : '?') . $args; + + if (!$no_entities) + $action = quote_amp($action); + + return url_de_base() . _DIR_RESTREINT_ABS . $action; +} + function generer_url_action($script, $args="", $no_entities=false) { return generer_url_public('', diff --git a/ecrire/prive.php b/ecrire/prive.php new file mode 100644 index 0000000000..4ce226ffe4 --- /dev/null +++ b/ecrire/prive.php @@ -0,0 +1,42 @@ +<?php + +/***************************************************************************\ + * SPIP, Systeme de publication pour l'internet * + * * + * Copyright (c) 2001-2006 * + * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * + * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + +# ou est l'espace prive : on y est deja ! +include_once 'inc_version.php'; + +include_spip('inc/cookie'); + +// +// Determiner l'action demandee +// + +$exec = _request('exec'); +if (!preg_match(',^[a-z][0-9a-z_]*$,i', $exec)) $exec = "accueil"; + +// +// Authentification, redefinissable +// + +if (autoriser_sans_cookie($exec)) { + if (!isset($reinstall)) $reinstall = 'non'; + $var_auth = true; +} else { + $var_auth = charger_fonction('auth', 'inc'); + $var_auth = $var_auth(); + if ($var_auth) redirige_par_entete($var_auth); +} + + +# au travail... +include_once 'public.php'; + +?> \ No newline at end of file -- GitLab