/***************************************************************************\
* SPIP, Systeme de publication pour l'internet *
* *
- * Copyright (c) 2001-2017 *
+ * Copyright (c) 2001-2019 *
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
* *
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
/** statuts associables a des rubriques (separes par des virgules) */
defined('_STATUT_AUTEUR_RUBRIQUE') || define('_STATUT_AUTEUR_RUBRIQUE', _ADMINS_RESTREINTS ? '0minirezo' : '');
-// mes_fonctions peut aussi declarer des autorisations, donc il faut donc le charger
-if ($f = find_in_path('mes_fonctions.php')) {
- global $dossier_squelettes;
- include_once(_ROOT_CWD . $f);
-}
-
if (!function_exists('autoriser')) {
/**
}
+// mes_fonctions peut aussi declarer des autorisations, il faut donc le charger
+// mais apres la fonction autoriser()
+if ($f = find_in_path('mes_fonctions.php')) {
+ global $dossier_squelettes;
+ include_once(_ROOT_CWD . $f);
+}
+
+
/**
* Autoriser une action
*
* @return bool true s'il a le droit, false sinon
**/
function autoriser_dater_dist($faire, $type, $id, $qui, $opt) {
+ $table = table_objet($type);
+ $trouver_table = charger_fonction('trouver_table', 'base');
+ $desc = $trouver_table($table);
+ if (!$desc) {
+ return false;
+ }
+
if (!isset($opt['statut'])) {
- $table = table_objet($type);
- $trouver_table = charger_fonction('trouver_table', 'base');
- $desc = $trouver_table($table);
- if (!$desc) {
- return false;
- }
if (isset($desc['field']['statut'])) {
$statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type) . '=' . intval($id));
} else {
} else {
$statut = $opt['statut'];
}
-
- if ($statut == 'publie'
- or ($statut == 'prop' and $type == 'article' and $GLOBALS['meta']['post_dates'] == 'non')) {
+
+ // Liste des statuts publiés pour cet objet
+ if (isset($desc['statut'][0]['publie'])) {
+ $statuts_publies = explode(',', $desc['statut'][0]['publie']);
+ }
+ // Sinon en dur le statut "publie"
+ else {
+ $statuts_publies = array('publie');
+ }
+
+ if (
+ in_array($statut, $statuts_publies)
+ // Ou cas particulier géré en dur ici pour les articles
+ or ($statut == 'prop' and $type == 'article' and $GLOBALS['meta']['post_dates'] == 'non')
+ ) {
return autoriser('modifier', $type, $id);
}
return sql_allfetsel(
'id_auteur',
'spip_auteurs_liens',
- "objet='article' AND id_objet=$id_article" . ($cond ? " AND $cond" : '')
+ "objet='article' AND id_objet=" . intval($id_article) . ($cond ? " AND $cond" : '')
);
}