Fatal Error: "Cannot edit this file!" on editing duplicated theme-files

VH Member
Hello!

I've duplicated the default-theme by the "Duplicate"-button, give the name and directory when asked for in the dialog boxes.

Can see that stuff in the directory "themes", a full copy of the default-theme with my given label. So far, so good, directories- and files-rights are setted to 755.

When using the Button "Edit" to work on my own theme the "Theme-File Editor" is opened.

Choosing a file to Edit brings up:

Fatal error: Cannot edit this file! in {my server-folder}/zp-core/functions-common.php on line 283

Figured out, that in the database-options-table (<prefix>options) the option "Zenphoto_theme_list" (called in admin_functions.php, line 2756) doesn't list my dupliciated theme.

ZP-Version: 1.4.5.2 [7e1a181548]
PHP-Version: 5.3.27
MySQLi Version: 5.5.31

Thanks, Regards,

VH

Comments

  • acrylian Administrator, Developer
    That is probably a file/folder permissions issue. Either it cannot copy or it sets wrong ones. Try to set the permissions via FTP (see user guide about info) or duplicated the theme manually via FTP as that might set the right permissions. Both does the same anyway.
  • VH Member
    I've tried what you've mentioned and created the directory via FTP and copy the files also that way - still get this error (right are setted to "0755").

    I don't think it's a permission error. Have a look at this code in admin_themes_editor.php (starting in line 79):

    // If we're attempting to edit a file from a bundled theme, this is an illegal attempt
    if (!themeIsEditable($theme))
    zp_error(gettext('Cannot edit this file!'));

    // If we're attempting to edit a file that's not a text file or that does not belong to the theme directory, this is an illegal attempt
    if ( $file_to_edit ) {
    if ( !in_array( $file_to_edit, $themefiles ) or !isTextFile( $file_to_edit ) or filesize( $file_to_edit ) == 0)
    zp_error(gettext('Cannot edit this file!'));
    }

    I've check the hole directory structure for the error text with Notepad++. This is the only hit in all files (accept the locate-files...)

    For me it look's like the duplicated theme is not in the list of availiable themes (table options, record "Zenphoto_theme_list"; '!in_array( $file_to_edit, $themefiles )' turns TRUE...? I'm not an expert...)...
  • acrylian Administrator, Developer
    Please post all you find also in Zenphoto's own debug log.
  • The option you refer to lists only the standard themes, so it is no surprise that yours is not there.

    If the `!in_array($file_to_edit,$themefiles)` has a value of `true` then something strange indeed is happening. $themefiles contains the set of files that are displayed for editing. So it is hard to see how the file could be present in the list to select but not present when the actual edit is processed.
  • VH Member
    Hello again!

    Chief-Developer... Whow... think, you're one of the best persons to tell, how much I zenPHOTO like. Very good stuff, simple to use and customiziable, just also for dummies like me. Congratulations, the team of zenPHOTO got evidently an effectual understandig on the practical meaning of Zen... :-)

    Back to the "Problem", latest news: I've installed zenPHOTO on my local machine (Win7 SP2, xampp 3.1.0). It works in this constellation, I can open file for editing!

    By installing I was asked for some permissional things, I set the "rights-mangement" to "strictly" (0644) - on the host-installation (Sun OS 10.x(?)) I wasn't asked for that.

    May be it's really a permissions-"problem". How can I check (and maybe update) the settings on my host-installation (How can I recall the Installation-routine without re-installing zenPHOTO)?

    And just another question, on the fly: when I have installed zenPHOTO and change afterwards the URL -without changing the directory zenPHOTO is installed in- I can't login. What is to change additional to give zenPHOTO a "knowledge" about the changed URL?

    Thanks a lot for your friendly, longanimous assistance, I will donate to aid the project and please excuse my horrible english...

    Regards, VH
    P.S.: I've worked on the german translation po-file (there were little spelling faults und I changed same terms). What have I to do for giving it into the project, if you're interested in?
  • acrylian Administrator, Developer
    Thanks we like to hear that!

    It can be a permissions issue. 644 ist stricter and not all servers work with that. Try one lever less strict (but never 777). My server does not allow the strictest, too but that does not matter since it is additionally secured by the host anyway.

    You can re-run setup by `yourdomain.com/zp-core/setup`. You will have to unprotect the setup files on the admin overview page first.

    Since I am maintaining the German translation, sure with those thousands of string there are surely some spelling errors I missed.

    Please see here about contribution info: http://www.zenphoto.org/news/translating-tutorial

    You need to use the latest master from Github for the translation and need a free GitHub account in any case.

    PS: No worries about your English :-)
  • VH Member
    Thank you, so far...
  • I think acrylian has well described the permissions issues. But I will add some things.

    To be clear, what works is a server dependent thing. Ideally you would want the permissions to be strict as you have done. But various "security" patches to servers may make this not work. In addition, sometimes servers do other things differently that prevent Zenphoto from accessing files which it creates. All a pretty big mess, unfortunately, but nothing we can do about it.

    You can look via FTP at the permissions of the files, but as per above that my not tell you anything. I do not know how you can see who the "owner" of the files is, which is another thing that can go wrong.

    But all these issues should be reflected in a log somewhere except if the server is "hiding" these files somehow from Zenphoto.
  • VH Member
    Thank you for your hints!

    I'm "playing" around with my host server and it's really a bit tricky with that permissioninal and owner things...
Sign In or Register to comment.