closes #873, removed global translator, templates and server objects

v1.18.x
Baris Soner Usakli 11 years ago
parent 393bb7245c
commit 2e786cc4d1

@ -106,11 +106,9 @@
upgrade.check(function(schema_ok) {
if (schema_ok || nconf.get('check-schema') === false) {
sockets.init();
sockets.init(webserver.server);
plugins.init();
global.templates = {};
global.translator = translator;
translator.loadServer();

@ -79,7 +79,7 @@
template.prototype.parse = parse;
template.prototype.html = String(html);
global.templates[file] = new template;
templates[file] = new template;
loaded--;
if (loaded === 0) {
@ -396,7 +396,7 @@
namespace = '';
} else {
// clean up all undefined conditionals
template = template.replace(/<!-- IF([^@]*?)ENDIF([^@]*?)-->/gi, '');
template = template.replace(/<!-- IF([^@]*?)ENDIF([^@]*?)-->/gi, '');
}
return template;

@ -1,16 +1,18 @@
var User = require('./user'),
var fs = require('fs'),
async = require('async'),
path = require('path'),
User = require('./user'),
Plugins = require('./plugins'),
Meta = require('./meta'),
Translator = require('../public/src/translator'),
fs = require('fs'),
async = require('async'),
path = require('path'),
templates = require('../public/src/templates'),
Emailer = {};
var render = function(template, params, callback) {
if (templates[template] !== null) {
if (templates[template]) {
Translator.translate(templates[template].parse(params), function(template) {
callback(null, template);
});

@ -7,13 +7,14 @@ var nconf = require('nconf'),
user = require('./../user'),
groups = require('../groups'),
topics = require('./../topics'),
pkg = require('./../../package.json'),
pkg = require('./../../package'),
categories = require('./../categories'),
meta = require('../meta'),
plugins = require('../plugins'),
Languages = require('../languages'),
events = require('./../events'),
utils = require('./../../public/src/utils.js');
utils = require('./../../public/src/utils'),
templates = require('./../../public/src/templates');
(function (Admin) {
Admin.isAdmin = function (req, res, next) {

@ -30,9 +30,9 @@ Sockets.userSockets = {};
Sockets.rooms = {};
Sockets.init = function() {
Sockets.init = function(server) {
io = socketioWildcard(SocketIO).listen(global.server, {
io = socketioWildcard(SocketIO).listen(server, {
log: false,
transports: ['websocket', 'xhr-polling', 'jsonp-polling', 'flashsocket'],
'browser client minification': true

@ -28,7 +28,9 @@ var path = require('path'),
meta = require('./meta'),
feed = require('./feed'),
plugins = require('./plugins'),
logger = require('./logger');
logger = require('./logger'),
templates = require('./../public/src/templates'),
translator = require('./../public/src/translator');
if(nconf.get('ssl')) {
server = require('https').createServer({
@ -39,13 +41,12 @@ if(nconf.get('ssl')) {
server = require('http').createServer(WebServer);
}
module.exports.server = server;
(function (app) {
"use strict";
var templates = null,
clientScripts;
var clientScripts;
plugins.ready(function() {
// Minify client-side libraries
@ -60,9 +61,6 @@ if(nconf.get('ssl')) {
});
});
server.app = app;
/**
* `options` object requires: req, res
* accepts: metaTags, linkTags
@ -375,8 +373,6 @@ if(nconf.get('ssl')) {
});
module.exports.init = function () {
templates = global.templates;
// translate all static templates served by webserver here. ex. footer, logout
plugins.fireHook('filter:footer.build', '', function(err, appendHTML) {
var footer = templates.footer.parse({
@ -931,6 +927,3 @@ if(nconf.get('ssl')) {
});
}(WebServer));
global.server = server;

Loading…
Cancel
Save