Example #1
0
        // 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);
        $_SESSION['dialog']['info'][] = $ret['error_string'];
        _log('saving username:'******' error_string:[' . $ret['error_string'] . ']', 2, 'user_config');
        header("Location: " . _u('index.php?app=main&inc=core_user&route=user_config&op=user_config' . $url_uname . '&view=' . $view));
        exit;
        break;
}
Example #2
0
function webservices_account_conf($uid, $data = array())
{
    $ret = user_edit_conf($uid, $data);
    if ($ret['status']) {
        $json['status'] = 'OK';
        $json['error'] = '0';
        $json['info'] = $ret['error_string'];
    } else {
        $json['status'] = 'ERR';
        $json['error'] = '618';
        $json['info'] = $ret['error_string'];
    }
    return $json;
}