function sms_quiz_hook_setsmsincomingaction($sms_datetime, $sms_sender, $quiz_keyword, $quiz_param = '', $sms_receiver = '') { $ok = false; $db_query = "SELECT uid FROM " . _DB_PREF_ . "_featureQuiz WHERE quiz_keyword='{$quiz_keyword}'"; $db_result = dba_query($db_query); if ($db_row = dba_fetch_array($db_result)) { $c_uid = $db_row['uid']; if (sms_quiz_handle($c_uid, $sms_datetime, $sms_sender, $quiz_keyword, $quiz_param)) { $ok = true; } } $ret['uid'] = $c_uid; $ret['status'] = $ok; return $ret; }
function sms_quiz_hook_recvsms_process($sms_datetime, $sms_sender, $quiz_keyword, $quiz_param = '', $sms_receiver = '', $smsc = '', $raw_message = '') { $ok = false; $db_query = "SELECT * FROM " . _DB_PREF_ . "_featureQuiz WHERE quiz_keyword='{$quiz_keyword}'"; $db_result = dba_query($db_query); if ($db_row = dba_fetch_array($db_result)) { if ($db_row['uid'] && $db_row['quiz_enable']) { $smsc = gateway_decide_smsc($smsc, $db_row['smsc']); logger_print('begin k:' . $quiz_keyword . ' c:' . $quiz_param, 2, 'sms_quiz'); if (sms_quiz_handle($db_row, $sms_datetime, $sms_sender, $quiz_keyword, $quiz_param, $sms_receiver, $smsc, $raw_message)) { $ok = true; } $status = $ok ? 'handled' : 'unhandled'; logger_print('end k:' . $quiz_keyword . ' c:' . $quiz_param . ' s:' . $status, 2, 'sms_quiz'); } } $ret['uid'] = $db_row['uid']; $ret['status'] = $ok; return $ret; }