From f0556a0828eb1a353863bc38dae6a7d1df641336 Mon Sep 17 00:00:00 2001 From: Julian Egelstaff Date: Sat, 9 Nov 2024 03:58:36 -0500 Subject: [PATCH] Redirecting from invalid entries more cleanly (#564) * Redirecting from invalid entries more cleanly * Handling rewriteAddress properly in event of novel screen creation order * Seeding the URL properly when rewriterule entry identifier is invalid and URL needs changing * Typo * Moving log writing to separate file so it can be invoked independently before the session (and xoopsUser) are finished being sorted out * Removing errant identifiers from clean URLs on forms * Encapsulate determination of entry id from rewriteruleElement, use to strip identifiers from clean done destination URLs * Ignore "new" entry id when altering URLs (avoids unnecessary slash at end when making new entries) * Smarter determination of rewrite address sid, if two screens have same address, we use entry identifier to prefer forms vs lists * Support alternate screens with same rewriteAddress when determining done destination --- libraries/icms/core/Session.php | 2 +- modules/formulize/class/templateScreen.php | 13 +- modules/formulize/include/entriesdisplay.php | 5 + modules/formulize/include/formdisplay.php | 6 +- .../formulize/include/formdisplaypages.php | 54 +--- modules/formulize/include/functions.php | 291 ++++++++++-------- .../formulize/include/writeToFormulizeLog.php | 113 +++++++ 7 files changed, 308 insertions(+), 176 deletions(-) create mode 100644 modules/formulize/include/writeToFormulizeLog.php diff --git a/libraries/icms/core/Session.php b/libraries/icms/core/Session.php index a4957b992..8b1d520cd 100644 --- a/libraries/icms/core/Session.php +++ b/libraries/icms/core/Session.php @@ -226,7 +226,7 @@ static public function service() { $instance->update_cookie(); } - include_once XOOPS_ROOT_PATH.'/modules/formulize/include/common.php'; + include_once XOOPS_ROOT_PATH.'/modules/formulize/include/writeToFormulizeLog.php'; writeToFormulizeLog(array( 'formulize_event'=>'session-loaded-for-user', 'user_id'=>intval($_SESSION['xoopsUserId']) diff --git a/modules/formulize/class/templateScreen.php b/modules/formulize/class/templateScreen.php index 2ea2714da..117ee6a00 100644 --- a/modules/formulize/class/templateScreen.php +++ b/modules/formulize/class/templateScreen.php @@ -133,8 +133,17 @@ function get($sid) { function render($screen, $entry_id, $settings = "") { if(!security_check($screen->getVar('fid'), $entry_id)) { - print "

You do not have permission to view this entry in the form

"; - return; + if(!$done_dest = $screen->getVar('donedest')) { + $done_dest = determineDoneDestinationFromURL($screen); + } + $done_dest = stripEntryFromDoneDestination($done_dest); + $done_dest = substr($done_dest,0,4) == "http" ? $done_dest : "http://".$done_dest; + icms::$logger->disableLogger(); + while(ob_get_level()) { + ob_end_clean(); + } + print ""; + exit(); } $previouslyRenderingScreen = (isset($GLOBALS['formulize_screenCurrentlyRendering']) AND $GLOBALS['formulize_screenCurrentlyRendering']) ? $GLOBALS['formulize_screenCurrentlyRendering'] : null; diff --git a/modules/formulize/include/entriesdisplay.php b/modules/formulize/include/entriesdisplay.php index b0b88fdca..9b112c395 100644 --- a/modules/formulize/include/entriesdisplay.php +++ b/modules/formulize/include/entriesdisplay.php @@ -3215,6 +3215,11 @@ function printResults($masterResults, $blankSettings, $groupingSettings, $groupi function interfaceJavascript($fid, $frid, $currentview, $useWorking, $useXhr, $lockedColumns) { print ""; + + global $formulizeRemoveEntryIdentifier; + if($formulizeRemoveEntryIdentifier) { + print ""; + } ?>