]> git.mxchange.org Git - friendica-addons.git/blobdiff - windowsphonepush/windowsphonepush.php
Merge pull request #488 from MrPetovan/task/fix-scrutinizer-issues
[friendica-addons.git] / windowsphonepush / windowsphonepush.php
index baa4c656e3beace9c1b015cfb223fd70edd4ea69..66b23a7ccbc4ec4acce5eb6049900369c0da5ad1 100644 (file)
@@ -247,10 +247,10 @@ function send_tile_update($device_url, $image_url, $count, $title, $priority = 1
                "</wp:Tile> " .
                "</wp:Notification>";
 
-       $result = send_push($device_url, array(
+       $result = send_push($device_url, [
                'X-WindowsPhone-Target: token',
                'X-NotificationClass: ' . $priority,
-               ), $msg);
+               ], $msg);
        return $result;
 }
 
@@ -269,10 +269,10 @@ function send_toast($device_url, $title, $message, $priority = 2)
                "</wp:Toast>" .
                "</wp:Notification>";
 
-       $result = send_push($device_url, array(
+       $result = send_push($device_url, [
                'X-WindowsPhone-Target: toast',
                'X-NotificationClass: ' . $priority,
-               ), $msg);
+               ], $msg);
        return $result;
 }
 
@@ -284,11 +284,11 @@ function send_push($device_url, $headers, $msg)
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_HEADER, true);
-       curl_setopt($ch, CURLOPT_HTTPHEADER, $headers + array(
+       curl_setopt($ch, CURLOPT_HTTPHEADER, $headers + [
                'Content-Type: text/xml',
                'charset=utf-8',
                'Accept: application/*',
-               )
+               ]
        );
        curl_setopt($ch, CURLOPT_POSTFIELDS, $msg);
 
@@ -336,13 +336,13 @@ function windowsphonepush_content(App $a)
                        case "update_settings":
                                $ret = windowsphonepush_updatesettings($a);
                                header("Content-Type: application/json; charset=utf-8");
-                               echo json_encode(array('status' => $ret));
+                               echo json_encode(['status' => $ret]);
                                killme();
                                break;
                        case "update_counterunseen":
                                $ret = windowsphonepush_updatecounterunseen();
                                header("Content-Type: application/json; charset=utf-8");
-                               echo json_encode(array('status' => $ret));
+                               echo json_encode(['status' => $ret]);
                                killme();
                                break;
                        default:
@@ -374,13 +374,13 @@ function windowsphonepush_showsettings()
        }
 
        header("Content-Type: application/json");
-       echo json_encode(array('uid' => local_user(),
+       echo json_encode(['uid' => local_user(),
                'enable' => $enable,
                'device_url' => $device_url,
                'senditemtext' => $senditemtext,
                'lastpushid' => $lastpushid,
                'counterunseen' => $counterunseen,
-               'addonversion' => $addonversion));
+               'addonversion' => $addonversion]);
 }
 
 /* update_settings is used to transfer the device_url from WP device to the Friendica server
@@ -458,7 +458,7 @@ function windowsphonepush_login(App $a)
        $user_id = User::authenticate($_SERVER['PHP_AUTH_USER'], trim($_SERVER['PHP_AUTH_PW']));
 
        if ($user_id) {
-               $record = dba::select('user', [], ['uid' => $user_id], ['limit' => 1]);
+               $record = dba::selectFirst('user', [], ['uid' => $user_id]);
        } else {
                logger('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
                header('WWW-Authenticate: Basic realm="Friendica"');