mirror of
https://github.com/nextcloud/ocsms.git
synced 2026-08-11 16:32:55 +00:00
Because there is a bug on boolean recognition in PHP, we are using string octal representation for flags
This commit is contained in:
+11
-6
@@ -23,14 +23,19 @@ class SmsMapper extends Mapper {
|
||||
// @TODO
|
||||
public function saveAll($userId, $smsList) {
|
||||
foreach ($smsList as $sms) {
|
||||
$smsFlags = sprintf("%s%s%s",
|
||||
$sms["read"] === "true" ? "1" : "0",
|
||||
$sms["seen"] === "true" ? "1" : "0",
|
||||
$sms["draft"] === "true" ? "1" : "0"
|
||||
);
|
||||
|
||||
$query = \OC_DB::prepare('INSERT INTO *PREFIX*ocsms_smsdatas ' .
|
||||
'(user_id, added, lastmodified, sms_read, sms_seen, sms_date,' .
|
||||
'sms_draft, sms_id, sms_address, sms_msg) VALUES ' .
|
||||
'(?,?,?,?,?,?,?,?,?,?)');
|
||||
'(user_id, added, lastmodified, sms_flags, sms_date, sms_id,' .
|
||||
'sms_address, sms_msg) VALUES ' .
|
||||
'(?,?,?,?,?,?,?,?)');
|
||||
$result = $query->execute(array(
|
||||
$userId, "NOW()", "NOW()",
|
||||
$sms["read"] === "true", $sms["seen"] === "true",
|
||||
(int) $sms["date"], $sms["draft"], (int) $sms["id"],
|
||||
$userId, "NOW()", "NOW()", $smsFlags,
|
||||
(int) $sms["date"], (int) $sms["id"],
|
||||
$sms["address"], $sms["body"]
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user