views:

563

answers:

3

I am using wamp on Win XP SP3 and creating a Joomla template with changeable parameters. initially the message is

The parameter file \templates\ssc_2010\params.ini is writable!

once I make changes everything works as expected, except now i get the message:

The parameter file \templates\ssc_2010\params.ini is unwritable!

One solution is to brows to the directory, right click the file, select properties, and uncheck read-only. Again the file is writable but once I modify the parameters again it becomes read only again. I'm quite lazy and would like to prevent this from happening again, I've notice this happening in past projects, but now I have to work a lot with parameters so it becomes quite boring doing manual labor like that :P

A: 

This sounds like a user rights problem within Windows - have a look a the security permissions for the directory in which the file you are editing is located, and check that the user "IUSR_xxx" (where xxx is the name of your computer) has full control.

If this doesn't work, then can you tell us what version of Windows you are running as this may help...

Matt

Matti
windows xp, it didn't work, I gave all users full control.
Moak
Which version of xp - home or pro? You should try explicitly giving the IUSR user full control (not just the "everyone" object) - I know it sounds daft but that may well work!
Matti
A: 

It is a normal behaviour in joomla for security resons, but i do not know how to solve

marc
+1  A: 

There is a bug in Joomla 1.5 that causes the message to be displayed.

A security feature was added that makes the template files unwritable until just before save, where they are made writable, saved, then made unwritable again.

Try to make a change, then go back and check the preview. You will see that the change was actually made.

If you want to fix the annoying unwritable message, add the following code to

administrator/components/controller.php around line 179, just after setting the FTP credentials:

        $file = $client->path.DS.'templates'.DS.$template.DS.'params.ini';

    // Try to make the params file writeable
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0755')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('Could not make the template parameter file writable'));
    }

This will make the file writable during the edit load process, and before the file's status is posted in the template.

Then for security, in case the edit screen is closed without saving, search for the following lines:

        require_once (JPATH_COMPONENT.DS.'admin.templates.html.php');
    TemplatesView::editTemplate($row, $lists, $params, $option, $client, $ftp, $template);

and paste the following code just AFTER these lines but before the closing brace:

        // Try to make the params file unwriteable
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('Could not make the template parameter file unwritable'));
    }

That will make the file unwritable again.

This is the same code that is used in the saveTemplate() function. We are just doing it again before we display the status of the file on the edit screen. If the process fails because of your web server's configuration, you will get warning messages, BEFORE you've made a bunch of changes to your template. :)

P.S. Remember to save a copy of this file separately, so that you can redo the changes when you upgrade Joomla! (if they haven't fixed this themselves yet.)

Rich C