X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fping.php;h=99ebde70c183a2367d8a19406b51436e66a95748;hb=070e1e73d60295e616314c952199fd4b0b209f2d;hp=b899fdb9d324aed3518d3eed9647334867e6d180;hpb=0ec44f3e8a73229c3aadea86f61b5571a701c6b7;p=friendica.git diff --git a/mod/ping.php b/mod/ping.php index b899fdb9d3..99ebde70c1 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -19,9 +19,9 @@ use Friendica\Model\Group; use Friendica\Model\Item; use Friendica\Util\DateTimeFormat; use Friendica\Util\Temporal; +use Friendica\Util\Proxy as ProxyUtils; use Friendica\Util\XML; -require_once 'mod/proxy.php'; require_once 'include/enotify.php'; /** @@ -108,7 +108,7 @@ function ping_init(App $a) if (local_user()) { // Different login session than the page that is calling us. - if (intval($_GET['uid']) && intval($_GET['uid']) != local_user()) { + if (!empty($_GET['uid']) && intval($_GET['uid']) != local_user()) { $data = ['result' => ['invalid' => 1]]; if ($format == 'json') { @@ -135,7 +135,7 @@ function ping_init(App $a) $params = ['order' => ['created' => true]]; $items = Item::selectForUser(local_user(), $fields, $condition, $params); - if (DBA::is_result($items)) { + if (DBA::isResult($items)) { $items_unseen = Item::inArray($items); $arr = ['items' => $items_unseen]; Addon::callHooks('network_ping', $arr); @@ -153,7 +153,7 @@ function ping_init(App $a) if (intval(Feature::isEnabled(local_user(), 'groups'))) { // Find out how unseen network posts are spread across groups $group_counts = Group::countUnseen(); - if (DBA::is_result($group_counts)) { + if (DBA::isResult($group_counts)) { foreach ($group_counts as $group_count) { if ($group_count['count'] > 0) { $groups_unseen[] = $group_count; @@ -164,7 +164,7 @@ function ping_init(App $a) if (intval(Feature::isEnabled(local_user(), 'forumlist_widget'))) { $forum_counts = ForumManager::countUnseenItems(); - if (DBA::is_result($forum_counts)) { + if (DBA::isResult($forum_counts)) { foreach ($forum_counts as $forum_count) { if ($forum_count['count'] > 0) { $forums_unseen[] = $forum_count; @@ -197,7 +197,7 @@ function ping_init(App $a) "SELECT `id`, `from-name`, `from-url`, `from-photo`, `created` FROM `mail` WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ", intval(local_user()), - dbesc($myurl) + DBA::escape($myurl) ); $mail_count = count($mails); @@ -208,7 +208,7 @@ function ping_init(App $a) WHERE `contact`.`self` = 1" ); - if (DBA::is_result($regs)) { + if (DBA::isResult($regs)) { $register_count = count($regs); } } @@ -221,15 +221,15 @@ function ping_init(App $a) WHERE `event`.`uid` = %d AND `start` < '%s' AND `finish` > '%s' and `ignore` = 0 ORDER BY `start` ASC ", intval(local_user()), - dbesc(DateTimeFormat::utc('now + 7 days')), - dbesc(DateTimeFormat::utcNow()) + DBA::escape(DateTimeFormat::utc('now + 7 days')), + DBA::escape(DateTimeFormat::utcNow()) ); - if (DBA::is_result($ev)) { + if (DBA::isResult($ev)) { Cache::set($cachekey, $ev, CACHE_HOUR); } } - if (DBA::is_result($ev)) { + if (DBA::isResult($ev)) { $all_events = count($ev); if ($all_events) { @@ -267,7 +267,7 @@ function ping_init(App $a) $data['birthdays'] = $birthdays; $data['birthdays-today'] = $birthdays_today; - if (DBA::is_result($notifs)) { + if (DBA::isResult($notifs)) { foreach ($notifs as $notif) { if ($notif['seen'] == 0) { $sysnotify_count ++; @@ -276,7 +276,7 @@ function ping_init(App $a) } // merge all notification types in one array - if (DBA::is_result($intros)) { + if (DBA::isResult($intros)) { foreach ($intros as $intro) { $notif = [ 'id' => 0, @@ -292,7 +292,7 @@ function ping_init(App $a) } } - if (DBA::is_result($mails)) { + if (DBA::isResult($mails)) { foreach ($mails as $mail) { $notif = [ 'id' => 0, @@ -308,7 +308,7 @@ function ping_init(App $a) } } - if (DBA::is_result($regs)) { + if (DBA::isResult($regs)) { foreach ($regs as $reg) { $notif = [ 'id' => 0, @@ -345,9 +345,9 @@ function ping_init(App $a) }; usort($notifs, $sort_function); - if (DBA::is_result($notifs)) { + if (DBA::isResult($notifs)) { // Are the nofications called from the regular process or via the friendica app? - $regularnotifications = (intval($_GET['uid']) && intval($_GET['_'])); + $regularnotifications = (!empty($_GET['uid']) && !empty($_GET['_'])); foreach ($notifs as $notif) { if ($a->is_friendica_app() || !$regularnotifications) { @@ -356,9 +356,9 @@ function ping_init(App $a) $contact = Contact::getDetailsByURL($notif['url']); if (isset($contact['micro'])) { - $notif['photo'] = proxy_url($contact['micro'], false, PROXY_SIZE_MICRO); + $notif['photo'] = ProxyUtils::proxifyUrl($contact['micro'], false, ProxyUtils::SIZE_MICRO); } else { - $notif['photo'] = proxy_url($notif['photo'], false, PROXY_SIZE_MICRO); + $notif['photo'] = ProxyUtils::proxifyUrl($notif['photo'], false, ProxyUtils::SIZE_MICRO); } $local_time = DateTimeFormat::local($notif['date']); @@ -481,8 +481,8 @@ function ping_get_notifications($uid) q( "UPDATE `notify` SET `name_cache` = '%s', `msg_cache` = '%s' WHERE `id` = %d", - dbesc($notification["name"]), - dbesc($notification["message"]), + DBA::escape($notification["name"]), + DBA::escape($notification["message"]), intval($notification["id"]) ); }