function sendsmstogr_yes() { $gp_code = $_POST[gp_code]; if (!$gp_code[0]) { $gp_code = $_POST[gp_code_text]; } $msg_flash = $_POST[msg_flash]; $message = $_POST[message]; if ($gp_code && $message) { $sms_type = "text"; if ($msg_flash == "on") { $sms_type = "flash"; } list($ok, $to, $smslog_id) = websend2group($username, $gp_code, $message, $sms_type); for ($i = 0; $i < count($ok); $i++) { if ($ok[$i]) { $error_string .= "Your SMS for `" . $to[$i] . "` has been delivered to queue<br>"; } else { $error_string .= "Fail to sent SMS to `" . $to[$i] . "`<br>"; } } // header("Location: menu.php?inc=send_sms&op=sendsmstogr&message=".urlencode($message)."&err=".urlencode($error_string)); } else { $error_string = "You must select receiver group and your message should not be empty"; // header("Location: menu.php?inc=send_sms&op=sendsmstogr&message=".urlencode($message)."&err=".urlencode("You must select receiver group and your message should not be empty")); } $link_data = array('menuaction' => 'sms.uisms.send_group', 'sms_id' => $sms_id, 'from' => $from, 'message' => urlencode($message), 'err' => urlencode($error_string)); $GLOBALS['phpgw']->redirect_link('/index.php', $link_data); }
function doAutosend($frequency) { echo "autosending for '{$frequency}' <br/>\n"; global $uid; $do = DB_DataObject::factory(playsms_featAutoSend); $do->frequency = $frequency; $do->find(); if ($frequency == "startup") { gw_waitForStartup(); } while ($do->fetch()) { echo "sending {$do->id}, {$do->frequency}, {$do->number}, \"{$do->msg}\"... <br/>\n"; if (gpcode2gpid($uid, $do->number)) { websend2group("admin", $do->number, $do->msg); } else { websend2pv("admin", $do->number, $do->msg); } } }
$content .= "\n\t\t\t\t\t<!-- WWW -->\n\t\t\t\t\t <script language=\"javascript\">\n\t\t\t\t\n\t\t\t\t\t\tfunction setTemplate()\n\t\t\t\t\t\t{\t\t \n\t\t\t\t\t\t sellength = fm_sendsms.smstemplate.length;\n\t\t\t\t\t\t for ( i=0; i<sellength; i++)\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\tif (fm_sendsms.smstemplate.options[i].selected == true)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t fm_sendsms.message.value = fm_sendsms.smstemplate.options[i].value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t }\n\t\t\t\t\t\t}\n\t\t\t\t\t </script>\n\t\t\t\t\n\t\t\t\t\t <form name=\"fm_smstemplate\">\n\t\t\t\t\t {$input_values}\n\t\t\t\t\t </form>\n\t\t\t\t\n\t\t\t\t\t <h2>Send broadcast SMS</h2>\n\t\t\t\t\t <p>\n\t\t\t\t\t <form name={$nameForm} id={$nameForm} action=menu.php?inc=send_sms&op=sendsmstogr_yes method=POST>\n\t\t\t\t\t <p>From: {$sms_from}\n\t\t\t\t\t <p>\n\t\t\t\t\t <p>Send to group: <select name=\"gp_code\">{$list_of_group}</select>\n\t\t\t\t\t <!--\n\t\t\t\t\t <table cellpadding=1 cellspacing=0 border=0>\n\t\t\t\t\t <tr>\n\t\t\t\t\t\t<td nowrap>\n\t\t\t\t\t\t Group(s):<br>\n\t\t\t\t\t\t <select name=\"gp_code_dump[]\" size=\"10\" multiple=\"multiple\" onDblClick=\"moveSelectedOptions(this.form['gp_code_dump[]'],this.form['gp_code[]'])\">{$list_of_group}</select>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td width=10> </td>\n\t\t\t\t\t\t<td align=center valign=middle>\n\t\t\t\t\t\t<input type=\"button\" class=\"button\" value=\">>\" onclick=\"moveSelectedOptions(this.form['gp_code_dump[]'],this.form['gp_code[]'])\"><br><br>\n\t\t\t\t\t\t<input type=\"button\" class=\"button\" value=\"All >>\" onclick=\"moveAllOptions(this.form['gp_code_dump[]'],this.form['gp_code[]'])\"><br><br>\n\t\t\t\t\t\t<input type=\"button\" class=\"button\" value=\"<<\" onclick=\"moveSelectedOptions(this.form['gp_code[]'],this.form['gp_code_dump[]'])\"><br><br>\n\t\t\t\t\t\t<input type=\"button\" class=\"button\" value=\"All <<\" onclick=\"moveAllOptions(this.form['gp_code[]'],this.form['gp_code_dump[]'])\">\n\t\t\t\t\t\t</td>\t\t\n\t\t\t\t\t\t<td width=10> </td>\n\t\t\t\t\t\t<td nowrap>\n\t\t\t\t\t\t Send to:<br>\n\t\t\t\t\t\t <select name=\"gp_code[]\" size=\"10\" multiple=\"multiple\" onDblClick=\"moveSelectedOptions(this.form['gp_code[]'],this.form['gp_code_dump[]'])\"></select>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </table>\n\t\t\t\t\t -->\n\t\t\t\t\t <p>Or: <input type=text size=20 maxlength=20 name=gp_code_text value=\"{$dst_gp_code}\"> (Group name)\n\t\t\t\t\t <p>SMS Footer (SMS Sender ID): {$sms_footer} \n\t\t\t\t\t <!-- WWW -->\n\t\t\t\t\t <p>Message template: <select name=\"smstemplate\">{$option_values}</select>\n\t\t\t\t\t <p><input type=\"button\" onClick=\"javascript: setTemplate();\" name=\"nb\" value=\"Use Template\" class=\"button\">\n\t\t\t\t "; $content .= generateSmsInput($nameForm, "Your message: ", $message, ""); $content .= "\n\t\t\t\t\t <p><input type=checkbox name=msg_flash> Send as flash message\n\t\t\t\t\t <p><input type=submit class=button value=Send onClick=\"selectAllOptions(this.form['gp_code[]'])\"> \n\t\t\t\t\t </form>\n\t\t\t\t\t"; echo $content; break; case "sendsmstogr_yes": $gp_code = $_POST[gp_code]; if (!$gp_code[0]) { $gp_code = $_POST[gp_code_text]; } $msg_flash = $_POST[msg_flash]; $message = $_POST[message]; if ($gp_code && $message) { $sms_type = "text"; if ($msg_flash == "on") { $sms_type = "flash"; } list($ok, $to) = websend2group($username, $gp_code, $message, $sms_type); for ($i = 0; $i < count($ok); $i++) { if ($ok[$i]) { $error_string .= "Your SMS for `" . $to[$i] . "` has been delivered to queue<br>"; } else { $error_string .= "Fail to sent SMS to `" . $to[$i] . "`<br>"; } } header("Location: menu.php?inc=send_sms&op=sendsmstogr&message=" . urlencode($message) . "&err=" . urlencode($error_string)); } else { header("Location: menu.php?inc=send_sms&op=sendsmstogr&message=" . urlencode($message) . "&err=" . urlencode("You must select receiver group and your message should not be empty")); } break; }
echo "OK {$smslog_id}"; } else { echo "ERR 200"; } } else { echo "ERR 201"; } die; break; case "BC": if ($to && $msg) { $transparent = false; if ($trn) { $transparent = true; } if (websend2group($u, $to, $msg)) { echo "OK"; } else { echo "ERR 300"; } } else { echo "ERR 301"; } die; break; case "DS": // output in CSV form: // SMS log ID; Source number; Destination Number; Message; Delivery Time; Update Pending Status Time; SMS Status // SMS Status: // 0 = pending // 1 = sent