Merge remote-tracking branch 'origin/feature/HOR-3559' into bugfix/HOR-3633-C
This commit is contained in:
@@ -52,58 +52,43 @@ class Common
|
||||
}
|
||||
|
||||
$files = glob("$path/$singlePattern", $flags);
|
||||
$dirs = glob("$path/*", GLOB_MARK|GLOB_ONLYDIR|GLOB_NOSORT);
|
||||
$dirs = glob("$path/*", GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT);
|
||||
|
||||
if(is_array($dirs)){
|
||||
if (is_array($dirs)) {
|
||||
foreach ($dirs as $dir) {
|
||||
$files = array_merge($files, self::rglob("$dir/$singlePattern", $flags));
|
||||
}
|
||||
}
|
||||
|
||||
if ($onlyFiles) {
|
||||
$files = array_filter($files, function($v) { return is_dir($v) ? false : true;});
|
||||
$files = array_filter($files, function ($v) {
|
||||
return is_dir($v) ? false : true;
|
||||
});
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last version given a pattern of file name
|
||||
*
|
||||
* @param string $pattern a valid pattern for glob(...) native function
|
||||
* @param int $flag php flags for glob(...) native function
|
||||
* @return int|string
|
||||
*
|
||||
* Example:
|
||||
* - Given the following files inside a directory:
|
||||
* /example/path/myApplication-v1.tar
|
||||
* /example/path/myApplication-v2.tar
|
||||
* /example/path/myApplication-v3.tar
|
||||
* /example/path/myApplication-v5.tar
|
||||
* /example/path/myApplication-v7.tar
|
||||
*
|
||||
* $lastVer = ProcessMaker\Util\Common::getLastVersion("/example/path/myApplication-*.tar");
|
||||
*
|
||||
* It will returns: 7
|
||||
* This method get the last version of file when exists a special characters
|
||||
* @param $pattern
|
||||
* @param $extension
|
||||
* @param int $flag
|
||||
* @return int
|
||||
*/
|
||||
public static function getLastVersion($pattern, $flag = 0)
|
||||
public static function getLastVersionSpecialCharacters($dir, $pattern, $extension, $flag = 0)
|
||||
{
|
||||
$files = glob($pattern, $flag);
|
||||
$files = glob($dir . quotemeta($pattern) . "-*." . $extension, $flag);
|
||||
$maxVersion = 0;
|
||||
|
||||
$pattern = str_replace("*", '([0-9\.]+)', basename($pattern));
|
||||
|
||||
$pattern = preg_quote(basename($pattern)) . '-([0-9\.]+)pmx';
|
||||
foreach ($files as $file) {
|
||||
$filename = basename($file);
|
||||
|
||||
if (preg_match('/'.$pattern.'/', $filename, $match)) {
|
||||
|
||||
if (preg_match('/' . $pattern . '/', $filename, $match)) {
|
||||
if ($maxVersion < $match[1]) {
|
||||
$maxVersion = $match[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $maxVersion;
|
||||
}
|
||||
|
||||
@@ -141,8 +126,8 @@ class Common
|
||||
}
|
||||
|
||||
while ($parent_folder_path = array_pop($folder_path)) {
|
||||
if (! @is_dir($parent_folder_path)) {
|
||||
if (! @mkdir($parent_folder_path, $rights)) {
|
||||
if (!@is_dir($parent_folder_path)) {
|
||||
if (!@mkdir($parent_folder_path, $rights)) {
|
||||
umask($oldumask);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
/**
|
||||
* require_once pakeFunction.php
|
||||
*/
|
||||
require_once( PATH_THIRDPARTY . 'pake' . PATH_SEP . 'pakeFunction.php');
|
||||
require_once( PATH_THIRDPARTY . 'pake' . PATH_SEP . 'pakeGetopt.class.php');
|
||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||
|
||||
// trap -V before pake
|
||||
|
||||
@@ -3238,20 +3238,34 @@ class G
|
||||
* @param (array) additional characteres map
|
||||
*
|
||||
*/
|
||||
public function inflect ($string, $replacement = '_', $map = array())
|
||||
public function inflect($string, $replacement = '_', $map = array())
|
||||
{
|
||||
if (is_array( $replacement )) {
|
||||
if (is_array($replacement)) {
|
||||
$map = $replacement;
|
||||
$replacement = '_';
|
||||
}
|
||||
|
||||
$quotedReplacement = preg_quote( $replacement, '/' );
|
||||
$quotedReplacement = preg_quote($replacement, '/');
|
||||
|
||||
$default = array ('/à|á|å|â/' => 'a','/è|é|ê|ẽ|ë/' => 'e','/ì|í|î/' => 'i','/ò|ó|ô|ø/' => 'o','/ù|ú|ů|û/' => 'u','/ç/' => 'c','/ñ/' => 'n','/ä|æ/' => 'ae','/ö/' => 'oe','/ü/' => 'ue','/Ä/' => 'Ae','/Ü/' => 'Ue','/Ö/' => 'Oe','/ß/' => 'ss','/\.|\,|\:|\-|\\|\//' => " ",'/\\s+/' => $replacement
|
||||
);
|
||||
$default = array('/à|á|å|â/' => 'a',
|
||||
'/è|é|ê|ẽ|ë/' => 'e',
|
||||
'/ì|í|î/' => 'i',
|
||||
'/ò|ó|ô|ø/' => 'o',
|
||||
'/ù|ú|ů|û/' => 'u',
|
||||
'/ç/' => 'c',
|
||||
'/ñ/' => 'n',
|
||||
'/ä|æ/' => 'ae',
|
||||
'/ö/' => 'oe',
|
||||
'/ü/' => 'ue',
|
||||
'/Ä/' => 'Ae',
|
||||
'/Ü/' => 'Ue',
|
||||
'/Ö/' => 'Oe',
|
||||
'/ß/' => 'ss',
|
||||
'/[\.|\,|\+|\"|\:|\;|\-|\\|\/]/' => " ",
|
||||
'/\\s+/' => $replacement);
|
||||
|
||||
$map = array_merge( $default, $map );
|
||||
return preg_replace( array_keys( $map ), array_values( $map ), $string );
|
||||
$map = array_merge($default, $map);
|
||||
return preg_replace(array_keys($map), array_values($map), $string);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -165,6 +165,13 @@ class RBAC
|
||||
'updateCategory' => array('PM_SETUP', 'PM_SETUP_PROCESS_CATEGORIES'),
|
||||
'canDeleteCategory' => array('PM_SETUP', 'PM_SETUP_PROCESS_CATEGORIES'),
|
||||
'deleteCategory' => array('PM_SETUP', 'PM_SETUP_PROCESS_CATEGORIES')
|
||||
),
|
||||
'emailServerAjax.php' => array(
|
||||
'INS' => array('PM_SETUP'),
|
||||
'UPD' => array('PM_SETUP'),
|
||||
'DEL' => array('PM_SETUP'),
|
||||
'LST' => array('PM_SETUP'),
|
||||
'TEST' => array('PM_SETUP')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -75,12 +75,13 @@ class RbacUsers extends BaseRbacUsers
|
||||
try {
|
||||
$c = new Criteria('rbac');
|
||||
$c->add(RbacUsersPeer::USR_USERNAME, $sUsername);
|
||||
/* @var $rs RbacUsers[] */
|
||||
$rs = RbacUsersPeer::doSelect($c, Propel::getDbConnection('rbac_ro'));
|
||||
if (is_array($rs) && isset($rs[0]) && is_object($rs[0]) && get_class($rs[0]) == 'RbacUsers') {
|
||||
$aFields = $rs[0]->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
//verify password with md5, and md5 format
|
||||
if (mb_strtoupper($sUsername, 'utf-8') === mb_strtoupper($aFields['USR_USERNAME'], 'utf-8')) {
|
||||
if( Bootstrap::verifyHashPassword($sPassword, $aFields['USR_PASSWORD']) ) {
|
||||
if( Bootstrap::verifyHashPassword($sPassword, $rs[0]->getUsrPassword()) ) {
|
||||
if ($aFields['USR_DUE_DATE'] < date('Y-m-d')) {
|
||||
return -4;
|
||||
}
|
||||
@@ -317,6 +318,25 @@ class RbacUsers extends BaseRbacUsers
|
||||
throw($oError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc} except USR_PASSWORD, for security reasons.
|
||||
*
|
||||
* @param string $keyType One of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return an associative array containing the field names (as keys) and field values
|
||||
*/
|
||||
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$key = RbacUsersPeer::translateFieldName(
|
||||
RbacUsersPeer::USR_PASSWORD,
|
||||
BasePeer::TYPE_COLNAME,
|
||||
$keyType
|
||||
);
|
||||
$array = parent::toArray($keyType);
|
||||
unset($array[$key]);
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
|
||||
// Users
|
||||
|
||||
@@ -490,4 +490,23 @@ class Users extends BaseUsers
|
||||
$criteria->add(UsersPeer::USR_ID, $id);
|
||||
return UsersPeer::doSelect($criteria)[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc} except USR_PASSWORD, for security reasons.
|
||||
*
|
||||
* @param string $keyType One of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return an associative array containing the field names (as keys) and field values
|
||||
*/
|
||||
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$key = UsersPeer::translateFieldName(
|
||||
UsersPeer::USR_PASSWORD,
|
||||
BasePeer::TYPE_COLNAME,
|
||||
$keyType
|
||||
);
|
||||
$array = parent::toArray($keyType);
|
||||
unset($array[$key]);
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
$option = (isset($_POST["option"]))? $_POST["option"] : "";
|
||||
|
||||
$response = array();
|
||||
|
||||
$RBAC->allows(basename(__FILE__), $option);
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
$arrayData = array();
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
use ProcessMaker\Util\Common;
|
||||
|
||||
$response = new StdClass();
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
@@ -42,7 +43,7 @@ try {
|
||||
$projectName = $exporter->getProjectName();
|
||||
$getProjectName = $exporter->truncateName($projectName, false);
|
||||
|
||||
$version = ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
|
||||
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1;
|
||||
$outputFilename = sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
|
||||
$outputFilename = $exporter->saveExport($outputDir . $outputFilename);
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
@@ -318,7 +318,7 @@ switch ($_POST['action']) {
|
||||
|
||||
require_once 'classes/model/UsersProperties.php';
|
||||
$oUserProperty = new UsersProperties();
|
||||
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($aFields['USR_UID'], array('USR_PASSWORD_HISTORY' => serialize(array($aFields['USR_PASSWORD']))));
|
||||
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($aFields['USR_UID'], array('USR_PASSWORD_HISTORY' => serialize(array($oUser->getUsrPassword()))));
|
||||
$aFields['USR_LOGGED_NEXT_TIME'] = $aUserProperty['USR_LOGGED_NEXT_TIME'];
|
||||
|
||||
if (array_key_exists('USR_PASSWORD', $aFields)) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
use ProcessMaker\Project;
|
||||
use ProcessMaker\Util\Common;
|
||||
|
||||
class GranularExporter
|
||||
{
|
||||
@@ -64,7 +65,7 @@ class GranularExporter
|
||||
$this->prjName = $projectData['PRJ_NAME'];
|
||||
$getProjectName = $this->publisher->truncateName($projectData['PRJ_NAME'], false);
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx2") + 1;
|
||||
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx2") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx2");
|
||||
|
||||
$bpnmDefinition = array(
|
||||
|
||||
@@ -785,7 +785,7 @@ class User
|
||||
$oUser = new Users();
|
||||
$aUser = $oUser->load($userUid);
|
||||
$oUserProperty = new UsersProperties();
|
||||
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($userUid, array("USR_PASSWORD_HISTORY" => serialize(array($aUser["USR_PASSWORD"]))));
|
||||
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($userUid, array("USR_PASSWORD_HISTORY" => serialize(array($oUser->getUsrPassword()))));
|
||||
$aUserProperty["USR_LOGGED_NEXT_TIME"] = $arrayData["USR_LOGGED_NEXT_TIME"];
|
||||
$oUserProperty->update($aUserProperty);
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ class WebEntry
|
||||
$arrayUserData = $user->load($arrayWebEntryData["USR_UID"]);
|
||||
|
||||
$usrUsername = $arrayUserData["USR_USERNAME"];
|
||||
$usrPassword = $arrayUserData["USR_PASSWORD"];
|
||||
$usrPassword = $user->getUsrPassword();
|
||||
|
||||
$dynaForm = new \Dynaform();
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ use ProcessMaker\Project;
|
||||
use ProcessMaker\Project\Adapter;
|
||||
use ProcessMaker\BusinessModel\Migrator;
|
||||
use ProcessMaker\BusinessModel\Migrator\ImportException;
|
||||
use ProcessMaker\Util\Common;
|
||||
|
||||
abstract class Importer
|
||||
{
|
||||
@@ -771,7 +772,7 @@ abstract class Importer
|
||||
$getProjectName = $exporter->truncateName($exporter->getProjectName(), false);
|
||||
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
|
||||
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
|
||||
|
||||
$exporter->setMetadata("export_version", $version);
|
||||
|
||||
@@ -10,6 +10,7 @@ use \ProcessMaker\BusinessModel\Validator;
|
||||
use \ProcessMaker\BusinessModel\Migrator\GranularExporter;
|
||||
use \ProcessMaker\BusinessModel\Migrator\ExportObjects;
|
||||
use \ProcessMaker\Util\IO\HttpStream;
|
||||
use \ProcessMaker\Util\Common;
|
||||
|
||||
/**
|
||||
* Class Project
|
||||
@@ -182,7 +183,7 @@ class Project extends Api
|
||||
$getProjectName = $exporter->truncateName($exporter->getProjectName(), false);
|
||||
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
|
||||
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
|
||||
|
||||
$exporter->setMetadata("export_version", $version);
|
||||
|
||||
Reference in New Issue
Block a user