예제 #1
0
         $sender_id_list[] = array('username' => $username, 'sender_id' => core_sanitize_sender($list[$j]['registry_key']), 'sender_id_description' => sender_id_description($list[$j]['uid'], $list[$j]['registry_key']), 'lastupdate' => core_display_datetime(core_convert_datetime($list[$j]['c_timestamp'])), 'status' => $toggle_status, 'action' => $action);
     }
     $tpl = array('name' => 'sender_id', 'vars' => array('DIALOG_DISPLAY' => _dialog(), 'SEARCH_FORM' => $search['form'], 'NAV_FORM' => $nav['form'], 'FORM_TITLE' => _('Manage sender ID'), 'ADD_URL' => _u('index.php?app=main&inc=core_sender_id&op=sender_id_add'), 'HTTP_PATH_THEMES' => _HTTP_PATH_THEMES_, 'HINT_STATUS' => _hint(_('Click the status button to enable or disable status')), 'Sender ID' => _('Sender ID'), 'Username' => _('Username'), 'Last update' => _('Last update')), 'ifs' => array('isadmin' => auth_isadmin()), 'loops' => array('sender_id_list' => $sender_id_list), 'injects' => array('icon_config'));
     _p(tpl_apply($tpl));
     break;
 case "sender_id_add":
     $nav = themes_nav_session();
     $search = themes_search_session();
     if ($nav['url']) {
         $ref = $nav['url'] . '&search_keyword=' . $search['keyword'] . '&page=' . $nav['page'] . '&nav=' . $nav['nav'];
     } else {
         $ref = 'index.php?app=main&inc=core_sender_id&op=sender_id_list';
     }
     if (auth_isadmin()) {
         $select_approve = _yesno('approved', 0);
         $select_users = themes_select_users_single('uid', $user_config['uid']);
     }
     $select_default = _yesno('default', 0);
     $tpl = array('name' => 'sender_id_add', 'vars' => array('DIALOG_DISPLAY' => _dialog(), 'FORM_TITLE' => _('Manage sender ID'), 'FORM_SUBTITLE' => _('Add sender ID'), 'ACTION_URL' => _u('index.php?app=main&inc=core_sender_id&op=sender_id_add_yes'), 'BUTTON_BACK' => _back($ref), 'HTTP_PATH_THEMES' => _HTTP_PATH_THEMES_, 'HINT_DEFAULT' => _hint(_('Only when the sender ID is approved')), 'input_tag' => 'required', 'Sender ID' => _mandatory(_('Sender ID')), 'Description' => _('Description'), 'User' => _('User'), 'Approve sender ID' => _('Approve sender ID'), 'Set as default' => _('Set as default')), 'ifs' => array('isadmin' => auth_isadmin()), 'injects' => array('select_default', 'select_approve', 'select_users', 'icon_config', 'core_config'));
     _p(tpl_apply($tpl));
     break;
 case "sender_id_add_yes":
     if (sender_id_add($uid, $c_sender_id, $c_sender_id_description, $_REQUEST['default'], $_REQUEST['approved'])) {
         if (auth_isadmin()) {
             $_SESSION['dialog']['info'][] = _('Sender ID description has been added') . ' (' . _('Sender ID') . ': ' . $c_sender_id . ')';
         } else {
             $_SESSION['dialog']['info'][] = _('Sender ID has been added and waiting for approval') . ' (' . _('Sender ID') . ': ' . $c_sender_id . ')';
         }
     } else {
         $_SESSION['dialog']['info'][] = _('Sender ID is not available') . ' (' . _('Sender ID') . ': ' . $c_sender_id . ')';
     }
