Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Admin Area JavaScript Error for Core update #5286

Open
Vodhin opened this issue Jun 27, 2024 · 0 comments
Open

[Bug]: Admin Area JavaScript Error for Core update #5286

Vodhin opened this issue Jun 27, 2024 · 0 comments
Labels
type: bug A problem that should not be happening

Comments

@Vodhin
Copy link

Vodhin commented Jun 27, 2024

What e107 version are you using?

v2.3.3

Bug description

Looks like admin.php is not returning a proper JSON response for Admin users who are NOT Main Admin and may not have permissions for the update function.

JavaScript Console Error

VM6027:1 Uncaught SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON
    at JSON.parse (<anonymous>)
    at n.parseJSON (jquery.min.js:4:6340)
    at Object.success (admin.php:104:22)
    at i (jquery.min.js:2:27151)
    at Object.fireWith [as resolveWith] (jquery.min.js:2:27914)
    at z (jquery.min.js:4:12059)
    at XMLHttpRequest.<anonymous> (jquery.min.js:4:15619)

From admin.php:

$('#e-admin-core-update').html('<i title="Checking for updates" class="fa fa-spinner fa-spin"></i>');
  		    	$.get('../e107_admin/admin.php?mode=core&type=update', function( data ) {
 		    	
  		    	var res = $.parseJSON(data);
		    
  		    	if(res === true)
  		    	{
  		    	    $('#e-admin-core-update').html('<span class="text-info"><i class="fa fa-database"></i></span>');
  		    	    
  		    	     $('[data-toggle="popover"]').popover('show');
	                 $('.popover').on('click', function() 
	                 {
	                     $('[data-toggle="popover"]').popover('hide');
	           		});
  		    	}
  		    	else
  		    	{
  		    	    // Hide li element.
  		    		$('#e-admin-core-update').parent().hide();
  		    	}
			   
			});

How to reproduce

Log in as and Admin without permissions for updates and go to Admin Area,

Expected behavior

Not fail.

What browser(s) are you seeing the problem on?

Chrome / Brave

PHP Version

8.2.2

@Vodhin Vodhin added the type: bug A problem that should not be happening label Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A problem that should not be happening
Projects
None yet
Development

No branches or pull requests

1 participant