]> git.mxchange.org Git - friendica.git/commitdiff
avoid returning events from getting posted again
authorFriendika <info@friendika.com>
Tue, 14 Jun 2011 03:42:37 +0000 (20:42 -0700)
committerFriendika <info@friendika.com>
Tue, 14 Jun 2011 03:42:37 +0000 (20:42 -0700)
include/event.php
include/items.php
mod/dfrn_notify.php

index 208ba1e1fd35a6dfa35b649abc6f012eea78e706..2cfc524087f56ab6fec296db15cb130f35a3c6e6 100644 (file)
@@ -193,6 +193,7 @@ function event_store($arr) {
        $arr['edited'] = (($arr['edited']) ? $arr['edited'] : datetime_convert());
        $arr['type'] = (($arr['type']) ? $arr['type'] : 'event' );      
        $arr['cid'] = ((intval($arr['cid'])) ? intval($arr['cid']) : 0);
+       $arr['uri'] = (x($arr,'uri') ? $arr['uri'] : item_new_uri($a->get_hostname(),$arr['uid']));
 
        if($arr['cid'])
                $c = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
@@ -250,14 +251,12 @@ function event_store($arr) {
        }
        else {
 
-               $uri = item_new_uri($a->get_hostname(),local_user());
-
                $r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`desc`,`location`,`type`,
                        `adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`)
                        VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
                        intval($arr['uid']),
                        intval($arr['cid']),
-                       dbesc($uri),
+                       dbesc($arr['uri']),
                        dbesc($arr['created']),
                        dbesc($arr['edited']),
                        dbesc($arr['start']),
index 514bd1efa983c1442ca6d649d7e7e804415c7c2f..dc177c468c9b21bc8e07ad3a08ea2363f2a70f64 100644 (file)
@@ -1338,6 +1338,8 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_fee
                                        $ev = bbtoevent($datarray['body']);
                                        if(x($ev,'desc') && x($ev,'start')) {
                                                $ev['uid'] = $importer['uid'];
+                                               $ev['uri'] = $item_id;
+
                                                if(is_array($contact))
                                                        $ev['cid'] = $contact['id'];
                                                $r = q("SELECT * FROM `event` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
index 949d9f9ab51fb92ee1e77ef6472032bf9896ab26..6ca3f9fc2fa0b4e5eaf12e497892661934a3f2fc 100644 (file)
@@ -599,6 +599,7 @@ function dfrn_notify_post(&$a) {
                                if(x($ev,'desc') && x($ev,'start')) {
                                        $ev['cid'] = $importer['id'];
                                        $ev['uid'] = $importer['uid'];
+                                       $ev['uri'] = $item_id;
 
                                        $r = q("SELECT * FROM `event` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
                                                dbesc($item_id),