Replaced the last occurences of "q"

This commit is contained in:
Michael 2021-10-07 19:30:10 +00:00
parent e61a3d02ce
commit 793eca1f7b
2 changed files with 19 additions and 21 deletions

View file

@ -1258,13 +1258,10 @@ function pumpio_fetchinbox(App $a, $uid)
$self = User::getOwnerDataById($uid); $self = User::getOwnerDataById($uid);
$lastitems = q("SELECT `uri` FROM `post-thread-user` $lastitems = DBA::p("SELECT `uri` FROM `post-thread-user`
INNER JOIN `post-view` ON `post-view`.`id` = `post-thread-user`.`id` INNER JOIN `post-view` ON `post-view`.`id` = `post-thread-user`.`id`
WHERE `post-thread-user`.`network` = '%s' AND `post-thread-user`.`uid` = %d AND `post-view`.`extid` != '' WHERE `post-thread-user`.`network` = ? AND `post-thread-user`.`uid` = ? AND `post-view`.`extid` != ''
ORDER BY `post-thread-user`.`commented` DESC LIMIT 10", ORDER BY `post-thread-user`.`commented` DESC LIMIT 10", Protocol::PUMPIO, $uid);
DBA::escape(Protocol::PUMPIO),
intval($uid)
);
$client = new oauth_client_class; $client = new oauth_client_class;
$client->oauth_version = '1.0a'; $client->oauth_version = '1.0a';
@ -1305,9 +1302,10 @@ function pumpio_fetchinbox(App $a, $uid)
} }
} }
foreach ($lastitems as $item) { while ($item = DBA::fetch($lastitems)) {
pumpio_fetchallcomments($a, $uid, $item["uri"]); pumpio_fetchallcomments($a, $uid, $item["uri"]);
} }
DBA::close($lastitems);
DI::pConfig()->set($uid, 'pumpio', 'last_id', $last_id); DI::pConfig()->set($uid, 'pumpio', 'last_id', $last_id);
} }
@ -1395,20 +1393,20 @@ function pumpio_getreceiver(App $a, array $b)
foreach ($gids AS $gid) { foreach ($gids AS $gid) {
$gid = trim($gid, " <>"); $gid = trim($gid, " <>");
$r = q("SELECT `contact`.`name`, `contact`.`nick`, `contact`.`url`, `contact`.`network` ". $contacts = DBA::p("SELECT `contact`.`name`, `contact`.`nick`, `contact`.`url`, `contact`.`network`
"FROM `group_member`, `contact` WHERE `group_member`.`gid` = %d ". FROM `group_member`, `contact` WHERE `group_member`.`gid` = ?
"AND `contact`.`id` = `group_member`.`contact-id` AND `contact`.`network` = '%s'", AND `contact`.`id` = `group_member`.`contact-id` AND `contact`.`network` = ?",
intval($gid), $gid, Protocol::PUMPIO);
DBA::escape(Protocol::PUMPIO)
);
foreach ($r AS $row) while ($row = DBA::fetch($contacts)) {
$receiver["bcc"][] = [ $receiver["bcc"][] = [
"displayName" => $row["name"], "displayName" => $row["name"],
"objectType" => "person", "objectType" => "person",
"preferredUsername" => $row["nick"], "preferredUsername" => $row["nick"],
"url" => $row["url"]]; "url" => $row["url"]];
} }
DBA::close($contacts);
}
} }
if ($b["inform"] != "") { if ($b["inform"] != "") {

View file

@ -149,16 +149,16 @@ function windowsphonepush_cron()
} else { } else {
// retrieve the number of unseen items and the id of the latest one (if there are more than // retrieve the number of unseen items and the id of the latest one (if there are more than
// one new entries since last poller run, only the latest one will be pushed) // one new entries since last poller run, only the latest one will be pushed)
$count = q("SELECT count(`id`) as count, max(`id`) as max FROM `post-view` WHERE `unseen` = 1 AND `type` <> 'activity' AND `uid` = %d", intval($rr['uid'])); $count = DBA::fetchFirst("SELECT count(`id`) AS count, max(`id`) AS max FROM `post-view` WHERE `unseen` AND `type` != ? AND `uid` = ?", 'activity', $rr['uid']);
// send number of unseen items to the device (the number will be displayed on Start screen until // send number of unseen items to the device (the number will be displayed on Start screen until
// App will be started by user) - this update will be sent every 10 minutes to update the number to 0 if // App will be started by user) - this update will be sent every 10 minutes to update the number to 0 if
// user has loaded the timeline through app or website // user has loaded the timeline through app or website
$res_tile = send_tile_update($device_url, "", $count[0]['count'], ""); $res_tile = send_tile_update($device_url, "", $count['count'], "");
switch (trim($res_tile)) { switch (trim($res_tile)) {
case "Received": case "Received":
// ok, count has been pushed, let's save it in personal settings // ok, count has been pushed, let's save it in personal settings
DI::pConfig()->set($rr['uid'], 'windowsphonepush', 'counterunseen', $count[0]['count']); DI::pConfig()->set($rr['uid'], 'windowsphonepush', 'counterunseen', $count['count']);
break; break;
case "QueueFull": case "QueueFull":
// maximum of 30 messages reached, server rejects any further push notification until device reconnects // maximum of 30 messages reached, server rejects any further push notification until device reconnects
@ -178,13 +178,13 @@ function windowsphonepush_cron()
} }
// additionally user receives the text of the newest item (function checks against last successfully pushed item) // additionally user receives the text of the newest item (function checks against last successfully pushed item)
if (intval($count[0]['max']) > intval($lastpushid)) { if (intval($count['max']) > intval($lastpushid)) {
// user can define if he wants to see the text of the item in the push notification // user can define if he wants to see the text of the item in the push notification
// this has been implemented as the device_url is not a https uri (not so secure) // this has been implemented as the device_url is not a https uri (not so secure)
$senditemtext = DI::pConfig()->get($rr['uid'], 'windowsphonepush', 'senditemtext'); $senditemtext = DI::pConfig()->get($rr['uid'], 'windowsphonepush', 'senditemtext');
if ($senditemtext == 1) { if ($senditemtext == 1) {
// load item with the max id // load item with the max id
$item = Post::selectFirst(['author-name', 'body', 'uri-id'], ['id' => $count[0]['max']]); $item = Post::selectFirst(['author-name', 'body', 'uri-id'], ['id' => $count['max']]);
// as user allows to send the item, we want to show the sender of the item in the toast // as user allows to send the item, we want to show the sender of the item in the toast
// toasts are limited to one line, therefore place is limited - author shall be in // toasts are limited to one line, therefore place is limited - author shall be in
@ -216,7 +216,7 @@ function windowsphonepush_cron()
// further log information done on count pushing with send_tile (see above) // further log information done on count pushing with send_tile (see above)
$res_toast = send_toast($device_url, $author, $body); $res_toast = send_toast($device_url, $author, $body);
if (trim($res_toast) === 'Received') { if (trim($res_toast) === 'Received') {
DI::pConfig()->set($rr['uid'], 'windowsphonepush', 'lastpushid', $count[0]['max']); DI::pConfig()->set($rr['uid'], 'windowsphonepush', 'lastpushid', $count['max']);
} }
} }
} }