$c_option_acl = array_flip(acl_getall()); $option_acl = _input('text', '', acl_getname($acl_id), array('readonly')); if (auth_isadmin()) { $option_acl = _select('up_acl_id', $c_option_acl, $acl_id); } if ($user_edited['status'] == 4) { $parent_id = user_getparentbyuid($user_edited['uid']); if ($parent_id == $user_config['uid']) { $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();
if (!auth_isadmin()) { auth_block(); } switch (_OP_) { case "mailsms": $items_global = registry_search(0, 'features', 'mailsms'); // option enable fetch $option_enable_fetch = _options(array(_('yes') => 1, _('no') => 0), $items_global['features']['mailsms']['enable_fetch']); // option check email sender $option_check_sender = _options(array(_('yes') => 1, _('no') => 0), $items_global['features']['mailsms']['check_sender']); // option protocol $option_protocol = _options(array('IMAP' => 'imap', 'POP3' => 'pop3'), $items_global['features']['mailsms']['protocol']); // option ssl $option_ssl = _options(array(_('yes') => 1, _('no') => 0), $items_global['features']['mailsms']['ssl']); // option cert $option_novalidate_cert = _options(array(_('yes') => 1, _('no') => 0), $items_global['features']['mailsms']['novalidate_cert']); $tpl = array('name' => 'mailsms', 'vars' => array('ERROR' => _err_display(), 'FORM_TITLE' => _('Manage email to SMS'), 'ACTION_URL' => _u('index.php?app=main&inc=feature_mailsms&op=mailsms_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'), 'Enable fetch new emails' => _('Enable fetch new emails'), '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('option_enable_fetch', 'option_check_sender', 'option_protocol', 'option_ssl', 'option_novalidate_cert', 'items_global')); _p(tpl_apply($tpl)); break; case "mailsms_save": $items_global = array('email' => $_REQUEST['email'], 'enable_fetch' => $_REQUEST['enable_fetch'], '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_global['password'] = $_REQUEST['password']; } registry_update(0, 'features', 'mailsms', $items_global); if ($_REQUEST['enable_fetch']) { $enabled = 'enabled'; $_SESSION['error_string'] = _('Email to SMS configuration has been saved and service enabled'); } else { $enabled = 'disabled'; $_SESSION['error_string'] = _('Email to SMS configuration has been saved and service disabled');
* 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 "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);
$options['enable_logo'] = _options(array(_('yes') => 1, _('no') => 0), $site_config['enable_logo']); // enable logo to replace main website title yes-no option $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'); }
if (!auth_isvalid()) { 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']) {
$c_language_title = $plugin_config[$language]['title']; if ($c_language_title) { $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;