From eb0799839697020e9c4f4625dcd63d15d8d38bb5 Mon Sep 17 00:00:00 2001
From: Matthieu Marcillaud <marcimat@rezo.net>
Date: Sat, 25 Sep 2010 08:23:36 +0000
Subject: [PATCH] =?UTF-8?q?D=C3=A9placement=20des=20d=C3=A9clarations=20de?=
 =?UTF-8?q?=20bases,=20autorisations,=20taches=20p=C3=A9riodiques=20des=20?=
 =?UTF-8?q?disparus,=20boucles=20et=20recherche=20dans=20le=20plugin=20sit?=
 =?UTF-8?q?es.=20(http://zone.spip.org/trac/spip-zone/changeset/41117)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/base/connect_sql.php  |  3 --
 ecrire/base/serial.php       | 62 +-----------------------------------
 ecrire/core.xml              |  2 --
 ecrire/genie/optimiser.php   | 15 ---------
 ecrire/inc/autoriser.php     | 19 -----------
 ecrire/inc/config.php        |  5 ---
 ecrire/inc/rechercher.php    |  3 --
 ecrire/public/boucles.php    | 46 --------------------------
 ecrire/public/interfaces.php | 23 -------------
 9 files changed, 1 insertion(+), 177 deletions(-)

diff --git a/ecrire/base/connect_sql.php b/ecrire/base/connect_sql.php
index ea03261354..ac29a6db20 100644
--- a/ecrire/base/connect_sql.php
+++ b/ecrire/base/connect_sql.php
@@ -249,9 +249,6 @@ function table_objet($type) {
 				'petition' => 'petitions',
 				'rubrique' => 'rubriques',
 				'signature' => 'signatures',
-				'syndic' => 'syndic',
-				'site' => 'syndic', # hum hum
-				'syndic_article' => 'syndic_articles',
 				'type_document' => 'types_documents', # hum
 				'extension' => 'types_documents' # hum
 			));
diff --git a/ecrire/base/serial.php b/ecrire/base/serial.php
index 99cf8594ea..3143a6d4d8 100644
--- a/ecrire/base/serial.php
+++ b/ecrire/base/serial.php
@@ -195,62 +195,6 @@ $spip_types_documents_key = array(
 		"PRIMARY KEY"	=> "extension",
 		"KEY inclus"	=> "inclus");
 
-$spip_syndic = array(
-		"id_syndic"	=> "bigint(21) NOT NULL",
-		"id_rubrique"	=> "bigint(21) DEFAULT '0' NOT NULL",
-		"id_secteur"	=> "bigint(21) DEFAULT '0' NOT NULL",
-		"nom_site"	=> "text DEFAULT '' NOT NULL",
-		"url_site"	=> "text DEFAULT '' NOT NULL",
-		"url_syndic"	=> "text DEFAULT '' NOT NULL",
-		"descriptif"	=> "text DEFAULT '' NOT NULL",
-#		"url_propre"	=> "VARCHAR(255) DEFAULT '' NOT NULL",
-		"maj"	=> "TIMESTAMP",
-		"syndication"	=> "VARCHAR(3) DEFAULT '' NOT NULL",
-		"statut"	=> "varchar(10) DEFAULT '0' NOT NULL",
-		"date"	=> "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
-		"date_syndic"	=> "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
-		"date_index"	=> "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
-		"moderation"	=> "VARCHAR(3) DEFAULT 'non'",
-		"miroir"	=> "VARCHAR(3) DEFAULT 'non'",
-		"oubli"	=> "VARCHAR(3) DEFAULT 'non'",
-		"resume"	=> "VARCHAR(3) DEFAULT 'oui'"
-);
-
-$spip_syndic_key = array(
-		"PRIMARY KEY"	=> "id_syndic",
-		"KEY id_rubrique"	=> "id_rubrique",
-		"KEY id_secteur"	=> "id_secteur",
-		"KEY statut"	=> "statut, date_syndic",
-#		"KEY url_propre"	=> "url_propre"
-);
-$spip_syndic_join = array(
-		"id_syndic"=>"id_syndic",
-		"id_rubrique"=>"id_rubrique");
-		
-$spip_syndic_articles = array(
-		"id_syndic_article"	=> "bigint(21) NOT NULL",
-		"id_syndic"	=> "bigint(21) DEFAULT '0' NOT NULL",
-		"titre"	=> "text DEFAULT '' NOT NULL",
-		"url"	=> "VARCHAR(255) DEFAULT '' NOT NULL",
-		"date"	=> "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
-		"lesauteurs"	=> "text DEFAULT '' NOT NULL",
-		"maj"	=> "TIMESTAMP",
-		"statut"	=> "varchar(10) DEFAULT '0' NOT NULL",
-		"descriptif"	=> "text DEFAULT '' NOT NULL",
-		"lang"	=> "VARCHAR(10) DEFAULT '' NOT NULL",
-		"url_source" => "TINYTEXT DEFAULT '' NOT NULL",
-		"source" => "TINYTEXT DEFAULT '' NOT NULL",
-		"tags" => "TEXT DEFAULT '' NOT NULL");
-
-$spip_syndic_articles_key = array(
-		"PRIMARY KEY"	=> "id_syndic_article",
-		"KEY id_syndic"	=> "id_syndic",
-		"KEY statut"	=> "statut",
-		"KEY url"	=> "url");
-$spip_syndic_articles_join = array(
-		"id_syndic_article"=>"id_syndic_article",
-		"id_syndic"=>"id_syndic");
-
 /// Attention: mes_fonctions peut avoir deja defini cette variable
 /// il faut donc rajouter, mais pas reinitialiser
 
