?
avatar PhilETaylor
PhilETaylor
13 Jan 2021

Steps to reproduce the issue

forked from comment #31710 (comment)

Screen.Recording.2021-01-13.at.09.42.37.am.mp4

Expected result

It should be impossible to delete index.php in the web interface, like it is impossible to delete joomla.asset.json

Actual result

index.php can be deleted - see video.

System information (as much as possible)

Additional comments

// @wilsonge

avatar PhilETaylor PhilETaylor - open - 13 Jan 2021
avatar joomla-cms-bot joomla-cms-bot - change - 13 Jan 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 13 Jan 2021
avatar PhilETaylor PhilETaylor - change - 13 Jan 2021
The description was changed
avatar PhilETaylor PhilETaylor - edited - 13 Jan 2021
avatar PhilETaylor PhilETaylor - change - 13 Jan 2021
The description was changed
avatar PhilETaylor PhilETaylor - edited - 13 Jan 2021
avatar PhilETaylor PhilETaylor - change - 13 Jan 2021
The description was changed
avatar PhilETaylor PhilETaylor - edited - 13 Jan 2021
avatar HLeithner
HLeithner - comment - 13 Jan 2021

I'm impressed that we try to save the user doing dumb things but OK if we protect the Json we also should protect the index.php, beside that you already said that the language file mentions the wrong filename. Should be an easy fix.

avatar PhilETaylor
PhilETaylor - comment - 13 Jan 2021

Someone has already changed the language file now to correct it. #31939

avatar brianteeman
brianteeman - comment - 14 Jan 2021

The problem would be that if you prevent someone deleting the file you also prevent them renaming the file so that they can create a completely new index.php perhaps for a new template design

avatar PhilETaylor
PhilETaylor - comment - 14 Jan 2021

You don't rename index.php, you copy it to create a new file.

A site with no active template index.php will be down, and in be in error.

avatar brianteeman
brianteeman - comment - 14 Jan 2021

A site with no active template index.php will be down, and in be in error.

Only if its the template in use

avatar wilsonge wilsonge - change - 14 Jan 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-01-14 12:56:27
Closed_By wilsonge
avatar wilsonge wilsonge - close - 14 Jan 2021
avatar wilsonge
wilsonge - comment - 14 Jan 2021

Oops. This was a bug in my previous commit. Should be fixed with 97a8329

avatar PhilETaylor
PhilETaylor - comment - 14 Jan 2021

Confirmed fixed

And to be clear @brianteeman I was not asking for a new feature, I was reporting that an existing feature was no longer working and was broken.

The code was already there

	if (base64_decode(urldecode($file)) == '/index.php')
		{
			$this->setMessage(Text::_('COM_TEMPLATES_ERROR_INDEX_DELETE'), 'warning');
			$url = 'index.php?option=com_templates&view=template&id=' . $id . '&file=' . $file;
			$this->setRedirect(Route::_($url, false));
		}

Screenshot 2021-01-14 at 12 59 40

avatar PhilETaylor
PhilETaylor - comment - 14 Jan 2021

The feature to prevent index.php being deleted was added in 2013 - gulp

03-Oct-2013 Michael Babker
  + [#31266] GSoC 2013 - Improved Template Manager.  Thanks Ram Tripathi

Add a Comment

Login with GitHub to post a comment