prevent a potentially badly written theme.json from blowing up your forum

v1.18.x
psychobunny 11 years ago
parent ca9cd36067
commit 30a45ee78e

@ -61,9 +61,10 @@
function loadServer() {
var loaded = templatesToLoad.length;
function getTemplates(directory) {
for (var t in templatesToLoad) {
(function (file) {
fs.readFile((customTemplateDir ? customTemplateDir : __dirname + '/../templates') + '/' + file + '.tpl', function (err, html) {
fs.readFile(directory + '/' + file + '.tpl', function (err, html) {
var template = function () {
this.toString = function () {
return this.html;
@ -82,6 +83,16 @@
}(templatesToLoad[t]));
}
}
if (customTemplateDir) {
fs.exists(customTemplateDir, function (exists) {
var directory = (exists ? customTemplateDir : __dirname + '/../templates');
getTemplates(customTemplateDir);
});
} else {
getTemplates(__dirname + '/../templates');
}
}
function loadClient() {
jQuery.when(jQuery.getJSON(RELATIVE_PATH + '/templates/config.json'), jQuery.getJSON(RELATIVE_PATH + '/api/get_templates_listing')).done(function (config_data, templates_data) {

Loading…
Cancel
Save