Skip to content

Smarty template implementation flaws #333

@hakito

Description

@hakito

The template implementation and documentation has several issues. I tried to add a custom template, but got an error indicator when clicking the update button, but no error messsage.

The reason is, that the custom-template file could not be written. The file would be written to the folder lang/de_de by the line:

https://github.com/LibreBooking/app/blob/5c9a13e12a5698bdea263c9139074a0514fbf4a6/Presenters/Admin/ManageEmailTemplatesPresenter.php#L121

But the documentation does not mention lang to be writable. Instead it mentions that tpl and tpl_c should be writable and refers to the documention. So i had a look at the Smarty documentation:

The compile dir and cache dir need to be writable

I always thought tpl_c was the cache directory. But in fact it's the compile directory. The cache directory would be cache

https://github.com/LibreBooking/app/blob/5c9a13e12a5698bdea263c9139074a0514fbf4a6/lib/Common/SmartyPage.php#L50

But caching is always set to false:

https://github.com/LibreBooking/app/blob/5c9a13e12a5698bdea263c9139074a0514fbf4a6/lib/Common/SmartyPage.php#L57

Proposal

  • Only two writeable directories upload for user content run_data for code generated files
  • Make installer check writeability for those folders, and create all nescessary subfolders in run_data. (tpl_c, logs, etc.)
  • Write custom tepmplates only to a run_data subfolder.
  • Fix caching
  • Error message in front end, when saving custom template fails

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleNo activity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions