X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fevent.php;h=616018bb77a629c848f875652b9ce7d7876ced6f;hb=b81a1fde09a5186153ad7d5f8b71a576417f4547;hp=d474d084d94706304ce6110b7fec013ceb1fd556;hpb=6e7bd68ebb027b90398eee4fcc3bd73912a881e3;p=friendica.git
diff --git a/include/event.php b/include/event.php
index d474d084d9..616018bb77 100644
--- a/include/event.php
+++ b/include/event.php
@@ -1,15 +1,46 @@
".bbcode($ev['summary'])."";
+
+ $o .= "
' . "\r\n";
@@ -19,28 +50,27 @@ function format_event_html($ev) {
$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;
}
@@ -49,7 +79,6 @@ function format_event_html($ev) {
function parse_event($h) {
require_once('include/Scrape.php');
- require_once('library/HTMLPurifier.auto.php');
require_once('include/html2bbcode');
$h = '' . $h . '';
@@ -128,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]';
@@ -177,7 +206,7 @@ function bbtoevent($s) {
}
-function sort_by_date($a) {
+function sort_by_date(App $a) {
usort($a,'ev_compare');
return $a;
@@ -191,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) {
@@ -211,6 +246,7 @@ function event_store($arr) {
$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);
+ $arr['guid'] = get_guid(32);
if($arr['cid'])
$c = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
@@ -236,7 +272,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.
@@ -244,7 +280,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.
@@ -258,11 +294,7 @@ function event_store($arr) {
`location` = '%s',
`type` = '%s',
`adjust` = %d,
- `nofinish` = %d,
- `allow_cid` = '%s',
- `allow_gid` = '%s',
- `deny_cid` = '%s',
- `deny_gid` = '%s'
+ `nofinish` = %d
WHERE `id` = %d AND `uid` = %d",
dbesc($arr['edited']),
@@ -274,10 +306,6 @@ function event_store($arr) {
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'])
);
@@ -285,43 +313,37 @@ function event_store($arr) {
intval($arr['id']),
intval($arr['uid'])
);
- if(count($r)) {
+ if (dbm::is_result($r)) {
$object = '