@@ -268,11 +212,7 @@ $tables_principales['spip_documents'] =
 	array('field' => &$spip_documents,  'key' => &$spip_documents_key, 'join' => &$spip_documents_join);
 $tables_principales['spip_types_documents']	=
 	array('field' => &$spip_types_documents, 'key' => &$spip_types_documents_key);
-$tables_principales['spip_syndic'] =
-	array('field' => &$spip_syndic, 'key' => &$spip_syndic_key, 'join' => &$spip_syndic_join);
-$tables_principales['spip_syndic_articles']	=
-	array('field' => &$spip_syndic_articles, 'key' => &$spip_syndic_articles_key, 'join' => &$spip_syndic_articles_join);
-	
+
 	$tables_principales = pipeline('declarer_tables_principales',$tables_principales);
 }
 
diff --git a/ecrire/core.xml b/ecrire/core.xml
index 00b3fb1fb4..ec7810892b 100644
--- a/ecrire/core.xml
+++ b/ecrire/core.xml
@@ -309,8 +309,6 @@
 	<pipeline><nom>post_edition</nom><action></action></pipeline>
 	<pipeline><nom>pre_insertion</nom><action></action></pipeline>
 	<pipeline><nom>post_insertion</nom><action></action></pipeline>
-	<pipeline><nom>pre_syndication</nom><action></action></pipeline>
-	<pipeline><nom>post_syndication</nom><action></action></pipeline>
 	<pipeline><nom>pre_indexation</nom><action></action></pipeline>
 	<pipeline><nom>propres_creer_chaine_url</nom><action></action></pipeline>
 	<pipeline><nom>requete_dico</nom><action></action></pipeline>
diff --git a/ecrire/genie/optimiser.php b/ecrire/genie/optimiser.php
index 9c0c04324f..8a5646ce5c 100644
--- a/ecrire/genie/optimiser.php
+++ b/ecrire/genie/optimiser.php
@@ -152,21 +152,6 @@ function optimiser_base_disparus($attente = 86400) {
 	sql_delete("spip_breves", "statut='refuse' AND maj < $mydate");
 
 
-	//
-	// Sites
-	//
-
-	sql_delete("spip_syndic", "maj < $mydate AND statut = 'refuse'");
-
-
-	# les articles syndiques appartenant a des sites effaces
-	$res = sql_select("S.id_syndic AS id",
-		      "spip_syndic_articles AS S
-		        LEFT JOIN spip_syndic AS syndic
-		          ON S.id_syndic=syndic.id_syndic",
-			"syndic.id_syndic IS NULL");
-
-	$n+= optimiser_sansref('spip_syndic_articles', 'id_syndic', $res);
 
 
 	//
diff --git a/ecrire/inc/autoriser.php b/ecrire/inc/autoriser.php
index a598116c53..0768759103 100644
--- a/ecrire/inc/autoriser.php
+++ b/ecrire/inc/autoriser.php
@@ -229,25 +229,6 @@ function autoriser_rubrique_creersitedans_dist($faire, $type, $id, $qui, $opt) {
 			    ($qui['statut']=='1comite' ? 1 : 2)));
 }
 
