X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fevent.php;h=4795867b129dde88fde5a377f34a7ff000cc113b;hb=0457bd995fe4e723a7cad33c8d464186646db5db;hp=b9988badfa1aaddbc110b03bfc8c43770ad5c9b8;hpb=c847a2f9cc969c9d79141713f646dd371e898168;p=friendica.git diff --git a/include/event.php b/include/event.php index b9988badfa..4795867b12 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; 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))) { @@ -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; }