Add two hooks, event_created and event_updated. One Bugfix for the <id>...</id> tag ($uri was never defined). Commented out the parse_event() function - its never called and would lead to a program abortion due to a broken require_once at the beginning

This commit is contained in:
Tobias Hößl 2012-05-29 19:03:30 +00:00
parent 2eafa9a475
commit dfef0ec84d
1 changed files with 11 additions and 6 deletions

View File

@ -42,7 +42,7 @@ function format_event_html($ev) {
return $o; return $o;
} }
/*
function parse_event($h) { function parse_event($h) {
require_once('include/Scrape.php'); require_once('include/Scrape.php');
@ -108,7 +108,7 @@ function parse_event($h) {
return $ret; return $ret;
} }
*/
function format_event_bbcode($ev) { function format_event_bbcode($ev) {
@ -162,7 +162,6 @@ function bbtoevent($s) {
$match = ''; $match = '';
if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match)) if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match))
$ev['adjust'] = $match[1]; $ev['adjust'] = $match[1];
$match = '';
$ev['nofinish'] = (((x($ev, 'start') && $ev['start']) && (!x($ev, 'finish') || !$ev['finish'])) ? 1 : 0); $ev['nofinish'] = (((x($ev, 'start') && $ev['start']) && (!x($ev, 'finish') || !$ev['finish'])) ? 1 : 0);
return $ev; return $ev;
@ -294,10 +293,14 @@ function event_store($arr) {
intval($arr['uid']) intval($arr['uid'])
); );
return $r[0]['id']; $item_id = $r[0]['id'];
} }
else else
return 0; $item_id = 0;
call_hooks("event_updated", $arr['id']);
return $item_id;
} }
else { else {
@ -361,7 +364,7 @@ function event_store($arr) {
$item_arr['body'] = format_event_bbcode($event); $item_arr['body'] = format_event_bbcode($event);
$item_arr['object'] = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($uri) . '</id>'; $item_arr['object'] = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($arr['uri']) . '</id>';
$item_arr['object'] .= '<content>' . xmlify(format_event_bbcode($event)) . '</content>'; $item_arr['object'] .= '<content>' . xmlify(format_event_bbcode($event)) . '</content>';
$item_arr['object'] .= '</object>' . "\n"; $item_arr['object'] .= '</object>' . "\n";
@ -383,6 +386,8 @@ function event_store($arr) {
); );
} }
call_hooks("event_created", $event['id']);
return $item_id; return $item_id;
} }
} }