X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=mod%2Fping.php;h=d8eaa8126fd03f0aad9b5a079db905dab216b2c5;hb=c54a2c1e83822f6e043b449468570d2c9ed3ab3a;hp=e722295b2ae2886e342f9abe4557e41082513a23;hpb=b92fc24ff06681f445edff0d45f8f81a7e25ebe6;p=friendica.git diff --git a/mod/ping.php b/mod/ping.php index e722295b2a..d8eaa8126f 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -3,17 +3,18 @@ * @file include/ping.php */ use Friendica\App; +use Friendica\Content\Feature; +use Friendica\Content\ForumManager; use Friendica\Core\Cache; use Friendica\Core\System; use Friendica\Core\PConfig; use Friendica\Database\DBM; -use Friendica\Object\Contact; +use Friendica\Model\Contact; +use Friendica\Model\Group; use Friendica\Util\XML; require_once 'include/datetime.php'; require_once 'include/bbcode.php'; -require_once 'include/ForumManager.php'; -require_once 'include/group.php'; require_once 'mod/proxy.php'; require_once 'include/enotify.php'; @@ -115,7 +116,7 @@ function ping_init(App $a) } } else { header("Content-type: text/xml"); - echo XML::from_array($data, $xml); + echo XML::fromArray($data, $xml); } killme(); } @@ -149,9 +150,9 @@ function ping_init(App $a) } if ($network_count) { - if (intval(feature_enabled(local_user(), 'groups'))) { + if (intval(Feature::isEnabled(local_user(), 'groups'))) { // Find out how unseen network posts are spread across groups - $group_counts = groups_count_unseen(); + $group_counts = Group::countUnseen(); if (DBM::is_result($group_counts)) { foreach ($group_counts as $group_count) { if ($group_count['count'] > 0) { @@ -161,10 +162,10 @@ function ping_init(App $a) } } - if (intval(feature_enabled(local_user(), 'forumlist_widget'))) { - $forum_counts = ForumManager::count_unseen_items(); - if (DBM::is_result($forums_counts)) { - foreach ($forums_counts as $forum_count) { + if (intval(Feature::isEnabled(local_user(), 'forumlist_widget'))) { + $forum_counts = ForumManager::countUnseenItems(); + if (DBM::is_result($forum_counts)) { + foreach ($forum_counts as $forum_count) { if ($forum_count['count'] > 0) { $forums_unseen[] = $forum_count; } @@ -202,13 +203,13 @@ function ping_init(App $a) if ($a->config['register_policy'] == REGISTER_APPROVE && is_site_admin()) { $regs = q( - "SELECT `contact`.`name`, `contact`.`url`, `contact`.`micro`, `register`.`created`, COUNT(*) AS `total` + "SELECT `contact`.`name`, `contact`.`url`, `contact`.`micro`, `register`.`created` FROM `contact` RIGHT JOIN `register` ON `register`.`uid` = `contact`.`uid` WHERE `contact`.`self` = 1" ); if (DBM::is_result($regs)) { - $register_count = $regs[0]['total']; + $register_count = count($regs); } } @@ -350,7 +351,7 @@ function ping_init(App $a) $notif['message'] = str_replace("{0}", $notif['name'], $notif['message']); } - $contact = get_contact_details_by_url($notif['url']); + $contact = Contact::getDetailsByURL($notif['url']); if (isset($contact['micro'])) { $notif['photo'] = proxy_url($contact['micro'], false, PROXY_SIZE_MICRO); } else { @@ -412,7 +413,7 @@ function ping_init(App $a) $data = ping_format_xml_data($data, $sysnotify_count, $notifications, $sysmsgs, $sysmsgs_info, $groups_unseen, $forums_unseen); header("Content-type: text/xml"); - echo XML::from_array(array("result" => $data), $xml); + echo XML::fromArray(array("result" => $data), $xml); } killme(); @@ -489,8 +490,10 @@ function ping_get_notifications($uid) $notification["href"] = System::baseUrl() . "/notify/view/" . $notification["id"]; - if ($notification["visible"] && !$notification["spam"] - && !$notification["deleted"] && !is_array($result[$notification["parent"]]) + if ($notification["visible"] + && !$notification["spam"] + && !$notification["deleted"] + && !(x($result, $notification["parent"]) && is_array($result[$notification["parent"]])) ) { // Should we condense the notifications or show them all? if (PConfig::get(local_user(), 'system', 'detailed_notif')) {