2011-06-03 18:40:51 -04:00
|
|
|
<?php
|
2023-03-24 17:55:53 +00:00
|
|
|
|
|
|
|
|
use ProcessMaker\Exception\RBACException;
|
|
|
|
|
|
|
|
|
|
// Include global object RBAC
|
|
|
|
|
global $RBAC;
|
|
|
|
|
|
|
|
|
|
// Check if the current user have the correct permissions to access to this resource, if not throws a RBAC Exception with code 403
|
|
|
|
|
if ($RBAC->userCanAccess('PM_SETUP') !== 1 || $RBAC->userCanAccess('PM_SETUP_LOGIN') !== 1) {
|
|
|
|
|
throw new RBACException('ID_ACCESS_DENIED', 403);
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
$request = isset($_REQUEST['request']) ? $_REQUEST['request'] : null;
|
2012-03-29 16:42:09 -04:00
|
|
|
|
2012-10-17 16:23:22 -04:00
|
|
|
switch ($request) {
|
|
|
|
|
case 'getLangList':
|
|
|
|
|
|
2012-11-27 17:15:57 -04:00
|
|
|
$Translations = new Translation();
|
2012-10-17 16:23:22 -04:00
|
|
|
$result = new stdClass();
|
2017-12-04 13:25:35 +00:00
|
|
|
$result->rows = array();
|
2012-10-17 16:23:22 -04:00
|
|
|
|
|
|
|
|
$langs = $Translations->getTranslationEnvironments();
|
|
|
|
|
foreach ($langs as $lang) {
|
2017-12-04 13:25:35 +00:00
|
|
|
$result->rows[] = array(
|
|
|
|
|
'LAN_ID' => $lang['LOCALE'],
|
|
|
|
|
'LAN_NAME' => $lang['LANGUAGE']
|
2012-10-17 16:23:22 -04:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
$result->rows[] = array("LAN_ID" => "", "LAN_NAME" => G::LoadTranslation("ID_USE_LANGUAGE_URL"));
|
2014-08-08 13:06:16 -04:00
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
print(G::json_encode($result));
|
2012-10-17 16:23:22 -04:00
|
|
|
break;
|
2011-06-03 18:40:51 -04:00
|
|
|
case 'saveSettings':
|
2017-12-04 13:25:35 +00:00
|
|
|
$memcache = PMmemcached::getSingleton(!empty(config("system.workspace")) ? config("system.workspace") : '');
|
2017-02-14 21:24:08 +00:00
|
|
|
|
2012-10-17 16:23:22 -04:00
|
|
|
$conf = new Configurations();
|
2017-12-04 13:25:35 +00:00
|
|
|
$conf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');
|
2012-10-17 16:23:22 -04:00
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
$conf->aConfig['login_enableForgotPassword'] = isset($_REQUEST['forgotPasswd']);
|
|
|
|
|
$conf->aConfig['login_enableVirtualKeyboard'] = isset($_REQUEST['virtualKeyboad']);
|
|
|
|
|
$conf->aConfig['login_defaultLanguage'] = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : 'en';
|
2012-10-17 16:23:22 -04:00
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
$conf->saveConfig('ENVIRONMENT_SETTINGS', '');
|
2012-10-17 16:23:22 -04:00
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
$lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : 'en';
|
2012-10-17 16:23:22 -04:00
|
|
|
//remove from memcache when this value is updated/created
|
2017-12-04 13:25:35 +00:00
|
|
|
$memcache->delete('flagForgotPassword');
|
2012-10-17 16:23:22 -04:00
|
|
|
|
2014-11-04 09:12:22 -04:00
|
|
|
$response = new stdclass();
|
2012-10-17 16:23:22 -04:00
|
|
|
$response->success = true;
|
2014-11-07 13:43:52 -04:00
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
$messEnableForgotPassword = (isset($conf->aConfig["login_enableForgotPassword"]) && $conf->aConfig["login_enableForgotPassword"] == "1") ? G::LoadTranslation("ID_YES") : G::LoadTranslation("ID_NO");
|
|
|
|
|
G::auditLog("UpdateLoginSettings",
|
|
|
|
|
"DefaultLanguage-> " . $lang . " EnableForgotPassword-> " . $messEnableForgotPassword);
|
2014-10-07 15:58:46 -04:00
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
echo G::json_encode($response);
|
2012-10-17 16:23:22 -04:00
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|