Пример #1
0
            } else {
                $_SESSION['dialog']['info'][] = _('Fail to edit SMSC');
            }
        } else {
            $_SESSION['dialog']['info'][] = _('Unknown error');
            header('Location: ' . _u('index.php?app=main&inc=core_gateway&op=gateway_list'));
            exit;
        }
        header('Location: ' . _u('index.php?app=main&inc=core_gateway&op=edit_smsc&id=' . $c_id));
        exit;
        break;
    case 'del_smsc':
        if ($c_id = $_REQUEST['id']) {
            $db_table = _DB_PREF_ . '_tblGateway';
            $condition = array('id' => $c_id);
            if (dba_remove($db_table, $condition)) {
                $_SESSION['dialog']['info'][] = _('SMSC has been removed');
            } else {
                $_SESSION['dialog']['info'][] = _('Fail to remove SMSC');
            }
        } else {
            $_SESSION['dialog']['info'][] = _('Unknown error');
        }
        header('Location: ' . _u('index.php?app=main&inc=core_gateway&op=gateway_list'));
        exit;
        break;
    default:
        $content = "\n\t\t\t<h3>" . _('List of gateways and SMSCs') . "</h3>\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-gateway' data-toggle=tab>" . _('Gateways') . "</a></li>\n\t\t\t\t<li><a href='#tabs-virtual' data-toggle=tab>" . _('SMSCs') . "</a></li>\n\t\t\t</ul>\n\t\t\t<div class=tab-content>\n\t\t\t\t<div id='tabs-gateway' class='tab-pane fade in active'>\n\t\t\t\t\t" . _gateway_display() . "\n\t\t\t\t</div>\n\t\t\t\t<div id='tabs-virtual' class='tab-pane fade'>\n\t\t\t\t\t" . _gateway_display_smsc() . "\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<script type=\"text/javascript\" src=\"" . $core_config['http_path']['plug'] . "/themes/common/jscss/jquery.cookie.js\"></script>\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\$('a[data-toggle=\"tab\"]').on('shown.bs.tab', function(e){\n\t\t\t\t\t\t//save the latest tab using a cookie:\n\t\t\t\t\t\t\$.cookie('gateway_last_tab', \$(e.target).attr('href'));\n\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\t//activate latest tab, if it exists:\n\t\t\t\t\tvar lastTab = \$.cookie('gateway_last_tab');\n\t\t\t\t\tif (lastTab) {\n\t\t\t\t\t\t\$('ul.nav-tabs').children().removeClass('active');\n\t\t\t\t\t\t\$('a[href='+ lastTab +']').parents('li:first').addClass('active');\n\t\t\t\t\t\t\$('div.tab-content').children().removeClass('in active');\n\t\t\t\t\t\t\$(lastTab).addClass('in active');\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t</script>\n\t\t";
}
$final_content = _dialog() . "\n\t<h2>" . _('Manage gateway and SMSC') . "</h2>\n\t" . $content;
_p($final_content);
Пример #2
0
             $_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)) {
Пример #3
0
 * 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 "sms_sync_list":
        $list = registry_search($user_config['uid'], 'feature', 'sms_sync');
        $sms_sync_secret = $list['feature']['sms_sync']['secret'];
        if ($list['feature']['sms_sync']['enable']) {
            $option_enable = 'checked';
        }
        $sync_url = $core_config['http_path']['base'] . '/plugin/feature/sms_sync/sync.php?uid=' . $user_config['uid'];
        unset($tpl);
        $tpl = array('name' => 'sms_sync', 'vars' => array('DIALOG_DISPLAY' => _dialog(), 'HINT_SECRET' => _hint(_('Secret key is used in SMSSync app')), 'HINT_ENABLE' => _hint(_('Check to enable receiving push messages from SMSSync app')), 'SECRET' => $sms_sync_secret, 'CHECKED' => $option_enable, 'SYNC_URL' => $sync_url, 'Manage sync' => _('Manage sync'), 'Secret key' => _('Secret key'), 'Enable SMS Sync' => _('Enable SMS Sync'), 'Sync URL' => _('Sync URL'), 'Notes' => _('Notes'), 'Download SMSSync app for Android from' => _('Download SMSSync app for Android from'), 'Save' => _('Save')));
        _p(tpl_apply($tpl));
        break;
    case "sms_sync_save":
        $items['secret'] = $_POST['sms_sync_secret'];
        $items['enable'] = trim($_POST['sms_sync_enable']) ? 1 : 0;
        if (registry_update($user_config['uid'], 'feature', 'sms_sync', $items)) {
            $_SESSION['dialog']['info'][] = _('SMS Sync configuration has been saved');
        } else {
            $_SESSION['dialog']['info'][] = _('Fail to save SMS Sync configuration');
        }
        header("Location: " . _u('index.php?app=main&inc=feature_sms_sync&op=sms_sync_list'));
        exit;
        break;
}
Пример #4
0
     $db_query = "SELECT custom_keyword FROM " . _DB_PREF_ . "_featureCustom WHERE custom_id='{$custom_id}'";
     $db_result = dba_query($db_query);
     $db_row = dba_fetch_array($db_result);
     if ($db_row['custom_keyword']) {
         $db_query = "DELETE FROM " . _DB_PREF_ . "_featureCustom WHERE custom_id='{$custom_id}'";
         if (@dba_affected_rows($db_query)) {
             $_SESSION['dialog']['info'][] = _('SMS custom has been deleted');
         } else {
             $_SESSION['dialog']['danger'][] = _('Fail to delete SMS custom');
         }
     }
     header("Location: " . _u('index.php?app=main&inc=feature_sms_custom&op=sms_custom_list'));
     exit;
     break;
 case "sms_custom_add":
     $content .= _dialog() . "\n\t\t\t<h2>" . _('Manage custom') . "</h2>\n\t\t\t<h3>" . _('Add SMS custom') . "</h3>\n\t\t\t<form action=index.php?app=main&inc=feature_sms_custom&op=sms_custom_add_yes method=post>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<table class=playsms-table>\n\t\t\t\t<tbody>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=label-sizer>" . _mandatory(_('Service name')) . "</td><td><input type=text size=30 maxlength=255 name=add_service_name value=\"" . _lastpost('add_service_name') . "\"></td>\n\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _mandatory(_('SMS custom keywords')) . "</td><td><input type=text size=30 maxlength=255 name=add_custom_keyword value=\"" . _lastpost('add_custom_keyword') . "\"> " . _hint('Multiple keywords seperated by space') . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _('Receiver number') . "</td><td><input type=text size=30 maxlength=20 name=add_sms_receiver value=\"" . _lastpost('add_sms_receiver') . "\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2>" . _('Pass these parameters to custom URL field') . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2>\n\t\t\t\t\t\t" . _('Pass these parameters to custom URL field') . "\n\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t<li>{SERVICENAME} " . _('will be replaced by service name') . "</li>\n\t\t\t\t\t\t\t<li>{SMSDATETIME} " . _('will be replaced by SMS incoming date/time') . "</li>\n\t\t\t\t\t\t\t<li>{SMSSENDER} " . _('will be replaced by sender number') . "</li>\n\t\t\t\t\t\t\t<li>{SMSRECEIVER} " . _('will be replaced by receiver number') . "</li>\n\t\t\t\t\t\t\t<li>{CUSTOMKEYWORD} " . _('will be replaced by custom keyword') . "</li>\n\t\t\t\t\t\t\t<li>{CUSTOMPARAM} " . _('will be replaced by custom parameter passed to server from SMS') . "</li>\n\t\t\t\t\t\t\t<li>{CUSTOMRAW} " . _('will be replaced by SMS raw message') . "</li>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t" . _('Example of SMS custom URL') . "\n\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t<li>" . htmlspecialchars('http://someserver.somedomain/handler.php?service={SERVICENAME}&datetime={SMSDATETIME}&sender={SMSSENDER}&receiver={SMSRECEIVER}&keyword={CUSTOMKEYWORD}&param={CUSTOMPARAM}&raw={CUSTOMRAW}') . "</li>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _mandatory(_('SMS custom URL')) . "</td><td><input type=text maxlength=255 name=add_custom_url value=\"" . _lastpost('add_custom_url') . "\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _('Make return as reply') . "</td><td><input type=checkbox name=add_custom_return_as_reply></td>\n\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<p><input type=submit class=button value=\"" . _('Save') . "\">\n\t\t\t</form>\n\t\t\t" . _back('index.php?app=main&inc=feature_sms_custom&op=sms_custom_list');
     _p($content);
     break;
 case "sms_custom_add_yes":
     $add_service_name = trim($_POST['add_service_name']);
     $add_sms_receiver = trim($_POST['add_sms_receiver']);
     $add_custom_return_as_reply = $_POST['add_custom_return_as_reply'] == 'on' ? '1' : '0';
     $add_custom_url = $_POST['add_custom_url'];
     $add_custom_keyword = strtoupper($_POST['add_custom_keyword']);
     $c_keywords = explode(' ', $add_custom_keyword);
     foreach ($c_keywords as $keyword) {
         if ($keyword) {
             if (keyword_isavail($keyword, $add_sms_receiver)) {
                 $keywords .= core_sanitize_alphanumeric($keyword) . ' ';
             } else {
                 $_SESSION['dialog']['danger'][] = sprintf(_('Keyword %s is not available'), $keyword);
Пример #5
0
 * 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_isvalid()) {
    auth_block();
}
switch (_OP_) {
    case "queuelog_list":
        $nav = themes_nav($count, "index.php?app=main&inc=feature_queuelog&op=queuelog_list");
        $content = _dialog() . "\n\t\t\t<h2>" . _('View SMS queue') . "</h2>";
        $count = queuelog_countall();
        if ($count) {
            $content .= "<p><a href=\"javascript: ConfirmURL('" . addslashes(_("Are you sure you want to delete ALL queues")) . " ?','" . _u('index.php?app=main&inc=feature_queuelog&op=queuelog_delete_all') . "')\">" . $icon_config['delete'] . _("Delete ALL queues") . " ({$count})</a></p>";
        }
        $content .= "<div align=center>" . $nav['form'] . "</div>\n\t\t\t<div class=table-responsive>\n\t\t\t<table class=playsms-table-list>\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t";
        if (auth_isadmin()) {
            $content .= "\n\t\t\t\t<th width=20%>" . _('Queue Code') . "</th>\n\t\t\t\t<th width=15%>" . _('User') . "</th>\n\t\t\t";
        } else {
            $content .= "\n\t\t\t\t<th width=30%>" . _('Queue Code') . "</th>\n\t\t\t";
        }
        $content .= "\n\t\t\t\t<th width=15%>" . _('Scheduled') . "</th>\n\t\t\t\t<th width=10%>" . _('Count') . "</th>\n\t\t\t\t<th width=30%>" . _('Message') . "</th>\n\t\t\t\t<th width=10%>" . _('Action') . "</th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t";
        $data = queuelog_get($nav['limit'], $nav['offset']);
        for ($c = count($data) - 1; $c >= 0; $c--) {
            $c_queue_code = $data[$c]['queue_code'];
            $c_datetime_scheduled = core_display_datetime($data[$c]['datetime_scheduled']);
Пример #6
0
 * 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 "mailsms_user":
        $items_global = registry_search(0, 'features', 'mailsms');
        $items = registry_search($user_config['uid'], 'features', 'mailsms_user');
        // option enable
        $option_enable = _options(array(_('yes') => 1, _('no') => 0), $items['features']['mailsms_user']['enable']);
        $tpl = array('name' => 'mailsms_user', 'vars' => array('DIALOG_DISPLAY' => _dialog(), 'FORM_TITLE' => _('My email to SMS'), 'ACTION_URL' => _u('index.php?app=main&inc=feature_mailsms&route=mailsms_user&op=mailsms_user_save'), 'HTTP_PATH_THEMES' => _HTTP_PATH_THEMES_, 'HINT_PASSWORD' => _hint(_('Fill the password field to change password')), 'Email to SMS address' => _('Email to SMS address'), 'PIN for email to SMS' => _mandatory(_('PIN for email to SMS'))), 'injects' => array('option_enable', 'items_global', 'items'));
        _p(tpl_apply($tpl));
        break;
    case "mailsms_user_save":
        $continue = FALSE;
        $pin = core_sanitize_alphanumeric(substr(trim($_REQUEST['pin']), 0, 40));
        if ($pin) {
            $continue = TRUE;
        } else {
            $_SESSION['dialog']['info'][] = _('PIN is empty');
            $_SESSION['dialog']['info'][] = _('Fail to save email to SMS PIN');
        }
        if ($continue) {
            $items = array('pin' => $pin);
            registry_update($user_config['uid'], 'features', 'mailsms_user', $items);
            $items_global = registry_search(0, 'features', 'mailsms');
Пример #7
0
     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;
Пример #8
0
    auth_block();
}
switch (_OP_) {
    case "email2sms":
        $items = registry_search($user_config['uid'], 'features', 'email2sms');
        // option enable
        $option_enable = _options(array(_('yes') => 1, _('no') => 0), $items['features']['email2sms']['enable']);
        // option check email sender
        $option_check_sender = _options(array(_('yes') => 1, _('no') => 0), $items['features']['email2sms']['check_sender']);
        // option protocol
        $option_protocol = _options(array('IMAP' => 'imap', 'POP3' => 'pop3'), $items['features']['email2sms']['protocol']);
        // option ssl
        $option_ssl = _options(array(_('yes') => 1, _('no') => 0), $items['features']['email2sms']['ssl']);
        // option cert
        $option_novalidate_cert = _options(array(_('yes') => 1, _('no') => 0), $items['features']['email2sms']['novalidate_cert']);
        $tpl = array('name' => 'email2sms', 'vars' => array('DIALOG_DISPLAY' => _dialog(), 'FORM_TITLE' => _('Manage email to SMS'), 'ACTION_URL' => _u('index.php?app=main&inc=feature_email2sms&op=email2sms_save'), 'HTTP_PATH_THEMES' => _HTTP_PATH_THEMES_, 'HINT_PASSWORD' => _hint(_('Fill the password field to change password')), 'PIN for email to SMS' => _mandatory(_('PIN for email to SMS')), 'Enable email to SMS' => _('Enable email to SMS'), 'Check email sender' => _('Check email sender'), 'Email protocol' => _('Email protocol'), 'Use SSL' => _('Use SSL'), 'No validate cert option' => _('No validate cert option'), 'Mail server address' => _('Mail server address'), 'Mail server port' => _('Mail server port'), 'Mailbox username' => _('Mailbox username'), 'Mailbox password' => _('Mailbox password'), 'PORT_DEFAULT' => '443', 'PORT_DEFAULT_SSL' => '993'), 'injects' => array('select_users', 'option_enable', 'option_check_sender', 'option_protocol', 'option_ssl', 'option_novalidate_cert', 'items'));
        _p(tpl_apply($tpl));
        break;
    case "email2sms_save":
        $continue = FALSE;
        $pin = core_sanitize_alphanumeric(substr($_REQUEST['pin'], 0, 40));
        if ($pin) {
            $continue = TRUE;
        } else {
            $_SESSION['dialog']['info'][] = _('PIN is empty');
            $_SESSION['dialog']['info'][] = _('Fail to save email to SMS configuration');
        }
        if ($continue) {
            $items = array('pin' => $pin, 'enable' => $_REQUEST['enable'], 'check_sender' => $_REQUEST['check_sender'], 'protocol' => $_REQUEST['protocol'], 'ssl' => $_REQUEST['ssl'], 'novalidate_cert' => $_REQUEST['novalidate_cert'], 'port' => $_REQUEST['port'], 'server' => $_REQUEST['server'], 'username' => $_REQUEST['username'], 'hash' => md5($_REQUEST['username'] . $_REQUEST['server'] . $_REQUEST['port']));
            if ($_REQUEST['password']) {
                $items['password'] = $_REQUEST['password'];
Пример #9
0
     $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>&nbsp;";
         $action .= "<a href=\"" . _u('index.php?app=main&inc=feature_schedule&route=edit&op=list&id=' . $db_row['id']) . "\">" . $icon_config['edit'] . "</a>&nbsp;";
         $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');
         }
Пример #10
0
/**
 * Display error string from function parameter or session
 * Shortcut to themes_dialog()
 * Compatibilty with previous playSMS versions, will be removed on 1.0
 *
 * @param array $content
 *        Array of contents of dialog, format: $content['dialog'][<Type_of_dialog>]
 *        Type of dialog: default, info, primary, success, warning, danger
 * @param string $title
 *        Dialog title
 * @return string HTML string of error strings
 */
function _err_display($content = array(), $title = '')
{
    return _dialog($content, $title);
}
Пример #11
0
     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;
Пример #12
0
             $lang_list[$c_language_title] = $language;
         }
     }
     if (is_array($lang_list)) {
         $option_language_module = _options($lang_list, $main_config['language_module']);
     }
     // select plus_sign_remove
     $option_plus_sign_remove = _options(array(_('yes') => 1, _('no') => 0), $main_config['plus_sign_remove']);
     // select plus_sign_add
     $option_plus_sign_add = _options(array(_('yes') => 1, _('no') => 0), $main_config['plus_sign_add']);
     // select enable_credit_unicode
     $option_enable_credit_unicode = _options(array(_('yes') => 1, _('no') => 0), $main_config['enable_credit_unicode']);
     // select brute_force_detection
     $option_brute_force_detection = _options(array(_('yes') => 1, _('no') => 0), $main_config['brute_force_detection']);
     // display
     $tpl = array('name' => 'main_config', 'vars' => array('DIALOG_DISPLAY' => _dialog(), 'ACTION_URL' => _u('index.php?app=main&inc=core_main_config&op=main_config_save'), 'Main configuration' => _('Main configuration'), 'Default settings' => _('Default settings'), 'Default site configuration' => _('Default site configuration'), 'Information page' => _('Information page'), 'Buy credit page' => _('Buy credit page'), 'Page title' => _('Page title'), 'Page content' => _('Page content'), 'Website URL' => _('Website URL'), 'Website title' => _('Website title'), 'Website email' => _('Website email'), 'Forwarded email footer' => _('Forwarded email footer'), 'Main website name' => _('Main website name'), 'Main website URL' => _('Main website URL'), 'Default sender ID' => _('Default sender ID'), 'Default timezone' => _('Default timezone'), 'Maximum username length' => _('Maximum username length'), 'Default SMS rate' => _('Default SMS rate'), 'Maximum SMS count' => _('Maximum SMS count'), 'Always remove plus sign' => _('Always remove plus sign'), 'Always add plus sign' => _('Always add plus sign'), 'Enable credit unicode SMS as normal SMS' => _('Enable credit unicode SMS as normal SMS'), 'Enable login brute force detection' => _('Enable login brute force detection'), 'Keyword separator' => _('Keyword separator'), 'Lowest credit limit to trigger notification' => _('Lowest credit limit to trigger notification'), 'Number of sent SMS per hour limit' => _('Number of sent SMS per hour limit'), 'Enable public registration' => _('Enable public registration'), 'Enable forgot password' => _('Enable forgot password'), 'Disable login as subuser' => _('Disable login as subuser'), 'Enhance privacy for subusers' => _('Enhance privacy for subusers'), 'Enable logo' => _('Enable logo'), 'Logo URL' => _('Logo URL'), 'Replace website title with logo' => _('Replace website title with logo'), 'Default SMSC' => _('Default SMSC'), 'Default prefix or country code' => _('Default prefix or country code'), 'Active themes' => _('Active themes'), 'Default language' => _('Default language'), 'Default account status upon registration' => _('Default account status upon registration'), 'Default parent upon registration' => _('Default parent upon registration'), 'Default ACL upon registration' => _('Default ACL upon registration'), 'Default credit upon registration' => _('Default credit upon registration'), 'Layout footer' => _('Layout footer'), 'Save' => _('Save'), 'HTTP_PATH_THEMES' => $core_config['http_path']['themes'], 'lang' => substr($user_config['language_module'], 0, 2), 'HINT_SENDER_ID' => _hint(_('Empty default sender ID to allow users setting their own sender ID')), 'HINT_TIMEZONE' => _hint(_('Eg: +0700 for Jakarta/Bangkok timezone')), 'HINT_ENABLE_LOGO' => _hint(_('Logo by default will be displayed at login, register and forgot password page')), 'HINT_WEBSITE_URL' => _hint(_('Access to unknown domain mapped to this server IP address will be redirected to this website URL. This website URL should be the primary address for the service.')), 'HINT_CUSTOM_SENDER_ID' => _hint(_('Allow users to select sender ID while on Send SMS page')), 'HINT_CUSTOM_FOOTER' => _hint(_('Allow users to select SMS footer while on Send SMS page')), 'HINT_SMS_LIMIT_PER_HOUR' => _hint(_('Fill with zero to disable limit')), 'HINT_DEFAULT_PARENT' => _hint(_('Default parent selected upon registration when the default account status on registration setting set to Subuser')), 'HINT_DEFAULT_ACL' => _hint(_('ACL DEFAULT will not restrict access to menus')), 'HINT_USERNAME_LENGTH' => _hint(_('Maximum username length must be a number between 4 to 100')), 'HINT_REPLACE_ZERO' => _hint(_('Default prefix or country code to replace prefix 0 on destination number')), 'HINT_CREDIT_LOWEST_LIMIT' => _hint(_('Set credit value bigger than 0 to set credit lowest limit that will trigger notification')), 'HINT_KEYWORD_SEPARATOR' => _hint(_('Define a single character as keyword separator replacing default keyword separator a space')), 'web_title' => $main_config['web_title'], 'email_service' => $main_config['email_service'], 'email_footer' => $main_config['email_footer'], 'main_website_name' => $main_config['main_website_name'], 'main_website_url' => $main_config['main_website_url'], 'gateway_number' => $main_config['gateway_number'], 'gateway_timezone' => $main_config['gateway_timezone'], 'username_length' => $main_config['username_length'] >= 3 && $main_config['username_length'] <= 100 ? $main_config['username_length'] : 30, 'default_rate' => $main_config['default_rate'], 'sms_max_count' => $main_config['sms_max_count'], 'credit_lowest_limit' => (double) $main_config['credit_lowest_limit'], 'sms_limit_per_hour' => (int) $main_config['sms_limit_per_hour'], 'default_replace_zero' => $main_config['default_replace_zero'], 'default_credit' => (double) $main_config['default_credit'], 'keyword_separator' => substr($main_config['keyword_separator'], 0, 1), 'logo_url' => $main_config['logo_url'], 'layout_footer' => $main_config['layout_footer'], 'information_title' => $main_config['information_title'], 'information_content' => $main_config['information_content'], 'option_default_user_status' => $option_default_user_status, 'option_default_parent' => $option_default_parent, 'option_default_acl' => $option_default_acl, 'option_enable_logo' => $option_enable_logo, 'option_logo_replace_title' => $option_logo_replace_title, 'option_enable_register' => $option_enable_register, 'option_enable_forgot' => $option_enable_forgot, 'option_disable_login_as' => $option_disable_login_as, 'option_enhance_privacy_subuser' => $option_enhance_privacy_subuser, 'option_gateway_module' => $option_gateway_module, 'option_themes_module' => $option_themes_module, 'option_language_module' => $option_language_module, 'option_plus_sign_remove' => $option_plus_sign_remove, 'option_plus_sign_add' => $option_plus_sign_add, 'option_enable_credit_unicode' => $option_enable_credit_unicode, 'option_brute_force_detection' => $option_brute_force_detection), 'injects' => array('core_config'));
     _p(tpl_apply($tpl));
     break;
 case "main_config_save":
     // logo
     $enable_logo = $_POST['edit_enable_logo'];
     $logo_url = trim($_POST['edit_logo_url']);
     $logo_replace_title = $_POST['edit_logo_replace_title'];
     if (!$logo_url) {
         $themes_logo = _APPS_PATH_THEMES_ . '/' . core_themes_get() . '/images/logo.png';
         $themes_logo_url = _HTTP_PATH_THEMES_ . '/' . core_themes_get() . '/images/logo.png';
         $default_logo = _APPS_PATH_THEMES_ . '/common/images/logo.png';
         $default_logo_url = _HTTP_PATH_THEMES_ . '/common/images/logo.png';
         $logo_url = file_exists($themes_logo) ? $themes_logo_url : $default_logo_url;
         // force to disable logo when neither themes_logo or default_logo exists
         if (!file_exists($default_logo)) {
Пример #13
0
 *
 * 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/smstools/config.php";
switch (_OP_) {
    case "manage":
        $content .= _dialog() . "\n\t\t\t<h2>" . _('Manage smstools') . "</h2>\n\t\t\t<form action=index.php?app=main&inc=gateway_smstools&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\t<tr>\n\t\t\t\t\t\t<td class=label-sizer>" . _('Gateway name') . "</td><td>smstools</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . _('Default default_queue directory') . "</td><td><input type=text name=up_default_queue value=\"" . $plugin_config['smstools']['default_queue'] . "\"></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=\"" . _('Save') . "\">\n\t\t\t</form>\n\t\t\t<p>" . _back('index.php?app=main&inc=core_gateway&op=gateway_list');
        _p($content);
        break;
    case "manage_save":
        $up_default_queue = trim(core_sanitize_path($_POST['up_default_queue']));
        if (!$up_default_queue) {
            $up_default_queue = "/var/spool/sms";
        }
        $items = array('default_queue' => $up_default_queue);
        registry_update(0, 'gateway', 'smstools', $items);
        $_SESSION['dialog']['info'][] = _('Changes have been made');
        header("Location: " . _u('index.php?app=main&inc=gateway_smstools&op=manage'));
        exit;
        break;
}
Пример #14
0
if (!auth_isadmin()) {
    auth_block();
}
$id = $_REQUEST['id'];
$acl_name = acl_getname($id);
switch (_OP_) {
    case "user_list":
        $search_var = array(_('Registered') => 'register_datetime', _('Username') => 'username', _('Name') => 'name', _('Mobile') => 'mobile');
        $search = themes_search($search_var, '');
        $conditions = array('flag_deleted' => 0, 'acl_id' => $id);
        $keywords = $search['dba_keywords'];
        $count = dba_count(_DB_PREF_ . '_tblUser', $conditions, $keywords);
        $nav = themes_nav($count, "index.php?app=main&inc=core_acl&route=view&op=user_list&id=" . $id);
        $extras = array('ORDER BY' => 'register_datetime DESC, username', 'LIMIT' => $nav['limit'], 'OFFSET' => $nav['offset']);
        $list = dba_search(_DB_PREF_ . '_tblUser', '*', $conditions, $keywords, $extras);
        $content .= _dialog() . "\n\t\t\t<h2>" . _('Manage ACL') . "</h2>\n\t\t\t<h3>" . _('View report') . "</h3>\n\n\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>" . _('ACL ID') . "</td>\n\t\t\t\t\t<td>" . $id . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _('ACL name') . "</td>\n\t\t\t\t\t<td>" . $acl_name . "</td>\n\t\t\t\t</tr>\n\t\t\t</table>\t\t\t\n\t\t\t<h4>" . _('List of accounts') . "</h4>\n\t\t\t<p>" . $search['form'] . "</p>\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%'>" . _('Registered') . "</th>\n\t\t\t\t<th width='20%'>" . _('Username') . "</th>\n\t\t\t\t<th width='20%'>" . _('Name') . "</th>\n\t\t\t\t<th width='20%'>" . _('Mobile') . "</th>\n\t\t\t\t<th width='20%'>" . _('Credit') . "</th>\n\t\t\t</tr></thead>\n\t\t\t<tbody>";
        $j = $nav['top'];
        for ($i = 0; $i < count($list); $i++) {
            $action = "";
            if ($list[$i]['uid'] != '1' || $list[$i]['uid'] != $user_config['uid']) {
                if (user_banned_get($list[$i]['uid'])) {
                    // unban
                    $banned_icon = $icon_config['ban'];
                } else {
                    // ban
                    $banned_icon = '';
                }
            }
            $j--;
            $content .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . core_display_datetime($list[$i]['register_datetime']) . "</td>\n\t\t\t\t\t" . $parent_column_row . "\n\t\t\t\t\t<td>" . $banned_icon . "" . $list[$i]['username'] . " </td>\n\t\t\t\t\t<td>" . $list[$i]['name'] . "</td>\n\t\t\t\t\t<td>" . $list[$i]['mobile'] . "</td>\n\t\t\t\t\t<td>" . rate_getusercredit($list[$i]['username']) . "</td>\n\t\t\t\t</tr>";
        }
Пример #15
0
     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'];
     $items['sandbox_match_sender_id'] = $post_rules['match_sender_id'];
     // sandbox prefix
Пример #16
0
 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['dialog']['info'][] = _('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 = _dialog() . "\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 (keyword_isavail($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";
Пример #17
0
                     $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;
Пример #18
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 {
Пример #19
0
                    $_SESSION['dialog']['danger'][] = _('Fail to recover password');
                }
            } else {
                $_SESSION['dialog']['danger'][] = _('Recover password disabled');
            }
        } else {
            $_SESSION['dialog']['danger'][] = _('Please type the displayed captcha phrase correctly');
        }
    }
    if ($ok) {
        header("Location: " . _u($core_config['http_path']['base']));
    } else {
        header("Location: " . _u('index.php?app=main&inc=core_auth&route=forgot'));
    }
    exit;
} else {
    $enable_logo = FALSE;
    $show_web_title = TRUE;
    if ($core_config['main']['enable_logo'] && $core_config['main']['logo_url']) {
        $enable_logo = TRUE;
        if ($core_config['main']['logo_replace_title']) {
            $show_web_title = FALSE;
        }
    }
    // captcha
    $captcha = new CaptchaBuilder();
    $captcha->build();
    $_SESSION['tmp']['captcha'] = $captcha->getPhrase();
    $tpl = array('name' => 'auth_forgot', 'vars' => array('HTTP_PATH_BASE' => $core_config['http_path']['base'], 'WEB_TITLE' => $core_config['main']['web_title'], 'DIALOG_DISPLAY' => _dialog(), 'URL_ACTION' => _u('index.php?app=main&inc=core_auth&route=forgot&op=forgot'), 'URL_REGISTER' => _u('index.php?app=main&inc=core_auth&route=register'), 'URL_LOGIN' => _u('index.php?app=main&inc=core_auth&route=login'), 'CAPTCHA_IMAGE' => $captcha->inline(), 'HINT_CAPTCHA' => _hint(_('Read and type the captcha phrase on verify captcha field. If you cannot read them please contact administrator.')), 'Username' => _('Username'), 'Email' => _('Email'), 'Recover password' => _('Recover password'), 'Login' => _('Login'), 'Submit' => _('Submit'), 'Register an account' => _('Register an account'), 'Verify captcha' => _('Verify captcha'), 'logo_url' => $core_config['main']['logo_url']), 'ifs' => array('enable_register' => $core_config['main']['enable_register'], 'enable_logo' => $enable_logo, 'show_web_title' => $show_web_title));
    _p(tpl_apply($tpl));
}
Пример #20
0
     $options['logo_replace_title'] = _options(array(_('yes') => 1, _('no') => 0), $site_config['logo_replace_title']);
     // get themes options
     $options['themes_module'] = _options($core_config['plugins']['list']['themes'], $site_config['themes_module']);
     // get language options
     $lang_list = '';
     for ($i = 0; $i < count($core_config['plugins']['list']['language']); $i++) {
         $language = $core_config['plugins']['list']['language'][$i];
         $c_language_title = $plugin_config[$language]['title'];
         if ($c_language_title) {
             $lang_list[$c_language_title] = $language;
         }
     }
     if (is_array($lang_list)) {
         $options['language_module'] = _options($lang_list, $site_config['language_module']);
     }
     $tpl = array('name' => 'site', 'vars' => array('ACTION_URL' => _u('index.php?app=main&inc=core_site&op=site_config_save'), 'HINT_ENABLE_LOGO' => _hint(_('Logo by default will be displayed at login, register and forgot password page')), 'HINT_DOMAIN' => _hint('Put your domain name here and then set your domain DNS A record to this server IP address'), 'DIALOG_DISPLAY' => _dialog(), 'Manage site' => _('Manage site'), 'Site configuration' => _('Site configuration'), 'Configuration' => _('Configuration'), 'Information page' => _('Information page'), 'Buy credit page' => _('Buy credit page'), 'Page title' => _('Page title'), 'Page content' => _('Page content'), 'Domain' => _('Domain'), 'Website title' => _('Website title'), 'Email service' => _('Email service'), 'Email footer' => _('Email footer'), 'Main website name' => _('Main website name'), 'Main website URL' => _('Main website URL'), 'Enable logo' => _('Enable logo'), 'Logo URL' => _('Logo URL'), 'Replace website title with logo' => _('Replace website title with logo'), 'Enable public registration' => _('Enable public registration'), 'Enable forgot password' => _('Enable forgot password'), 'Active themes' => _('Active themes'), 'Default language' => _('Default language'), 'Default credit upon registration' => _('Default credit upon registration'), 'Layout footer' => _('Layout footer'), 'Save' => _('Save')), 'injects' => array('core_config', 'site_config', 'options'));
     _p(tpl_apply($tpl));
     break;
 case "site_config_save":
     foreach ($_POST['up'] as $key => $val) {
         $up[$key] = $val;
     }
     $site = site_config_getbydomain($up['domain']);
     if ($up['domain'] && $site[0]['uid'] && $site[0]['uid'] != $user_config['uid']) {
         $_SESSION['dialog']['info'][] = _('The domain is already configured by other user') . ' (' . _('domain') . ':' . $up['domain'] . ')';
     } else {
         site_config_set($up);
         $_SESSION['dialog']['info'][] = _('Site configuration has been saved');
     }
     _log('site configuration saved. uid:' . $user_config['uid'] . ' domain:' . $up['domain'], 3, 'site');
     header('Location:' . _u('index.php?app=main&inc=core_site&op=site_config'));
Пример #21
0
/**
 * 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 (_OP_ == 'block') {
    if (auth_isvalid()) {
        $_SESSION['dialog']['danger'][] = _('You have no access to this page');
        logger_print("WARNING: no access or blocked. sid:" . $_SESSION['sid'] . " ip:" . $_SERVER['REMOTE_ADDR'] . " uid:" . $user_config['uid'] . " app:" . _APP_ . " inc:" . _INC_ . " op:" . _OP_ . " route:" . _ROUTE_, 2, "auth_block");
        header("Location: " . _u('index.php?app=main&inc=core_auth&route=block'));
    } else {
        header("Location: " . _u('index.php?app=main&inc=core_auth&route=login'));
    }
    exit;
} else {
    unset($tpl);
    $tpl = array('name' => 'auth_block', 'vars' => array('DIALOG_DISPLAY' => _dialog(), 'HTTP_PATH_BASE' => $core_config['http_path']['base'], 'Home' => _('Home')));
    _p(tpl_apply($tpl));
}
Пример #22
0
 *
 * 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_isvalid()) {
    auth_block();
}
switch (_OP_) {
    case 'list':
        $content = _dialog() . '<h2>' . _('Send from file') . '</h2><p />';
        if (auth_isadmin()) {
            $info_format = _('destination number, message, username');
        } else {
            $info_format = _('destination number, message');
        }
        $content .= "\n\t\t\t<table class=ps_table>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<form action=\"index.php?app=main&inc=feature_sendfromfile&op=upload_confirm\" enctype=\"multipart/form-data\" method=\"post\">\n\t\t\t\t\t\t\t" . _CSRF_FORM_ . "\n\t\t\t\t\t\t\t<p>" . _('Please select CSV file') . "</p>\n\t\t\t\t\t\t\t<p><input type=\"file\" name=\"fncsv\"></p>\n\t\t\t\t\t\t\t<p class=help-block>" . _('CSV file format') . " : " . $info_format . "</p>\n\t\t\t\t\t\t\t<p><input type=checkbox name=fncsv_dup value=1 checked> " . _('Prevent duplicates') . "</p>\n\t\t\t\t\t\t\t<p><input type=\"submit\" value=\"" . _('Upload file') . "\" class=\"button\"></p>\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>";
        _p($content);
        break;
    case 'upload_confirm':
        $filename = $_FILES['fncsv']['name'];
        $fn = $_FILES['fncsv']['tmp_name'];
        $fs = (int) $_FILES['fncsv']['size'];
        $nodups = $_REQUEST['fncsv_dup'] ? TRUE : FALSE;
        $all_numbers = array();
        $valid = 0;
Пример #23
0
     $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'];
Пример #24
0
         $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;
             }
Пример #25
0
         if ($list[$j]['p_status'] == 2) {
             $p_charge = '0.0';
         }
         $msg = $list[$j]['p_msg'];
         $p_msg = core_display_text($msg);
         if ($msg && $p_dst) {
             $resend = _sendsms($p_dst, $msg, '', $icon_config['resend']);
             $forward = _sendsms('', $msg, '', $icon_config['forward']);
         }
         $c_message = "\n\t\t\t\t<div id=\"msg_label\">" . $p_datetime . "&nbsp;" . _('count') . ":" . $p_count . "&nbsp;" . _('rate') . ":" . $p_rate . "&nbsp;" . _('cost') . ":" . $p_charge . "&nbsp;" . $p_status . "</div>\n\t\t\t\t<div id=\"all_outgoing_msg\">" . $p_msg . "</div>\n\t\t\t\t<div id=\"msg_option\">" . $resend . "&nbsp" . $forward . "</div>";
         $i--;
         $content .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>{$p_username}</td>\n\t\t\t\t\t<td><div>" . $p_smsc . "</div><div>" . $p_gateway . "</td>\n\t\t\t\t\t<td><div>" . $current_p_dst . "</div><div>" . $queue_view_link . "</div></td>\n\t\t\t\t\t<td>{$c_message}</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<input type=hidden name=itemid" . $j . " value=\"{$smslog_id}\">\n\t\t\t\t\t\t<input type=checkbox name=checkid" . $j . ">\n\t\t\t\t\t</td>\n\t\t\t\t</tr>";
     }
     $content .= "\n\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t</div>\n\t\t\t<div class=pull-right>" . $nav['form'] . "</div>\n\t\t\t</form>" . $queue_home_link;
     if ($err = TRUE) {
         _p(_dialog());
     }
     _p($content);
     break;
 case "actions":
     $nav = themes_nav_session();
     $search = themes_search_session();
     $go = $_REQUEST['go'];
     switch ($go) {
         case 'export':
             $conditions = array('A.flag_deleted' => 0);
             if ($queue_code = trim($_REQUEST['queue_code'])) {
                 $conditions['A.queue_code'] = $queue_code;
             }
             $table = _DB_PREF_ . '_tblSMSOutgoing';
             $join = "INNER JOIN " . _DB_PREF_ . "_tblUser AS B ON B.flag_deleted='0' AND A.uid=B.uid";
Пример #26
0
 * 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();
}
switch (_OP_) {
    case "simulate":
        $sender = '629876543210';
        $receiver = '1234';
        $datetime = core_get_datetime();
        $content .= _dialog() . "\n\t\t\t<h2>" . _('Simulate incoming SMS') . "</h2>\n\t\t\t<form action=\"index.php?app=main&inc=gateway_dev&route=simulate&op=simulate_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><td class=label-sizer>" . _('Message') . "</td><td><input type=text name=message value=\"{$message}\" maxlength=250></td></tr>\n\t\t\t\t<tr><td>" . _('Sender') . "</td><td><input type=text name=sender value=\"{$sender}\" maxlength=20></td></tr>\n\t\t\t\t<tr><td>" . _('Receiver') . "</td><td><input type=text name=receiver value=\"{$receiver}\" maxlength=20></td></tr>\n\t\t\t\t<tr><td>" . _('Date/Time') . "</td><td><input type=text name=datetime value=\"" . core_display_datetime($datetime) . "\" maxlength=20></td></tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<p><input type=submit class=button value=\"" . _('Submit') . "\">\n\t\t\t</form>";
        _p($content);
        break;
    case "simulate_yes":
        $sms_sender = $_REQUEST['sender'] ? $_REQUEST['sender'] : '629876543210';
        $sms_receiver = $_REQUEST['receiver'] ? $_REQUEST['receiver'] : '1234';
        $sms_datetime = $_REQUEST['datetime'] ? $_REQUEST['datetime'] : core_get_datetime();
        $message = $_REQUEST['message'] ? $_REQUEST['message'] : _('This is a test incoming SMS message');
        $message = htmlspecialchars_decode($message);
        if (trim($sms_sender) && trim($sms_receiver) && trim($sms_datetime) && trim($message)) {
            recvsms($sms_datetime, $sms_sender, $message, $sms_receiver, 'dev');
            $err[] = "Sender ID: " . $sms_sender;
            $err[] = "Receiver number: " . $sms_receiver;
            $err[] = "Sent: " . $sms_datetime;
            $err[] = "Message: " . stripslashes($message);
            _log(print_r($err, TRUE), 3, "dev incoming");
Пример #27
0
             $c_option_acl = array_flip(acl_getallbyuid($user_config['uid']));
             $option_acl = _select('up_acl_id', $c_option_acl, $acl_id);
         }
     }
     // additional user's config available on registry
     $data = registry_search($c_uid, 'core', 'user_config');
     // credit unicodes messages as single message
     $option_enable_credit_unicode = _options(array(_('yes') => 1, _('no') => 0), $data['core']['user_config']['enable_credit_unicode']);
     if (auth_isadmin()) {
         $option_enable_credit_unicode = "<select name='edit_enable_credit_unicode'>" . $option_enable_credit_unicode . "</select>";
     } else {
         $option_enable_credit_unicode = $user_config['opt']['enable_credit_unicode'] ? _('yes') : _('no');
     }
     // error string
     if ($err = TRUE) {
         $error_content = _dialog();
     }
     $tpl = array('name' => 'user_config', 'vars' => array('Application options' => _('Application options'), 'Username' => _('Username'), 'Access Control List' => _('Access Control List'), 'Effective SMS sender ID' => _('Effective SMS sender ID'), 'Default sender ID' => _('Default sender ID'), 'Default message footer' => _('Default message footer'), 'Webservices username' => _('Webservices username'), 'Webservices token' => _('Webservices token'), 'Renew webservices token' => _('Renew webservices token'), 'Enable webservices' => _('Enable webservices'), 'Webservices IP range' => _('Webservices IP range'), 'Active language' => _('Active language'), 'Timezone' => _('Timezone'), 'Credit' => _('Credit'), 'Enable credit unicode SMS as normal SMS' => _('Enable credit unicode SMS as normal SMS'), 'Forward message to inbox' => _('Forward message to inbox'), 'Forward message to email' => _('Forward message to email'), 'Forward message to mobile' => _('Forward message to mobile'), 'Local number length' => _('Local number length'), 'Prefix or country code' => _('Prefix or country code'), 'Always choose to send as unicode' => _('Always choose to send as unicode'), 'Save' => _('Save'), 'DIALOG_DISPLAY' => $error_content, 'FORM_TITLE' => $form_title, 'BUTTON_DELETE' => $button_delete, 'BUTTON_BACK' => $button_back, 'URL_UNAME' => $url_uname, 'VIEW' => $view, 'HINT_MAX_CHARS' => _hint(_('Max. 16 numeric or 11 alphanumeric characters')), 'HINT_MAX_ALPHANUMERIC' => _hint(_('Max. 30 alphanumeric characters')), 'HINT_COMMA_SEPARATED' => _hint(_('Comma separated')), 'HINT_TIMEZONE' => _hint(_('Eg: +0700 for Jakarta/Bangkok timezone')), 'HINT_LOCAL_LENGTH' => _hint(_('Min length to detect missing country code')), 'HINT_REPLACE_ZERO' => _hint(_('Replace prefix 0 or padding local numbers')), 'HINT_MANAGE_CREDIT' => _hint(_('Add or reduce credit from manage credit menu')), 'HINT_ACL' => _hint(_('ACL DEFAULT will not restrict access to menus')), 'option_new_token' => $option_new_token, 'option_enable_webservices' => $option_enable_webservices, 'option_language_module' => $option_language_module, 'option_fwd_to_inbox' => $option_fwd_to_inbox, 'option_fwd_to_email' => $option_fwd_to_email, 'option_fwd_to_mobile' => $option_fwd_to_mobile, 'option_acl' => $option_acl, 'option_sender_id' => $option_sender_id, 'c_username' => $c_username, 'effective_sender_id' => sendsms_get_sender($c_username), 'sender' => $sender, 'footer' => $footer, 'token' => $token, 'webservices_ip' => $webservices_ip, 'datetime_timezone' => $datetime_timezone, 'local_length' => $local_length, 'replace_zero' => $replace_zero, 'credit' => $credit, 'option_enable_credit_unicode' => $option_enable_credit_unicode));
     _p(tpl_apply($tpl));
     break;
 case "user_config_save":
     $fields = array('footer', 'datetime_timezone', 'language_module', 'fwd_to_inbox', 'fwd_to_email', 'fwd_to_mobile', 'local_length', 'replace_zero', 'new_token', 'enable_webservices', 'webservices_ip', 'sender', 'acl_id');
     $up = array();
     foreach ($fields as $field) {
         if (strlen($_POST['up_' . $field])) {
             $up[$field] = trim($_POST['up_' . $field]);
         }
     }
     $ret = user_edit_conf($c_uid, $up);
     $items['enable_credit_unicode'] = (int) $_POST['edit_enable_credit_unicode'];
     registry_update($c_uid, 'core', 'user_config', $items);
     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)) {
Пример #29
0
/**
 * 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;
}
Пример #30
0
 */
defined('_SECURE_') or die('Forbidden');
if (!auth_isvalid()) {
    auth_block();
}
switch (_OP_) {
    case "list":
        $id = $_REQUEST['id'];
        $db_query = "SELECT * FROM " . _DB_PREF_ . "_featureSchedule WHERE uid='" . $user_config['uid'] . "' AND id='{$id}' AND flag_deleted='0'";
        $db_result = dba_query($db_query);
        $db_row = dba_fetch_array($db_result);
        $name = $db_row['name'];
        $message = $db_row['message'];
        $schedule_rule = $db_row['schedule_rule'];
        if ($id && $name && $message) {
            $content = _dialog() . "\n\t\t\t<h2>" . _('Schedule messages') . "</h2>\n\t\t\t<h3>" . _('Edit schedule') . "</h3>\n\t\t\t<form action=index.php?app=main&inc=feature_schedule&route=edit&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>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('Schedule ID') . "</td><td>" . $id . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>" . _mandatory(_('Schedule name')) . "</td><td><input type=text maxlength=100 name=name value=\"" . $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 value=\"" . $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'], $schedule_rule) . "</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');
        } else {
            auth_block();
        }
        _p($content);
        break;
    case "edit_yes":
        $id = $_POST['id'];
        $name = $_POST['name'];
        $message = $_POST['message'];
        $schedule_rule = (int) $_POST['schedule_rule'];
        if ($id && $name && $message) {
            $db_query = "\n\t\t\t\tUPDATE " . _DB_PREF_ . "_featureSchedule\n\t\t\t\tSET c_timestamp='" . mktime() . "',name='{$name}',message='{$message}', schedule_rule='{$schedule_rule}'\n\t\t\t\tWHERE uid='" . $user_config['uid'] . "' AND id='{$id}' AND flag_deleted='0'";
            if (@dba_affected_rows($db_query)) {
                $_SESSION['dialog']['info'][] = _('SMS schedule been saved');
            } else {