diff --git a/ecrire/inc/agenda.php b/ecrire/inc/agenda.php index 8d52b61aded9bb9b35e68b114bf62b2ea3f9195a..bf42d2a43933630a86dd424e2bfe5ee323bdc776 100644 --- a/ecrire/inc/agenda.php +++ b/ecrire/inc/agenda.php @@ -1153,8 +1153,7 @@ function calendrier_categories($table, $num, $objet) return generer_calendrier_class($table, $num, $objet); else { // cf calendrier.css - $result= spip_fetch_array(spip_query(" -SELECT " . (($objet != 'id_breve') ? 'id_secteur' : 'id_rubrique') . " + $result= spip_fetch_array(spip_query("SELECT " . (($objet != 'id_breve') ? 'id_secteur' : 'id_rubrique') . " FROM $table WHERE $objet=$num ")); @@ -1248,7 +1247,7 @@ ORDER BY date 'CATEGORIES' => calendrier_categories('spip_articles', $id, 'id_article'), 'DESCRIPTION' => $row['descriptif'], 'SUMMARY' => $row['titre'], - 'URL' => generer_url_article($id)); + 'URL' => generer_url_article($id, 'prop')); } } @@ -1271,7 +1270,7 @@ ORDER BY date 'CATEGORIES' => calendrier_categories('spip_rubriques', $id, 'id_rubrique'), 'DESCRIPTION' => $row['descriptif'], 'SUMMARY' => $row['titre'], - 'URL' => generer_url_rubrique($id)); + 'URL' => generer_url_rubrique($id, 'prop')); } } @@ -1290,7 +1289,7 @@ ORDER BY date_heure $ir = $row['id_rubrique']; $evenements[$amj][]= array( - 'URL' => generer_url_breve($id), + 'URL' => generer_url_breve($id, 'prop'), 'CATEGORIES' => calendrier_categories('spip_breves', $ir, 'id_breve'), 'SUMMARY' => $row['titre']); } diff --git a/ecrire/inc/urls.php b/ecrire/inc/urls.php index aa50e7598fba9ec93d05b940ecadb30bb956de50..74aa85f77acff94670e0f2f22bea315f38cc0fba 100644 --- a/ecrire/inc/urls.php +++ b/ecrire/inc/urls.php @@ -10,51 +10,58 @@ * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * \***************************************************************************/ - -// if (!defined("_ECRIRE_INC_VERSION")) return; - -function generer_url_article($id_article) { - if (($row = spip_fetch_array(spip_query( - "SELECT statut FROM spip_articles WHERE id_article=$id_article" - ))) AND ($row['statut'] == 'publie')) - return generer_url_action('redirect', "id_article=$id_article"); - else return generer_url_ecrire('articles',"id_article=$id_article"); +function generer_url_article($id_article, $statut='') { + $args = "id_article=" . intval($id_article); + if (!$statut) + list($statut) = spip_fetch_array(spip_query("SELECT statut FROM spip_articles WHERE $args")); + if ($statut == 'publie') + return generer_url_action('redirect', $args); + else return generer_url_ecrire('articles', $args); } -function generer_url_rubrique($id_rubrique) { - if (($row = spip_fetch_array(spip_query( - "SELECT statut FROM spip_rubriques WHERE id_rubrique=$id_rubrique" - ))) AND ($row['statut'] == 'publie')) - return generer_url_action('redirect', "id_rubrique=$id_rubrique"); - else - return generer_url_ecrire('naviguer',"id_rubrique=$id_rubrique"); +function generer_url_rubrique($id_rubrique, $statut='') { + $args = "id_rubrique=" . intval($id_rubrique); + if (!$statut) + list($statut) = spip_fetch_array(spip_query("SELECT statut FROM spip_rubriques WHERE $args")); + if ($statut == 'publie') + return generer_url_action('redirect', $args); + else return generer_url_ecrire('naviguer',$args); } -function generer_url_breve($id_breve) { - if (($row = spip_fetch_array(spip_query( - "SELECT statut FROM spip_breves WHERE id_breve=$id_breve" - ))) AND ($row['statut'] == 'publie')) - return generer_url_action('redirect', "id_breve=$id_breve"); - else - return generer_url_ecrire('breves_voir',"id_breve=$id_breve"); +function generer_url_breve($id_breve, $statut='') { + $args = "id_breve=" . intval($id_breve); + if (!$statut) + list($statut) = spip_fetch_array(spip_query("SELECT statut FROM spip_breves WHERE $args")); + if ($statut == 'publie') + return generer_url_action('redirect', $args); + else return generer_url_ecrire('breves_voir',$args); } -function generer_url_forum($id_forum) { - return generer_url_action('redirect', "id_forum=$id_forum"); +function generer_url_mot($id_mot, $statut='') { + $args = "id_mot=" . intval($id_mot); + if (!$statut) + return generer_url_action('redirect', $args); + else return generer_url_ecrire('mots_edit',$args); } -function generer_url_mot($id_mot) { - return generer_url_action('redirect', "id_mot=$id_mot"); +function generer_url_site($id_syndic, $statut='') { + $args = "id_syndic=" . intval($id_syndic); + if (!$statut) + return generer_url_action('redirect', $args); + else return generer_url_ecrire('sites',$args); } -function generer_url_site($id_syndic) { - return generer_url_action('redirect', "id_syndic=$id_syndic"); +function generer_url_auteur($id_auteur, $statut='') { + $args = "id_auteur=" . intval($id_auteur); + if (!$statut) + return generer_url_action('redirect', $args); + else return generer_url_ecrire('auteurs_edit',$args); } -function generer_url_auteur($id_auteur) { - return generer_url_action('redirect', "id_auteur=$id_auteur"); +function generer_url_forum($id_forum) { + return generer_url_action('redirect', "id_forum=$id_forum"); } function generer_url_document($id_document) {