Joomla 模板参数和 params.ini - 文件在保存后变得不可写

发布于 2024-08-31 02:11:57 字数 439 浏览 2 评论 0原文

我在 Win XP SP3 上使用 wamp 并创建具有可更改参数的 Joomla 模板。 最初的消息是

参数文件\templates\ssc_2010\params.ini为 可写!

一旦我进行更改,一切都会按预期工作,除了现在我收到消息:

参数文件\templates\ssc_2010\params.ini为 不可写!

一种解决方案是浏览到目录,右键单击文件,选择属性,然后取消选中只读。该文件再次是可写的,但是一旦我再次修改参数,它就会再次变为只读。我很懒,想防止这种情况再次发生,我注意到在过去的项目中发生过这种情况,但现在我必须大量使用参数,所以做这样的体力劳动变得很无聊:P

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

木格 2024-09-07 02:11:57

Joomla 1.5 中存在一个导致显示该消息的错误。

添加了一项安全功能,使模板文件在保存之前不可写,在保存之前将它们设置为可写、保存,然后再次设置为不可写。

尝试进行更改,然后返回并检查预览。您将看到更改实际上已完成。

将以下代码添加到

如果您想修复烦人的不可写消息,请在设置 FTP 凭据之后,

        $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'));
    }

administrator/components/controller.php 的第 179 行附近:这将使文件在编辑加载过程中以及文件状态之前可写已发布在模板中。

然后,为了安全起见,如果编辑屏幕在未保存的情况下关闭,请搜索以下行:

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

并将以下代码粘贴到这些行之后但在右大括号之前:

        // 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'));
    }

这将使文件再次不可写。

这与 saveTemplate() 函数中使用的代码相同。在编辑屏幕上显示文件状态之前,我们只是再次执行此操作。如果该过程由于 Web 服务器的配置而失败,您将在对模板进行大量更改之前收到警告消息。 :)

PS 请记住单独保存该文件的副本,以便您在升级 Joomla! 时可以重做更改! (如果他们自己还没有解决这个问题。)

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.)

暗藏城府 2024-09-07 02:11:57

这听起来像是 Windows 中的用户权限问题 - 查看您正在编辑的文件所在目录的安全权限,并检查用户“IUSR_xxx”(其中 xxx 是您计算机的名称)是否具有完全权限控制。

如果这不起作用,那么您能否告诉我们您正在运行的 Windows 版本,因为这可能会有所帮助...

Matt

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文