2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
38 /*********************************************************************************
40 * Description: TODO: To be written.
41 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
42 * All Rights Reserved.
43 * Contributor(s): ______________________________________..
44 ********************************************************************************/
47 if(!is_admin($current_user)){
48 sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
50 function clearPasswordSettings() {
51 $_POST['passwordsetting_SystemGeneratedPasswordON'] = '';
52 $_POST['passwordsetting_generatepasswordtmpl'] = '';
53 $_POST['passwordsetting_lostpasswordtmpl'] = '';
54 $_POST['passwordsetting_forgotpasswordON'] = '0';
55 $_POST['passwordsetting_linkexpiration'] = '1';
56 $_POST['passwordsetting_linkexpirationtime'] = '30';
57 $_POST['passwordsetting_linkexpirationtype'] = '1';
58 $_POST['passwordsetting_systexpiration'] = '0';
59 $_POST['passwordsetting_systexpirationtime'] = '';
60 $_POST['passwordsetting_systexpirationtype'] = '0';
61 $_POST['passwordsetting_systexpirationlogin'] = '';
64 require_once('modules/Administration/Forms.php');
65 echo getClassicModuleTitle(
68 "<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
69 $mod_strings['LBL_MANAGE_PASSWORD_TITLE'],
73 require_once('modules/Configurator/Configurator.php');
74 $configurator = new Configurator();
75 $sugarConfig = SugarConfig::getInstance();
76 $focus = new Administration();
77 $configurator->parseLoggerSettings();
78 $valid_public_key= true;
79 if(!empty($_POST['saveConfig'])){
80 if ($_POST['captcha_on'] == '1'){
81 $handle = @fopen("http://api.recaptcha.net/challenge?k=".$_POST['captcha_public_key']."&cachestop=35235354", "r");
84 while (!feof($handle)) {
85 $buffer .= fgets($handle, 4096);
89 $valid_public_key= substr($buffer, 1, 4) == 'var '? true : false;
91 if ($valid_public_key){
92 if (isset($_REQUEST['system_ldap_enabled']) && $_REQUEST['system_ldap_enabled'] == 'on') {
93 $_POST['system_ldap_enabled'] = 1;
94 clearPasswordSettings();
97 $_POST['system_ldap_enabled'] = 0;
100 if(isset($_REQUEST['authenticationClass']))
102 $configurator->useAuthenticationClass = true;
104 $configurator->useAuthenticationClass = false;
105 $_POST['authenticationClass'] = '';
109 if (isset($_REQUEST['ldap_group_checkbox']) && $_REQUEST['ldap_group_checkbox'] == 'on')
110 $_POST['ldap_group'] = 1;
112 $_POST['ldap_group'] = 0;
114 if (isset($_REQUEST['ldap_authentication_checkbox']) && $_REQUEST['ldap_authentication_checkbox'] == 'on')
115 $_POST['ldap_authentication'] = 1;
117 $_POST['ldap_authentication'] = 0;
119 if( isset($_REQUEST['passwordsetting_lockoutexpirationtime']) && is_numeric($_REQUEST['passwordsetting_lockoutexpirationtime']) )
120 $_POST['passwordsetting_lockoutexpiration'] = 2;
122 $configurator->saveConfig();
124 $focus->saveConfig();
126 header('Location: index.php?module=Administration&action=index');
130 $focus->retrieveSettings();
133 require_once('include/SugarLogger/SugarLogger.php');
134 $sugar_smarty = new Sugar_Smarty();
136 // if no IMAP libraries available, disable Save/Test Settings
137 if(!function_exists('imap_open')) $sugar_smarty->assign('IE_DISABLED', 'DISABLED');
139 $config_strings=return_module_language($GLOBALS['current_language'],'Configurator');
140 $sugar_smarty->assign('CONF', $config_strings);
141 $sugar_smarty->assign('MOD', $mod_strings);
142 $sugar_smarty->assign('APP', $app_strings);
143 $sugar_smarty->assign('APP_LIST', $app_list_strings);
144 $sugar_smarty->assign('config', $configurator->config);
145 $sugar_smarty->assign('error', $configurator->errors);
146 $sugar_smarty->assign('LANGUAGES', get_languages());
147 $sugar_smarty->assign("settings", $focus->settings);
149 $sugar_smarty->assign('saml_enabled_checked', false);
151 //echo "sugar_config[authenticationClass]: " . $sugar_config['authenticationClass'];
152 //if (array_key_exists('authenticationClass', $sugar_config) && $sugar_config['authenticationClass'] == 'SAMLAuthenticate') {
153 // $sugar_smarty->assign('saml_enabled_checked', true);
155 // $sugar_smarty->assign('saml_enabled_checked', false);
159 if(!function_exists('mcrypt_cbc')){
160 $sugar_smarty->assign("LDAP_ENC_KEY_READONLY", 'readonly');
161 $sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LDAP_ENC_KEY_NO_FUNC_DESC']);
163 $sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LBL_LDAP_ENC_KEY_DESC']);
165 $sugar_smarty->assign("settings", $focus->settings);
167 if ($valid_public_key){
168 if(!empty($focus->settings['captcha_on'])){
169 $sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
171 $sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'none');
174 $sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
177 $sugar_smarty->assign("VALID_PUBLIC_KEY", $valid_public_key);
181 $res=$GLOBALS['sugar_config']['passwordsetting'];
184 require_once('include/SugarPHPMailer.php');
185 $mail = new SugarPHPMailer();
186 $mail->setMailerForSystem();
187 if($mail->Mailer == 'smtp' && $mail->Host ==''){
188 $sugar_smarty->assign("SMTP_SERVER_NOT_SET", '1');
191 $sugar_smarty->assign("SMTP_SERVER_NOT_SET", '0');
193 $focus = new InboundEmail();
195 $storedOptions = unserialize(base64_decode($focus->stored_options));
196 $email_templates_arr = get_bean_select_array(true, 'EmailTemplate','name', '','name',true);
197 $create_case_email_template = (isset($storedOptions['create_case_email_template'])) ? $storedOptions['create_case_email_template'] : "";
198 $TMPL_DRPDWN_LOST =get_select_options_with_id($email_templates_arr, $res['lostpasswordtmpl']);
199 $TMPL_DRPDWN_GENERATE =get_select_options_with_id($email_templates_arr, $res['generatepasswordtmpl']);
201 $sugar_smarty->assign("TMPL_DRPDWN_LOST", $TMPL_DRPDWN_LOST);
202 $sugar_smarty->assign("TMPL_DRPDWN_GENERATE", $TMPL_DRPDWN_GENERATE);
204 $sugar_smarty->display('modules/Administration/PasswordManager.tpl');