Advertisement
Guest User

Untitled

a guest
Dec 31st, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "use strict";
  2.  
  3. var replyThread = require("../../form/replyThread");
  4. var newThread = require("../../form/newThread");
  5.  
  6. exports.engineVersion = "2.4";
  7.  
  8. exports.setTitles = function(parameters) {
  9.     for (var i = 0; i < parameters.files.metadata.length; ++i) {
  10.         var oldTitle = parameters.files.metadata[i].title;
  11.        
  12.         var newTitle = Math.floor(new Date() / 1000);
  13.         var periodIndex = oldTitle.lastIndexOf(".");
  14.        
  15.         if (periodIndex !== -1)
  16.             newTitle += oldTitle.substring(periodIndex, oldTitle.length);
  17.        
  18.         parameters.files.metadata[i].title = newTitle;
  19.     }
  20. };
  21.  
  22. exports.init = function() {
  23.     var oldCreatePost = replyThread.createPost;
  24.    
  25.     replyThread.createPost = function(json, req, userData, parameters, captchaId, res, auth) {
  26.         exports.setTitles(parameters);
  27.  
  28.         oldCreatePost(json, req, userData, parameters, captchaId, res, auth);
  29.     };
  30.    
  31.     var oldCreateThread = newThread.createThread;
  32.    
  33.     newThread.createThread = function(json, req, user, parameters, captchaId, res, auth) {
  34.         exports.setTitles(parameters);
  35.        
  36.         oldCreateThread(json, req, user, parameters, captchaId, res, auth);
  37.     };
  38. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement