*/
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))) {
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);
}
);
}
- if (dbm::is_result($c)) {
+ if (DBM::is_result($c)) {
$contact = $c[0];
}
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.
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.
intval($arr['id']),
intval($arr['uid'])
);
- if (dbm::is_result($r)) {
+ if (DBM::is_result($r)) {
$object = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($arr['uri']) . '</id>';
$object .= '<content>' . xmlify(format_event_bbcode($arr)) . '</content>';
$object .= '</object>' . "\n";
dbesc($arr['uri']),
intval($arr['uid'])
);
- if (dbm::is_result($r)) {
+ if (DBM::is_result($r)) {
$event = $r[0];
}
$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;
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,
intval($event_params["event_id"])
);
- if (dbm::is_result($r)) {
+ if (DBM::is_result($r)) {
return event_remove_duplicates($r);
}
}
dbesc($event_params["adjust_finish"])
);
- if (dbm::is_result($r)) {
+ if (DBM::is_result($r)) {
return event_remove_duplicates($r);
}
}
);
}
- if (dbm::is_result($r)) {
+ if (DBM::is_result($r)) {
return $r;
}
}
// 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'];
}
* 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;
}
* 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;
}
// Format the event location.
$evloc = event_location2array($item['event-location']);
- $location = array(
- 'name' => prepare_text($evloc['name'])
- );
+ $location = array();
+
+ if (isset($evloc['name'])) {
+ $location['name'] = prepare_text($evloc['name']);
+ }
// Construct the map HTML.
if (isset($evloc['address'])) {
$location['map'] = '<div class="map">' . generate_named_map($evloc['address']) . '</div>';
$location['map'] = '<div class="map">' . generate_map(str_replace('/', ' ', $evloc['coordinates'])) . '</div>';
}
+ // Construct the profile link (magic-auth).
+ $sp = false;
+ $profile_link = best_link_url($item, $sp);
+
+ if (!$sp) {
+ $profile_link = zrl($profile_link);
+ }
+
$event = replace_macros(get_markup_template('event_stream_item.tpl'), array(
'$id' => $item['event-id'],
'$title' => prepare_text($item['event-summary']),
'$end_time' => $end_time,
'$end_short' => $end_short,
'$author_name' => $item['author-name'],
- '$author_link' => $item['author-link'],
+ '$author_link' => $profile_link,
'$author_avatar' => $item['author-avatar'],
- '$description' => prepare_text($item['event-desc']),
+ '$description' => prepare_text($item['event-desc']),
'$location_label' => t('Location:'),
'$show_map_label' => t('Show map'),
'$hide_map_label' => t('Hide map'),