From 06497d362e39d733c7512d1258a9dfdad8f37594 Mon Sep 17 00:00:00 2001 From: Brayan Pereyra Date: Wed, 24 Sep 2025 14:18:54 +0000 Subject: [PATCH] USER_HISTORY-236 Fix the session block funcionality --- gulliver/system/class.menu.php | 5 +- gulliver/system/class.pagedTable.php | 10 +- workflow/engine/classes/PropelTable.php | 6 +- workflow/engine/js/src/Sessions.js | 18 +-- .../engine/methods/login/authentication.php | 2 +- workflow/engine/methods/login/login.php | 5 +- .../engine/methods/login/sessionBlock.php | 148 ++++++++++++++++++ workflow/engine/methods/login/sysLogin.php | 2 +- workflow/engine/methods/setup/location.php | 18 +-- workflow/engine/templates/cases/casesList.js | 2 +- .../templates/cases/casesListConsolidated.js | 4 +- .../engine/templates/cases/casesStartCase.js | 2 +- workflow/engine/templates/processes/main.js | 2 +- workflow/engine/xmlform/login/login.xml | 2 +- 14 files changed, 187 insertions(+), 39 deletions(-) create mode 100644 workflow/engine/methods/login/sessionBlock.php diff --git a/gulliver/system/class.menu.php b/gulliver/system/class.menu.php index c8b992771..9262068b7 100644 --- a/gulliver/system/class.menu.php +++ b/gulliver/system/class.menu.php @@ -354,14 +354,13 @@ class Menu //$aux = $this->Icons[$ncount]; $aux = $this->JS[$ncount]; if ($this->Types[$ncount] == 'absolute') { - //$target = G::encryptLink(str_replace('sys' . SYS_TEMP, SYS_TEMP, $this->Options[$ncount])); $target = $this->Options[$ncount]; } if ($this->Types[$ncount] != 'absolute') { if (!empty(config("system.workspace"))) { - $target = '/sys' . SYS_TEMP . G::encryptLink('/' . SYS_LANG . '/' . SYS_SKIN . '/' . $this->Options[$ncount]); + $target = '/sys' . SYS_TEMP . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $this->Options[$ncount]; } else { - $target = '/sys/' . G::encryptLink(SYS_LANG . '/' . SYS_SKIN . '/' . $this->Options[$ncount]); + $target = '/sys/' . SYS_LANG . '/' . SYS_SKIN . '/' . $this->Options[$ncount]; } } $label = $this->Labels[$ncount]; diff --git a/gulliver/system/class.pagedTable.php b/gulliver/system/class.pagedTable.php index b07d9db80..125f634c2 100644 --- a/gulliver/system/class.pagedTable.php +++ b/gulliver/system/class.pagedTable.php @@ -327,8 +327,8 @@ class pagedTable } else { $this->filter = ""; } - $this->ajaxServer = G::encryptLink('../gulliver/pagedTableAjax'); - $this->ownerPage = G::encryptLink(SYS_CURRENT_URI); + $this->ajaxServer = '../gulliver/pagedTableAjax'; + $this->ownerPage = SYS_CURRENT_URI; //Needed for $mysql_real_escape_string $auxDbc = new DBConnection(); if (isset($this->xmlForm->sql)) { @@ -420,11 +420,11 @@ class pagedTable // $xmlPopup=''; // $this->xmlFormFile=""; ///* if ($table->Action) - // $this->ajaxServer=G::encryptLink($table->Action); + // $this->ajaxServer=$table->Action; // else*/ - // $this->ajaxServer=G::encryptLink('../gulliver/pagedTableAjax'); + // $this->ajaxServer='../gulliver/pagedTableAjax'; // $this->popupPage = $this->ajaxServer . '?function=printForm&filename=' . urlencode($xmlPopup); - // $this->ownerPage=G::encryptLink(SYS_CURRENT_URI); + // $this->ownerPage=SYS_CURRENT_URI; // $this->sqlConnection=''; // if (isset($table->_source)) // $this->sqlSelect=$table->_source; diff --git a/workflow/engine/classes/PropelTable.php b/workflow/engine/classes/PropelTable.php index aa975bfe1..e907f0fe5 100644 --- a/workflow/engine/classes/PropelTable.php +++ b/workflow/engine/classes/PropelTable.php @@ -202,11 +202,11 @@ class PropelTable $this->filter = urldecode($_GET['filter']); } if ($xmlForm->ajaxServer != '') { - $this->ajaxServer = G::encryptLink($xmlForm->ajaxServer); + $this->ajaxServer = $xmlForm->ajaxServer; } else { - $this->ajaxServer = G::encryptLink('../gulliver/propelTableAjax'); + $this->ajaxServer = '../gulliver/propelTableAjax'; } - $this->ownerPage = G::encryptLink(SYS_CURRENT_URI); + $this->ownerPage = SYS_CURRENT_URI; // Config attributes from XMLFORM file $myAttributes = get_class_vars(get_class($this)); foreach ($this->xmlForm->xmlform->tree->attribute as $atrib => $value) { diff --git a/workflow/engine/js/src/Sessions.js b/workflow/engine/js/src/Sessions.js index bb101da4b..49f86712b 100644 --- a/workflow/engine/js/src/Sessions.js +++ b/workflow/engine/js/src/Sessions.js @@ -8,7 +8,7 @@ PM.Sessions = (function () { window.location.pathname.indexOf("sysLogin") === -1 && window.location.pathname.indexOf("authentication") === -1 && window.location.pathname.indexOf("/sys/") === -1 && - this.getCookie('PM-TabPrimary') !== '101010010') { + this.getCookie('LURANA-TabPrimary') !== '101010010') { this.isClose = (this.getLabel('mainWindowClose') === "true"); if (this.isClose && parent.parent.parent.window.name === "") { this.register(); @@ -19,30 +19,30 @@ PM.Sessions = (function () { Sessions.prototype.register = function () { this.setLabel('mainWindowClose', false); - window.name = this.getCookie('PM-TabPrimary'); + window.name = this.getCookie('LURANA-TabPrimary'); }; Sessions.prototype.checkTab = function () { var ieVersion, msg, win; - if (window.name === this.getCookie('PM-TabPrimary')) { + if (window.name === this.getCookie('LURANA-TabPrimary')) { this.setLabel('mainWindowClose', false); } - if (parent.parent.parent.window.name !== this.getCookie('PM-TabPrimary') && - parent.parent.parent.window.name.indexOf(this.getCookie('PM-TabPrimary')) === -1 ) { + if (parent.parent.parent.window.name !== this.getCookie('LURANA-TabPrimary') && + parent.parent.parent.window.name.indexOf(this.getCookie('LURANA-TabPrimary')) === -1 ) { ieVersion = this.detectBrowser(); msg = this.getLabel('ID_BLOCKER_MSG'); win = window.open('', '_self', ''); if (ieVersion && ieVersion <= 11) { win.document.execCommand('Stop'); - win.open("/errors/block.php","_self"); + win.open("../login/sessionBlock.php","_self"); } else if (ieVersion && ieVersion <= 13) { win.document.execCommand('Stop'); - win.open("/errors/block.php","_self"); + win.open("../login/sessionBlock.php","_self"); } else { win.stop(); - win.open("/errors/block.php","_self"); + win.open("../login/sessionBlock.php","_self"); } } }; @@ -133,7 +133,7 @@ PM.Sessions = (function () { })(); PM.Sessions.addEventHandler(window, "unload",function () { - if (window.name === PM.Sessions.getCookie('PM-TabPrimary')){ + if (window.name === PM.Sessions.getCookie('LURANA-TabPrimary')){ PM.Sessions.setLabel('mainWindowClose', true); } }); \ No newline at end of file diff --git a/workflow/engine/methods/login/authentication.php b/workflow/engine/methods/login/authentication.php index 57fa22d7b..a3f9a2e7a 100644 --- a/workflow/engine/methods/login/authentication.php +++ b/workflow/engine/methods/login/authentication.php @@ -452,7 +452,7 @@ try { $configS = System::getSystemConfiguration('', '', config("system.workspace")); $activeSession = isset($configS['session_block']) ? !(int)$configS['session_block']:true; if ($activeSession){ - setcookie('PM-TabPrimary', 101010010, $cookieOptions); + setcookie('LURANA-TabPrimary', 101010010, $cookieOptions); } // Update the User's last login date diff --git a/workflow/engine/methods/login/login.php b/workflow/engine/methods/login/login.php index 0d31ce05f..b2045b34b 100644 --- a/workflow/engine/methods/login/login.php +++ b/workflow/engine/methods/login/login.php @@ -223,11 +223,12 @@ $flagForgotPassword = isset($oConf->aConfig['login_enableForgotPassword']) $configS = System::getSystemConfiguration('', '', config("system.workspace")); $activeSession = isset($configS['session_block']) ? !(int)$configS['session_block'] : true; + $cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60)]); if ($activeSession) { - setcookie('PM-TabPrimary', 101010010, $cookieOptions); + setcookie('LURANA-TabPrimary', 101010010, $cookieOptions); } else { - setcookie('PM-TabPrimary', uniqid(), $cookieOptions); + setcookie('LURANA-TabPrimary', uniqid(), $cookieOptions); } $oHeadPublisher->addScriptCode("var flagForgotPassword = '$flagForgotPassword';"); diff --git a/workflow/engine/methods/login/sessionBlock.php b/workflow/engine/methods/login/sessionBlock.php new file mode 100644 index 000000000..a1262c5ea --- /dev/null +++ b/workflow/engine/methods/login/sessionBlock.php @@ -0,0 +1,148 @@ + + + + + + + <?php echo htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); ?> + + + +
+