-// Autoriser a modifier un site
-// http://doc.spip.org/@autoriser_site_modifier_dist
-function autoriser_site_modifier_dist($faire, $type, $id, $qui, $opt) {
-	if ($qui['statut'] == '0minirezo' AND !$qui['restreint'])
-		return true;
-
-	$t = sql_fetsel("id_rubrique,statut", "spip_syndic", "id_syndic=".sql_quote($id));
-	return ($t
-		AND autoriser('voir','rubrique',$t['id_rubrique'])
-		AND ($t['statut'] == 'prop'
-			OR autoriser('modifier', 'rubrique', $t['id_rubrique'])
-		)
-	);
-}
-// Autoriser a voir un site $id_syndic
-// http://doc.spip.org/@autoriser_site_voir_dist
-function autoriser_site_voir_dist($faire, $type, $id, $qui, $opt) {
-	return autoriser_site_modifier_dist($faire, $type, $id, $qui, $opt);
-}
 
 // Autoriser a modifier la rubrique $id
 // = publierdans rubrique $id
diff --git a/ecrire/inc/config.php b/ecrire/inc/config.php
index e6666a9adb..4d59f5f8c5 100644
--- a/ecrire/inc/config.php
+++ b/ecrire/inc/config.php
@@ -366,11 +366,6 @@ function liste_metas()
 		'rubriques_descriptif' => 'non',
 		'rubriques_texte' => 'oui',
 
-		'activer_sites' => 'non',
-		'proposer_sites' => 0,
-		'activer_syndic' => 'oui',
-		'moderation_sites' => 'non',
-
 		'accepter_inscriptions' => 'non',
 		'accepter_visiteurs' => 'non',
 		'prevenir_auteurs' => 'non',
