function sms_autoreply_hook_setsmsincomingaction($sms_datetime, $sms_sender, $autoreply_keyword, $autoreply_param = '', $sms_receiver = '') { $ok = false; $db_query = "SELECT uid,autoreply_id FROM " . _DB_PREF_ . "_featureAutoreply WHERE autoreply_keyword='{$autoreply_keyword}'"; $db_result = dba_query($db_query); if ($db_row = dba_fetch_array($db_result)) { $c_uid = $db_row['uid']; $autoreply_id = $db_row['autoreply_id']; if (sms_autoreply_handle($sms_datetime, $sms_sender, $c_uid, $autoreply_id, $autoreply_keyword, $autoreply_param)) { $ok = true; } } $ret['uid'] = $c_uid; $ret['status'] = $ok; return $ret; }
/** * Implementations of hook recvsms_process() * * @param $sms_datetime date * and time when incoming sms inserted to playsms * @param $sms_sender sender * on incoming sms * @param $autoreply_keyword check * if keyword is for sms_autoreply * @param $autoreply_param get * parameters from incoming sms * @param $sms_receiver receiver * number that is receiving incoming sms * @return $ret array of keyword owner uid and status, TRUE if incoming sms handled */ function sms_autoreply_hook_recvsms_process($sms_datetime, $sms_sender, $autoreply_keyword, $autoreply_param = '', $sms_receiver = '', $smsc = '', $raw_message = '') { $ok = false; $db_query = "SELECT * FROM " . _DB_PREF_ . "_featureAutoreply WHERE autoreply_keyword='{$autoreply_keyword}'"; $db_result = dba_query($db_query); if ($db_row = dba_fetch_array($db_result)) { $c_uid = $db_row['uid']; $autoreply_id = $db_row['autoreply_id']; $smsc = gateway_decide_smsc($smsc, $db_row['smsc']); if (sms_autoreply_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $autoreply_id, $autoreply_keyword, $autoreply_param, $smsc, $raw_message)) { $ok = true; } } $ret['uid'] = $c_uid; $ret['status'] = $ok; return $ret; }