Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to load templates from json files #206

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bartvanhalder
Copy link

Our config.inc.php was getting a bit long and unreadable, so i added support for loading templates from .json files.

For existing installs this changes nothing as templates loaded from files are appended to the existing $templates before the "is this user allowed to use this template" check.

If an error is encountered loading a template a message is logged and the template is skipped.

@tuxis-ie
Copy link
Owner

Cool, thanks. How do 'we' feel about including json-files that are not checked on sanity at all?

@bartvanhalder
Copy link
Author

I can see two ways of reasoning here myself.

The first one would be that this is already slightly more sanity checked than templates in config.inc.php. Because a failed file_get_contents or json_decode will only result in an error in the log and a correctly functioning nsedit (but without the template that failed to load).

The second way of thinking would be that if someone touches this anyway they should do full sanity checking on the content of the template as well. I obviously did not do that as i wasn't sure the functionality would be welcome in nsedit at all, but if you want i can try to find the time to add full sanity checking to the loaded templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants