} else {
         $_SESSION['dialog']['danger'][] = _('All mandatory fields must be filled');
     }
     header("Location: " . _u('index.php?app=main&inc=feature_autorespond&op=autorespond_add'));
     exit;
     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']);
예제 #2
0
     $db_query = "SELECT custom_keyword FROM " . _DB_PREF_ . "_featureCustom WHERE custom_id='{$custom_id}'";
     $db_result = dba_query($db_query);
     $db_row = dba_fetch_array($db_result);
     if ($db_row['custom_keyword']) {
         $db_query = "DELETE FROM " . _DB_PREF_ . "_featureCustom WHERE custom_id='{$custom_id}'";
         if (@dba_affected_rows($db_query)) {
             $_SESSION['dialog']['info'][] = _('SMS custom has been deleted');
         } else {
             $_SESSION['dialog']['danger'][] = _('Fail to delete SMS custom');
         }
     }
     header("Location: " . _u('index.php?app=main&inc=feature_sms_custom&op=sms_custom_list'));
     exit;
     break;
 case "sms_custom_add":
     $content .= _dialog() . "\n\t\t\t<h2>" . _('Manage custom') . "</h2>\n\t\t\t<h3>" . _('Add SMS custom') . "</h3>\n\t\t\t<form action=index.php?app=main&inc=feature_sms_custom&op=sms_custom_add_yes method=post>\n\t\t\t" . _CSRF_FORM_ . "\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 name')) . "</td><td><input type=text size=30 maxlength=255 name=add_service_name value=\"" . _lastpost('add_service_name') . "\"></td>\n\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _mandatory(_('SMS custom keywords')) . "</td><td><input type=text size=30 maxlength=255 name=add_custom_keyword value=\"" . _lastpost('add_custom_keyword') . "\"> " . _hint('Multiple keywords seperated by space') . "</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=add_sms_receiver value=\"" . _lastpost('add_sms_receiver') . "\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2>" . _('Pass these parameters to custom URL field') . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2>\n\t\t\t\t\t\t" . _('Pass these parameters to custom URL field') . "\n\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t<li>{SERVICENAME} " . _('will be replaced by service name') . "</li>\n\t\t\t\t\t\t\t<li>{SMSDATETIME} " . _('will be replaced by SMS incoming date/time') . "</li>\n\t\t\t\t\t\t\t<li>{SMSSENDER} " . _('will be replaced by sender number') . "</li>\n\t\t\t\t\t\t\t<li>{SMSRECEIVER} " . _('will be replaced by receiver number') . "</li>\n\t\t\t\t\t\t\t<li>{CUSTOMKEYWORD} " . _('will be replaced by custom keyword') . "</li>\n\t\t\t\t\t\t\t<li>{CUSTOMPARAM} " . _('will be replaced by custom parameter passed to server from SMS') . "</li>\n\t\t\t\t\t\t\t<li>{CUSTOMRAW} " . _('will be replaced by SMS raw message') . "</li>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t" . _('Example of SMS custom URL') . "\n\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t<li>" . htmlspecialchars('http://someserver.somedomain/handler.php?service={SERVICENAME}&datetime={SMSDATETIME}&sender={SMSSENDER}&receiver={SMSRECEIVER}&keyword={CUSTOMKEYWORD}&param={CUSTOMPARAM}&raw={CUSTOMRAW}') . "</li>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _mandatory(_('SMS custom URL')) . "</td><td><input type=text maxlength=255 name=add_custom_url value=\"" . _lastpost('add_custom_url') . "\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _('Make return as reply') . "</td><td><input type=checkbox name=add_custom_return_as_reply></td>\n\t\t\t\t</tr>\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_sms_custom&op=sms_custom_list');
     _p($content);
     break;
 case "sms_custom_add_yes":
     $add_service_name = trim($_POST['add_service_name']);
     $add_sms_receiver = trim($_POST['add_sms_receiver']);
     $add_custom_return_as_reply = $_POST['add_custom_return_as_reply'] == 'on' ? '1' : '0';
     $add_custom_url = $_POST['add_custom_url'];
     $add_custom_keyword = strtoupper($_POST['add_custom_keyword']);
     $c_keywords = explode(' ', $add_custom_keyword);
     foreach ($c_keywords as $keyword) {
         if ($keyword) {
             if (keyword_isavail($keyword, $add_sms_receiver)) {
                 $keywords .= core_sanitize_alphanumeric($keyword) . ' ';
             } else {
                 $_SESSION['dialog']['danger'][] = sprintf(_('Keyword %s is not available'), $keyword);
예제 #3
0
     $content = _dialog() . "\n\t\t\t<h2>" . _('Phonebook') . "</h2>\n\t\t\t<h3>" . _('Group') . "</h3>\n\t\t\t<p>" . $search['form'] . "</p>\n\t\t\t<form id=fm_phonebook_group_list name=fm_phonebook_group_list action='index.php?app=main&inc=feature_phonebook&route=group&op=actions' method=post>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<input type=hidden name=go value=delete>\n\t\t\t<div class=actions_box>\n\t\t\t\t<div class=pull-left>\n\t\t\t\t\t<a href='" . _u('index.php?app=main&inc=feature_phonebook&route=group&op=add') . "'>" . $icon_config['add'] . "</a>\n\t\t\t\t</div>\n\t\t\t\t<div class=pull-right>" . $nav['form'] . "</div>\n\t\t\t</div>\n\t\t\t<div class=table-responsive>\n\t\t\t<table class=playsms-table-list>\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th width=60%>" . _('Name') . "</th>\n\t\t\t\t<th width=35%>" . _('Group code') . "</th>\n\t\t\t\t<th width=5%>" . _('Action') . "</th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>";
     $j = 0;
     for ($j = 0; $j < count($list); $j++) {
         $gpid = $list[$j]['id'];
         $name = $list[$j]['name'];
         $code = $list[$j]['code'];
         $flag_sender = (int) $list[$j]['flag_sender'];
         $i++;
         $content .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td><a href='" . _u('index.php?app=main&inc=feature_phonebook&route=group&op=edit&gpid=' . $gpid) . "'>" . $name . "</a></td>\n\t\t\t\t\t<td>" . $phonebook_flag_sender[$flag_sender] . " " . $code . "</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<a href='" . _u('index.php?app=main&inc=feature_phonebook&route=group&op=actions&go=delete&gpid=' . $gpid) . "' onClick=\"return SureConfirm();\">" . $icon_config['delete'] . "</a>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>";
     }
     $content .= "\n\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t</div>\n\t\t\t</form>\n\t\t\t" . _back('index.php?app=main&inc=feature_phonebook&op=phonebook_list');
     _p($content);
     break;
 case "add":
     $option_flag_sender = "\n\t\t\t<option value='0'>" . _('Me only') . "</option>\n\t\t\t<option value='1'>" . _('Members') . "</option>\n\t\t\t<option value='2'>" . _('Anyone') . "</option>";
     $content = _dialog() . "\n\t\t\t<h2>" . _('Phonebook') . "</h2>\n\t\t\t<h3>" . _('Add group') . "</h3>\n\t\t\t<p>\n\t\t\t<form action=\"index.php?app=main&inc=feature_phonebook&route=group&op=actions&go=add\" method=POST>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<table class=playsms-table>\n\t\t\t<tbody>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=label-sizer>" . _('Group name') . "</td>\n\t\t\t\t\t<td><input type=text name=group_name value=\"" . _lastpost('group_name') . "\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _('Group code') . "</td>\n\t\t\t\t\t<td><input type=text name=group_code size=10 value=\"" . _lastpost('group_code') . "\"> " . _hint(_('Group code may be used to broadcast SMS to this group') . ". " . _('Please use alphanumeric only and make it short')) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _('Share phonebook and allow broadcast') . "</td>\n\t\t\t\t\t<td><select name=flag_sender>" . $option_flag_sender . "</select> " . _hint(_('Share this phonebook group and set permission for broadcasting SMS to this group from mobile phone')) . "</td>\n\t\t\t\t</tr>\n\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<p><input type=submit class=button value=\"" . _('Save') . "\"></p>\n\t\t\t</form>\n\t\t\t" . _back('index.php?app=main&inc=feature_phonebook&route=group&op=list');
     _p($content);
     break;
 case "edit":
     $gpid = $_REQUEST['gpid'];
     $group = phonebook_getgroupbyid($gpid);
     ${'selected_' . $group['flag_sender']} = 'selected';
     $option_flag_sender = "\n\t\t\t<option value='0' {$selected_0}>" . _('Me only') . "</option>\n\t\t\t<option value='1' {$selected_1}>" . _('Members') . "</option>\n\t\t\t<option value='2' {$selected_2}>" . _('Anyone') . "</option>";
     $content = _dialog() . "\n\t\t\t<h2>" . _('Phonebook') . "</h2>\n\t\t\t<h3>" . _('Edit group') . "</h3>\n\t\t\t<p>\n\t\t\t<form action=\"index.php?app=main&inc=feature_phonebook&route=group&op=actions&go=edit\" method=POST>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<input type=hidden name=gpid value=\"{$gpid}\">\n\t\t\t<table class=playsms-table>\n\t\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('Group name') . "</td>\n\t\t\t\t<td><input type=text name=group_name value=\"" . phonebook_groupid2name($user_config['uid'], $gpid) . "\"></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Group code') . "</td>\n\t\t\t\t<td><input type=text name=group_code value=\"" . phonebook_groupid2code($user_config['uid'], $gpid) . "\" size=10> " . _hint(_('Please use uppercase and make it short')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Share phonebook and allow broadcast') . "</td>\n\t\t\t\t<td><select name=flag_sender>" . $option_flag_sender . "</select> " . _hint(_('Share this phonebook group and set permission for broadcasting SMS to this group from mobile phone')) . "</td>\n\t\t\t</tr>\n\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<p><input type=submit class=button value=\"" . _('Save') . "\"></p>\n\t\t\t</form>\n\t\t\t" . _back('index.php?app=main&inc=feature_phonebook&route=group&op=list');
     if ($err = TRUE) {
         _p(_dialog());
     }
     _p($content);
     break;
 case "actions":
     $nav = themes_nav_session();