$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'; } $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) {
$_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)) {
$input_prefix = _input('text', 'sandbox_prefix', $post_rules['insert_prefix'], $params, 'playsms-sandbox-prefix', 'form-control'); // sandbox forward to users unset($params); $params = array('width' => '100%', 'placeholder' => _('Select users')); $select_users = themes_select_users_multi('uids', $post_rules['forward_to'], $params, 'playsms-route-to-users'); // sandbox forward to URL unset($params); $params = array('size' => '100%', 'maxlength' => 255, 'placeholder' => _('URL')); $input_url = _input('text', 'forward_to_url', $post_rules['forward_to_url'], $params, 'playsms-forward-to-url', 'form-control'); $form_post_rules = array(array('id' => 'playsms-sandbox-match-sender-id', 'label' => _('Route all sandbox SMS with matched sender ID'), 'input' => $select_match_sender_id, 'help' => _('Route to user inbox if receiver number matched with user sender ID')), array('id' => 'playsms-route-to-users', 'label' => _('Route all sandbox SMS to users'), 'input' => $select_users, 'help' => _('Route all sandbox SMS to one or more users')), array('id' => 'playsms-forward-to-url', 'label' => _('Forward all sandbox SMS to a URL'), 'input' => $input_url, 'help' => _('Example') . ': <br />http://external.app/handler.php?json={SANDBOX_PAYLOAD}&dt={SANDBOX_DATETIME}&s={SANDBOX_SENDER}&m={SANDBOX_MESSAGE}&r={SANDBOX_RECEIVER}&smsc={SANDBOX_SMSC}')); // form settings $settings = incoming_settings_get(); // settings to leave copy on sandbox $settings_leave_copy_sandbox = _yesno('settings_leave_copy_sandbox', $settings['leave_copy_sandbox'], '', '', '', 'settings_leave_copy_sandbox', 'form-control'); // settings to match with all approved sender ID $settings_match_all_sender_id = _yesno('settings_match_all_sender_id', $settings['match_all_sender_id'], '', '', '', 'settings_match_all_sender_id', 'form-control'); $form_settings = array(array('id' => 'playsms-settings-leave-copy', 'label' => _('Leave a copy in sandbox SMS page'), 'input' => $settings_leave_copy_sandbox, 'help' => _('Leaving a copy in sandbox SMS page may be useful for audit or reviews')), array('id' => 'playsms-settings-match-all', 'label' => _('Match with all approved sender ID'), 'input' => $settings_match_all_sender_id, 'help' => _('Receiver number can be matched with default sender ID or with all approved sender ID'))); $tpl = array('name' => 'incoming', 'vars' => array('DIALOG_DISPLAY' => _dialog(), 'PAGE_TITLE' => _('Route incoming SMS'), 'ACTION_URL' => _u('index.php?app=main&inc=feature_incoming&op=incoming_save'), 'HTTP_PATH_THEMES' => _HTTP_PATH_THEMES_, 'HINT_PRE_RULES' => _hint(_('Rules applied before incoming SMS processed')), 'HINT_POST_RULES' => _hint(_('Rules applied after incoming SMS processed')), 'Pre rules' => _('Pre rules'), 'Post rules' => _('Post rules'), 'Settings' => _('Settings'), 'Save' => _('Save')), 'loops' => array('form_pre_rules' => $form_pre_rules, 'form_post_rules' => $form_post_rules, 'form_settings' => $form_settings), 'injects' => array('core_config')); _p(tpl_apply($tpl)); break; case "incoming_save": // form pre rules // scan message for @username $pre_rules['match_username'] = (int) $_REQUEST['incoming_match_username']; $items['incoming_match_username'] = $pre_rules['match_username']; // scan message for #groupcode $pre_rules['match_groupcode'] = (int) $_REQUEST['incoming_match_groupcode']; $items['incoming_match_groupcode'] = $pre_rules['match_groupcode']; // form post rules // sandbox match receiver number and sender ID $post_rules['match_sender_id'] = (int) $_REQUEST['sandbox_match_sender_id'];