Files
luos/workflow/engine/methods/users/usersInit.php

76 lines
3.2 KiB
PHP
Raw Normal View History

<?php
global $RBAC;
2017-08-14 16:13:46 -04:00
use ProcessMaker\Core\System;
require_once 'classes/model/Users.php';
2017-12-04 13:25:35 +00:00
unset($_SESSION['CURRENT_USER']);
$oUser = new Users();
2017-12-04 13:25:35 +00:00
$aFields = $oUser->load($_SESSION['USER_LOGGED']);
2017-12-04 13:25:35 +00:00
if ($RBAC->userCanAccess('PM_EDITPERSONALINFO') == 1) { //he has permitions for edit his profile
$canEdit = false;
} else { //he has not permitions for edit his profile, so just view mode will be displayed
$canEdit = true;
}
2016-03-02 15:57:15 -04:00
$canEditCalendar = $RBAC->userCanAccess('PM_EDITPERSONALINFO') == 1 &&
$RBAC->userCanAccess('PM_EDITPERSONALINFO_CALENDAR') == 1;
//calculating the max upload file size;
2017-12-04 13:25:35 +00:00
$POST_MAX_SIZE = ini_get('post_max_size');
$mul = substr($POST_MAX_SIZE, - 1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int) $POST_MAX_SIZE * $mul;
2017-12-04 13:25:35 +00:00
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize');
$mul = substr($UPLOAD_MAX_SIZE, - 1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
2019-07-10 08:43:16 -04:00
//We need to use the following abbreviations: Bytes, KB, MB, GB
$maxFileSize = changeAbbreviationOfDirectives(ini_get('upload_max_filesize'));
if ($postMaxSize < $uploadMaxSize) {
$uploadMaxSize = $postMaxSize;
}
2016-06-02 10:23:09 -04:00
//Add year by expiration date
$expirationDate = 1;
$envFile = PATH_CONFIG . 'env.ini';
2017-12-04 13:25:35 +00:00
if (file_exists($envFile)) {
2017-08-14 16:13:46 -04:00
$sysConf = System::getSystemConfiguration($envFile);
2017-12-04 13:25:35 +00:00
if (isset($sysConf['expiration_year']) && $sysConf['expiration_year']>0) {
$expirationDate = abs($sysConf['expiration_year']);
2016-06-02 10:23:09 -04:00
}
}
2015-12-03 15:01:58 -04:00
$languageManagement = 0;
/*----------------------------------********---------------------------------*/
2017-12-04 13:25:35 +00:00
$licensedFeatures = PMLicensedFeatures::getSingleton();
2015-12-03 15:01:58 -04:00
if ($licensedFeatures->verifyfeature('w2LL3o4NFNiaDRXcFFCYVpJS3Jsall5dmh0ZWtBTkdKR3ROS0VzWGdoLzNQYz0=')) {
$languageManagement = 1;
}
/*----------------------------------********---------------------------------*/
2017-10-10 12:33:25 -04:00
$arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace"));
2017-12-04 13:25:35 +00:00
$oHeadPublisher = headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('users/users', true); //adding a javascript file .js
// $oHeadPublisher->addContent('users/users'); //adding a html file .html.
2017-12-04 13:25:35 +00:00
$oHeadPublisher->assign('USR_UID', $aFields['USR_UID']);
$oHeadPublisher->assign('infoMode', true);
$oHeadPublisher->assign('EDITPROFILE', 1);
$oHeadPublisher->assign('canEdit', $canEdit);
2016-03-02 15:57:15 -04:00
$oHeadPublisher->assign('canEditCalendar', $canEditCalendar);
2019-07-10 08:43:16 -04:00
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $maxFileSize . ') ');
2017-12-04 13:25:35 +00:00
$oHeadPublisher->assign('MODE', '');
$oHeadPublisher->assign('SYSTEM_TIME_ZONE', $arraySystemConfiguration['time_zone']);
2017-12-04 13:25:35 +00:00
$oHeadPublisher->assign('TIME_ZONE_DATA', array_map(function ($value) {
return [$value, $value];
}, DateTimeZone::listIdentifiers()));
$oHeadPublisher->assign('__SYSTEM_UTC_TIME_ZONE__', (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])? 1 : 0);
$oHeadPublisher->assign('EXPIRATION_DATE', $expirationDate);
2015-12-03 15:01:58 -04:00
$oHeadPublisher->assign('LANGUAGE_MANAGEMENT', $languageManagement);
$oHeadPublisher->assign('__ACTION__', 'savePersonalInfo');
2017-12-04 13:25:35 +00:00
G::RenderPage('publish', 'extJs');