function action_relancer_signature_dist($id_signature = null)
{
    if (!$id_signature) {
        $securiser_action = charger_fonction('securiser_action', 'inc');
        $id_signature = $securiser_action();
    }
    if (autoriser('relancer', 'signature', $id_signature)) {
        $row = sql_fetsel('*', 'spip_signatures', 'id_signature=' . intval($id_signature));
        $id_article = sql_getfetsel('id_article', 'spip_petitions', 'id_petition=' . intval($row['id_petition']));
        if ($id_article = intval($id_article) and autoriser('mordererpetition', 'article', $id_article)) {
            include_spip('action/editer_signature');
            include_spip('formulaires/signature');
            $url = generer_url_entite_absolue($id_article, 'article', '', '', true);
            if (signature_a_confirmer($id_article, $url, $row['nom_email'], $row['ad_email'], $row['nom_site'], $row['url_site'], $row['message'], $row['lang'], $row['statut'])) {
                signature_modifier($id_signature, array("date_time" => date('Y-m-d H:i:s')));
            }
        }
    }
}
Пример #2
0
function action_editer_signatures_post($r)
{
	$id = $id_article = intval($r[1]);
	if ($r[2] == 'A')
	  $id = 0;
	else $id_article = 0;

	if ($id < 0){
		$id = 0 - $id;
		sql_updateq("spip_signatures", array("statut" => 'poubelle'), "id_signature=$id");

	} elseif ($id > 0){
		$row = sql_fetsel('*', 'spip_signatures', "id_signature=$id"); 
		if ($row['statut']=='poubelle')
			sql_updateq("spip_signatures", array("statut" => 'publie'), "id_signature=$id");
		else {
			include_spip('formulaires/signature');
			include_spip('inc/texte');
			
			$id_article = $row['id_article'];
			
			$url = generer_url_entite_absolue($id_article, 'article','','',true);
			if (signature_a_confirmer($id_article, $url, $row['nom_email'], $row['ad_email'], $row['nom_site'], $row['url_site'], $row['message'], $row['lang'], $row['statut']))
				sql_updateq("spip_signatures", array("date_time" => date('Y-m-d H:i:s')), "id_signature=$id");
			$id = 0;
		}
	} elseif ($id_article) {
		action_editer_signatures_relance($id_article);
	}

	// Invalider les pages ayant trait aux petitions
	if (!$id_article AND $id) {
		$id_article = sql_getfetsel("id_article", "spip_signatures", "id_signature=$id");
		if ($id_article) {
			include_spip('inc/invalideur');
			suivre_invalideur("id='varia/pet$id_article'");
		}
	}

	# cette requete devrait figurer dans l'optimisation
	sql_delete("spip_signatures", "NOT (statut='publie' OR statut='poubelle') AND date_time<DATE_SUB(NOW(),INTERVAL 10 DAY)");
}
Пример #3
0
function inc_controler_signature_dist($id_article, $nom, $mail, $message, $site, $url_site, $url_page)
{
    // tout le monde est la.
    // cela a ete verifie en amont, dans formulaires_signature_verifier()
    if (!($row = sql_fetsel('*', 'spip_petitions', "id_article=" . intval($id_article)))) {
        return _T('petitions:form_pet_probleme_technique');
    }
    $statut = "";
    if (!($ret = signature_a_confirmer($id_article, $url_page, $nom, $mail, $site, $url_site, $message, 'fr', $statut))) {
        return _T('petitions:form_pet_probleme_technique');
    }
    include_spip('action/editer_signature');
    $id_signature = signature_inserer($row['id_petition']);
    if (!$id_signature) {
        return _T('petitions:form_pet_probleme_technique');
    }
    signature_modifier($id_signature, array('statut' => $statut, 'nom_email' => $nom, 'ad_email' => $mail, 'message' => $message, 'nom_site' => $site, 'url_site' => $url_site));
    return $ret;
}
Пример #4
0
function inc_controler_signature_dist($id_article, $nom, $mail, $message, $site, $url_site, $url_page) {

	include_spip('inc/texte');
	include_spip('inc/filtres');

	// tout le monde est la.
	// cela a ete verifie en amont, dans formulaires_signature_verifier()
	if (!$row = sql_fetsel('*', 'spip_petitions', "id_article=$id_article"))
		return _T('form_pet_probleme_technique');

	$statut = "";
	if (!$ret = signature_a_confirmer($id_article, $url_page, $nom, $mail, $site, $url_site, $message, $lang, $statut))
		return _T('form_pet_probleme_technique');

	$id_signature = sql_insertq('spip_signatures', array(
		'id_article' => $id_article,
		'date_time' => date('Y-m-d H:i:s'),
		'statut' => $statut,
		'ad_email' => $mail,
		'url_site' => $url_site));

	if (!$id_signature) return _T('form_pet_probleme_technique');

	include_spip('inc/modifier');
	revision_signature($id_signature, array(
		'nom_email' => $nom,
		'ad_email' => $mail,
		'message' => $message,
		'nom_site' => $site,
		'url_site' => $url_site
	));

	return $ret;
}