$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureSubscribe WHERE subscribe_id='{$subscribe_id}'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); $edit_subscribe_keyword = $db_row['subscribe_keyword']; $edit_subscribe_msg = $db_row['subscribe_msg']; $edit_unsubscribe_msg = $db_row['unsubscribe_msg']; $edit_subscribe_param = $db_row['subscribe_param']; $edit_unsubscribe_param = $db_row['unsubscribe_param']; $edit_forward_param = $db_row['forward_param']; $max_length = $core_config['main']['max_sms_length']; $edit_unknown_format_msg = $db_row['unknown_format_msg']; $edit_already_member_msg = $db_row['already_member_msg']; $edit_expire_msg = $db_row['expire_msg']; $select_durations = _select('edit_duration', $plugin_config['sms_subscribe']['durations'], $db_row['duration']); if (auth_isadmin()) { $select_reply_smsc = "<tr><td>" . _('SMSC') . "</td><td>" . gateway_select_smsc('smsc', $db_row['smsc']) . "</td></tr>"; } if ($err = $_SESSION['error_string']) { $content = "<div class=error_string>{$err}</div>"; } $content .= "\n\t\t\t<link rel='stylesheet' type='text/css' href=" . _HTTP_PATH_THEMES_ . "/common/jscss/sms_subscribe.css />\n\t\t\t<h2>" . _('Manage subscribe') . "</h2>\n\t\t\t<h3>" . _('Edit SMS subscribe') . "</h3>\n\t\t\t<form name=\"form_subscribe_edit\" id=\"form_subscribe_edit\" action=index.php?app=main&inc=feature_sms_subscribe&op=sms_subscribe_edit_yes method=post>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<input type=hidden name=subscribe_id value=\"{$subscribe_id}\">\n\t\t\t<input type=hidden name=edit_subscribe_keyword value=\"{$edit_subscribe_keyword}\">\n\t\t\t<table class=playsms-table>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('SMS subscribe keyword') . "</td><td>{$edit_subscribe_keyword}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('SMS subscribe parameter') . "</td>\n\t\t\t\t\n\t\t\t\t<td>\n\t\t\t\t\t<input type=text size=10 maxlength=20 name=edit_subscribe_param value=\"{$edit_subscribe_param}\">\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('SMS subscribe reply') . "</td>\n\t\t\t\t<td>\n\t\t\t\t\t<textarea maxlength=\"140\" name=\"edit_subscribe_msg\" id=\"edit_subscribe_msg\" value=\"\" cols=\"35\" rows=\"3\" \n\t\t\t\t\t\tonClick=\"SmsSetCounter_Abstract('edit_subscribe_msg','txtcount','hiddcount','hiddcount_unicode');\" \n\t\t\t\t\t\tonkeypress=\"SmsSetCounter_Abstract('edit_subscribe_msg','txtcount','hiddcount','hiddcount_unicode');\" \n\t\t\t\t\t\tonblur=\"SmsSetCounter_Abstract('edit_subscribe_msg','txtcount','hiddcount','hiddcount_unicode');\" \n\t\t\t\t\t\tonKeyUp=\"SmsSetCounter_Abstract('edit_subscribe_msg','txtcount','hiddcount','hiddcount_unicode');\"\t\n\t\t\t\t\t\tonKeyUp=\"SmsCountKeyUp_Abstract({$max_length}, 'form_subscribe_edit', 'edit_subscribe_msg');\" \n\t\t\t\t\t\tonKeyDown=\"SmsCountKeyDown_Abstract({$max_length}, 'form_subscribe_edit');\">{$edit_subscribe_msg}</textarea>\n\t\t\t\t\t<br>\n\t\t\t\t\t<input type=\"text\" style=\"font-weight:bold;\" name=\"txtcount\" id=\"txtcount\" value=\"0 char : 0 SMS\" size=\"17\" onFocus=\"document.form_subscribe_edit.edit_subscribe_msg.focus();\" readonly>\n\t\t\t\t\t<input type=\"hidden\" value=\"" . $core_config['main']['max_sms_length'] . "\" name=\"hiddcount\" id=\"hiddcount\"> \n\t\t\t\t\t<input type=\"hidden\" value=\"" . $core_config['main']['max_sms_length_unicode'] . "\" name=\"hiddcount_unicode\" id=\"hiddcount_unicode\"> \n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('SMS unsubscribe parameter') . "</td>\n\t\t\t\t\n\t\t\t\t<td>\n\t\t\t\t\t<input type=text size=10 maxlength=20 name=edit_unsubscribe_param value=\"{$edit_unsubscribe_param}\">\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('SMS unsubscribe reply') . "</td>\n\t\t\t\t<td>\n\t\t\t\t\t<textarea maxlength=\"140\" name=\"edit_unsubscribe_msg\" id=\"edit_unsubscribe_msg\" value=\"\" cols=\"35\" rows=\"3\" \n\t\t\t\t\t\tonClick=\"SmsSetCounter_Abstract('edit_unsubscribe_msg','txtcount_un','hiddcount_un','hiddcount_unicode_un');\" \n\t\t\t\t\t\tonkeypress=\"SmsSetCounter_Abstract('edit_unsubscribe_msg','txtcount_un','hiddcount_un','hiddcount_unicode_un');\" \n\t\t\t\t\t\tonblur=\"SmsSetCounter_Abstract('edit_unsubscribe_msg','txtcount_un','hiddcount_un','hiddcount_unicode_un');\" \n\t\t\t\t\t\tonKeyUp=\"SmsSetCounter_Abstract('edit_unsubscribe_msg','txtcount_un','hiddcount_un','hiddcount_unicode_un');\"\t\n\t\t\t\t\t\tonKeyUp=\"SmsCountKeyUp_Abstract({$max_length}, 'form_subscribe_edit', 'edit_unsubscribe_msg');\" \n\t\t\t\t\t\tonKeyDown=\"SmsCountKeyDown_Abstract({$max_length}, 'form_subscribe_edit');\">{$edit_unsubscribe_msg}</textarea>\n\t\t\t\t\t<br>\n\t\t\t\t\t<input type=\"text\" style=\"font-weight:bold;\" name=\"txtcount_un\" id=\"txtcount_un\" value=\"0 char : 0 SMS\" size=\"17\" onFocus=\"document.form_subscribe_edit.edit_unsubscribe_msg.focus();\" readonly>\n\t\t\t\t\t<input type=\"hidden\" value=\"" . $core_config['main']['max_sms_length'] . "\" name=\"hiddcount_un\" id=\"hiddcount_un\"> \n\t\t\t\t\t<input type=\"hidden\" value=\"" . $core_config['main']['max_sms_length_unicode'] . "\" name=\"hiddcount_unicode_un\" id=\"hiddcount_unicode_un\"> \n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('SMS forward parameter') . "</td>\t\t\t\t\n\t\t\t\t<td>\n\t\t\t\t\t<input type=text size=10 maxlength=20 name=edit_forward_param value=\"{$edit_forward_param}\">\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Subscribe duration') . "</td>\t\t\t\t\n\t\t\t\t<td>" . $select_durations . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Subscription expired reply') . "</td>\n\t\t\t\t<td>\n\t\t\t\t\t<textarea maxlength=\"140\" name=\"edit_expire_msg\" id=\"edit_expire_msg\" value=\"\" cols=\"35\" rows=\"3\" \n\t\t\t\t\t\tonClick=\"SmsSetCounter_Abstract('edit_expire_msg','txtcount_ex','hiddcount_ex','hiddcount_unicode_ex');\" \n\t\t\t\t\t\tonkeypress=\"SmsSetCounter_Abstract('edit_expire_msg','txtcount_ex','hiddcount_ex','hiddcount_unicode_ex');\" \n\t\t\t\t\t\tonblur=\"SmsSetCounter_Abstract('edit_expire_msg','txtcount_ex','hiddcount_ex','hiddcount_unicode_ex');\" \n\t\t\t\t\t\tonKeyUp=\"SmsSetCounter_Abstract('edit_expire_msg','txtcount_ex','hiddcount_ex','hiddcount_unicode_ex');\"\t\n\t\t\t\t\t\tonKeyUp=\"SmsCountKeyUp_Abstract({$max_length}, 'form_subscribe_add', 'edit_expire_msg');\" \n\t\t\t\t\t\tonKeyDown=\"SmsCountKeyDown_Abstract({$max_length}, 'form_subscribe_add');\">{$edit_expire_msg}</textarea>\n\t\t\t\t\t<br>\n\t\t\t\t\t<input type=\"text\" style=\"font-weight:bold;\" name=\"txtcount_ex\" id=\"txtcount_ex\" value=\"0 char : 0 SMS\" size=\"17\" onFocus=\"document.form_subscribe_add.edit_expire_msg.focus();\" readonly>\n\t\t\t\t\t<input type=\"hidden\" value=\"" . $core_config['main']['max_sms_length'] . "\" name=\"hiddcount_ex\" id=\"hiddcount_ex\"> \n\t\t\t\t\t<input type=\"hidden\" value=\"" . $core_config['main']['max_sms_length_unicode'] . "\" name=\"hiddcount_unicode_ex\" id=\"hiddcount_unicode_ex\"> \n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Unknown format reply') . "</td>\n\t\t\t\t<td>\n\t\t\t\t\t<textarea maxlength=\"140\" name=\"edit_unknown_format_msg\" id=\"edit_unknown_format_msg\" value=\"\" cols=\"35\" rows=\"3\" \n\t\t\t\t\t\tonClick=\"SmsSetCounter_Abstract('edit_unknown_format_msg','txtcount_uk','hiddcount_uk','hiddcount_unicode_uk');\" \n\t\t\t\t\t\tonkeypress=\"SmsSetCounter_Abstract('edit_unknown_format_msg','txtcount_uk','hiddcount_uk','hiddcount_unicode_uk');\" \n\t\t\t\t\t\tonblur=\"SmsSetCounter_Abstract('edit_unknown_format_msg','txtcount_uk','hiddcount_uk','hiddcount_unicode_uk');\" \n\t\t\t\t\t\tonKeyUp=\"SmsSetCounter_Abstract('edit_unknown_format_msg','txtcount_uk','hiddcount_uk','hiddcount_unicode_uk');\"\t\n\t\t\t\t\t\tonKeyUp=\"SmsCountKeyUp_Abstract({$max_length}, 'form_subscribe_add', 'edit_unknown_format_msg');\" \n\t\t\t\t\t\tonKeyDown=\"SmsCountKeyDown_Abstract({$max_length}, 'form_subscribe_add');\">{$edit_unknown_format_msg}</textarea>\n\t\t\t\t\t<br>\n\t\t\t\t\t<input type=\"text\" style=\"font-weight:bold;\" name=\"txtcount_uk\" id=\"txtcount_uk\" value=\"0 char : 0 SMS\" size=\"17\" onFocus=\"document.form_subscribe_add.edit_unknown_format_msg.focus();\" readonly>\n\t\t\t\t\t<input type=\"hidden\" value=\"" . $core_config['main']['max_sms_length'] . "\" name=\"hiddcount_uk\" id=\"hiddcount_uk\"> \n\t\t\t\t\t<input type=\"hidden\" value=\"" . $core_config['main']['max_sms_length_unicode'] . "\" name=\"hiddcount_unicode_uk\" id=\"hiddcount_unicode_uk\"> \n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Already a member reply') . "</td>\n\t\t\t\t<td>\n\t\t\t\t\t<textarea maxlength=\"140\" name=\"edit_already_member_msg\" id=\"edit_already_member_msg\" value=\"\" cols=\"35\" rows=\"3\" \n\t\t\t\t\t\tonClick=\"SmsSetCounter_Abstract('edit_already_member_msg','txtcount_am','hiddcount_am','hiddcount_unicode_am');\" \n\t\t\t\t\t\tonkeypress=\"SmsSetCounter_Abstract('edit_already_member_msg','txtcount_am','hiddcount_am','hiddcount_unicode_am');\" \n\t\t\t\t\t\tonblur=\"SmsSetCounter_Abstract('edit_already_member_msg','txtcount_am','hiddcount_am','hiddcount_unicode_am');\" \n\t\t\t\t\t\tonKeyUp=\"SmsSetCounter_Abstract('edit_already_member_msg','txtcount_am','hiddcount_am','hiddcount_unicode_am');\"\t\n\t\t\t\t\t\tonKeyUp=\"SmsCountKeyUp_Abstract({$max_length}, 'form_subscribe_add', 'edit_already_member_msg');\" \n\t\t\t\t\t\tonKeyDown=\"SmsCountKeyDown_Abstract({$max_length}, 'form_subscribe_add');\">{$edit_already_member_msg}</textarea>\n\t\t\t\t\t<br>\n\t\t\t\t\t<input type=\"text\" style=\"font-weight:bold;\" name=\"txtcount_am\" id=\"txtcount_am\" value=\"0 char : 0 SMS\" size=\"17\" onFocus=\"document.form_subscribe_add.edit_already_member_msg.focus();\" readonly>\n\t\t\t\t\t<input type=\"hidden\" value=\"" . $core_config['main']['max_sms_length'] . "\" name=\"hiddcount_am\" id=\"hiddcount_am\"> \n\t\t\t\t\t<input type=\"hidden\" value=\"" . $core_config['main']['max_sms_length_unicode'] . "\" name=\"hiddcount_unicode_am\" id=\"hiddcount_unicode_am\"> \n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t" . $select_reply_smsc . "\n\t\t</table>\n\t\t<p><input type=submit class=button value=\"" . _('Save') . "\">\n\t\t</form>\n\t\t<p>" . _back('index.php?app=main&inc=feature_sms_subscribe&op=sms_subscribe_list'); _p($content); break; case "sms_subscribe_edit_yes": $edit_subscribe_keyword = strtoupper($_POST['edit_subscribe_keyword']); $edit_subscribe_msg = $_POST['edit_subscribe_msg']; $edit_unsubscribe_msg = $_POST['edit_unsubscribe_msg']; $edit_subscribe_param = strtoupper($_POST['edit_subscribe_param']); $edit_unsubscribe_param = strtoupper($_POST['edit_unsubscribe_param']); $edit_forward_param = strtoupper($_POST['edit_forward_param'] ? $_POST['edit_forward_param'] : 'BC'); $edit_forward_param = strtoupper($_POST['edit_forward_param']);
break; case "autorespond_edit": if (!auth_isadmin()) { auth_block(); } $db_query = "SELECT * FROM " . _DB_PREF_ . "_featureAutorespond WHERE id='{$id}' AND flag_deleted='0'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); $edit_service_name = _lastpost('edit_service_name') ? _lastpost('edit_service_name') : $db_row['service_name']; $edit_regex = _lastpost('edit_regex') ? _lastpost('edit_regex') : $db_row['regex']; $edit_message = _lastpost('edit_message') ? _lastpost('edit_message') : $db_row['message']; $edit_uid = $db_row['uid']; $edit_sms_receiver = $db_row['sms_receiver']; $edit_smsc = $db_row['smsc']; if (auth_isadmin()) { $select_reply_smsc = "<tr><td>" . _('SMSC') . "</td><td>" . gateway_select_smsc('edit_smsc', $edit_smsc) . "</td></tr>"; } $content .= _dialog() . "\n\t\t\t<h2>" . _('Manage autorespond') . "</h2>\n\t\t\t<h3>" . _('Edit SMS autorespond') . "</h3>\n\t\t\t<form action=index.php?app=main&inc=feature_autorespond&op=autorespond_edit_yes method=post>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<input type=hidden name=id value={$id}>\n\t\t\t<table class=playsms-table>\n\t\t\t\t<tbody>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=label-sizer>" . _mandatory(_('Service')) . "</td><td><input type=text size=30 maxlength=255 name=edit_service_name value=\"" . $edit_service_name . "\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _mandatory(_('Regex')) . "</td><td><input type=text size=140 maxlength=140 name=edit_regex value=\"" . $edit_regex . "\"> " . _hint(_('Regular expression to match with incoming SMS')) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _mandatory(_('Respond message')) . "</td><td><input type=text name=edit_message value=\"" . $edit_message . "\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _mandatory(_('User')) . "</td><td>" . themes_select_users_single('edit_uid', $edit_uid) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _('Receiver number') . "</td><td><input type=text size=30 maxlength=20 name=edit_sms_receiver value=\"" . $edit_sms_receiver . "\"></td>\n\t\t\t\t</tr>\n\t\t\t\t" . $select_reply_smsc . "\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<p><input type=submit class=button value=\"" . _('Save') . "\">\n\t\t\t</form>\n\t\t\t" . _back('index.php?app=main&inc=feature_autorespond&op=autorespond_list'); _p($content); break; case "autorespond_edit_yes": if (!auth_isadmin()) { auth_block(); } $edit_service_name = trim($_POST['edit_service_name']); $edit_regex = trim($_POST['edit_regex']); $edit_message = trim($_POST['edit_message']); $edit_uid = (int) $_POST['edit_uid']; $edit_sms_receiver = trim($_POST['edit_sms_receiver']); $edit_smsc = trim($_POST['edit_smsc']); if ($id && $edit_service_name && $edit_regex && $edit_message && $edit_uid) {