X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fevent.php;h=616018bb77a629c848f875652b9ce7d7876ced6f;hb=b81a1fde09a5186153ad7d5f8b71a576417f4547;hp=c24484f8a558891d91542a7a6d83bce84f15bc8f;hpb=dd2fbb0c9f81d1076380d64910b65628b2877e45;p=friendica.git
diff --git a/include/event.php b/include/event.php
index c24484f8a5..616018bb77 100644
--- a/include/event.php
+++ b/include/event.php
@@ -1,17 +1,46 @@
".bbcode($ev['summary'])."";
+
+ $o .= "
' . "\r\n";
@@ -21,33 +50,25 @@ 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'])
+ $o .= ' ' . t('Location:') . ' '
+ . bbcode($ev['location'])
. '
' . "\r\n";
-
- if (str_pos("[map", $ev['location'])==0) {
+
+ if (strpos($ev['location'], "[map") !== False) {
$map = generate_named_map($ev['location']);
if ($map!==$ev['location']) $o.=$map;
}
-
+
}
$o .= '
' . "\r\n";
@@ -58,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 . '';
@@ -137,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]';
@@ -186,7 +206,7 @@ function bbtoevent($s) {
}
-function sort_by_date($a) {
+function sort_by_date(App $a) {
usort($a,'ev_compare');
return $a;
@@ -200,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) {
@@ -220,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",
@@ -245,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.
@@ -253,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.
@@ -267,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']),
@@ -283,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'])
);
@@ -294,43 +313,37 @@ function event_store($arr) {
intval($arr['id']),
intval($arr['uid'])
);
- if(count($r)) {
+ if (dbm::is_result($r)) {
$object = '