Пример #1
0
         $sms_from = $mobile;
     }
     // WWW
     $db_query2 = "SELECT * FROM playsms_tblSMSTemplate WHERE uid='{$uid}'";
     $db_result2 = dba_query($db_query2);
     $j = 0;
     $option_values = "<option value=\"\" default>--Please Select--</option>";
     while ($db_row = dba_fetch_array($db_result2)) {
         $j++;
         $option_values .= "<option value=\"" . $db_row[t_text] . "\">" . $db_row[t_title] . "</option>";
         $input_values .= "<input type=\"hidden\" name=\"content_{$j}\" value=\"" . $db_row[t_text] . "\">";
     }
     // document.fm_sendsms.message.value = document.fm_smstemplate.content_num.value;
     $nameForm = "fm_sendsms";
     $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>&nbsp;</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=\"&gt;&gt;\" 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 &gt;&gt;\" 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=\"&lt;&lt;\" 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 &lt;&lt;\" 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>&nbsp;</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";
         }
Пример #2
0
     $t_text = $_POST[t_text];
     $db_query = "INSERT INTO playsms_tblSMSTemplate (uid,t_title,t_text) VALUES ('{$uid}','{$t_title}','{$t_text}')";
     $db_result = dba_insert_id($db_query);
     if ($db_result > 0) {
         $error_string = "Message template is saved";
     } else {
         // FIXME
     }
     header("Location: menu.php?inc=sms_template&op=list&err=" . urlencode($error_string));
     break;
 case "edit_template":
     $db_query = "SELECT * FROM playsms_tblSMSTemplate WHERE tid='{$tid}'";
     $db_result = dba_query($db_query);
     $db_row = dba_fetch_array($db_result);
     $formName = "editTemplate";
     $smsinput .= generateSmsInput($formName, "Message template content: ", $db_row[t_text], "t_text");
     $content = "\n\t\t\t    <h2>Edit message template</h2>\n\t\t\t    <p>\n\t\t\t    <form name= \"{$formName}\" id= \"{$formName}\" action=\"menu.php?inc=sms_template&op=edit_yes&tid={$tid}\" method=\"post\">\n\t\t\t    <p/>Message template name:\n\t\t\t    <br/><input type=\"text\" size= \"50\" maxlength=\"100\" name=\"t_title\" value=\"" . $db_row[t_title] . "\">\n\t\t\t    {$smsinput}\n\t\t\t    <p><input type=\"submit\" class=\"button\" value=\"Save Template\">\n\t\t\t    <input type=\"hidden\" name=\"item_count\" value=\"{$i}\">\n\t\t\t    </form>\n\t\t\t    <p><li><a href=\"menu.php?inc=sms_template&op=list\">Back</a>\n\t\t\t    </form>\n\t\t\t";
     echo $content;
     break;
 case "edit_yes":
     $t_title = $_POST[t_title];
     $t_text = $_POST[t_text];
     $db_query = "UPDATE playsms_tblSMSTemplate SET t_title='{$t_title}', t_text='{$t_text}' WHERE tid='{$tid}'";
     $db_result = dba_affected_rows($db_query);
     if ($db_result > 0) {
         $error_string = "Message template has been edited";
     } else {
         $error_string = "Fail to edit message template";
     }
     header("Location: menu.php?inc=sms_template&op=list&err={$err}=" . urlencode($error_string));
     break;