]> git.mxchange.org Git - friendica.git/blobdiff - mod/ping.php
Merge pull request #5702 from annando/and-a-notice
[friendica.git] / mod / ping.php
index 11968eec75164ec96c15ca6b0e700a14575bf3f9..99ebde70c183a2367d8a19406b51436e66a95748 100644 (file)
@@ -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') {
@@ -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);
 
@@ -221,8 +221,8 @@ 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::isResult($ev)) {
                                Cache::set($cachekey, $ev, CACHE_HOUR);
@@ -347,7 +347,7 @@ function ping_init(App $a)
 
                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"])
                                );
                        }