//echo "Нажмите <a href='./index.php?module=Administration&action=smsProvider'>сюда</a>, чтобы настроить шлюз.</div>"; break; } $resp = $sms->balance(); echo $resp; break; case "editor": $sms->retrieve_settings(); if (empty($sms->params['sms_instance_id'])) { echo "<div style='background-color:#fff;padding:10px;text-align:center;'>Вы не настроили SMS шлюз. "; echo "Нажмите <a href='./index.php?module=Administration&action=smsProvider'>сюда</a>, чтобы настроить шлюз.</div>"; break; } if (isset($_GET['rec'])) { $sugartalk_SMS = new sugartalk_SMS(); $sugartalk_SMS->retrieve($_GET['rec']); $phone_number = $sugartalk_SMS->phone_number; $msg = $sugartalk_SMS->description; $pid = $sugartalk_SMS->id; // uses $pid to store the record id $ptype = $sugartalk_SMS->parent_type; // not really needed but may be later $pname = $sugartalk_SMS->name; // not really needed but may be later $onclick = "resend_sms();"; $send_to_multi = '0'; } else { $mod_key_sing = $GLOBALS["beanList"][$_GET['ptype']]; $mod_bean_files = $GLOBALS["beanFiles"][$mod_key_sing]; # retrieve configured SMS phone field for the active module require_once "modules/Administration/sugartalk_smsPhone/sms_enzyme.php";
function resend($sms_id, $to, $text) { global $current_user; $sugartalk_SMS = new sugartalk_SMS(); $sugartalk_SMS->retrieve($sms_id); if (isset($sugartalk_SMS->id) and !empty($sugartalk_SMS->id)) { $to = preg_replace('/[^0-9]/', '', $to); $response = $this->send($to, $text); $sugartalk_SMS->phone_number = strlen($to) ? $to . " " : "-none-"; $sugartalk_SMS->description = $text; $sugartalk_SMS->api_message = $response['API_MSG']; $sugartalk_SMS->delivery_status = $response['STATUS']; $sugartalk_SMS->type = "outbound"; $sugartalk_SMS->save(); } else { $this->response_text = "Javascript fault: Unable to send message."; } $this->response_text = $response['API_MSG']; return $this->response_text; }