[38484] | 1 | <?php |
---|
| 2 | |
---|
| 3 | /***************************************************************************\ |
---|
| 4 | * SPIP, Systeme de publication pour l'internet * |
---|
| 5 | * * |
---|
[113294] | 6 | * Copyright (c) 2001-2019 * |
---|
[38484] | 7 | * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
---|
| 8 | * * |
---|
| 9 | * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
---|
| 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
---|
| 11 | \***************************************************************************/ |
---|
| 12 | |
---|
[69881] | 13 | /** |
---|
| 14 | * Utilisations de pipelines |
---|
| 15 | * |
---|
| 16 | * @package SPIP\Petitions\Pipelines |
---|
[93619] | 17 | **/ |
---|
[69881] | 18 | |
---|
[93619] | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
---|
| 20 | return; |
---|
| 21 | } |
---|
[53209] | 22 | |
---|
[38484] | 23 | /** |
---|
| 24 | * Boite de configuration des objets articles |
---|
| 25 | * |
---|
| 26 | * @param array $flux |
---|
| 27 | * @return array |
---|
| 28 | */ |
---|
[93619] | 29 | function petitions_afficher_config_objet($flux) { |
---|
| 30 | if ((($type = $flux['args']['type']) == 'article') |
---|
[93649] | 31 | and ($id = $flux['args']['id']) |
---|
[93619] | 32 | ) { |
---|
| 33 | if (autoriser('modererpetition', $type, $id)) { |
---|
[60182] | 34 | $table = table_objet($type); |
---|
| 35 | $id_table_objet = id_table_objet($type); |
---|
[93619] | 36 | $flux['data'] .= recuperer_fond("prive/configurer/petitionner", array($id_table_objet => $id)); |
---|
[60182] | 37 | } |
---|
[38484] | 38 | } |
---|
[93619] | 39 | |
---|
[38484] | 40 | return $flux; |
---|
| 41 | } |
---|
| 42 | |
---|
[41232] | 43 | |
---|
[45469] | 44 | /** |
---|
[69881] | 45 | * Optimiser la base de données en supprimant les pétitions orphelines |
---|
[45469] | 46 | * |
---|
[69881] | 47 | * @param array $flux |
---|
| 48 | * @return array |
---|
[45469] | 49 | */ |
---|
[93619] | 50 | function petitions_optimiser_base_disparus($flux) { |
---|
[45469] | 51 | $n = &$flux['data']; |
---|
| 52 | $mydate = $flux['args']['date']; |
---|
[41232] | 53 | |
---|
[45469] | 54 | // |
---|
| 55 | // Signatures poubelles |
---|
| 56 | // |
---|
| 57 | |
---|
[93619] | 58 | sql_delete("spip_petitions", "statut=" . sql_quote('poubelle') . " AND maj < " . sql_quote($mydate)); |
---|
[45469] | 59 | |
---|
| 60 | // rejeter les signatures non confirmees trop vieilles (20jours) |
---|
[93619] | 61 | if (!defined('_PETITIONS_DELAI_SIGNATURES_REJETEES')) { |
---|
| 62 | define('_PETITIONS_DELAI_SIGNATURES_REJETEES', 20); |
---|
| 63 | } |
---|
| 64 | sql_delete("spip_signatures", "NOT (statut='publie' OR statut='poubelle') AND NOT(" . sql_date_proche('date_time', |
---|
| 65 | -_PETITIONS_DELAI_SIGNATURES_REJETEES, ' DAY') . ')'); |
---|
[45469] | 66 | |
---|
| 67 | |
---|
| 68 | return $flux; |
---|
| 69 | |
---|
| 70 | } |
---|