diff --git a/ecrire/inc/rechercher.php b/ecrire/inc/rechercher.php
index 4ca1a74ab1..71a2f399c1 100644
--- a/ecrire/inc/rechercher.php
+++ b/ecrire/inc/rechercher.php
@@ -41,9 +41,6 @@ function liste_des_champs() {
 			'document' => array(
 				'titre' => 3, 'descriptif' => 1, 'fichier' => 1
 			),
-			'syndic_article' => array(
-				'titre' => 5, 'descriptif' => 1
-			),
 			'signature' => array(
 				'nom_email' => 2, 'ad_email' => 4,
 				'nom_site' => 2, 'url_site' => 4,
diff --git a/ecrire/public/boucles.php b/ecrire/public/boucles.php
index 6668ac0494..cc8f5ce53a 100644
--- a/ecrire/public/boucles.php
+++ b/ecrire/public/boucles.php
@@ -224,50 +224,4 @@ function boucle_HIERARCHIE_dist($id_boucle, &$boucles) {
 }
 
 
-//
-// <BOUCLE(SYNDICATION)>
-//
-// http://doc.spip.org/@boucle_SYNDICATION_dist
-function boucle_SYNDICATION_dist($id_boucle, &$boucles) {
-	$boucle = &$boucles[$id_boucle];
-	$id_table = $boucle->id_table;
-	$mstatut = $id_table .'.statut';
-
-	// Restreindre aux elements publies
-
-	if (!isset($boucle->modificateur['criteres']['statut'])) {
-		if (!$GLOBALS['var_preview']) {
-			array_unshift($boucle->where,array("'='", "'$mstatut'", "'\\'publie\\''"));
-		} else
-			array_unshift($boucle->where,array("'IN'", "'$mstatut'", "'(\\'publie\\',\\'prop\\')'"));
-	}
-	return calculer_boucle($id_boucle, $boucles); 
-}
-
-//
-// <BOUCLE(SYNDIC_ARTICLES)>
-//
-// http://doc.spip.org/@boucle_SYNDIC_ARTICLES_dist
-function boucle_SYNDIC_ARTICLES_dist($id_boucle, &$boucles) {
-	$boucle = &$boucles[$id_boucle];
-	$id_table = $boucle->id_table;
-	$mstatut = $id_table .'.statut';
-
-	// Restreindre aux elements publies, sauf critere contraire
-	if (isset($boucle->modificateur['criteres']['statut']) AND $boucle->modificateur['criteres']['statut']) {}
-	else if ($GLOBALS['var_preview'])
-		array_unshift($boucle->where,array("'IN'", "'$mstatut'", "'(\\'publie\\',\\'prop\\')'"));
-	else {
-		$jointure = array_search("spip_syndic", $boucle->from);
-		if (!$jointure) {
-			fabrique_jointures($boucle, array(array($id_table, array('spip_syndic'), 'id_syndic')), true, $boucle->show, $id_table);
-			$jointure = array_search('spip_syndic', $boucle->from);
-		}
-		array_unshift($boucle->where,array("'='", "'$mstatut'", "'\\'publie\\''"));
-		$boucle->where[]= array("'='", "'$jointure" . ".statut'", "'\\'publie\\''");
-
-	}
-	return calculer_boucle($id_boucle, $boucles);
-}
-
 ?>
diff --git a/ecrire/public/interfaces.php b/ecrire/public/interfaces.php
index 3f95c2fc9f..1558191f17 100644
--- a/ecrire/public/interfaces.php
+++ b/ecrire/public/interfaces.php
@@ -186,9 +186,6 @@ $table_des_tables['breves']='breves';
 $table_des_tables['documents']='documents';
 $table_des_tables['types_documents']='types_documents';
 $table_des_tables['rubriques']='rubriques';
-$table_des_tables['syndication']='syndic';
-$table_des_tables['syndic']='syndic';
-$table_des_tables['syndic_articles']='syndic_articles';
 $table_des_tables['hierarchie']='rubriques';
 $table_des_tables['messages']='messages';
 
@@ -203,20 +200,12 @@ $exceptions_des_tables['documents']['extension_document']=array('types_documents
 $exceptions_des_tables['documents']['mime_type']=array('types_documents'
 , 'mime_type');
 
-# ne sert plus ? verifier balise_URL_ARTICLE
-$exceptions_des_tables['syndic_articles']['url_article']='url';
-# ne sert plus ? verifier balise_LESAUTEURS
-$exceptions_des_tables['syndic_articles']['lesauteurs']='lesauteurs';
-$exceptions_des_tables['syndic_articles']['url_site']=array('syndic', 'url_site');
-$exceptions_des_tables['syndic_articles']['nom_site']=array('syndic', 'nom_site');
 
 $table_titre['breves']= 'titre , lang';
 $table_titre['articles']= 'titre, lang';
 $table_titre['rubriques']= 'titre, lang';
 $table_titre['messages']= "titre, '' AS lang";
 $table_titre['auteurs']= "nom AS titre, '' AS lang";
-$table_titre['site']= "nom_site AS titre, '' AS lang";
-$table_titre['syndic']= "nom_site AS titre, '' AS lang";
 $table_titre['documents']= "titre, fichier AS surnom, '' AS lang";
 
 $table_date['articles']='date';
@@ -225,8 +214,6 @@ $table_date['breves']='date_heure';
 $table_date['documents']='date';
 $table_date['types_documents']='date';
 $table_date['rubriques']='date';
-$table_date['syndication']='date';
-$table_date['syndic_articles']='date';
 
 //
 // tableau des tables de jointures
@@ -246,8 +233,6 @@ $tables_jointures['spip_documents'][]= 'types_documents';
 
 $tables_jointures['spip_rubriques'][]= 'documents_liens';
 
-$tables_jointures['spip_syndic_articles'][]= 'syndic';
-
 
 
 global  $exceptions_des_jointures;
@@ -272,7 +257,6 @@ $table_des_traitements['LIEN_TITRE'][]= _TRAITEMENT_TYPO;
 $table_des_traitements['LIEN_URL'][]= 'vider_url(%s)';
 $table_des_traitements['MESSAGE'][]= _TRAITEMENT_RACCOURCIS;
 $table_des_traitements['NOM_SITE_SPIP'][]= _TRAITEMENT_TYPO;
-$table_des_traitements['NOM_SITE'][]=  _TRAITEMENT_TYPO;
 $table_des_traitements['NOM'][]= _TRAITEMENT_TYPO;
 $table_des_traitements['AUTEUR'][]= _TRAITEMENT_TYPO;
 $table_des_traitements['PS'][]= _TRAITEMENT_RACCOURCIS;
@@ -287,13 +271,6 @@ $table_des_traitements['DESCRIPTIF_SITE_SPIP'][]= _TRAITEMENT_RACCOURCIS;
 $table_des_traitements['ENV'][]= 'entites_html(%s,true)';
 
 
-// Articles syndiques : passage des donnees telles quelles, sans traitement typo
-// A noter, dans applique_filtres la securite et conformite XHTML de ces champs
-// est assuree par safehtml()
-foreach(array('TITRE','DESCRIPTIF','SOURCE') as $balise)
-	if (!isset($table_des_traitements[$balise]['syndic_articles']))
-		$table_des_traitements[$balise]['syndic_articles'] = '%s';
-
 	// gerer l'affectation en 2 temps car si le pipe n'est pas encore declare, on ecrase les globales
 	$interfaces = pipeline('declarer_tables_interfaces',
 			array(
-- 
GitLab