if ($plugin_config['kannel']['local_time']) { $selected1 = 'selected'; } else { $selected2 = 'selected'; } $option_local_time = "\n\t\t\t<option value=1 {$selected1}>" . _('Yes') . "</option>\n\t\t\t<option value=0 {$selected2}>" . _('No') . "</option>\n\t\t\t"; $admin_port = $plugin_config['kannel']['admin_port']; $admin_host = $plugin_config['kannel']['sendsms_host']; $admin_host = $admin_port ? $admin_host . ':' . $admin_port : $admin_host; $admin_password = $plugin_config['kannel']['admin_password']; $url = 'http://' . $admin_host . '/status?password='******'Unable to access Kannel admin commands'; } $content .= _dialog() . "\n\t\t\t<h2>" . _('Manage kannel') . "</h2>\n\t\t\t<ul class='nav nav-tabs nav-justified' id='playsms-tab'>\n\t\t\t\t<li class=active><a href='#tabs-configuration' data-toggle=tab>" . _('Configuration') . "</a></li>\n\t\t\t\t<li><a href='#tabs-operational' data-toggle=tab>" . _('Operational') . "</a></li>\n\t\t\t</ul>\n\t\t\t<div class=tab-content>\n\t\t\t\t<div id='tabs-configuration' class='tab-pane fade in active'>\n\t\t\t\t\t<form action=index.php?app=main&inc=gateway_kannel&op=manage_save method=post>\n\t\t\t\t\t" . _CSRF_FORM_ . "\n\t\t\t\t\t<table class=playsms-table cellpadding=1 cellspacing=2 border=0>\n\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=label-sizer>" . _('Gateway name') . "</td><td>kannel</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . _('Username') . "</td><td><input type=text maxlength=30 name=up_username value=\"" . $plugin_config['kannel']['username'] . "\"></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . _('Password') . "</td><td><input type=password maxlength=30 name=up_password value=\"\"> " . _hint(_('Fill to change the password')) . "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . _('Module sender ID') . "</td><td><input type=text maxlength=16 name=up_module_sender value=\"" . $plugin_config['kannel']['module_sender'] . "\"> " . _hint(_('Max. 16 numeric or 11 alphanumeric char. empty to disable')) . "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . _('Module timezone') . "</td><td><input type=text size=5 maxlength=5 name=up_module_timezone value=\"" . $plugin_config['kannel']['module_timezone'] . "\"> " . _hint(_('Eg: +0700 for Jakarta/Bangkok timezone')) . "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . _('Bearerbox hostname or IP') . "</td><td><input type=text maxlength=250 name=up_bearerbox_host value=\"" . $plugin_config['kannel']['bearerbox_host'] . "\"> " . _hint(_('Kannel specific')) . "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . _('Send SMS hostname or IP') . "</td><td><input type=text maxlength=250 name=up_sendsms_host value=\"" . $plugin_config['kannel']['sendsms_host'] . "\"> " . _hint(_('Kannel specific')) . "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . _('Send SMS port') . "</td><td><input type=text maxlength=10 name=up_sendsms_port value=\"" . $plugin_config['kannel']['sendsms_port'] . "\"> " . _hint(_('Kannel specific')) . "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . _('DLR mask') . "</td><td><input type=text maxlength=2 name=up_dlr_mask value=\"" . $plugin_config['kannel']['dlr_mask'] . "\"> " . _hint(_('Kannel dlr-mask option')) . "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . _('Additional URL parameter') . "</td><td><input type=text maxlength=250 name=up_additional_param value=\"" . $plugin_config['kannel']['additional_param'] . "\"></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . _('playSMS web URL') . "</td><td><input type=text maxlength=250 name=up_playsms_web value=\"" . $plugin_config['kannel']['playsms_web'] . "\"> " . _hint(_('URL to playSMS, empty it to set it to base URL')) . "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . _('Incoming SMS time is in local time') . "</td><td><select name=up_local_time>" . $option_local_time . "</select> " . _hint(_('Select no if the incoming SMS time is in UTC')) . "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t\t<p><input type=submit class=button value=\"" . _('Save') . "\">\n\t\t\t\t</div>\n\t\t\t\t<div id='tabs-operational' class='tab-pane fade'>\n\t\t\t\t\t<table class=playsms-table cellpadding=1 cellspacing=2 border=0>\n\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . _('Kannel admin host') . "</td><td><input type=text maxlength=250 name=up_admin_host value=\"" . $plugin_config['kannel']['admin_host'] . " \"> " . _hint(_('HTTP Kannel admin host')) . "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . _('Kannel admin port') . "</td><td><input type=text maxlength=250 name=up_admin_port value=\"" . $plugin_config['kannel']['admin_port'] . "\"> " . _hint(_('HTTP Kannel admin port')) . "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . _('Kannel admin password') . "</td><td><input type=password maxlength=250 name=up_admin_password value=\"\"> " . _hint(_('HTTP Kannel admin password')) . "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . _('Kannel status') . "</td><td><textarea rows='20' style='height: 25em; width: 100%' disabled>" . $kannel_status . "</textarea></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t<input type=submit class=button value=\"" . _('Save') . "\">\n\t\t\t\t\t\t<input type='button' value=\"" . _('Update status') . "\" class='button' onClick=\"parent.location.href='index.php?app=main&inc=gateway_kannel&op=manage_update'\">\n\t\t\t\t\t\t<input type='button' value=\"" . _('Restart Kannel') . "\" class='button' onClick=\"parent.location.href='index.php?app=main&inc=gateway_kannel&op=manage_restart'\">\n\t\t\t\t\t</p>\n\t\t\t\t\t</form>\n\t\t\t\t</div>\n\t\t\t\t<script type=\"text/javascript\" src=\"" . $core_config['http_path']['plug'] . "/themes/common/jscss/jquery.cookie.js\"></script>\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\$('a[data-toggle=\"tab\"]').on('shown.bs.tab', function(e){\n\t\t\t\t\t\t\t//save the latest tab using a cookie:\n\t\t\t\t\t\t\t\$.cookie('gateway_kannel_last_tab', \$(e.target).attr('href'));\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\t//activate latest tab, if it exists:\n\t\t\t\t\t\tvar lastTab = \$.cookie('gateway_kannel_last_tab');\n\t\t\t\t\t\tif (lastTab) {\n\t\t\t\t\t\t\t\$('ul.nav-tabs').children().removeClass('active');\n\t\t\t\t\t\t\t\$('a[href='+ lastTab +']').parents('li:first').addClass('active');\n\t\t\t\t\t\t\t\$('div.tab-content').children().removeClass('in active');\n\t\t\t\t\t\t\t\$(lastTab).addClass('in active');\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t</script>\n\t\t\t</div>" . _back('index.php?app=main&inc=core_gateway&op=gateway_list'); _p($content); break; case "manage_save": $items = array('username' => $_POST['up_username'], 'module_sender' => $_POST['up_module_sender'], 'module_timezone' => $_POST['up_module_timezone'], 'bearerbox_host' => $_POST['up_bearerbox_host'], 'sendsms_host' => $_POST['up_sendsms_host'], 'sendsms_port' => $_POST['up_sendsms_port'], 'playsms_web' => $_POST['up_playsms_web'], 'additional_param' => $_POST['up_additional_param'], 'dlr_mask' => $_POST['up_dlr_mask'], 'admin_host' => $_POST['up_admin_host'], 'admin_port' => $_POST['up_admin_port'], 'local_time' => $_POST['up_local_time']); if ($_POST['up_password']) { $items['password'] = $_POST['up_password']; } if ($_POST['up_admin_password']) { $items['admin_password'] = $_POST['up_admin_password']; } registry_update(1, 'gateway', 'kannel', $items); $_SESSION['dialog']['info'][] = _('Changes have been made'); header("Location: " . _u('index.php?app=main&inc=gateway_kannel&op=manage')); exit; break;
case 'del': $rid = $_REQUEST['rid']; $data = inboxgroup_getdatabyid($rid); $in_receiver = $data['in_receiver']; $keywords = $data['keywords']; $description = $data['description']; $c_members = count(inboxgroup_getmembers($rid)); $c_members = "<a href='" . _u('index.php?app=main&inc=feature_inboxgroup&route=members&op=members&rid=' . $rid) . "'>" . $c_members . "</a>"; $c_catchall = count(inboxgroup_getcatchall($rid)); $c_catchall = "<a href='" . _u('index.php?app=main&inc=feature_inboxgroup&route=catchall&op=catchall&rid=' . $rid) . "'>" . $c_catchall . "</a>"; $c_status = $data['status'] ? "<span class=status_enabled />" : "<span class=status_disabled />"; if ($error_content) { $content .= $error_content; } unset($tpl); $tpl = array('name' => 'inboxgroup_del', 'vars' => array('DIALOG_DISPLAY' => $error_content, 'Group inbox' => _('Group inbox'), 'Delete group inbox' => _('Delete group inbox'), 'RID' => $rid, 'Receiver number' => _('Receiver number'), 'Keywords' => _('Keywords'), 'Description' => _('Description'), 'Members' => _('Members'), 'Catch-all' => _('Catch-all'), 'Status' => _('Status'), 'IN_RECEIVER' => $in_receiver, 'KEYWORDS' => $keywords, 'DESCRIPTION' => $description, 'C_MEMBERS' => $c_members, 'C_CATCHALL' => $c_catchall, 'C_STATUS' => $c_status, 'ARE_YOU_SURE' => _('Are you sure you want to delete this group inbox ?'), 'Yes' => _('Yes'), 'BACK' => _back('index.php?app=main&inc=feature_inboxgroup&op=list'))); _p(tpl_apply($tpl)); break; case 'del_submit': $rid = $_REQUEST['rid']; $data = inboxgroup_getdatabyid($rid); $in_receiver = $data['in_receiver']; if ($rid && $in_receiver) { if (inboxgroup_datadel($rid)) { $_SESSION['dialog']['info'][] = _('Group inbox has been deleted') . " (" . _('Number') . ": " . $in_receiver . ")"; } else { $_SESSION['dialog']['info'][] = _('Fail to delete group inbox') . " (" . _('Number') . ": " . $in_receiver . ")"; } } else { $_SESSION['dialog']['info'][] = _('Receiver number does not exist'); }
if (strtoupper($c_sms_from) == strtoupper($sender_id)) { $selected = 'selected'; } $option_sender_id .= "<option value=\"" . $sender_id . "\" title=\"" . $sender_id . "\" " . $selected . ">" . $sender_id . "</option>"; } // admin or users if ($uname && (auth_isadmin() || $is_parent)) { $form_title = _('Manage account'); // fixme anton - now disabled since plugin/feature/credit exists // $option_credit = "<tr><td>" . _('Credit') . "</td><td><input type=text maxlength=14 name=up_credit value=\"$credit\"></td></tr>"; if ($is_parent) { $button_delete = "<input type=button class=button value='" . _('Delete') . "' onClick=\"javascript: ConfirmURL('" . _('Are you sure you want to delete subuser ?') . " (" . _('username') . ": " . $c_username . ")','index.php?app=main&inc=core_user&route=subuser_mgmnt&op=subuser_del" . $url_uname . "')\">"; $button_back = _back('index.php?app=main&inc=core_user&route=subuser_mgmnt&op=subuser_list'); } else { $button_delete = "<input type=button class=button value='" . _('Delete') . "' onClick=\"javascript: ConfirmURL('" . _('Are you sure you want to delete user ?') . " (" . _('username') . ": " . $c_username . ")','index.php?app=main&inc=core_user&route=user_mgmnt&op=user_del" . $url_uname . "&view=" . $view . "')\">"; $button_back = _back('index.php?app=main&inc=core_user&route=user_mgmnt&op=user_list&view=' . $view); } } else { $form_title = _('User configuration'); // fixme anton - now disabled since plugin/feature/credit exists // $option_credit = "<tr><td>" . _('Credit') . "</td><td>$credit</td></tr>"; } // get access control list $c_option_acl = array_flip(acl_getall()); $option_acl = _input('text', '', acl_getname($acl_id), array('readonly')); if (auth_isadmin()) { $option_acl = _select('up_acl_id', $c_option_acl, $acl_id); } if ($user_edited['status'] == 4) { $parent_id = user_getparentbyuid($user_edited['uid']); if ($parent_id == $user_config['uid']) {
* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with playSMS. If not, see <http://www.gnu.org/licenses/>. */ defined('_SECURE_') or die('Forbidden'); if (!auth_isadmin()) { auth_block(); } include $core_config['apps_path']['plug'] . "/gateway/generic/config.php"; switch (_OP_) { case "manage": if ($err = TRUE) { $error_content = _dialog(); } $tpl = array('name' => 'generic', 'vars' => array('DIALOG_DISPLAY' => $error_content, 'Manage generic' => _('Manage generic'), 'Gateway name' => _('Gateway name'), 'Generic send SMS URL' => _mandatory(_('Generic send SMS URL')), 'Callback URL' => _('Callback URL'), 'API username' => _mandatory(_('API username')), 'API password' => _('API password'), 'Module sender ID' => _('Module sender ID'), 'Module timezone' => _('Module timezone'), 'Save' => _('Save'), 'Notes' => _('Notes'), 'HINT_CALLBACK_URL' => _hint(_('Empty callback URL to set default')), 'HINT_FILL_PASSWORD' => _hint(_('Fill to change the API password')), 'HINT_MODULE_SENDER' => _hint(_('Max. 16 numeric or 11 alphanumeric char. empty to disable')), 'HINT_TIMEZONE' => _hint(_('Eg: +0700 for Jakarta/Bangkok timezone')), 'CALLBACK_URL_IS' => _('Your current callback URL is'), 'CALLBACK_URL_ACCESSIBLE' => _('Your callback URL should be accessible from Generic'), 'GENERIC_PUSH_DLR' => _('Generic will push DLR and incoming SMS to your callback URL'), 'BUTTON_BACK' => _back('index.php?app=main&inc=core_gateway&op=gateway_list'), 'status_active' => $status_active, 'generic_param_url' => $plugin_config['generic']['url'], 'generic_param_callback_url' => $plugin_config['generic']['callback_url'], 'generic_param_api_username' => $plugin_config['generic']['api_username'], 'generic_param_module_sender' => $plugin_config['generic']['module_sender'], 'generic_param_datetime_timezone' => $plugin_config['generic']['datetime_timezone'])); _p(tpl_apply($tpl)); break; case "manage_save": $up_url = $_REQUEST['up_url'] ? $_REQUEST['up_url'] : $plugin_config['generic']['default_url']; $up_callback_url = $_REQUEST['up_callback_url'] ? $_REQUEST['up_callback_url'] : $plugin_config['generic']['default_callback_url']; $up_api_username = $_REQUEST['up_api_username']; $up_api_password = $_REQUEST['up_api_password']; $up_module_sender = $_REQUEST['up_module_sender']; $up_datetime_timezone = $_REQUEST['up_datetime_timezone']; if ($up_url && $up_api_username) { $items = array('url' => $up_url, 'callback_url' => $up_callback_url, 'api_username' => $up_api_username, 'module_sender' => $up_module_sender, 'datetime_timezone' => $up_datetime_timezone); if ($up_api_password) { $items['api_password'] = $up_api_password; } if (registry_update(0, 'gateway', 'generic', $items)) {
* along with playSMS. If not, see <http://www.gnu.org/licenses/>. */ defined('_SECURE_') or die('Forbidden'); if (!auth_isadmin()) { auth_block(); } @set_time_limit(0); switch (_OP_) { case "all_outgoing": $search_category = array(_('User') => 'username', _('Gateway') => 'p_gateway', _('SMSC') => 'p_smsc', _('Time') => 'p_datetime', _('To') => 'p_dst', _('Message') => 'p_msg', _('Footer') => 'p_footer'); $base_url = 'index.php?app=main&inc=feature_report&route=all_outgoing&op=all_outgoing'; $queue_label = ""; $queue_home_link = ""; if ($queue_code = trim($_REQUEST['queue_code'])) { $queue_label = "<h4>" . sprintf(_('List of queue %s'), $queue_code) . "</h4>"; $queue_home_link = _back($base_url); $base_url .= '&queue_code=' . $queue_code; $search = themes_search($search_category, $base_url); $conditions = array('A.queue_code' => $queue_code, 'A.flag_deleted' => 0); $keywords = $search['dba_keywords']; $table = _DB_PREF_ . '_tblSMSOutgoing'; $join = "INNER JOIN " . _DB_PREF_ . "_tblUser AS B ON B.flag_deleted='0' AND A.uid=B.uid"; $count = dba_count($table . ' AS A', $conditions, $keywords, '', $join); $nav = themes_nav($count, $search['url']); $extras = array('ORDER BY' => 'A.smslog_id DESC', 'LIMIT' => $nav['limit'], 'OFFSET' => $nav['offset']); $list = dba_search($table . ' AS A', 'B.username, A.p_gateway, A.p_smsc, A.smslog_id, A.p_dst, A.p_sms_type, A.p_msg, A.p_footer, A.p_datetime, A.p_update, A.p_status, A.uid, A.queue_code', $conditions, $keywords, $extras, $join); } else { $search = themes_search($search_category, $base_url); $conditions = array('A.flag_deleted' => 0); $keywords = $search['dba_keywords']; $table = _DB_PREF_ . '_tblSMSOutgoing';
* * You should have received a copy of the GNU General Public License * along with playSMS. If not, see <http://www.gnu.org/licenses/>. */ defined('_SECURE_') or die('Forbidden'); if (!auth_isadmin()) { auth_block(); } include $core_config['apps_path']['plug'] . "/gateway/openvox/config.php"; $callback_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/plugin/gateway/openvox/callback.php"; $callback_url = str_replace("//", "/", $callback_url); $callback_url = "http://" . $callback_url; switch (_OP_) { case "manage": if ($err = TRUE) { $error_content = _dialog(); } $tpl = array('name' => 'openvox', 'vars' => array('DIALOG_DISPLAY' => $error_content, 'Manage OpenVox' => _('Manage OpenVox'), 'Gateway name' => _('Gateway name'), 'Gateway host' => _('Gateway host'), 'Gateway port' => _('Gateway port'), 'Username' => _('Username'), 'Password' => _('Password'), 'Module sender ID' => _('Module sender ID'), 'Module timezone' => _('Module timezone'), 'Save' => _('Save'), 'Notes' => _('Notes'), 'HINT_FILL_SECRET' => _hint(_('Fill to change the password')), 'CALLBACK_URL_IS' => _('Your callback URL is'), 'CALLBACK_URL_ACCESSIBLE' => _('Your callback URL should be accessible from OpenVox'), 'BUTTON_BACK' => _back('index.php?app=main&inc=core_gateway&op=gateway_list'), 'openvox_param_gateway_host' => $plugin_config['openvox']['gateway_host'], 'openvox_param_gateway_port' => $plugin_config['openvox']['gateway_port'], 'openvox_param_username' => $plugin_config['openvox']['username'], 'callback_url' => $callback_url)); _p(tpl_apply($tpl)); break; case "manage_save": $_SESSION['dialog']['info'][] = _('Changes have been made'); $items = array('gateway_host' => $_POST['up_gateway_host'], 'gateway_port' => $_POST['up_gateway_port'], 'username' => $_POST['up_username'], 'password' => $_POST['up_password']); if ($_POST['up_password']) { $items['password'] = $_POST['up_password']; } registry_update(1, 'gateway', 'openvox', $items); header("Location: " . _u('index.php?app=main&inc=gateway_openvox&op=manage')); exit; break; }
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'; } $items['id'] = $_REQUEST['id']; $items['uid'] = $uid; $items['sender_id'] = $data_sender_id[0]['registry_key']; $items['description'] = sender_id_description($uid, $data_sender_id[0]['registry_key']); if (auth_isadmin()) { $select_approve = _yesno('approved', $data_sender_id[0]['registry_value']); $select_users = user_getfieldbyuid($uid, 'name') . ' (' . user_uid2username($uid) . ')'; } $default_sender_id = sender_id_default_get($uid); $select_default = _yesno('default', strtoupper($data_sender_id[0]['registry_key']) == strtoupper($default_sender_id) ? 1 : 0); $tpl = array('name' => 'sender_id_add', 'vars' => array('DIALOG_DISPLAY' => _dialog(), 'FORM_TITLE' => _('Manage sender ID'), 'FORM_SUBTITLE' => _('Edit sender ID'), 'ACTION_URL' => _u('index.php?app=main&inc=core_sender_id&op=sender_id_edit_yes'), 'BUTTON_BACK' => _back($ref), 'HTTP_PATH_THEMES' => _HTTP_PATH_THEMES_, 'HINT_DEFAULT' => _hint(_('Only when the sender ID is approved')), 'input_tag' => 'readonly', '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', 'items', 'icon_config', 'core_config')); _p(tpl_apply($tpl)); break; case "sender_id_edit_yes": if (sender_id_update($uid, $c_sender_id, $c_sender_id_description, $_REQUEST['default'], $_REQUEST['approved'])) { $_SESSION['dialog']['info'][] = _('Sender ID description has been updated') . ' (' . _('Sender ID') . ': ' . $c_sender_id . ')'; } else { $_SESSION['dialog']['info'][] = _('Fail to update due to invalid sender ID') . ' (' . _('Sender ID') . ': ' . $c_sender_id . ')'; } header("Location: " . _u('index.php?app=main&inc=core_sender_id&op=sender_id_edit&id=' . $_REQUEST['id'])); exit; break; case "toggle_status": $search = array('id' => $_REQUEST['id'], 'registry_family' => 'sender_id'); foreach (registry_search_record($search) as $row) { $status = $row['registry_value'] == 0 ? 1 : 0;
if ($err = $_SESSION['error_string']) { $content = "<div class=error_string>{$err}</div>"; } $content .= "\n\t\t\t<h2>" . _('Manage poll') . "</h2>\n\t\t\t<h3>" . _('Edit SMS poll') . "</h3>\n\t\t\t<form action=index.php?app=main&inc=feature_sms_poll&op=sms_poll_edit_yes method=post>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<input type=hidden name=poll_id value=\"{$poll_id}\">\n\t\t\t<input type=hidden name=edit_poll_keyword value=\"{$edit_poll_keyword}\">\n\t\t\t<table class=playsms-table>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('SMS poll keyword') . "</td><td>{$edit_poll_keyword}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('SMS poll title') . "</td><td><input type=text maxlength=100 name=edit_poll_title value=\"{$edit_poll_title}\"></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('SMS poll access code') . "</td><td><input type=text maxlength=100 name=edit_poll_access_code value=\"{$edit_poll_access_code}\"> " . _hint(_('SMS poll access code used mainly by webservices')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Vote option') . "</td><td>" . _select('edit_poll_option_vote', $option_vote, $edit_poll_option_vote) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Reply message on out of vote option') . "</td><td><textarea maxlength=160 name=\"edit_poll_message_option\">{$edit_poll_message_option}</textarea></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Reply message on valid vote') . "</td><td><textarea maxlength=160 name=\"edit_poll_message_valid\">{$edit_poll_message_valid}</textarea></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Reply message on invalid vote') . "</td><td><textarea maxlength=160 name=\"edit_poll_message_invalid\">{$edit_poll_message_invalid}</textarea></td>\n\t\t\t</tr>\n\t\t\t" . $select_reply_smsc . "\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<br />\n\t\t\t<h3>" . _('Edit SMS poll choices') . "</h3>"; $db_query = "SELECT choice_id,choice_title,choice_keyword FROM " . _DB_PREF_ . "_featurePoll_choice WHERE poll_id='{$poll_id}' ORDER BY choice_keyword"; $db_result = dba_query($db_query); $content .= "\n\t\t\t<div class=table-responsive>\n\t\t\t<table class=playsms-table-list>\n\t\t\t<thead><tr>\n\t\t\t\t<th width=20%>" . _('Choice keyword') . "</th>\n\t\t\t\t<th width=70%>" . _('Description') . "</th>\n\t\t\t\t<th width=10%>" . _('Action') . "</th>\n\t\t\t</tr></thead>\n\t\t\t<tbody>"; $i = 0; while ($db_row = dba_fetch_array($db_result)) { $choice_id = $db_row['choice_id']; $choice_keyword = $db_row['choice_keyword']; $choice_title = $db_row['choice_title']; $i++; $content .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>{$choice_keyword}</td>\n\t\t\t\t\t<td>{$choice_title}</td>\n\t\t\t\t\t<td><a href=\"javascript:ConfirmURL('" . _('Are you sure you want to delete choice ?') . " (" . _('title') . ": " . addslashes($choice_title) . ", " . _('keyword') . ": " . $choice_keyword . ")','" . _u('index.php?app=main&inc=feature_sms_poll&op=sms_poll_choice_del&poll_id=' . $poll_id . '&choice_id=' . $choice_id) . "');\">" . $icon_config['delete'] . "</a></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<br />\n\t\t\t<p>" . _('Add choice to this poll') . "\n\t\t\t<form action=\"index.php?app=main&inc=feature_sms_poll&op=sms_poll_choice_add\" method=post>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<input type=hidden name=poll_id value=\"{$poll_id}\">\n\t\t\t<table class=playsms-table cellpadding=1 cellspacing=2 border=0>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('Choice keyword') . "</td><td><input type=text size=3 maxlength=10 name=add_choice_keyword></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Choice description') . "</td><td><input type=text maxlength=250 name=add_choice_title></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t<p><input type=submit class=button value=\"" . _('Add') . "\">\n\t\t\t</form>\n\t\t\t" . _back('index.php?app=main&inc=feature_sms_poll&op=sms_poll_list'); _p($content); break; case "sms_poll_edit_yes": $edit_poll_keyword = strtoupper($_POST['edit_poll_keyword']); $edit_poll_title = $_POST['edit_poll_title']; $edit_poll_access_code = $_POST['edit_poll_access_code']; $edit_poll_option_vote = (int) $_POST['edit_poll_option_vote']; $edit_poll_message_option = $_POST['edit_poll_message_option']; $edit_poll_message_valid = $_POST['edit_poll_message_valid']; $edit_poll_message_invalid = $_POST['edit_poll_message_invalid']; if (auth_isadmin()) { $edit_smsc = $_POST['edit_smsc']; $query_smsc = ",smsc='{$edit_smsc}'"; } if ($poll_id && $edit_poll_title && $edit_poll_keyword && $edit_poll_message_valid && $edit_poll_message_invalid) {
$c_gid = phonebook_groupcode2id($uid, $contact[3]); if (!$c_gid) { $contact[3] = ''; } $contact[1] = sendsms_getvalidnumber($contact[1]); $contact[4] = phonebook_tags_clean($contact[4]); if ($contact[0] && $contact[1]) { $i++; $content .= "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>{$i}.</td>\n\t\t\t\t\t\t\t<td>{$contact['0']}</td>\n\t\t\t\t\t\t\t<td>{$contact['1']}</td>\n\t\t\t\t\t\t\t<td>{$contact['2']}</td>\n\t\t\t\t\t\t\t<td>{$contact['3']}</td>\n\t\t\t\t\t\t\t<td>{$contact['4']}</td>\n\t\t\t\t\t\t\t</tr>"; $k = $i - 1; $_SESSION['tmp'][$session_import][$k] = $contact; } } } ini_set('auto_detect_line_endings', FALSE); $content .= "\n\t\t\t\t</tbody></table>\n\t\t\t\t</div>\n\t\t\t\t<p>" . _('Import above phonebook entries ?') . "</p>\n\t\t\t\t<form action=\"index.php?app=main&inc=feature_phonebook&route=import&op=import_yes\" method=POST>\n\t\t\t\t" . _CSRF_FORM_ . "\n\t\t\t\t<input type=\"hidden\" name=\"number_of_row\" value=\"{$j}\">\n\t\t\t\t<input type=\"hidden\" name=\"session_import\" value=\"" . $session_import . "\">\n\t\t\t\t<p><input type=\"submit\" class=\"button\" value=\"" . _('Import') . "\"></p>\n\t\t\t\t</form>\n\t\t\t\t" . _back('index.php?app=main&inc=feature_phonebook&route=import&op=list'); _p($content); } else { $_SESSION['dialog']['danger'][] = _('Fail to upload CSV file for phonebook'); header("Location: " . _u('index.php?app=main&inc=feature_phonebook&route=import&op=list')); exit; } break; case "import_yes": @set_time_limit(0); $num = $_POST['number_of_row']; $session_import = $_POST['session_import']; $data = $_SESSION['tmp'][$session_import]; // $i = 0; foreach ($data as $d) { $name = trim($d[0]);
*/ defined('_SECURE_') or die('Forbidden'); if (!auth_isadmin()) { auth_block(); } include $core_config['apps_path']['plug'] . "/gateway/uplink/config.php"; switch (_OP_) { case "manage": if ($plugin_config['uplink']['try_disable_footer']) { $selected['yes'] = 'selected'; } else { $selected['no'] = 'selected'; } $option_try_disable_footer = "<option value=\"1\" " . $selected['yes'] . ">" . _('yes') . "</option>"; $option_try_disable_footer .= "<option value=\"0\" " . $selected['no'] . ">" . _('no') . "</option>"; $content = _dialog() . "\n\t\t\t<h2>" . _('Manage uplink') . "</h2>\n\t\t\t<form action=index.php?app=main&inc=gateway_uplink&op=manage_save 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>" . _('Gateway name') . "</td><td>uplink</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _mandatory(_('Master URL')) . "</td><td><input type=text maxlength=250 name=up_master value=\"" . $plugin_config['uplink']['master'] . "\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _('Additional URL parameter') . "</td><td><input type=text maxlength=250 name=up_additional_param value=\"" . $plugin_config['uplink']['additional_param'] . "\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _mandatory(_('Webservice username')) . "</td><td><input type=text maxlength=30 name=up_username value=\"" . $plugin_config['uplink']['username'] . "\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _mandatory(_('Webservice token')) . "</td><td><input type=text maxlength=32 name=up_token value=\"" . $plugin_config['uplink']['token'] . "\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _('Try to disable SMS footer on master') . "</td><td><select name=up_try_disable_footer>" . $option_try_disable_footer . "</select></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _('Module sender ID') . "</td><td><input type=text maxlength=16 name=up_module_sender value=\"" . $plugin_config['uplink']['module_sender'] . "\"> " . _hint(_('Max. 16 numeric or 11 alphanumeric char. empty to disable')) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _('Module timezone') . "</td><td><input type=text size=5 maxlength=5 name=up_datetime_timezone value=\"" . $plugin_config['uplink']['datetime_timezone'] . "\"> " . _hint(_('Eg: +0700 for Jakarta/Bangkok timezone')) . "</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>" . _back('index.php?app=main&inc=core_gateway&op=gateway_list'); _p($content); break; case "manage_save": $up_master = $_POST['up_master']; $up_additional_param = $_POST['up_additional_param']; $up_username = $_POST['up_username']; $up_token = $_POST['up_token']; $up_module_sender = $_POST['up_module_sender']; $up_datetime_timezone = $_POST['up_datetime_timezone']; $up_try_disable_footer = $_POST['up_try_disable_footer']; if ($up_master && $up_username && $up_token) { $db_query = "\n\t\t\t\tUPDATE " . _DB_PREF_ . "_gatewayUplink_config\n\t\t\t\tSET c_timestamp='" . mktime() . "',\n\t\t\t\tcfg_master='{$up_master}',\n\t\t\t\tcfg_additional_param='{$up_additional_param}',\n\t\t\t\tcfg_username='******',\n\t\t\t\tcfg_token='{$up_token}',\n\t\t\t\tcfg_module_sender='{$up_module_sender}',\n\t\t\t\tcfg_datetime_timezone='{$up_datetime_timezone}',\n\t\t\t\tcfg_try_disable_footer='{$up_try_disable_footer}'"; if (@dba_affected_rows($db_query)) { $_SESSION['dialog']['info'][] = _('Gateway module configurations has been saved'); } else {
} } header('Location: ' . _u('index.php?app=main&inc=core_gateway&op=add_smsc&gateway=' . $c_gateway)); exit; break; case 'edit_smsc': $c_id = $_REQUEST['id']; $smsc = gateway_get_smscbyid($c_id); $c_name = $smsc['name']; $c_gateway = gateway_valid_name($smsc['gateway']); $c_data = json_decode($smsc['data']); $dv = $plugin_config[$c_gateway]['_smsc_config_'] ? $plugin_config[$c_gateway]['_smsc_config_'] : array(); foreach ($dv as $key => $val) { $dynamic_variables[] = array('key' => $key, 'title' => $val, 'value' => $c_data->{$key}); } $tpl = array('name' => 'gateway_edit_smsc', 'vars' => array('FORM_TITLE' => _('Edit SMSC'), 'ACTION_URL' => 'index.php?app=main&inc=core_gateway&op=edit_smsc_save', 'ID' => $c_id, 'NAME' => $c_name, 'GATEWAY' => $c_gateway, 'BACK' => _back('index.php?app=main&inc=core_gateway&op=gateway_list'), 'Gateway' => _('Gateway'), 'SMSC name' => _('SMSC name'), 'Save' => _('Save')), 'loops' => array('dynamic_variables' => $dynamic_variables)); $content = tpl_apply($tpl); break; case 'edit_smsc_save': $c_id = (int) $_REQUEST['id']; $smsc = gateway_get_smscbyid($c_id); // do not edit dev and blocked $continue = FALSE; if (!($smsc['gateway'] == 'dev' || $smsc['gateway'] == 'blocked')) { $continue = TRUE; } $c_gateway = gateway_valid_name($_REQUEST['gateway']); if ($continue && $c_id && $c_gateway && $c_gateway == $smsc['gateway']) { $dv = $plugin_config[$c_gateway]['_smsc_config_'] ? $plugin_config[$c_gateway]['_smsc_config_'] : array(); $dynamic_variables = array(); foreach ($dv as $key => $val) {
$content .= "\n\t\t\t<h2>" . _('Manage quiz') . "</h2>\n\t\t\t<h3>" . _('Received answer list for keyword') . " " . $db_answer_row['quiz_keyword'] . "</h3>"; $db_query = "SELECT * FROM " . _DB_PREF_ . "_featureQuiz_log WHERE quiz_id='{$quiz_id}' ORDER BY in_datetime DESC"; $db_result = dba_query($db_query); $content .= "\n\t\t\t<div class=table-responsive>\n\t\t\t<table class=playsms-table-list>\n\t\t\t<thead><tr>\n\t\t\t\t<th width=30%>" . _('Datetime') . "</th>\n\t\t\t\t<th width=20%>" . _('Sender') . "</th>\n\t\t\t\t<th width=30%>" . _('Answer') . "</th>\n\t\t\t\t<th width=10%>" . _('Status') . "</th>\n\t\t\t\t<th width=10%>" . _('Action') . "</th>\n\t\t\t</tr></thead>\n\t\t\t<tbody>"; $i = 0; while ($db_row = dba_fetch_array($db_result)) { if ($db_row['quiz_answer'] == $db_answer_row['quiz_answer']) { $iscorrect = "<font color=green>" . _('correct') . "</font>"; } else { $iscorrect = "<font color=red>" . _('incorrect') . "</font>"; } $action = "<a href=\"javascript: ConfirmURL('" . _('Are you sure you want to delete this answer ?') . "','" . _u('index.php?app=main&inc=feature_sms_quiz&op=sms_answer_del&quiz_id=' . $quiz_id . '&answer_id=' . $db_row['answer_id']) . "')\">" . $icon_config['delete'] . "</a>"; $i++; $content .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . $db_row['in_datetime'] . "</td>\n\t\t\t\t\t<td>" . $db_row['quiz_sender'] . "</td>\n\t\t\t\t\t<td>" . $db_row['quiz_answer'] . "</td>\n\t\t\t\t\t<td>{$iscorrect}</td>\n\t\t\t\t\t<td>{$action}</td>\n\t\t\t\t</tr>"; } $content .= "</tbody>\n\t\t\t</table>\n\t\t\t</div>\n\t\t\t" . _back('index.php?app=main&inc=feature_sms_quiz&op=sms_quiz_list'); _p($content); break; case "sms_answer_del": $answer_id = $_REQUEST['answer_id']; $db_query = "SELECT answer_id FROM " . _DB_PREF_ . "_featureQuiz_log WHERE answer_id='{$answer_id}'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); if ($answer_id = $db_row['answer_id']) { $db_query = "DELETE FROM " . _DB_PREF_ . "_featureQuiz_log WHERE answer_id='{$answer_id}'"; if (@dba_affected_rows($db_query)) { $_SESSION['dialog']['info'][] = _('SMS quiz answer messages have been deleted'); } } header("Location: " . _u('index.php?app=main&inc=feature_sms_quiz&op=sms_answer_view&quiz_id=' . $quiz_id)); exit;
$i = 0; while ($db_row = dba_fetch_array($db_result)) { $status_active = "<a href=\"" . _u('index.php?app=main&inc=feature_schedule&op=status&id=' . $db_row['id'] . '&status=0') . "\"><span class=status_enabled /></a>"; $status_inactive = "<a href=\"" . _u('index.php?app=main&inc=feature_schedule&op=status&id=' . $db_row['id'] . '&status=1') . "\"><span class=status_disabled /></a>"; $status = $db_row['flag_active'] == 1 ? $status_active : $status_inactive; $action = "<a href=\"" . _u('index.php?app=main&inc=feature_schedule&route=manage&op=list&id=' . $db_row['id']) . "\">" . $icon_config['manage'] . "</a> "; $action .= "<a href=\"" . _u('index.php?app=main&inc=feature_schedule&route=edit&op=list&id=' . $db_row['id']) . "\">" . $icon_config['edit'] . "</a> "; $action .= "<a href=\"javascript: ConfirmURL('" . _('Are you sure you want to delete SMS schedule ?') . " (" . _('Schedule ID') . ": " . $db_row['id'] . ")','" . _u('index.php?app=main&inc=feature_schedule&op=del&id=' . $db_row['id']) . "')\">" . $icon_config['delete'] . "</a>"; $i++; $content .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . $db_row['id'] . "</td>\n\t\t\t\t\t\t<td>" . $db_row['name'] . "</td>\n\t\t\t\t\t\t<td>" . $db_row['message'] . "</td>\n\t\t\t\t\t\t<td>" . $status . "</td>\n\t\t\t\t\t\t<td>" . $action . "</td>\n\t\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" . _button('index.php?app=main&inc=feature_schedule&op=add', _('Add SMS schedule')); _p($content); break; case "add": $content = _dialog() . "\n\t\t\t<h2>" . _('Schedule messages') . "</h2>\n\t\t\t<h3>" . _('Add SMS schedule') . "</h3>\n\t\t\t<form action=index.php?app=main&inc=feature_schedule&op=add_yes method=post>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<table class=playsms-table cellpadding=1 cellspacing=2 border=0>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _mandatory(_('Schedule name')) . "</td><td><input type=text maxlength=100 name=name></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _mandatory(_('Scheduled message')) . "</td><td><input type=text name=message></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Schedule rule') . "</td><td>" . _select('schedule_rule', $plugin_config['schedule']['rules']) . "</td>\n\t\t\t</tr>\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_schedule&op=list'); _p($content); break; case "add_yes": $name = $_POST['name']; $message = $_POST['message']; $schedule_rule = (int) $_POST['schedule_rule']; if ($name && $message) { // flag_active : 1 active, 2 inactive, 0 considered inactive // flag_deleted : 1 deleted, other values considered non-deleted $db_query = "\n\t\t\t\tINSERT INTO " . _DB_PREF_ . "_featureSchedule (c_timestamp,uid,name,message,schedule_rule,flag_active,flag_deleted)\n\t\t\t\tVALUES (" . mktime() . ",'" . $user_config['uid'] . "','{$name}','{$message}','{$schedule_rule}','2','0')"; if ($new_uid = @dba_insert_id($db_query)) { $_SESSION['dialog']['info'][] = _('New SMS schedule been added'); } else { $_SESSION['dialog']['info'][] = _('Fail to add new SMS schedule'); }
if (@dba_affected_rows($db_query)) { $_SESSION['error_string'] = _('Rate has been saved') . " (" . _('destination') . ": {$up_dst}, " . _('prefix') . ": {$up_prefix})"; } else { $_SESSION['error_string'] = _('Fail to save rate') . " (" . _('destination') . ": {$up_dst}, " . _('prefix') . ": {$up_prefix})"; } } else { $_SESSION['error_string'] = _('You must fill all fields'); } header("Location: " . _u('index.php?app=main&inc=feature_simplerate&op=simplerate_edit&rateid=' . $rateid)); exit; break; case "simplerate_add": if ($err = $_SESSION['error_string']) { $content = "<div class=error_string>{$err}</div>"; } $content .= "\n\t\t\t<h2>" . _('Manage SMS rate') . "</h2>\n\t\t\t<h3>" . _('Add rate') . "</h3>\n\t\t\t<form action='index.php?app=main&inc=feature_simplerate&op=simplerate_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>" . _('Destination') . "</td><td><input type='text' maxlength='30' name='add_dst' value=\"{$add_dst}\"></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Prefix') . "</td><td><input type='text' maxlength=10 name='add_prefix' value=\"{$add_prefix}\"></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Rate') . "</td><td><input type='text' maxlength=14 name='add_rate' value=\"{$add_rate}\"></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_simplerate&op=simplerate_list'); _p($content); break; case "simplerate_add_yes": $add_dst = $_POST['add_dst']; $add_prefix = $_POST['add_prefix']; $add_prefix = preg_replace('/[^0-9.]*/', '', $add_prefix); $add_rate = $_POST['add_rate']; if ($add_dst && $add_prefix >= 0 && $add_rate >= 0) { $db_query = "SELECT * FROM " . _DB_PREF_ . "_featureSimplerate WHERE prefix='{$add_prefix}'"; $db_result = dba_query($db_query); if ($db_row = dba_fetch_array($db_result)) { $_SESSION['error_string'] = _('Rate already exists') . " (" . _('destination') . ": " . $db_row['dst'] . ", " . _('prefix') . ": " . $db_row['prefix'] . ")"; } else { $db_query = "\n\t\t\t\t\tINSERT INTO " . _DB_PREF_ . "_featureSimplerate (dst,prefix,rate)\n\t\t\t\t\tVALUES ('{$add_dst}','{$add_prefix}','{$add_rate}')"; if ($new_uid = @dba_insert_id($db_query)) {
$removed = TRUE; } } break; } $search = themes_search_session(); $nav = themes_nav_session(); if ($removed) { $_SESSION['dialog']['info'][] = _('Mobile numbers have 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 "stoplist_add": $content = _dialog() . "\n\t\t\t<h2>" . _('Manage stoplist') . "</h2>\n\t\t\t<h3>" . _('Add blocked mobile numbers') . " " . _hint(_('Multiple mobile numbers must be comma-separated')) . "</h3>\n\t\t\t<form action='index.php?app=main&inc=feature_stoplist&op=stoplist_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(_('Mobile numbers')) . "</td>\n\t\t\t\t<td><input type=text name='add_mobile' required> " . _hint(_('Comma separated values for multiple mobile numbers')) . "\n\t\t\t\t</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_stoplist&op=stoplist_list'); _p($content); break; case "stoplist_add_yes": $add_mobile = $_POST['add_mobile']; if ($add_mobile) { $mobiles = explode(',', str_replace(' ', '', $add_mobile)); foreach ($mobiles as $mobile) { blacklist_mobile_add($user_config['uid'], $mobile); } $_SESSION['dialog']['info'][] = _('Mobile numbers have been blocked'); } else { $_SESSION['dialog']['danger'][] = _('You must fill all fields'); } header("Location: " . _u('index.php?app=main&inc=feature_stoplist&op=stoplist_add')); exit;
$select_parents = themes_select_account_level_single(3, 'add_parent_uid', $default_parent_uid); if ($view == 'admin') { $selected_admin = 'selected'; } else { if ($view == 'users') { $selected_users = 'selected'; } else { if ($view == 'subusers') { $selected_subusers = 'selected'; } } } $option_status = "\n\t\t\t<option value='2' " . $selected_admin . ">" . _('Administrator') . "</option>\n\t\t\t<option value='3' " . $selected_users . ">" . _('User') . "</option>\n\t\t\t<option value='4' " . $selected_subusers . ">" . _('Subuser') . "</option>\n\t\t"; // get access control list $option_acl = _select('add_acl_id', array_flip(acl_getall())); $content .= "\n\t\t<h2>" . _('Manage account') . "</h2>\n\t\t<h3>" . _('Add account') . "</h3>\n\t\t<form action='index.php?app=main&inc=core_user&route=user_mgmnt&op=user_add_yes&view=" . $view . "' method=POST>\n\t\t" . _CSRF_FORM_ . "\n\t\t<table class=playsms-table>\n\t\t<tbody>\n\t\t<tr>\n\t\t\t<td class=label-sizer>" . _('Account status') . "</td><td><select name='add_status'>{$option_status}</select></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>" . _('Access Control List') . "</td><td>" . $option_acl . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>" . _('Parent account') . " (" . _('for subuser only') . ") </td><td>" . $select_parents . " " . _hint(_('Parent account is mandatory for subusers only. If no value is given then the subuser will be automatically assigned to user admin')) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>" . _mandatory(_('Username')) . "</td><td><input type='text' maxlength='30' name='add_username' value=\"{$add_username}\"></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>" . _mandatory(_('Password')) . "</td><td><input type='password' maxlength='30' name='add_password' value=\"{$add_password}\"></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>" . _mandatory(_('Full name')) . "</td><td><input type='text' maxlength='100' name='add_name' value=\"{$add_name}\"></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>" . _mandatory(_('Email')) . "</td><td><input type='text' maxlength='250' name='add_email' value=\"{$add_email}\"></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>" . _('Mobile') . "</td><td><input type='text' size='16' maxlength='16' name='add_mobile' value=\"{$add_mobile}\"> " . _hint(_('Max. 16 numeric or 11 alphanumeric characters')) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>" . _('SMS footer') . "</td><td><input type='text' maxlength='30' name='add_footer' value=\"{$add_footer}\"> " . _hint(_('Max. 30 alphanumeric characters')) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>" . _('Timezone') . "</td><td><input type='text' size='5' maxlength='5' name='add_datetime_timezone' value=\"{$add_datetime_timezone}\"> " . _hint(_('Eg: +0700 for Jakarta/Bangkok timezone')) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>" . _('Active language') . "</td><td><select name='add_language_module'>{$option_language_module}</select></td>\n\t\t</tr>\n\t\t</tbody>\n\t\t</table>\n\t\t<p><input type='submit' class='button' value='" . _('Save') . "'></p>\n\t\t</form>\n\t\t" . _back('index.php?app=main&inc=core_user&route=user_mgmnt&op=user_list&view=' . $view); _p($content); break; case "user_add_yes": $add['email'] = $_POST['add_email']; $add['status'] = $_POST['add_status']; $add['acl_id'] = (int) $_POST['add_acl_id']; $add['username'] = $_POST['add_username']; $add['password'] = $_POST['add_password']; $add['mobile'] = $_POST['add_mobile']; $add['name'] = $_POST['add_name']; $add['footer'] = $_POST['add_footer']; $add['datetime_timezone'] = $_POST['add_datetime_timezone']; $add['language_module'] = $_POST['add_language_module']; // subuser's parent uid, by default its uid=1 if ($_POST['add_parent_uid']) {
break; case "add": if ($err = TRUE) { $content = _dialog(); } $content .= "\n\t\t\t<h2>" . _('Message template') . "</h2>\n\t\t\t<h3>" . _('Add message template') . "</h3>\n\t\t\t<form action='index.php?app=main&inc=feature_msgtemplate&op=actions&go=add' 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>" . _('Message template name') . "</td><td><input type=text maxlength=100 name=t_title></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Message template content') . "</td><td><input type=text name=t_text></td>\n\t\t\t</tr>\t\n\t\t\t</table>\t\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_msgtemplate&op=list'); _p($content); break; case "edit": $db_query = "SELECT * FROM " . _DB_PREF_ . "_featureMsgtemplate WHERE tid='{$tid}'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); if ($err = TRUE) { $content = _dialog(); } $content .= "\n\t\t\t<h2>" . _('Message template') . "</h2>\n\t\t\t<h3>" . _('Edit message template') . "</h3>\n\t\t\t<form action='index.php?app=main&inc=feature_msgtemplate&op=actions&go=edit' method=POST>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<input type=hidden name=item_count value='" . $i . "'>\n\t\t\t<input type=hidden name=tid value='" . $tid . "'>\n\t\t\t<table class=playsms-table>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('Message template name') . "</td><td><input type=text maxlength=100 name=t_title value='" . $db_row['t_title'] . "'></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Message template content') . "</td><td><input type=text name=t_text value='" . $db_row['t_text'] . "'></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t<input type='hidden' name='item_count' value='{$i}'>\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_msgtemplate&op=list'); _p($content); break; case "actions": $go = $_REQUEST['go']; switch ($go) { case "add": $t_title = $_POST['t_title']; $t_text = $_POST['t_text']; if ($t_title && $t_text) { $db_query = "INSERT INTO " . _DB_PREF_ . "_featureMsgtemplate (uid,t_title,t_text) VALUES ('" . $user_config['uid'] . "','{$t_title}','{$t_text}')"; $db_result = dba_insert_id($db_query); if ($db_result > 0) { $_SESSION['dialog']['info'][] = _('Message template has been saved'); } else { $_SESSION['dialog']['info'][] = _('Fail to add message template');
$j++; } $content .= "\n\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t</div>\n\t\t\t<div class=pull-right>" . $nav['form'] . "</div>\n\t\t\t</form>"; if ($err = TRUE) { _p(_dialog()); } _p($content); break; case "credit_add": $select_user = credit_html_select_user(); $content = _dialog() . "\n\t\t\t<script language=\"javascript\" type=\"text/javascript\">\n\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\$(\"#playsms-credit-select-user\").select2({\n\t\t\t\t\t\tplaceholder: \"" . _('Select users') . "\",\n\t\t\t\t\t\twidth: \"resolve\",\n\t\t\t\t\t\tseparator: [','],\n\t\t\t\t\t\ttokenSeparators: [','],\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t</script>\n\t\t\t<h2>" . _('Manage credit') . "</h2>\n\t\t\t<h3>" . _('Add credit') . "</h3>\n\t\t\t<form id=fm_feature_credit_add name=id_feature_credit_add action=\"" . _u('index.php?app=main&inc=feature_credit&op=actions&go=add') . "\" 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\t<tr>\n\t\t\t\t\t\t<td class=label-sizer>" . _('Add credit to users') . "</td>\n\t\t\t\t\t\t<td>" . $select_user . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . _('Amount') . "</td>\n\t\t\t\t\t\t<td><input type='text' maxlength=14 name=amount value=\"0.0\"></td>\n\t\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='" . _('Add credit') . "'>\n\t\t\t</form>\n\t\t\t" . _back('index.php?app=main&inc=feature_credit&op=credit_list'); _p($content); break; case "credit_reduce": $select_user = credit_html_select_user(); $content = _dialog() . "\n\t\t\t<script language=\"javascript\" type=\"text/javascript\">\n\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\$(\"#playsms-credit-select-user\").select2({\n\t\t\t\t\t\tplaceholder: \"" . _('Select users') . "\",\n\t\t\t\t\t\twidth: \"resolve\",\n\t\t\t\t\t\tseparator: [','],\n\t\t\t\t\t\ttokenSeparators: [',']\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t</script>\n\t\t\t<h2>" . _('Manage credit') . "</h2>\n\t\t\t<h3>" . _('Reduce credit') . "</h3>\n\t\t\t<form id=fm_feature_credit_reduce name=id_feature_credit_reduce action=\"" . _u('index.php?app=main&inc=feature_credit&op=actions&go=reduce') . "\" 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\t<tr>\n\t\t\t\t\t\t<td class=label-sizer>" . _('Reduce credit from users') . "</td>\n\t\t\t\t\t\t<td>" . $select_user . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . _('Amount') . "</td>\n\t\t\t\t\t\t<td><input type='text' maxlength=14 name=amount value=\"0.0\"></td>\n\t\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='" . _('Reduce credit') . "'>\n\t\t\t</form>\n\t\t\t" . _back('index.php?app=main&inc=feature_credit&op=credit_list'); _p($content); break; case "actions": $db_table = $plugin_config['credit']['db_table']; $nav = themes_nav_session(); $search = themes_search_session(); $go = $_REQUEST['go']; switch ($go) { case 'export': $conditions = array('flag_deleted' => 0); // only if users if ($user_config['status'] == 3) { $conditions['parent_uid'] = $user_config['uid']; $conditions['status'] = 4; }
} $entries = array_unique($entries); $session_import = 'schedule_' . _PID_; $_SESSION['tmp'][$session_import] = array(); $i = 0; foreach ($entries as $entry) { if ($entry[0] && $entry[1] && $entry[2]) { $i++; $content .= "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>{$i}.</td>\n\t\t\t\t\t\t\t<td>{$entry['0']}</td>\n\t\t\t\t\t\t\t<td>{$entry['1']}</td>\n\t\t\t\t\t\t\t<td>{$entry['2']}</td>\n\t\t\t\t\t\t\t</tr>"; $k = $i - 1; $_SESSION['tmp'][$session_import][$k] = $entry; } } } ini_set('auto_detect_line_endings', FALSE); $content .= "\n\t\t\t\t</tbody></table>\n\t\t\t\t</div>\n\t\t\t\t<p>" . _('Import above destination entries ?') . "</p>\n\t\t\t\t<form action='index.php?app=main&inc=feature_schedule&route=import&op=import_yes' method=POST>\n\t\t\t\t" . _CSRF_FORM_ . "\n\t\t\t\t<input type='hidden' name='schedule_id' value='{$schedule_id}'>\n\t\t\t\t<input type='hidden' name='number_of_row' value='{$j}'>\n\t\t\t\t<input type='hidden' name='session_import' value='" . $session_import . "'>\n\t\t\t\t<p><input type='submit' class='button' value='" . _('Import') . "'></p>\n\t\t\t\t</form>\n\t\t\t\t" . _back('index.php?app=main&inc=feature_schedule&route=import&op=list&schedule_id=' . $schedule_id); _p($content); } else { $_SESSION['dialog']['info'][] = _('Fail to upload CSV file'); header("Location: " . _u('index.php?app=main&inc=feature_schedule&route=import&op=list&schedule_id=' . $schedule_id)); exit; } break; case "import_yes": @set_time_limit(0); $num = $_POST['number_of_row']; $session_import = $_POST['session_import']; $data = $_SESSION['tmp'][$session_import]; foreach ($data as $d) { $name = trim($d[0]); $destination = trim($d[1]);
case "sms_board_del": $db_query = "SELECT board_keyword FROM " . _DB_PREF_ . "_featureBoard WHERE board_id='{$board_id}'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); $board_keyword = $db_row['board_keyword']; if ($board_keyword) { $db_query = "DELETE FROM " . _DB_PREF_ . "_featureBoard WHERE board_keyword='{$board_keyword}'"; if (@dba_affected_rows($db_query)) { $_SESSION['error_string'] = _('SMS board with all its messages has been deleted') . " (" . _('keyword') . ": {$board_keyword})"; } } header("Location: " . _u('index.php?app=main&inc=feature_sms_board&op=sms_board_list')); exit; break; case "sms_board_add": $content = _err_display() . "\n\t\t\t<h2>" . _('Manage board') . "</h2>\n\t\t\t<h3>" . _('Add SMS board') . "</h3>\n\t\t\t<form action=index.php?app=main&inc=feature_sms_board&op=sms_board_add_yes method=post>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<table class=playsms-table cellpadding=1 cellspacing=2 border=0>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('SMS board keyword') . "</td><td><input type=text maxlength=30 name=add_board_keyword value=\"{$add_board_keyword}\"></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Forward to email') . "</td><td><input type=text name=add_email value=\"{$add_email}\"></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('CSS URL') . "</td><td><input type=text name=add_css value=\"{$add_css}\"></td>\n\t\t\t</tr>\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_board&op=sms_board_list'); _p($content); break; case "sms_board_add_yes": $add_board_keyword = strtoupper($_POST['add_board_keyword']); $add_email = $_POST['add_email']; $add_css = $_POST['add_css']; $add_template = $_POST['add_template']; if ($add_board_keyword) { if (checkavailablekeyword($add_board_keyword)) { if (!$add_template) { $add_template = "<div class=sms_board_row>\n"; $add_template .= "\t<div class=sender>{SENDER}</div>\n"; $add_template .= "\t<div class=datetime>{DATETIME}</div>\n"; $add_template .= "\t<div class=message>{MESSAGE}</div>\n"; $add_template .= "</div>\n";
$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}¶m={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);
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 ($add_uid) { $add_username = user_uid2username($add_uid); if (!$add_username) { $add_uid = 0; } } $add_dst = $_POST['add_dst']; $add_prefix = $_POST['add_prefix']; $add_prefix = core_sanitize_numeric($add_prefix); $add_prefix = (string) substr($add_prefix, 0, 8); $add_smsc = $_POST['add_smsc'] ? $_POST['add_smsc'] : 'blocked';
$schedule_id = $_REQUEST['schedule_id']; // schedule ID $db_query = "SELECT * FROM " . _DB_PREF_ . "_featureSchedule WHERE uid='" . $user_config['uid'] . "' AND id='{$schedule_id}' AND flag_deleted='0'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); $schedule_name = $db_row['name']; $schedule_message = $db_row['message']; if ($id && $schedule_id && $schedule_name && $schedule_message) { $db_query = "SELECT * FROM " . _DB_PREF_ . "_featureSchedule_dst WHERE schedule_id='{$schedule_id}' AND id='{$id}'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); $schedule = $db_row['schedule']; $schedule = $schedule ? core_display_datetime($schedule) : '0000-00-00 00:00:00'; $name = $db_row['name']; $destination = $db_row['destination']; $content = _dialog() . "\n\t\t\t\t<h2>" . _('Schedule messages') . "</h2>\n\t\t\t\t<h3>" . _('Manage schedule') . "</h3>\n\t\t\t\t<h4>" . _('Edit destination') . "</h4>\n\t\t\t\t<form action=index.php?app=main&inc=feature_schedule&route=manage&op=dst_edit_yes method=post>\n\t\t\t\t" . _CSRF_FORM_ . "\n\t\t\t\t<input type=hidden name=schedule_id value='" . $schedule_id . "'>\n\t\t\t\t<input type=hidden name=id value='" . $id . "'>\n\t\t\t\t<table class=playsms-table cellpadding=1 cellspacing=2 border=0>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=label-sizer>" . _('Schedule name') . "</td><td>" . $schedule_name . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _('Scheduled message') . "</td><td>" . $schedule_message . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _mandatory(_('Name')) . "</td><td><input type=text maxlength=250 name=name value='" . $name . "'></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _mandatory(_('Destination')) . "</td><td><input type=text maxlength=20 name=destination value='" . $destination . "'> " . _hint(_('Separate by comma for multiple destinations')) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _mandatory(_('Schedule')) . "</td><td><input type=text maxlength=19 name=schedule value='" . $schedule . "'> " . _hint(_('Format YYYY-MM-DD hh:mm')) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\t<p><input type=submit class=button value=\"" . _('Save') . "\">\n\t\t\t\t</form>\n\t\t\t\t" . _back('index.php?app=main&inc=feature_schedule&route=manage&op=list&id=' . $schedule_id); } else { auth_block(); } _p($content); break; case "dst_edit_yes": $id = $_REQUEST['id']; // destination ID $schedule_id = $_REQUEST['schedule_id']; // schedule ID $db_query = "SELECT * FROM " . _DB_PREF_ . "_featureSchedule WHERE uid='" . $user_config['uid'] . "' AND id='{$schedule_id}' AND flag_deleted='0'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); $schedule_name = $db_row['name']; $schedule_message = $db_row['message'];
$content .= "<h2>" . _('Group inbox') . "</h2>"; $content .= "<h3>" . _('Delete catch-all') . "</h3>"; $content .= "\n\t\t\t<table width='100%>\n\t\t\t<tr><td class=label-sizer>" . _('Receiver number') . "</td><td>" . $in_receiver . "</td></tr>\n\t\t\t<tr><td>" . _('Keywords') . "</td><td>" . $keywords . "</td></tr>\n\t\t\t<tr><td>" . _('Description') . "</td><td>" . $description . "</td></tr>\n\t\t\t<tr><td>" . _('Members') . "</td><td>" . $c_members . "</td></tr>\n\t\t\t<tr><td>" . _('Catch-all') . "</td><td>" . $c_catchall . "</td></tr>\n\t\t\t<tr><td>" . _('Status') . "</td><td>" . $c_status . "</td></tr>\n\t\t\t</table>"; $list_of_catchall = ''; // get catchall $users = inboxgroup_getcatchall($rid); for ($i = 0; $i < count($users); $i++) { $c_uid = $users[$i]['uid']; $c_user = user_getdatabyuid($c_uid); if ($c_username = $c_user['username']) { $c_name = $c_user['name']; $c_mobile = $c_user['mobile']; $list_of_users .= "<option value='" . $c_uid . "'>" . $c_name . " " . $c_mobile . "</option>"; } } $content .= "\n\t\t\t<form action=\"index.php?app=main&inc=feature_inboxgroup&route=catchall&op=catchall_delete_submit\" method=\"post\">\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<input type=hidden name='rid' value='" . $rid . "'>\n\t\t\t<table>\n\t\t\t\t<tbody>\n\t\t\t\t<tr>\n\t\t\t\t\t<td nowrap>\n\t\t\t\t\t\t" . _('Current catchall') . ":<br />\n\t\t\t\t\t\t<select name=\"uids_dump[]\" id=\"msg_combo_sendto\" size=\"10\" multiple=\"multiple\" onDblClick=\"moveSelectedOptions(this.form['uids_dump[]'],this.form['uids[]'])\">{$list_of_users}</select>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<p><input type=\"button\" class=\"button\" value=\">\" onclick=\"moveSelectedOptions(this.form['uids_dump[]'],this.form['uids[]'])\"></p>\n\t\t\t\t\t\t<p><input type=\"button\" class=\"button\" value=\"<\" onclick=\"moveSelectedOptions(this.form['uids[]'],this.form['uids_dump[]'])\"></p>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td nowrap>\n\t\t\t\t\t " . _('Selected catchall') . ":<br>\n\t\t\t\t\t <select name=\"uids[]\" id=\"msg_combo_sendto\" size=\"10\" multiple=\"multiple\" onDblClick=\"moveSelectedOptions(this.form['uids[]'],this.form['uids_dump[]'])\"></select>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<p>" . _('Press submit button to remove selected catchall from catch-all list') . "</p>\n\t\t\t<p><input class='button' type='submit' value='Submit' onClick=\"selectAllOptions(this.form['uids[]'])\"></p>\n\t\t\t</form>\n\t\t" . _back('index.php?app=main&inc=feature_inboxgroup&route=catchall&op=catchall&rid=' . $rid); _p($content); break; case 'catchall_delete_submit': $rid = $_REQUEST['rid']; $rid = $_REQUEST['rid']; $data = inboxgroup_getdatabyid($rid); $in_receiver = $data['in_receiver']; if ($rid && $in_receiver) { $uids = $_REQUEST['uids']; for ($i = 0; $i < count($uids); $i++) { $c_uid = $uids[$i]; $c_username = user_uid2username($c_uid); if (inboxgroup_catchalldel($rid, $c_uid)) { $_SESSION['error_string'] .= _('Catch-all has been deleted') . " (" . _('Username') . ": " . $c_username . ")<br />"; } else {
$_SESSION['dialog']['info'][] = _('New ACL been added'); } else { $_SESSION['dialog']['info'][] = _('Fail to add new ACL'); } } else { $_SESSION['dialog']['info'][] = _('Mandatory fields must not be empty'); } header("Location: " . _u('index.php?app=main&inc=core_acl&op=add')); exit; break; case "edit": $id = (int) $_REQUEST['id']; $db_query = "SELECT * FROM " . _DB_PREF_ . "_tblACL WHERE flag_deleted='0' AND id='" . $id . "'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); $content = _dialog() . "\n\t\t\t<h2>" . _('Manage ACL') . "</h2>\n\t\t\t<h3>" . _('Edit ACL') . "</h3>\n\t\t\t<form action=index.php?app=main&inc=core_acl&op=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 cellpadding=1 cellspacing=2 border=0>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('ACL ID') . "</td><td>" . $id . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Name') . "</td><td>" . strtoupper($db_row['name']) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Subuser ACL') . "</td><td><input type=text name=acl_subuser value='" . strtoupper($db_row['acl_subuser']) . "'> " . _hint(_('Comma separated for multiple entries')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('Disallowed URLs') . "</td><td>" . _yesno('acl_disallowed', $db_row['flag_disallowed']) . " " . _hint(_('Decide if this ACL is containing disallowed URLs rather than allowed URLs')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _('URLs') . "</td><td><textarea rows=5 name=url>" . $db_row['url'] . "</textarea><br />" . _hint(_('Comma separated for multiple entries')) . "</td>\n\t\t\t</tr>\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=core_acl&op=acl_list'); _p($content); break; case "edit_yes": $id = (int) $_POST['id']; $name = trim(strtoupper($_POST['name'])); $acl_subusers = explode(',', trim(strtoupper($_POST['acl_subuser']))); foreach ($acl_subusers as $item) { $acl_subuser .= ' ' . trim(strtoupper($item)) . ','; } $acl_subuser = trim(substr($acl_subuser, 0, -1)); $acl_disallowed = (int) $_REQUEST['acl_disallowed']; $url = trim($_POST['url']); if ($id) { $db_query = "\n\t\t\t\tUPDATE " . _DB_PREF_ . "_tblACL SET c_timestamp='" . mktime() . "',acl_subuser='******',url='" . $url . "',flag_disallowed='" . $acl_disallowed . "'\n\t\t\t\tWHERE id='" . $id . "'"; if ($new_id = @dba_affected_rows($db_query)) {
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)) {
if (!auth_isadmin()) { auth_block(); } include $core_config['apps_path']['plug'] . "/gateway/telerivet/config.php"; $gw = core_gateway_get(); if ($gw == $plugin_config['telerivet']['name']) { $status_active = "<span class=status_active />"; } else { $status_active = "<span class=status_inactive />"; } switch (_OP_) { case "manage": if ($err = TRUE) { $content = _dialog(); } $tpl = array('name' => 'telerivet', 'vars' => array('DIALOG_DISPLAY' => $error_content, 'Manage telerivet' => _('Manage telerivet'), 'Gateway name' => _('Gateway name'), 'Project ID' => _('Project ID'), 'Telerivet URL' => _('Telerivet URL'), 'API key' => _('API key'), 'Callback URL' => _('Callback URL'), 'Callback Secret' => _('Callback Secret'), 'Save' => _('Save'), 'HINT_FILL_KEY' => _hint(_('Fill to change the API key')), 'BUTTON_BACK' => _back('index.php?app=main&inc=core_gateway&op=gateway_list'), 'status_active' => $status_active, 'telerivet_param_url' => $plugin_config['telerivet']['url'], 'telerivet_param_project_id' => $plugin_config['telerivet']['project_id'], 'telerivet_param_api_key' => $plugin_config['telerivet']['api_key'], 'telerivet_param_status_url' => $plugin_config['telerivet']['status_url'], 'telerivet_param_status_secret' => $plugin_config['telerivet']['status_secret'])); _p(tpl_apply($tpl)); break; case "manage_save": $up_url = $_POST['up_url']; $up_project_id = $_POST['up_project_id']; $up_api_key = $_POST['up_api_key']; $up_status_url = $_POST['up_status_url']; $up_status_secret = $_POST['up_status_secret']; $_SESSION['dialog']['info'][] = _('No changes has been made'); if ($up_url && $up_project_id) { if ($up_api_key) { $api_key_change = "cfg_api_key='{$up_api_key}',"; } $db_query = "\n UPDATE " . _DB_PREF_ . "_gatewayTelerivet_config\n SET c_timestamp='" . mktime() . "',\n cfg_url='{$up_url}',\n " . $api_key_change . "\n cfg_project_id='{$up_project_id}',\n cfg_status_url='{$up_status_url}',\n cfg_status_secret='{$up_status_secret}'"; _log('query:' . $db_query, 2, 'config telerivet');
header("Location: " . _u('index.php?app=main&inc=feature_sms_subscribe&op=msg_list&subscribe_id=' . $subscribe_id)); exit; break; case "msg_view": $list = dba_search(_DB_PREF_ . '_featureSubscribe', 'subscribe_keyword', array('subscribe_id' => $subscribe_id)); $subscribe_name = $list[0]['subscribe_keyword']; $msg_id = $_REQUEST['msg_id']; $db_query = "SELECT * FROM " . _DB_PREF_ . "_featureSubscribe_msg WHERE subscribe_id='{$subscribe_id}' AND msg_id='{$msg_id}'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); $message = $db_row['msg']; $counter = $db_row['counter']; if ($err = $_SESSION['error_string']) { $content = "<div class=error_string>{$err}</div>"; } $content .= "\n\t\t\t<h2>" . _('Manage subscribe') . "</h2>\n\t\t\t<h3>" . _('Message detail') . "</h3>\n\t\t\t<form action=index.php?app=main&inc=feature_sms_subscribe&op=msg_send method=post>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<input type=hidden value={$message} name=msg>\n\t\t\t<input type=hidden value={$subscribe_id} name=subscribe_id>\n\t\t\t<input type=hidden value={$msg_id} name=msg_id>\n\t\t\t<table class=playsms-table>\n\t\t\t<tr><td class=label-sizer>" . _('SMS subscribe keyword') . "</td><td>{$subscribe_name}</td></tr>\n\t\t\t<tr><td>" . _('Message ID') . "</td><td>" . $msg_id . "</td></tr>\n\t\t\t<tr><td>" . _('Message') . "</td><td>" . $message . "</td></tr>\n\t\t\t<tr><td>" . _('Sent') . "</td><td>" . $counter . "</td></tr>\n\t\t\t</table>\n\t\t\t<br />\n\t\t\t<p>" . _('Send this message to all members') . "</p>\n\t\t\t<p><input type=submit value=\"" . _('Send') . "\" class=\"button\" />\n\t\t\t</form>\n\t\t\t<p>" . _back('index.php?app=main&inc=feature_sms_subscribe&op=msg_list&subscribe_id=' . $subscribe_id); _p($content); break; case "msg_send": $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); $smsc = $db_row['smsc']; $c_uid = $db_row['uid']; $username = user_uid2username($c_uid); $msg_id = $_POST['msg_id']; $db_query = "SELECT msg FROM " . _DB_PREF_ . "_featureSubscribe_msg WHERE subscribe_id='{$subscribe_id}' AND msg_id='{$msg_id}'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); $message = addslashes($db_row['msg']); $counter = $db_row['counter'];
/** * This file is part of playSMS. * * playSMS is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * playSMS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with playSMS. If not, see <http://www.gnu.org/licenses/>. */ defined('_SECURE_') or die('Forbidden'); if (!auth_isadmin()) { auth_block(); } include $core_config['apps_path']['plug'] . "/gateway/dev/config.php"; switch (_OP_) { case "manage": if ($err = TRUE) { $content = _dialog(); } $content .= "\n\t\t\t<h2>" . _('Manage dev') . "</h2>\n\t\t\t<table class=playsms-table>\n\t\t\t\t<tbody><tr><td class=label-sizer>" . _('Gateway name') . "</td><td>dev</td></tr></tbody>\n\t\t\t</table>\n\t\t"; $content .= _back('index.php?app=main&inc=core_gateway&op=gateway_list'); _p($content); break; }
* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with playSMS. If not, see <http://www.gnu.org/licenses/>. */ defined('_SECURE_') or die('Forbidden'); if (!auth_isvalid()) { auth_block(); } switch (_OP_) { case "user_inbox": $search_category = array(_('Time') => 'in_datetime', _('From') => 'in_sender', _('Message') => 'in_msg'); $base_url = 'index.php?app=main&inc=feature_report&route=user_inbox&op=user_inbox'; if ($in_sender = trim($_REQUEST['in_sender'])) { $subpage_label = "<h4>" . sprintf(_('List of messages from %s'), $in_sender) . "</h4>"; $home_link = _back($base_url); $base_url .= '&in_sender=' . urlencode($in_sender); $search = themes_search($search_category, $base_url); $conditions = array('in_sender' => $in_sender, 'in_uid' => $user_config['uid'], 'flag_deleted' => 0); $keywords = $search['dba_keywords']; $count = dba_count(_DB_PREF_ . '_tblSMSInbox', $conditions, $keywords); $nav = themes_nav($count, $search['url']); $extras = array('ORDER BY' => 'in_id DESC', 'LIMIT' => $nav['limit'], 'OFFSET' => $nav['offset']); $list = dba_search(_DB_PREF_ . '_tblSMSInbox', 'in_id, in_uid, in_datetime, in_sender, in_msg', $conditions, $keywords, $extras); } else { $search = themes_search($search_category, $base_url); $conditions = array('in_uid' => $user_config['uid'], 'flag_deleted' => 0); $keywords = $search['dba_keywords']; $list = dba_search(_DB_PREF_ . '_tblSMSInbox', 'in_id', $conditions, $keywords, array('GROUP BY' => 'in_sender')); $count = count($list); $nav = themes_nav($count, $search['url']);