Skip to content

Commit

Permalink
Fixes redirect after closing locked Template
Browse files Browse the repository at this point in the history
  • Loading branch information
oliveratgithub committed Jan 14, 2024
1 parent 674f543 commit 41b52b5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions www/actions/tpleditor_close.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
* Template Editor close Template Action
* @package zorg\Smarty\Tpleditor
*/
require_once dirname(__FILE__).'/../includes/main.inc.php';
require_once __DIR__.'/../includes/config.inc.php';
require_once INCLUDES_DIR.'main.inc.php';
require_once INCLUDES_DIR.'tpleditor.inc.php';

/** Validate params */
$updated_tplid = ($_GET['tplupd'] === 'new' ? 'new' : (filter_input(INPUT_GET, 'tplupd', FILTER_VALIDATE_INT) ?? null)); // $_GET['tplupd']
unset($_GET['tplupd']);
$return_url = filter_input(INPUT_GET, 'location', FILTER_SANITIZE_FULL_SPECIAL_CHARS) ?? '/index.php?tpl='.$updated_tplid; // $_GET['location']
$return_url = (isset($_GET['location']) ? base64url_decode(filter_input(INPUT_GET, 'location', FILTER_SANITIZE_FULL_SPECIAL_CHARS)) : '/index.php?tpl='.$updated_tplid); // $_GET['location']
unset($_GET['tpleditor']);

/** Unlock etc. only when Tpl ID not "new" */
Expand All @@ -20,9 +21,9 @@

if (empty($return_url))
{
if ($updated_tplid === 'new') $return_url = base64url_encode('/');
else $return_url = base64url_encode('/tpl/'.$updated_tplid);
if ($updated_tplid === 'new') $return_url = '/';
else $return_url = '/tpl/'.$updated_tplid;
}

header('Location: '.base64url_decode($return_url));
header('Location: '.$return_url);
exit;

0 comments on commit 41b52b5

Please sign in to comment.