]> git.mxchange.org Git - friendica.git/blobdiff - include/event.php
Friendicaland
[friendica.git] / include / event.php
old mode 100755 (executable)
new mode 100644 (file)
index 29202ba..8aef0a2
@@ -12,6 +12,9 @@ function format_event_html($ev) {
 
        $o = '<div class="vevent">' . "\r\n";
 
+
+       $o .= '<p class="summary event-summary">' . bbcode($ev['summary']) .  '</p>' . "\r\n";
+
        $o .= '<p class="description event-description">' . bbcode($ev['desc']) .  '</p>' . "\r\n";
 
        $o .= '<p class="event-start">' . t('Starts:') . ' <abbr class="dtstart" title="'
@@ -42,7 +45,7 @@ function format_event_html($ev) {
        return $o;
 }
 
-
+/*
 function parse_event($h) {
 
        require_once('include/Scrape.php');
@@ -108,12 +111,15 @@ function parse_event($h) {
 
        return $ret;
 }
-
+*/
 
 function format_event_bbcode($ev) {
 
        $o = '';
 
+       if($ev['summary'])
+               $o .= '[event-summary]' . $ev['summary'] . '[/event-summary]';
+
        if($ev['desc'])
                $o .= '[event-description]' . $ev['desc'] . '[/event-description]';
 
@@ -147,6 +153,9 @@ function bbtoevent($s) {
 
        $ev = array();
 
+       $match = '';
+       if(preg_match("/\[event\-summary\](.*?)\[\/event\-summary\]/is",$s,$match))
+               $ev['summary'] = $match[1];
        $match = '';
        if(preg_match("/\[event\-description\](.*?)\[\/event\-description\]/is",$s,$match))
                $ev['desc'] = $match[1];
@@ -162,7 +171,6 @@ function bbtoevent($s) {
        $match = '';
        if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match))
                $ev['adjust'] = $match[1];
-       $match = '';
        $ev['nofinish'] = (((x($ev, 'start') && $ev['start']) && (!x($ev, 'finish') || !$ev['finish'])) ? 1 : 0);
        return $ev;
 
@@ -245,6 +253,7 @@ function event_store($arr) {
                        `edited` = '%s',
                        `start` = '%s',
                        `finish` = '%s',
+                       `summary` = '%s',
                        `desc` = '%s',
                        `location` = '%s',
                        `type` = '%s',
@@ -259,6 +268,7 @@ function event_store($arr) {
                        dbesc($arr['edited']),
                        dbesc($arr['start']),
                        dbesc($arr['finish']),
+                       dbesc($arr['summary']),
                        dbesc($arr['desc']),
                        dbesc($arr['location']),
                        dbesc($arr['type']),
@@ -294,18 +304,22 @@ function event_store($arr) {
                                intval($arr['uid'])
                        );
 
-                       return $r[0]['id'];
+                       $item_id = $r[0]['id'];
                }
                else
-                       return 0;
+                       $item_id = 0;
+
+               call_hooks("event_updated", $arr['id']);
+
+               return $item_id;
        }
        else {
 
                // New event. Store it. 
 
-               $r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`desc`,`location`,`type`,
+               $r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`summary`, `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' ) ",
+                       VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
                        intval($arr['uid']),
                        intval($arr['cid']),
                        dbesc($arr['uri']),
@@ -313,6 +327,7 @@ function event_store($arr) {
                        dbesc($arr['edited']),
                        dbesc($arr['start']),
                        dbesc($arr['finish']),
+                       dbesc($arr['summary']),
                        dbesc($arr['desc']),
                        dbesc($arr['location']),
                        dbesc($arr['type']),
@@ -361,7 +376,7 @@ function event_store($arr) {
                $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'] .= '</object>' . "\n";
 
@@ -383,6 +398,8 @@ function event_store($arr) {
                        );
                }
 
+               call_hooks("event_created", $event['id']);
+
                return $item_id;
        }
 }