+
+

+
+
+ $url"; + }, + $escapedMessage + ); + echo $escapedMessage; + ?> +
+
+ Conxole Admin +
+
+
+ + \ No newline at end of file diff --git a/workflow/engine/methods/login/sysLogin.php b/workflow/engine/methods/login/sysLogin.php index 269468c2e..405b20c4e 100644 --- a/workflow/engine/methods/login/sysLogin.php +++ b/workflow/engine/methods/login/sysLogin.php @@ -145,7 +145,7 @@ switch (WS_IN_LOGIN) { } $cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60)]); -setcookie('PM-TabPrimary', uniqid(), $cookieOptions); +setcookie('LURANA-TabPrimary', uniqid(), $cookieOptions); $oHeadPublisher = headPublisher::getSingleton(); $oHeadPublisher->addScriptFile('/jscore/src/PM.js'); diff --git a/workflow/engine/methods/setup/location.php b/workflow/engine/methods/setup/location.php index 4d127c9ef..381a2e67a 100644 --- a/workflow/engine/methods/setup/location.php +++ b/workflow/engine/methods/setup/location.php @@ -76,14 +76,14 @@ function changeCity() { var country=document.getElementById('form[USR_COUNTRY]'); var city=document.getElementById('form[USR_CITY]'); - ajax_function('','changeCity','row='+rowNumber+'&country='+encodeURIComponent(country.value)+'&city='+encodeURIComponent(city.value)); + ajax_function('','changeCity','row='+rowNumber+'&country='+encodeURIComponent(country.value)+'&city='+encodeURIComponent(city.value)); } function addLocation() { var lr = document.getElementById('lastRow'); var city=document.getElementById('form[USR_CITY]'); if (newLocation.value=='') return; - lr.outerHTML=ajax_function('','newLocation','row='+rowNumber+'&location='+encodeURIComponent(newLocation.value)+'&city='+encodeURIComponent(city.value)); + lr.outerHTML=ajax_function('','newLocation','row='+rowNumber+'&location='+encodeURIComponent(newLocation.value)+'&city='+encodeURIComponent(city.value)); rowNumber++; newLocation.value=''; } @@ -91,7 +91,7 @@ function deleteLocation(locat) { var lr = document.getElementById('DIV_LOCATIONS'); var city=document.getElementById('form[USR_CITY]'); - lr.innerHTML=ajax_function('','delLocation','row='+rowNumber+'&uid='+encodeURIComponent(locat)+'&city='+encodeURIComponent(city.value)); + lr.innerHTML=ajax_function('','delLocation','row='+rowNumber+'&uid='+encodeURIComponent(locat)+'&city='+encodeURIComponent(city.value)); rowNumber--; } function changeRegion() @@ -104,23 +104,23 @@ function changeRegion() { var city=document.getElementById('form[USR_CITY]'); var lr = document.getElementById('DIV_LOCATIONS'); - lr.innerHTML=ajax_function('','changeRegion','city='+encodeURIComponent(city.value)); - rowNumber=ajax_function('','getRowRegion','city='+encodeURIComponent(city.value)); + lr.innerHTML=ajax_function('','changeRegion','city='+encodeURIComponent(city.value)); + rowNumber=ajax_function('','getRowRegion','city='+encodeURIComponent(city.value)); } } function changeCities() { var country=document.getElementById('form[USR_COUNTRY]'); var lr = document.getElementById('DIV_LOCATIONS'); - lr.innerHTML=ajax_function('','changecities','country='+encodeURIComponent(country.value)); - rowNumber=ajax_function('','getRowCities','country='+encodeURIComponent(country.value)); + lr.innerHTML=ajax_function('','changecities','country='+encodeURIComponent(country.value)); + rowNumber=ajax_function('','getRowCities','country='+encodeURIComponent(country.value)); } function addCity() { var lr = document.getElementById('lastRow'); var country=document.getElementById('form[USR_COUNTRY]'); if (newCity.value=='') return; - lr.outerHTML=ajax_function('','addCity','row='+rowNumber+'&city='+encodeURIComponent(newCity.value)+'&country='+encodeURIComponent(country.value)); + lr.outerHTML=ajax_function('','addCity','row='+rowNumber+'&city='+encodeURIComponent(newCity.value)+'&country='+encodeURIComponent(country.value)); rowNumber++; newCity.value=''; //Refresh the city's dropdown @@ -134,7 +134,7 @@ function deleteCity(locat) { var lr = document.getElementById('DIV_LOCATIONS'); var country=document.getElementById('form[USR_COUNTRY]'); - lr.innerHTML=ajax_function('','delCity','row='+rowNumber+'&uid='+encodeURIComponent(locat)+'&country='+encodeURIComponent(country.value)); + lr.innerHTML=ajax_function('','delCity','row='+rowNumber+'&uid='+encodeURIComponent(locat)+'&country='+encodeURIComponent(country.value)); rowNumber--; //Refresh the city's dropdown attachFunctionEventOnChange(document.getElementById('form[USR_CITY]'),null); diff --git a/workflow/engine/templates/cases/casesList.js b/workflow/engine/templates/cases/casesList.js index 525a9d6af..406c78551 100644 --- a/workflow/engine/templates/cases/casesList.js +++ b/workflow/engine/templates/cases/casesList.js @@ -144,7 +144,7 @@ function openCase(){ if(casesNewTab) { casesNewTab.close(); } - nameTab = PM.Sessions.getCookie('PM-TabPrimary') + '_openCase'; + nameTab = PM.Sessions.getCookie('LURANA-TabPrimary') + '_openCase'; casesNewTab = window.open(requestFile + '?' + params, nameTab); } else { redirect(requestFile + '?' + params); diff --git a/workflow/engine/templates/cases/casesListConsolidated.js b/workflow/engine/templates/cases/casesListConsolidated.js index c5d246010..7cb26d9cb 100644 --- a/workflow/engine/templates/cases/casesListConsolidated.js +++ b/workflow/engine/templates/cases/casesListConsolidated.js @@ -243,7 +243,7 @@ function openCase() { } newCaseNewTab = window.open(requestFile + '?' + params); - newCaseNewTab.name = PM.Sessions.getCookie('PM-TabPrimary'); + newCaseNewTab.name = PM.Sessions.getCookie('LURANA-TabPrimary'); } else { redirect(requestFile + '?' + params); } @@ -269,7 +269,7 @@ function jumpToCase(appNumber) { if (newCaseNewTab) { newCaseNewTab.close(); } - nameTab = PM.Sessions.getCookie('PM-TabPrimary') + '_openCase'; + nameTab = PM.Sessions.getCookie('LURANA-TabPrimary') + '_openCase'; newCaseNewTab = window.open(requestFile + '?' + params, nameTab); } else { redirect(requestFile + '?' + params); diff --git a/workflow/engine/templates/cases/casesStartCase.js b/workflow/engine/templates/cases/casesStartCase.js index c27c6319f..9b55850af 100644 --- a/workflow/engine/templates/cases/casesStartCase.js +++ b/workflow/engine/templates/cases/casesStartCase.js @@ -459,7 +459,7 @@ function openCaseA(n){ if(newCaseNewTab) { newCaseNewTab.close(); } - nameTab = PM.Sessions.getCookie('PM-TabPrimary') + '_openCase'; + nameTab = PM.Sessions.getCookie('LURANA-TabPrimary') + '_openCase'; newCaseNewTab = window.open(res.openCase.PAGE, nameTab); } else { window.location = res.openCase.PAGE; diff --git a/workflow/engine/templates/processes/main.js b/workflow/engine/templates/processes/main.js index 605ea2fac..c0682e6d1 100644 --- a/workflow/engine/templates/processes/main.js +++ b/workflow/engine/templates/processes/main.js @@ -2390,7 +2390,7 @@ function openWindowIfIE(pathDesigner) { if (Ext.getCmp('exportProcessObjectsWindow')) Ext.getCmp('exportProcessObjectsWindow').close(); processesGrid.store.reload(); - nameTab = PM.Sessions.getCookie('PM-TabPrimary') + '_winDesigner'; + nameTab = PM.Sessions.getCookie('LURANA-TabPrimary') + '_winDesigner'; if (winDesigner && winDesigner.closed === false) { if (winDesigner.window.PMDesigner.project.isDirty()) { Ext.Msg.alert(_('ID_REFRESH_LABEL'), _('ID_UNSAVED_TRIGGERS_WINDOW')); diff --git a/workflow/engine/xmlform/login/login.xml b/workflow/engine/xmlform/login/login.xml index 3fe339dc9..305f94cc2 100644 --- a/workflow/engine/xmlform/login/login.xml +++ b/workflow/engine/xmlform/login/login.xml @@ -30,7 +30,7 @@ SELECT LANG_ID, LANG_NAME FROM langOptions //validate iframe login if(inIframe() && (window.location.search.indexOf("inIFrame=1")===-1)) { - if (PM.Sessions.getCookie('PM-TabPrimary') !== '101010010' + if (PM.Sessions.getCookie('LURANA-TabPrimary') !== '101010010' && (window.location.pathname.indexOf("login/login") !== -1 || window.location.pathname.indexOf("sysLogin") !== -1)) { window.top.location.href = window.location.pathname;