Update of /home/spip-cvs/spip/ecrire
In directory alan:/tmp/cvs-serv11612/ecrire
Modified Files:
articles.php3 auteur_infos.php3 breves.php3 forum_envoi.php3
import_all.php3 inc.php3 inc_acces.php3 inc_auth.php3
inc_config.php3 inc_lang.php3 inc_session.php3
inc_version.php3 install.php3 mots_edit.php3 mots_tous.php3
sites.php3
Log Message:
redirection & taches de fond
Index: inc_lang.php3
RCS file: /home/spip-cvs/spip/ecrire/inc_lang.php3,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -d -r1.123 -r1.124
--- inc_lang.php3 10 Oct 2004 07:02:34 -0000 1.123
+++ inc_lang.php3 22 Oct 2004 21:48:05 -0000 1.124
@@ -510,8 +510,7 @@
$destination->addvar('lang', $lang_demandee);
if ($GLOBALS['recalcul'] == 'oui')
$destination->addvar('recalcul', 'oui');
- @header("Location: ".$destination->getUrl());
- exit;
+ calculer_action_auteur($destination->getUrl());
}
// Subtilite : si la langue demandee par cookie est la bonne
Index: inc_auth.php3
RCS file: /home/spip-cvs/spip/ecrire/inc_auth.php3,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- inc_auth.php3 22 Jul 2004 09:20:09 -0000 1.59
+++ inc_auth.php3 22 Oct 2004 21:48:05 -0000 1.60
@@ -107,15 +107,13 @@
$clean_link->delVar('bonjour');
$url = str_replace('/./', '/', 'ecrire/'.$clean_link->getUrl());
$link->addVar('var_url', $url);
- @header("Location: ".$link->getUrl());
- exit;
+ redirige_par_entete($link->getUrl());
}
// Si pas authentifie, demander login / mdp
if (!$auth_login) {
$url = str_replace('/./', '/', 'ecrire/'.$clean_link->getUrl());
- @header("Location: ../spip_login.php3?var_url=".urlencode($url));
- exit;
+ redirige_par_entete(" ../spip_login.php3?var_url=".urlencode($url));
}
//
Index: inc_session.php3
RCS file: /home/spip-cvs/spip/ecrire/inc_session.php3,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- inc_session.php3 10 Oct 2004 07:02:34 -0000 1.45
+++ inc_session.php3 22 Oct 2004 21:48:05 -0000 1.46
@@ -52,9 +52,8 @@
fputs($f, $texte);
fclose($f);
} else {
- $dir = $GLOBALS['flag_ecrire'] ? '../' : '';
- @header("Location: ${dir}spip_test_dirs.php3");
- exit;
+ redirige_par_entete((_DIR_RESTREINT ? "" : "../") .
+ "spip_test_dirs.php3");
}
}
Index: sites.php3
RCS file: /home/spip-cvs/spip/ecrire/sites.php3,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- sites.php3 4 Oct 2004 21:39:08 -0000 1.38
+++ sites.php3 22 Oct 2004 21:48:05 -0000 1.39
@@ -193,7 +193,7 @@
if ($redirect AND $redirect_ok == 'oui') {
- @header("Location: $redirect");
+ redirige_par_entete($redirect);
}
Index: mots_tous.php3
RCS file: /home/spip-cvs/spip/ecrire/mots_tous.php3,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- mots_tous.php3 26 Jul 2004 21:10:04 -0000 1.25
+++ mots_tous.php3 22 Oct 2004 21:48:05 -0000 1.26
@@ -36,8 +36,7 @@
$nb_sites = $nb_sites[0];
if ($nb_articles + $nb_breves + $nb_sites == 0) {
- header("Location: mots_edit.php3?supp_mot=$id_mot&redirect_ok=oui&redirect=mots_tous.php3");
- exit();
+ redirige_par_entete("mots_edit.php3?supp_mot=$id_mot&redirect_ok=oui&redirect=mots_tous.php3");
} // else traite plus loin
}
}
Index: mots_edit.php3
RCS file: /home/spip-cvs/spip/ecrire/mots_edit.php3,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- mots_edit.php3 16 Sep 2004 19:47:01 -0000 1.38
+++ mots_edit.php3 22 Oct 2004 21:48:05 -0000 1.39
@@ -70,8 +70,7 @@
// redirection ou affichage
//
if ($redirect_ok == 'oui' && $redirect) {
- @header("Location: ".rawurldecode($redirect));
- exit;
+ redirige_par_entete(rawurldecode($redirect));
}
//
Index: install.php3
RCS file: /home/spip-cvs/spip/ecrire/install.php3,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- install.php3 22 Oct 2004 15:09:19 -0000 1.63
+++ install.php3 22 Oct 2004 21:48:05 -0000 1.64
@@ -356,11 +356,12 @@
}
else if ($etape == 'dirs') {
- header("Location: ../spip_test_dirs.php3");
+ redirige_par_entete(" ../spip_test_dirs.php3");
}
else if (!$etape) {
$menu_langues = menu_langues('var_lang_ecrire');
- if (!$menu_langues) header("Location: ../spip_test_dirs.php3");
+ if (!$menu_langues)
+ redirige_par_entete(" ../spip_test_dirs.php3");
else {
install_debut_html();
Index: inc_version.php3
RCS file: /home/spip-cvs/spip/ecrire/inc_version.php3,v
retrieving revision 1.390
retrieving revision 1.391
diff -u -d -r1.390 -r1.391
--- inc_version.php3 22 Oct 2004 18:01:58 -0000 1.390
+++ inc_version.php3 22 Oct 2004 21:48:05 -0000 1.391
@@ -220,14 +220,15 @@
define_once('_DIR_RESTREINT', (!@is_dir('ecrire') ? "" : "ecrire/"));
-// essai d'un SPip multi-site. Expérimental.
+/* bientot
if ($d = ($GLOBALS['HTTP_GET_VARS']['var_install']))
{
$d = substr($d,0,strrpos($d,'/')+1);
define('_DIR_PREFIX1', $d);
define('_DIR_PREFIX2', $d);
- } else {
+ } else */
+{
define('_DIR_PREFIX1', (_DIR_RESTREINT ? "" : "../"));
define('_DIR_PREFIX2', _DIR_RESTREINT);
}
@@ -1138,6 +1139,30 @@
}
}
+// Gestion des taches de fond ? toutes les 5 secondes
+// (on mettra 30 s quand on aura prevu la preemption par une image-cron)
+function taches_de_fond() {
+
+ verifier_htaccess(_DIR_SESSIONS);
+ if (!@file_exists(_FILE_CRON_LOCK)
+ OR (time() - @filemtime(_FILE_CRON_LOCK) > 5)) {
+
+ // Si MySQL est out, laisser souffler
+ if (!@file_exists(_FILE_MYSQL_OUT)
+ OR (time() - @filemtime(_FILE_MYSQL_OUT) > 300)) {
+ include_ecrire('inc_cron.php3');
+ spip_cron();
+ }
+ }
+}
+
+function redirige_par_entete($url)
+{
+ header("Location: $url");
+ taches_de_fond();
+ exit;
+}
+
// Envoi des en-tetes
function debut_entete($title)
Index: import_all.php3
RCS file: /home/spip-cvs/spip/ecrire/import_all.php3,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- import_all.php3 10 Oct 2004 07:02:34 -0000 1.12
+++ import_all.php3 22 Oct 2004 21:48:05 -0000 1.13
@@ -49,8 +49,5 @@
fin_admin($action);
-@header("Location: index.php3");
-
-exit;
-
+redirige_par_entete("index.php3");
?>
Index: forum_envoi.php3
RCS file: /home/spip-cvs/spip/ecrire/forum_envoi.php3,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- forum_envoi.php3 15 Oct 2004 19:05:59 -0000 1.34
+++ forum_envoi.php3 22 Oct 2004 21:48:05 -0000 1.35
@@ -24,8 +24,7 @@
$result = spip_query($query);
}
- @header("Location: $adresse_retour");
- die();
+ redirige_par_entete($adresse_retour);
}
if ($id_message) debut_page(_T('titre_page_forum_envoi'), "asuivre", "messagerie");
Index: breves.php3
RCS file: /home/spip-cvs/spip/ecrire/breves.php3,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- breves.php3 14 Oct 2004 22:59:50 -0000 1.16
+++ breves.php3 22 Oct 2004 21:48:05 -0000 1.17
@@ -6,8 +6,7 @@
$query="UPDATE spip_breves SET date_heure=NOW(), statut=\"$statut\" WHERE id_breve=$id_breve";
$result=spip_query($query);
calculer_rubriques();
-
- @header("Location:breves.php3");
+ redirige_par_entete("breves.php3");
}
Index: auteur_infos.php3
RCS file: /home/spip-cvs/spip/ecrire/auteur_infos.php3,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- auteur_infos.php3 1 Oct 2004 07:20:35 -0000 1.61
+++ auteur_infos.php3 22 Oct 2004 21:48:05 -0000 1.62
@@ -217,14 +217,7 @@
// Redirection
if (!$echec AND $redirect_ok == "oui") {
- if ($redirect) {
- @Header("Location: ".rawurldecode($redirect));
- exit;
- }
- else {
- @Header("Location:auteurs_edit.php3?id_auteur=$id_auteur");
- exit;
- }
+ redirige_par_entete($redirect ? rawurldecode($redirect) : "auteurs_edit.php3?id_auteur=$id_auteur");
}
Index: articles.php3
RCS file: /home/spip-cvs/spip/ecrire/articles.php3,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -d -r1.198 -r1.199
--- articles.php3 15 Oct 2004 23:08:48 -0000 1.198
+++ articles.php3 22 Oct 2004 21:48:05 -0000 1.199
@@ -35,8 +35,7 @@
spip_query("DELETE FROM spip_auteurs_articles WHERE id_article = $id_article");
spip_query("INSERT INTO spip_auteurs_articles (id_auteur, id_article) VALUES ($connect_id_auteur, $id_article)");
} else {
- @header("Location: ./index.php3");
- exit;
+ redirige_par_entete("./index.php3");
}
}
Index: inc.php3
RCS file: /home/spip-cvs/spip/ecrire/inc.php3,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- inc.php3 19 Oct 2004 19:56:02 -0000 1.87
+++ inc.php3 22 Oct 2004 21:48:05 -0000 1.88
@@ -7,8 +7,7 @@
(@file_exists("inc_connect.php3") ? "inc_connect.php3" : ''));
if (!_FILE_CONNECT) {
- header("Location: install.php3");
- exit;
+ redirige_par_entete("install.php3");
}
if (!defined('_ECRIRE_INC_VERSION')) { include ("inc_version.php3"); }
Index: inc_config.php3
RCS file: /home/spip-cvs/spip/ecrire/inc_config.php3,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- inc_config.php3 18 Oct 2004 12:22:27 -0000 1.55
+++ inc_config.php3 22 Oct 2004 21:48:05 -0000 1.56
@@ -286,8 +286,10 @@
}
if ($purger_skel) {
- $hash = calculer_action_auteur("purger_squelettes");
- @header ("Location:../spip_cache.php3?purger_squelettes=oui&id_auteur=$connect_id_auteur&hash=$hash&redirect=".urlencode($clean_link->getUrl()));
+ redirige_par_entete("../spip_cache.php3?purger_squelettes=oui&id_auteur=$connect_id_auteur&hash=" .
+ calculer_action_auteur("purger_squelettes") .
+ "&redirect=".
+ urlencode($clean_link->getUrl()));
}
}
Index: inc_acces.php3
RCS file: /home/spip-cvs/spip/ecrire/inc_acces.php3,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- inc_acces.php3 19 Oct 2004 10:20:37 -0000 1.28
+++ inc_acces.php3 22 Oct 2004 21:48:05 -0000 1.29
@@ -10,7 +10,8 @@
$seed = (double) (microtime() + 1) * time();
mt_srand($seed);
srand($seed);
-
+ $s = '';
+ $pass = '';
for ($i = 0; $i < $longueur; $i++) {
if (!$s) {
$s = mt_rand();
@@ -106,8 +107,7 @@
ecrire_logins($fichier, $logins);
fclose($fichier);
} else {
- @header ("Location: ../spip_test_dirs.php3");
- exit;
+ redirige_par_entete("../spip_test_dirs.php3");
}
$query = "SELECT login, htpass FROM spip_auteurs WHERE statut = '0minirezo'";