v1.18.x
barisusakli 10 years ago
parent 64c0e1df61
commit ef3b6a2450

@ -2,6 +2,7 @@
var async = require('async'), var async = require('async'),
meta = require('../meta'),
db = require('../database'), db = require('../database'),
plugins = require('../plugins'), plugins = require('../plugins'),
user = require('../user'), user = require('../user'),
@ -46,6 +47,10 @@ module.exports = function(Posts) {
postData.toPid = data.toPid; postData.toPid = data.toPid;
} }
if (data.ip && parseInt(meta.config.trackIpPerPost, 10) === 1) {
postData.ip = data.ip;
}
plugins.fireHook('filter:post.save', postData, next); plugins.fireHook('filter:post.save', postData, next);
}, },
function(postData, next) { function(postData, next) {

@ -250,7 +250,7 @@ Sockets.reqFromSocket = function(socket) {
referer = headers.referer || ''; referer = headers.referer || '';
return { return {
ip: socket.ip, ip: headers['x-forwarded-for'] || socket.ip,
host: host, host: host,
protocol: socket.request.connection.encrypted ? 'https' : 'http', protocol: socket.request.connection.encrypted ? 'https' : 'http',
secure: !!socket.request.connection.encrypted, secure: !!socket.request.connection.encrypted,

@ -226,7 +226,7 @@ module.exports = function(Topics) {
checkContentLength(content, next); checkContentLength(content, next);
}, },
function(next) { function(next) {
posts.create({uid: uid, tid: tid, content: content, toPid: toPid}, next); posts.create({uid: uid, tid: tid, content: content, toPid: toPid, ip: data.req.ip}, next);
}, },
function(data, next) { function(data, next) {
postData = data; postData = data;

@ -41,6 +41,11 @@
<label>Minimum Post Length</label> <label>Minimum Post Length</label>
<input type="number" class="form-control" value="8" data-field="minimumPostLength"> <input type="number" class="form-control" value="8" data-field="minimumPostLength">
</div> </div>
<div class="checkbox">
<label>
<input type="checkbox" data-field="trackIpPerPost"> <strong>Track IP Address for each post</strong>
</label>
</div>
</form> </form>
</div> </div>
</div> </div>

Loading…
Cancel
Save