diff --git a/base/soyezcreateurs.php b/base/soyezcreateurs.php index b0a31fa1c3a117626b944f2e9bca012ec2f10d30..c94d8cbc85968673fba30a39116814d614f8358a 100644 --- a/base/soyezcreateurs.php +++ b/base/soyezcreateurs.php @@ -159,7 +159,7 @@ function create_groupe($groupe, $descriptif='', $texte='', $unseul='non', $oblig spip_log("2. (create_groupe) retour de find_groupe : $id_groupe, donc insertion avec id = $id_insert et titre = $groupe", _LOG_DEBUG); } else if ($id_groupe > 0) { - $id_insert = remplacer_groupe($groupe, $descriptif, $texte, $unseul, $obligatoire, $tables_liees, $minirezo, $comite, $forum); + $id_insert = remplacer_groupe($id_groupe, $set); spip_log("2. (create_groupe) retour de find_groupe : $id_groupe... passage a remplacer_groupe", _LOG_DEBUG); } return $id_insert; @@ -189,21 +189,15 @@ function vider_groupe($nom_groupe) { } //fonction qui mets à jour un groupe de mots clés -function remplacer_groupe($titre, $descriptif, $texte, $unseul, $obligatoire, $tables_liees, $minirezo, $comite, $forum) { - $id_groupe = id_groupe($titre); - sql_updateq( - "spip_groupes_mots", array( - "descriptif" => $descriptif, - "texte" => $texte, - "unseul" => $unseul, - "obligatoire" => $obligatoire, - "tables_liees" => $tables_liees, - "minirezo" => $minirezo, - "comite" => $comite, - "forum" => $forum - ), "id_groupe=$id_groupe" - ); - return true; +function remplacer_groupe($id_groupe, $set) { + include_spip('action/editer_objet'); + include_spip('inc/autoriser'); + + autoriser_exception('modifier', 'groupes_mots', $id_groupe); + $retour = objet_modifier('groupes_mots', $id_groupe, $set); + + autoriser_exception('modifier', 'groupes_mots', $id_groupe, false); + return $retour; } // fonction qui permet de trouver si un mot clé existe à partir du titre et de l'id du groupe @@ -251,7 +245,7 @@ function create_mot($groupe, $mot, $descriptif='', $texte='') { else if ($find_mot > 0) { $id_mot = id_mot($mot, $id_groupe); spip_log("1. (create_mot) mise a jour dans la table du mot cle : $mot", _LOG_DEBUG); - remplacer_mot($id_mot, $mot, $descriptif, $texte, $id_groupe, $groupe); + remplacer_mot($id_mot, $set); } else { spip_log("insertion impossible ! debug : groupe = $groupe --- id_groupe = $id_groupe", _LOG_DEBUG); @@ -260,16 +254,9 @@ function create_mot($groupe, $mot, $descriptif='', $texte='') { } //fonction qui permet de mettre à jour un mot clé -function remplacer_mot($id_mot, $mot, $descriptif, $texte, $id_groupe, $groupe) { - sql_updateq( - "spip_mots", array( - "titre" => $mot, - "descriptif" => $descriptif, - "texte" => $texte, - "id_groupe" => $id_groupe, - "type" => $groupe - ), "id_mot=$id_mot" - ); +function remplacer_mot($id_mot, $set) { + include_spip('action/editer_objet'); + objet_modifier('remplacer_mot', $id_mot, $set); return true; } @@ -317,14 +304,10 @@ function delete_rubrique($titre) { } // fonction qui permet de renommer une rubrique à partir du titre -function rename_rubrique($titre, $nouveau_titre) { - $id_rubrique = id_rubrique($titre); +function rename_rubrique($id_rubrique, $set) { + include_spip('action/editer_objet'); if ($id_rubrique) { - sql_updateq( - "spip_rubriques", array( - "titre" => $nouveau_titre - ), "id_rubrique=$id_rubrique" - ); + objet_modifer('rubrique', $set); spip_log("rename_rubrique) renommage de $titre en $nouveau_titre", _LOG_DEBUG); } return $id_rubrique; @@ -446,26 +429,15 @@ function create_article($texte, $rubrique, $lang='fr') { else if ($count_articles > 0) { $id_article = id_article($texte['titre'], $id_rubrique); spip_log("2. (create_article) maj de l'article : ".$texte['titre'], _LOG_DEBUG); - remplacer_article($id_article, $id_rubrique, $texte); + remplacer_article($id_article, $set); } return $id_article; } //fonction qui permet de mettre à jour un article -function remplacer_article($id_article, $id_rubrique, $texte) { - sql_updateq( - "spip_articles", array( - "surtitre" => $texte['surtitre'], - "soustitre" => $texte['soustitre'], - "descriptif" => $texte['descriptif'], - "chapo" => $texte['chapo'], - "texte" => $texte['texte'], - "ps" => $texte['ps'], - "nom_site" => $texte['nom_site'], - "url_site" => $texte['url_site'], - "virtuel" => $texte['virtuel'] - ), "id_article=$id_article AND id_rubrique=$id_rubrique" - ); +function remplacer_article($id_article, $set) { + include_spip('action/editer_objet'); + objet_modifer('article',$set); return true; }