The function zen_back_link, in /includes/functions/functions_general.php, does not account for pages (like password_forgotten) that remove themselves from the navigation history ($_SESSION['navigation']->remove_current_page()). If, for example, you use a stock v150 installation and go to Home, New Products, Login, Password Forgotten and then press the back button you will be taken to the new_products page instead of the login page.
Here's a rewrite (including my previously-reported validation issue) that corrects this problem:
Code://// // Set back button function zen_back_link($link_only = false) { /*-BOF rewrite lat9 if (sizeof($_SESSION['navigation']->path)-2 >= 0) { $back = sizeof($_SESSION['navigation']->path)-2; $link = zen_href_link($_SESSION['navigation']->path[$back]['page'], zen_array_to_string($_SESSION['navigation']->path[$back]['get'], array('action')), $_SESSION['navigation']->path[$back]['mode']); } else { if (isset($_SERVER['HTTP_REFERER']) && preg_match("~^".HTTP_SERVER."~i", $_SERVER['HTTP_REFERER']) ) { //if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], str_replace(array('http://', 'https://'), '', HTTP_SERVER) ) ) { $link= $_SERVER['HTTP_REFERER']; } else { $link = zen_href_link(FILENAME_DEFAULT); } $_SESSION['navigation'] = new navigationHistory; } */ $link = ''; $nav_size = sizeof ($_SESSION['navigation']->path); if ($nav_size != 0) { $back = $nav_size - 1; if ($_SESSION['navigation']->path[$back]['page'] != $current_page || ($back--) != 0) { $link = zen_href_link($_SESSION['navigation']->path[$back]['page'], zen_array_to_string($_SESSION['navigation']->path[$back]['get'], array('action')), $_SESSION['navigation']->path[$back]['mode']); } } if ($link == '') { if (isset($_SERVER['HTTP_REFERER']) && preg_match("~^".HTTP_SERVER."~i", $_SERVER['HTTP_REFERER']) ) { $link= $_SERVER['HTTP_REFERER']; } else { $link = zen_href_link(FILENAME_DEFAULT); } $_SESSION['navigation'] = new navigationHistory; } $link = str_replace('&', '&', $link); //-lat9- Validation issue if ($link_only == true) { return $link; } else { return '<a href="' . $link . '">'; } }


Reply With Quote
