mirror of
https://github.com/nerzhul/ocsms.git
synced 2025-06-07 07:56:23 +00:00
Add support for SMS types
This commit is contained in:
parent
dfbee0fac1
commit
a8ff01b999
@ -72,6 +72,12 @@
|
||||
<notnull>true</notnull>
|
||||
<length>1</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>sms_type</name>
|
||||
<type>integer</type>
|
||||
<notnull>true</notnull>
|
||||
<length>1</length>
|
||||
</field>
|
||||
</declaration>
|
||||
</table>
|
||||
</database>
|
||||
|
@ -5,6 +5,6 @@
|
||||
<description>Owncloud SMS app</description>
|
||||
<licence>AGPL</licence>
|
||||
<author>Loic Blot</author>
|
||||
<version>0.1.5</version>
|
||||
<version>0.1.7</version>
|
||||
<requiremin>7</requiremin>
|
||||
</info>
|
||||
|
@ -60,7 +60,7 @@ class SmsController extends Controller {
|
||||
foreach ($smsDatas as &$sms) {
|
||||
if (!array_key_exists("_id", $sms) || !array_key_exists("read", $sms) ||
|
||||
!array_key_exists("date", $sms) || !array_key_exists("seen", $sms) ||
|
||||
!array_key_exists("mbox", $sms) ||
|
||||
!array_key_exists("mbox", $sms) || !array_key_exists("type", $sms)
|
||||
!array_key_exists("body", $sms) || !array_key_exists("address", $sms)) {
|
||||
$this->errorMsg = "Error: bad SMS entry";
|
||||
return false;
|
||||
@ -71,6 +71,11 @@ class SmsController extends Controller {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_numeric($sms["type"])) {
|
||||
$this->errorMsg = sprintf("Error: Invalid SMS type '%s'", $sms["type"]);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_numeric($sms["mbox"]) && $sms["mbox"] != 0 && $sms["mbox"] != 1 &&
|
||||
$sms["mbox"] != 2) {
|
||||
$this->errorMsg = sprintf("Error: Invalid Mailbox ID '%s'", $sms["mbox"]);
|
||||
|
@ -30,12 +30,13 @@ class SmsMapper extends Mapper {
|
||||
|
||||
$query = \OC_DB::prepare('INSERT INTO *PREFIX*ocsms_smsdatas ' .
|
||||
'(user_id, added, lastmodified, sms_flags, sms_date, sms_id,' .
|
||||
'sms_address, sms_msg, sms_mailbox) VALUES ' .
|
||||
'(?,?,?,?,?,?,?,?,?)');
|
||||
'sms_address, sms_msg, sms_mailbox, sms_type) VALUES ' .
|
||||
'(?,?,?,?,?,?,?,?,?,?)');
|
||||
$result = $query->execute(array(
|
||||
$userId, "NOW()", "NOW()", $smsFlags,
|
||||
(int) $sms["date"], (int) $sms["_id"],
|
||||
$sms["address"], $sms["body"], (int) $sms["mbox"]
|
||||
$sms["address"], $sms["body"], (int) $sms["mbox"],
|
||||
(int) $sms["type"]
|
||||
));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user