Skip to content

Commit

Permalink
Fix javascript "back button" links (#650)
Browse files Browse the repository at this point in the history
Use history.back() method instead of currently non-functional back()
  • Loading branch information
xalt7x authored Sep 16, 2024
1 parent e7c1ab1 commit 7e55fb3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions lib/CommonErrors.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static function fatal($code, $active, $customMessage = '', $modal = false
$errorTitle = 'Invalid Information';
$internalErrorTitle = 'Bad Input';
$errorMessage = 'Some of the information you provided doesn\'t follow the correct format and '
. 'CATS can\'t interpret what it is. Please <a href="javascript:back()">go back</a> and '
. 'CATS can\'t interpret what it is. Please <a href="javascript:history.back()">go back</a> and '
. 'complete each field paying close attention to any instructions provided. '
. '<p><b>' . $customMessage . '</b>';
break;
Expand Down Expand Up @@ -124,7 +124,7 @@ public static function fatal($code, $active, $customMessage = '', $modal = false
. 'traffic or older web browsers. The latest version of the <a href="http://www.getfirefox.com"> '
. 'Mozilla Firefox&copy;</a> browser '
. 'is recommended.<br /><br />The problem may be resolved by using the '
. '<a href="javascript:back()">back button</a> on your browser and trying again.';
. '<a href="javascript:history.back()">back button</a> on your browser and trying again.';
break;
case COMMONERROR_BADINDEX:
$errorTitle = 'Bad Server Information';
Expand All @@ -139,7 +139,7 @@ public static function fatal($code, $active, $customMessage = '', $modal = false
. 'may have been provided to you.'
. '<br /><br />'
. '<b>It\'s ok!</b> CATS can\'t complete whatever action you requested; but chances are, '
. 'if you click the <a href="javascript:back()">back button</a> and <b>refresh</b> the page '
. 'if you click the <a href="javascript:history.back()">back button</a> and <b>refresh</b> the page '
. 'and try again it will work just fine.';
break;

Expand All @@ -148,7 +148,7 @@ public static function fatal($code, $active, $customMessage = '', $modal = false
$internalErrorTitle = 'Permission Denied';
$errorMessage = 'You don\'t have access to the action you\'re attempting to perform. If you '
. 'feel you should have access, contact your site administrator. '
. 'You can click the <a href="javascript:back()">back</a> button on your browser to return '
. 'You can click the <a href="javascript:history.back()">back button</a> on your browser to return '
. 'to where you came from.';
break;

Expand All @@ -169,7 +169,7 @@ public static function fatal($code, $active, $customMessage = '', $modal = false
$internalErrorTitle = 'Required Fields Missing';
$errorMessage = 'One or more of the input fields on the page you came from were required and '
. 'were left with blank or incorrect values. The action you\'re trying to perform cannot '
. 'be completed without those fields. Please use the <a href="javascript:back()">back button</a> '
. 'be completed without those fields. Please use the <a href="javascript:history.back()">back button</a> '
. 'on your browser to return to where you came from.'
. '<br /><br />';

Expand All @@ -189,7 +189,7 @@ public static function fatal($code, $active, $customMessage = '', $modal = false
$internalErrorTitle = 'Missing wild card string';
$errorMessage = 'One or more of the input fields on the page you came from were required and '
. 'were left with blank or incorrect values. The action you\'re trying to perform cannot '
. 'be completed without those fields. Please use the <a href="javascript:back()">back button</a> '
. 'be completed without those fields. Please use the <a href="javascript:history.back()">back button</a> '
. 'on your browser to return to where you came from.'
. '<br /><br />';

Expand All @@ -207,7 +207,7 @@ public static function fatal($code, $active, $customMessage = '', $modal = false
case COMMONERROR_NOPASSWORDMATCH:
$errorTitle = 'Passwords do not Match';
$internalErrorTitle = 'Passwords do not match';
$errorMessage = 'The passwords you entered do not match. Please use the <a href="javascript:back()">'
$errorMessage = 'The passwords you entered do not match. Please use the <a href="javascript:history.back()">'
. 'back button</a> on your browser to return from where you came and enter the correct password '
. 'in all required fields.';
break;
Expand All @@ -216,7 +216,7 @@ public static function fatal($code, $active, $customMessage = '', $modal = false
$errorTitle = 'File Does Not Exist';
$internalErrorTitle = 'File Does Not Exist';
$errorMessage = 'The file you are requesting for does not exist. Please use the '
. '<a href="javascript:back()">back button</a> on your browser to return to where '
. '<a href="javascript:history.back()">back button</a> on your browser to return to where '
. 'you came from.<br /><br />';

if (!empty($customMessage))
Expand All @@ -229,7 +229,7 @@ public static function fatal($code, $active, $customMessage = '', $modal = false
$errorTitle = 'An Error Has Occurred';
$internalErrorTitle = 'Undefined';
$errorMessage = 'An error has occurred and the operation you were attempting to perform cannot be '
. 'completed. Please use the <a href="javascript:back();">back</a> button on your web browser '
. 'completed. Please use the <a href="javascript:history.back();">back button</a> on your web browser '
. 'to return from where you came. The administrators have been notified, so you may wish to '
. 'try again later.';
break;
Expand Down
2 changes: 1 addition & 1 deletion modules/import/ImportUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,7 @@ public function massImport($step = 1)
{
$this->_template->assign('errorMessage', 'You didn\'t upload any files or there was a '
. 'problem working with any files you uploaded. Please use the '
. '<a href="javascript:back()"><b>Back</b></a> button on your web browser '
. '<a href="javascript:history.back()"><b>Back button</b></a> on your web browser '
. 'and select one or more files to import.'
);

Expand Down

0 comments on commit 7e55fb3

Please sign in to comment.