39 lines
825 B
PHP
39 lines
825 B
PHP
<?php
|
|
if (!defined('_ECRIRE_INC_VERSION')) return;
|
|
|
|
/**
|
|
* créer un slug Gamumail
|
|
*
|
|
* @plugin GamuMail
|
|
*
|
|
* @copyright 2020
|
|
* @author cy_altern
|
|
* @licence GNU/GPL
|
|
*
|
|
**/
|
|
|
|
include_spip('inc/editer');
|
|
include_spip('action/editer_objet');
|
|
include_spip('inc/autoriser');
|
|
|
|
function action_creer_slug_dist(){
|
|
include_spip('inc/autoriser');
|
|
if (!autoriser('creer','gamumail')) {
|
|
return false;
|
|
}
|
|
|
|
$set = [
|
|
'slug' => '',
|
|
'titre' => 'Le titre du modèle',
|
|
'sujet' => 'Le sujet du mail',
|
|
'texte' => 'Le texte du mail',
|
|
'statut' => 'publie',
|
|
];
|
|
if ($id_slug = objet_inserer('gamumail', null, $set)) {
|
|
sql_updateq('spip_gamumails', ['slug' => 'slug_'.$id_slug], 'id_gamumail = '.$id_slug);
|
|
}
|
|
|
|
// Cache
|
|
include_spip('inc/invalideur');
|
|
suivre_invalideur("id='id_gamumail/$id_gamumail'");
|
|
}
|