X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fevent.php;h=fedbe24468ab67a4085422375974013e279bd77e;hb=4c04a78d1b6f14ce90e4ca0b23e356d234c4a296;hp=29202baddf982417cdf3decedc3f0b69be539dc8;hpb=cb05801a9031254f5882038de07a3ee4d5f89dd0;p=friendica.git
diff --git a/include/event.php b/include/event.php
index 29202baddf..73e61f25cf 100644
--- a/include/event.php
+++ b/include/event.php
@@ -1,52 +1,84 @@
".bbcode($ev['summary'])."";
+
+ $o .= "
' . "\r\n";
+
+ $o .= '
' . bbcode($ev['summary']) . '
' . "\r\n";
+
$o .= '
' . bbcode($ev['desc']) . '
' . "\r\n";
$o .= '
' . t('Starts:') . ' '
- . (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
- $ev['start'] , $bd_format ))
- : day_translate(datetime_convert('UTC', 'UTC',
- $ev['start'] , $bd_format)))
+ . '" >'.$event_start
. '
' . "\r\n";
if(! $ev['nofinish'])
$o .= '
' . t('Finishes:') . ' '
- . (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
- $ev['finish'] , $bd_format ))
- : day_translate(datetime_convert('UTC', 'UTC',
- $ev['finish'] , $bd_format )))
+ . '" >'.$event_end
. '
' . "\r\n";
- if(strlen($ev['location']))
- $o .= '
' . t('Location:') . ' '
- . bbcode($ev['location'])
+ if(strlen($ev['location'])){
+ $o .= ' ' . t('Location:') . ' '
+ . bbcode($ev['location'])
. '
' . "\r\n";
+ if (strpos($ev['location'], "[map") !== False) {
+ $map = generate_named_map($ev['location']);
+ if ($map!==$ev['location']) $o.=$map;
+ }
+
+ }
+
$o .= '
' . "\r\n";
return $o;
}
-
+/*
function parse_event($h) {
require_once('include/Scrape.php');
- require_once('library/HTMLPurifier.auto.php');
require_once('include/html2bbcode');
$h = '' . $h . '';
@@ -108,12 +140,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]';
@@ -122,7 +157,7 @@ function format_event_bbcode($ev) {
if(($ev['finish']) && (! $ev['nofinish']))
$o .= '[event-finish]' . $ev['finish'] . '[/event-finish]';
-
+
if($ev['location'])
$o .= '[event-location]' . $ev['location'] . '[/event-location]';
@@ -147,6 +182,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,14 +200,13 @@ 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;
}
-function sort_by_date($a) {
+function sort_by_date(App &$a) {
usort($a,'ev_compare');
return $a;
@@ -183,11 +220,17 @@ function ev_compare($a,$b) {
if($date_a === $date_b)
return strcasecmp($a['desc'],$b['desc']);
-
+
return strcmp($date_a,$date_b);
}
+function event_delete($event_id) {
+ if ($event_id == 0)
+ return;
+ q("DELETE FROM `event` WHERE `id` = %d", intval($event_id));
+ logger("Deleted event ".$event_id, LOGGER_DEBUG);
+}
function event_store($arr) {
@@ -199,7 +242,7 @@ function event_store($arr) {
$arr['created'] = (($arr['created']) ? $arr['created'] : datetime_convert());
$arr['edited'] = (($arr['edited']) ? $arr['edited'] : datetime_convert());
- $arr['type'] = (($arr['type']) ? $arr['type'] : 'event' );
+ $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']));
$arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 0);
@@ -228,7 +271,7 @@ function event_store($arr) {
intval($arr['id']),
intval($arr['uid'])
);
- if((! count($r)) || ($r[0]['edited'] === $arr['edited'])) {
+ if((! dbm::is_result($r)) || ($r[0]['edited'] === $arr['edited'])) {
// Nothing has changed. Grab the item id to return.
@@ -236,7 +279,7 @@ function event_store($arr) {
intval($arr['id']),
intval($arr['uid'])
);
- return((count($r)) ? $r[0]['id'] : 0);
+ return((dbm::is_result($r)) ? $r[0]['id'] : 0);
}
// The event changed. Update it.
@@ -245,29 +288,23 @@ function event_store($arr) {
`edited` = '%s',
`start` = '%s',
`finish` = '%s',
+ `summary` = '%s',
`desc` = '%s',
`location` = '%s',
`type` = '%s',
`adjust` = %d,
- `nofinish` = %d,
- `allow_cid` = '%s',
- `allow_gid` = '%s',
- `deny_cid` = '%s',
- `deny_gid` = '%s'
- WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ `nofinish` = %d
+ WHERE `id` = %d AND `uid` = %d",
dbesc($arr['edited']),
dbesc($arr['start']),
dbesc($arr['finish']),
+ dbesc($arr['summary']),
dbesc($arr['desc']),
dbesc($arr['location']),
dbesc($arr['type']),
intval($arr['adjust']),
intval($arr['nofinish']),
- dbesc($arr['allow_cid']),
- dbesc($arr['allow_gid']),
- dbesc($arr['deny_cid']),
- dbesc($arr['deny_gid']),
intval($arr['id']),
intval($arr['uid'])
);
@@ -275,37 +312,35 @@ function event_store($arr) {
intval($arr['id']),
intval($arr['uid'])
);
- if(count($r)) {
+ if (dbm::is_result($r)) {
$object = '