This commit is contained in:
Roly Rudy Gutierrez Pinto
2017-08-08 09:53:00 -04:00
parent 33bb062fe7
commit 45c1ceffcc
19 changed files with 128 additions and 40 deletions

View File

@@ -187,7 +187,7 @@ class G
* @param string $symbol
* @return string
*/
public function generate_password($length = 15, $availableSets = "luns", $symbol = "_-+=!@#$%*&,.")
public function generate_password($length = 15, $availableSets = "luns", $symbol = "_-$!")
{
$chars = "";
if (strpos($availableSets, "l") !== false) {
@@ -1825,6 +1825,14 @@ class G
$arrayGrid = array_unique($arrayGrid);
//Given the set: 'valueOne', 'valueOneTwo', where the second string
//contains the first string, this causes the larger string to take
//the second, resulting in a delimitation error, to avoid this problem
//we first search the string larger size.
usort($arrayGrid, function($a, $b) {
return strlen($b) - strlen($a);
});
foreach ($arrayGrid as $index => $value) {
if($value !== "") {
$grdName = $value;
@@ -2912,6 +2920,16 @@ class G
return (bool) preg_match( '/^[0-9A-Za-z]{14,}/', $uid );
}
/**
* Verify if the input string is a valid UID of size 32
* @param string $uid
* @return boolean
*/
public static function verifyUniqueID32($uid)
{
return (bool) preg_match('/^[0-9A-Za-z]{32,32}$/', $uid);
}
/**
* is_utf8
*
@@ -2921,11 +2939,10 @@ class G
*/
public function is_utf8 ($string)
{
if (is_array( $string )) {
$enc = implode( '', $string );
return @! ((ord( $enc[0] ) != 239) && (ord( $enc[1] ) != 187) && (ord( $enc[2] ) != 191));
if (preg_match('//u', $string)) {
return true;
} else {
return (utf8_encode( utf8_decode( $string ) ) == $string);
return false;
}
}
@@ -5408,6 +5425,12 @@ class G
}
/**
* This function save history about some actions in the file audit.log
* The data is used in the Audit Log functionality
*
* @param string $actionToLog
* @param string $valueToLog
* @return void
*/
public static function auditLog($actionToLog, $valueToLog = "")
{
@@ -5416,13 +5439,25 @@ class G
$sflag = $conf->getConfiguration('AUDIT_LOG', 'log');
$sflagAudit = $sflag == 'true' ? true : false;
$ipClient = G::getIpAddress();
$userUid = 'Unknow User';
$fullName = '-';
/*----------------------------------********---------------------------------*/
$licensedFeatures = PMLicensedFeatures::getSingleton();
if ($sflagAudit && $licensedFeatures->verifyfeature('vtSeHNhT0JnSmo1bTluUVlTYUxUbUFSVStEeXVqc1pEUG5EeXc0MGd2Q3ErYz0=')) {
$username = isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '' ? $_SESSION['USER_LOGGED'] : 'Unknow User';
$fullname = isset($_SESSION['USR_FULLNAME']) && $_SESSION['USR_FULLNAME'] != '' ? $_SESSION['USR_FULLNAME'] : '-';
G::log("|". $workspace ."|". $ipClient ."|". $username . "|" . $fullname ."|" . $actionToLog . "|" . $valueToLog, PATH_DATA, "audit.log");
if (isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '') {
$userUid = $_SESSION['USER_LOGGED'];
} else {
//Get the usrUid related to the accessToken
$userUid = \ProcessMaker\Services\OAuth2\Server::getUserId();
if (!empty($userUid)) {
$oUserLogged = new \Users();
$user = $oUserLogged->loadDetails($userUid);
$fullName = $user['USR_FULLNAME'];
}
}
$fullName = isset($_SESSION['USR_FULLNAME']) && $_SESSION['USR_FULLNAME'] != '' ? $_SESSION['USR_FULLNAME'] : $fullName;
G::log("|". $workspace ."|". $ipClient ."|". $userUid . "|" . $fullName ."|" . $actionToLog . "|" . $valueToLog, PATH_DATA, "audit.log");
}
/*----------------------------------********---------------------------------*/
}