예제 #2
0
파일: fn.php 프로젝트: yrahman/playSMS
function themes_select_users_multi($select_field_name, $selected_value = array(), $tag_params = array(), $css_id = '', $css_class = '')
{
    $ret = '';
    if (core_themes_get()) {
        $ret = core_hook(core_themes_get(), 'themes_select_users_multi', array($select_field_name, $selected_value, $tag_params, $css_id, $css_class));
    }
    if (!$ret) {
        $tag_params['multiple'] = 'multiple';
        $ret = themes_select_users_single($select_field_name . '[]', $selected_value, $tag_params, $css_id, $css_class);
        return $ret;
    }
}
예제 #3
0
         if (@dba_affected_rows($db_query)) {
             $_SESSION['error_string'] = _('Route has been saved') . " (" . _('destination') . ": {$up_dst}, " . _('prefix') . ": {$up_prefix})";
         } else {
             $_SESSION['error_string'] = _('Fail to save route') . " (" . _('destination') . ": {$up_dst}, " . _('prefix') . ": {$up_prefix})";
         }
     } else {
         $_SESSION['error_string'] = _('You must fill all mandatory fields');
     }
     header("Location: " . _u('index.php?app=main&inc=feature_outgoing&op=outgoing_edit&rid=' . $rid));
     exit;
     break;
 case "outgoing_add":
     if ($err = $_SESSION['error_string']) {
         $content = "<div class=error_string>{$err}</div>";
     }
     $select_users = themes_select_users_single('add_uid');
     $select_smsc = "<select name=add_smsc>";
     unset($smsc_list);
     $list = gateway_getall_smsc();
     foreach ($list as $c_smsc) {
         $smsc_list[] = $c_smsc['name'];
     }
     foreach ($smsc_list as $smsc_name) {
         $select_smsc .= "<option>" . $smsc_name . "</option>";
     }
     $select_smsc .= "</select>";
     $content .= "\n\t\t\t<h2>" . _('Route outgoing SMS') . "</h2>\n\t\t\t<h3>" . _('Add route') . "</h3>\n\t\t\t<form action='index.php?app=main&inc=feature_outgoing&op=outgoing_add_yes' method='post'>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<table class=playsms-table>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('User') . "</td><td>" . $select_users . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _mandatory(_('Destination name')) . "</td><td><input type='text' maxlength='30' name='add_dst' value=\"{$add_dst}\" required></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _mandatory(_('Prefix')) . "</td><td><input type='text' maxlength=8 name='add_prefix' value=\"{$add_prefix}\" required> " . _hint(_('Maximum 8 digits numeric only')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('SMSC') . "</td><td>" . $select_smsc . "</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t<input type='submit' class='button' value='" . _('Save') . "'>\n\t\t\t</form>\n\t\t\t" . _back('index.php?app=main&inc=feature_outgoing&op=outgoing_list');
     _p($content);
     break;
 case "outgoing_add_yes":
     $add_uid = $_REQUEST['add_uid'];
     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) {
         $db_query = "UPDATE " . _DB_PREF_ . "_featureAutorespond SET last_update='" . core_get_datetime() . "',service_name='{$edit_service_name}',regex='{$edit_regex}',message='{$edit_message}',uid='{$edit_uid}',sms_receiver='{$edit_sms_receiver}',smsc='{$edit_smsc}' WHERE id='{$id}' AND flag_deleted='0'";
         if (@dba_affected_rows($db_query)) {
예제 #5
0
         case 'delete':
             foreach ($items as $item) {
                 $conditions = array('id' => $item);
                 dba_remove(_DB_PREF_ . '_featureFirewall', $conditions);
             }
             break;
     }
     $search = themes_search_session();
     $nav = themes_nav_session();
     $_SESSION['error_string'] = _('IP addreses has been deleted');
     $ref = $search['url'] . '&search_keyword=' . $search['keyword'] . '&search_category=' . $search['category'] . '&page=' . $nav['page'] . '&nav=' . $nav['nav'];
     header("Location: " . _u($ref));
     exit;
     break;
 case "firewall_add":
     $content = _err_display() . "\n\t\t\t<h2>" . _('Manage firewall') . "</h2>\n\t\t\t<h3>" . _('Add blocked IP addresses') . " " . _hint(_('Multiple IP addresses must be comma seperated')) . "</h3>\n\t\t\t<form action='index.php?app=main&inc=feature_firewall&op=firewall_add_yes' method='post'>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<table class=playsms-table>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _mandatory(_('Select username')) . "</td>\n\t\t\t\t<td>" . themes_select_users_single('add_username') . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _mandatory(_('IP addresses')) . "</td>\n\t\t\t\t<td><textarea name='add_ip_address' required></textarea></td>\n\t\t\t</tr>\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_firewall&op=firewall_list');
     _p($content);
     break;
 case "firewall_add_yes":
     $add_username = user_uid2username($_POST['add_username']);
     $add_ip_address = $_POST['add_ip_address'];
     if ($add_username && $add_ip_address) {
         foreach (explode(',', str_replace(' ', '', $add_ip_address)) as $ip) {
             blacklist_addip($add_username, $ip);
         }
         $_SESSION['error_string'] = _('IP addresses have been blocked');
     } else {
         $_SESSION['error_string'] = _('You must fill all fields');
     }
     header("Location: " . _u('index.php?app=main&inc=feature_firewall&op=firewall_add'));
     exit;