Replace q() with DBA methods, fix code style

- Remove unused variables
- Fix doc block
- Fix indentation
This commit is contained in:
Hypolite Petovan 2018-12-30 01:08:51 -05:00
parent d838e6d0ec
commit 5abc22f6c5
3 changed files with 74 additions and 75 deletions

View file

@ -1807,31 +1807,28 @@ class Diaspora
return false;
}
q(
"INSERT INTO `mail` (`uid`, `guid`, `convid`, `from-name`,`from-photo`,`from-url`,`contact-id`,`title`,`body`,`seen`,`reply`,`uri`,`parent-uri`,`created`)
VALUES (%d, '%s', %d, '%s', '%s', '%s', %d, '%s', '%s', %d, %d, '%s','%s','%s')",
intval($importer["uid"]),
DBA::escape($msg_guid),
intval($conversation["id"]),
DBA::escape($person["name"]),
DBA::escape($person["photo"]),
DBA::escape($person["url"]),
intval($contact["id"]),
DBA::escape($subject),
DBA::escape($body),
0,
0,
DBA::escape($message_uri),
DBA::escape($author.":".$guid),
DBA::escape($msg_created_at)
);
DBA::insert('mail', [
'uid' => $importer['uid'],
'guid' => $msg_guid,
'convid' => $conversation['id'],
'from-name' => $person['name'],
'from-photo' => $person['photo'],
'from-url' => $person['url'],
'contact-id' => $contact['id'],
'title' => $subject,
'body' => $body,
'seen' => 0,
'reply' => 0,
'uri' => $message_uri,
'parent-uri' => $author . ':' . $guid,
'created' => $msg_created_at
]);
DBA::unlock();
DBA::update('conv', ['updated' => DateTimeFormat::utcNow()], ['id' => $conversation["id"]]);
notification(
[
notification([
"type" => NOTIFY_MAIL,
"notify_flags" => $importer["notify-flags"],
"language" => $importer["language"],
@ -1843,8 +1840,9 @@ class Diaspora
"source_link" => $person["url"],
"source_photo" => $person["photo"],
"verb" => ACTIVITY_POST,
"otype" => "mail"]
);
"otype" => "mail"
]);
return true;
}
@ -2066,24 +2064,22 @@ class Diaspora
return false;
}
q(
"INSERT INTO `mail` (`uid`, `guid`, `convid`, `from-name`,`from-photo`,`from-url`,`contact-id`,`title`,`body`,`seen`,`reply`,`uri`,`parent-uri`,`created`)
VALUES ( %d, '%s', %d, '%s', '%s', '%s', %d, '%s', '%s', %d, %d, '%s','%s','%s')",
intval($importer["uid"]),
DBA::escape($guid),
intval($conversation["id"]),
DBA::escape($person["name"]),
DBA::escape($person["photo"]),
DBA::escape($person["url"]),
intval($contact["id"]),
DBA::escape($conversation["subject"]),
DBA::escape($body),
0,
1,
DBA::escape($message_uri),
DBA::escape($author.":".$conversation["guid"]),
DBA::escape($created_at)
);
DBA::insert('mail', [
'uid' => $importer['uid'],
'guid' => $guid,
'convid' => $conversation['id'],
'from-name' => $person['name'],
'from-photo' => $person['photo'],
'from-url' => $person['url'],
'contact-id' => $contact['id'],
'title' => $conversation['subject'],
'body' => $body,
'seen' => 0,
'reply' => 1,
'uri' => $message_uri,
'parent-uri' => $author.":".$conversation['guid'],
'created' => $created_at
]);
DBA::unlock();