re-enable smsstops
This commit is contained in:
parent
8f7868cae7
commit
8492da652a
|
@ -68,6 +68,14 @@ namespace controllers\internals;
|
|||
return false;
|
||||
}
|
||||
|
||||
//Check if the received message is a SMS STOP and we must register it
|
||||
$internal_smsstop = new SmsStop($this->bdd);
|
||||
$is_stop = $internal_smsstop->check_for_stop($received['text']);
|
||||
if ($is_stop)
|
||||
{
|
||||
$internal_smsstop->create($id_user, $origin);
|
||||
}
|
||||
|
||||
//Link medias
|
||||
$internal_media = new Media($this->bdd);
|
||||
foreach ($media_ids as $media_id)
|
||||
|
|
|
@ -285,7 +285,9 @@ namespace controllers\internals;
|
|||
$internal_group = new \controllers\internals\Group($this->bdd);
|
||||
$internal_conditional_group = new \controllers\internals\ConditionalGroup($this->bdd);
|
||||
$internal_phone = new \controllers\internals\Phone($this->bdd);
|
||||
$internal_smsstop = new \controllers\internals\SmsStop($this->bdd);
|
||||
|
||||
$users_smsstops = [];
|
||||
$users_settings = [];
|
||||
$users_phones = [];
|
||||
$users_mms_phones = [];
|
||||
|
@ -305,6 +307,17 @@ namespace controllers\internals;
|
|||
$users_settings[$scheduled['id_user']][$name] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($users_smsstops[$scheduled['id_user']]) && $users_settings[$scheduled['id_user']]['smsstop'])
|
||||
{
|
||||
$users_smsstops[$scheduled['id_user']] = [];
|
||||
|
||||
$smsstops = $internal_smsstop->gets_for_user($scheduled['id_user']);
|
||||
foreach ($smsstops as $smsstop)
|
||||
{
|
||||
$users_settings[$scheduled['id_user']][] = $smsstop['number'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($users_phones[$scheduled['id_user']]))
|
||||
{
|
||||
|
@ -467,6 +480,12 @@ namespace controllers\internals;
|
|||
continue;
|
||||
}
|
||||
|
||||
//Remove messages to smsstops numbers
|
||||
if (in_array($message['destination'], $users_smsstops[$scheduled['id_user']]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$smss_to_send[] = $message;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,4 +73,15 @@ namespace controllers\internals;
|
|||
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a string to check if its a SMS stop
|
||||
*
|
||||
* @param string $str : The string to check
|
||||
* @return bool : true if sms stop, false else
|
||||
*/
|
||||
public function check_for_stop (string $str)
|
||||
{
|
||||
return trim(mb_strtolower($str)) == 'STOP';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue