X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fevent.php;h=bc9467dc80217a1c352277ebaf94ef91c4fe6c3d;hb=369fcb7bae306026d6a1d6f8d0bb9dd565617d51;hp=b9988badfa1aaddbc110b03bfc8c43770ad5c9b8;hpb=3b4f72da939fa9f5155311799044414220d5d039;p=friendica.git diff --git a/include/event.php b/include/event.php index b9988badfa..bc9467dc80 100644 --- a/include/event.php +++ b/include/event.php @@ -5,11 +5,15 @@ */ use Friendica\App; +use Friendica\Content\Feature; +use Friendica\Core\PConfig; use Friendica\Core\System; +use Friendica\Database\DBM; +use Friendica\Util\Map; require_once 'include/bbcode.php'; -require_once 'include/map.php'; require_once 'include/datetime.php'; +require_once "include/conversation.php"; function format_event_html($ev, $simple = false) { if (! ((is_array($ev)) && count($ev))) { @@ -71,7 +75,7 @@ function format_event_html($ev, $simple = false) { // Include a map of the location if the [map] BBCode is used. if (strpos($ev['location'], "[map") !== false) { - $map = generate_named_map($ev['location']); + $map = Map::byLocation($ev['location']); if ($map !== $ev['location']) { $o.= $map; } @@ -214,7 +218,7 @@ function event_delete($event_id) { return; } - q("DELETE FROM `event` WHERE `id` = %d", intval($event_id)); + dba::delete('event', array('id' => $event_id)); logger("Deleted event ".$event_id, LOGGER_DEBUG); } @@ -253,7 +257,7 @@ function event_store($arr) { ); } - if (dbm::is_result($c)) { + if (DBM::is_result($c)) { $contact = $c[0]; } @@ -268,7 +272,7 @@ function event_store($arr) { intval($arr['id']), intval($arr['uid']) ); - if ((! dbm::is_result($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. @@ -276,7 +280,7 @@ function event_store($arr) { intval($arr['id']), intval($arr['uid']) ); - return ((dbm::is_result($r)) ? $r[0]['id'] : 0); + return ((DBM::is_result($r)) ? $r[0]['id'] : 0); } // The event changed. Update it. @@ -309,7 +313,7 @@ function event_store($arr) { intval($arr['id']), intval($arr['uid']) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $object = '' . xmlify(ACTIVITY_OBJ_EVENT) . '' . xmlify($arr['uri']) . ''; $object .= '' . xmlify(format_event_bbcode($arr)) . ''; $object .= '' . "\n"; @@ -360,7 +364,7 @@ function event_store($arr) { dbesc($arr['uri']), intval($arr['uid']) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $event = $r[0]; } @@ -403,7 +407,7 @@ function event_store($arr) { $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($arr['uid']) ); - //if (dbm::is_result($r)) + //if (DBM::is_result($r)) // $plink = System::baseUrl() . '/display/' . $r[0]['nickname'] . '/' . $item_id; @@ -435,10 +439,7 @@ function event_store($arr) { function get_event_strings() { // First day of the week (0 = Sunday). - $firstDay = get_pconfig(local_user(), 'system', 'first_day_of_week'); - if ($firstDay === false) { - $firstDay = 0; - } + $firstDay = PConfig::get(local_user(), 'system', 'first_day_of_week', 0); $i18n = array( "firstDay" => $firstDay, @@ -546,7 +547,7 @@ function event_by_id($owner_uid = 0, $event_params, $sql_extra = '') { intval($event_params["event_id"]) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { return event_remove_duplicates($r); } } @@ -590,7 +591,7 @@ function events_by_date($owner_uid = 0, $event_params, $sql_extra = '') { dbesc($event_params["adjust_finish"]) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { return event_remove_duplicates($r); } } @@ -804,7 +805,7 @@ function events_by_uid($uid = 0, $sql_extra = '') { ); } - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { return $r; } } @@ -828,7 +829,7 @@ function event_export($uid, $format = 'ical') { // We are allowed to show events. // Get the timezone the user is in. $r = q("SELECT `timezone` FROM `user` WHERE `uid` = %d LIMIT 1", intval($uid)); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $timezone = $r[0]['timezone']; } @@ -899,7 +900,7 @@ function widget_events() { * for exporting the cal is enabled (otherwise the widget would appear for logged in users * on foreigen profile pages even if the widget is disabled). */ - if (intval($owner_uid) && local_user() !== $owner_uid && ! feature_enabled($owner_uid, "export_calendar")) { + if (intval($owner_uid) && local_user() !== $owner_uid && ! Feature::isEnabled($owner_uid, "export_calendar")) { return; } @@ -907,7 +908,7 @@ function widget_events() { * If it's a kind of profile page (intval($owner_uid)) return if the user not logged in and * export feature isn't enabled. */ - if (intval($owner_uid) && ! local_user() && ! feature_enabled($owner_uid, "export_calendar")) { + if (intval($owner_uid) && ! local_user() && ! Feature::isEnabled($owner_uid, "export_calendar")) { return; } @@ -966,9 +967,9 @@ function format_event_item($item) { } // Construct the map HTML. if (isset($evloc['address'])) { - $location['map'] = '
' . generate_named_map($evloc['address']) . '
'; + $location['map'] = '
' . Map::byLocation($evloc['address']) . '
'; } elseif (isset($evloc['coordinates'])) { - $location['map'] = '
' . generate_map(str_replace('/', ' ', $evloc['coordinates'])) . '
'; + $location['map'] = '
' . Map::byCoordinates(str_replace('/', ' ', $evloc['coordinates'])) . '
'; } // Construct the profile link (magic-auth).