Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 4d3d8d94 authored by Rob Swindell's avatar Rob Swindell 💬

Use the newest methods of getting a user's birth month/day.

Remove birthdate.js - not needed or used anywhere (anymore).
parent cd15abe1
// $Id: birthdate.js,v 1.4 2018/06/06 21:44:23 rswindell Exp $
/*
* When this code is load()ed, User objects get an extra 'birthDate' property
* which is a JavaScript Date object representing the user's birthdate.
*/
User.prototype.__defineGetter__("birthDate", function() {
var mfirst=system.datestr(1728000).substr(0,2)=='01';
var match;
var m,d,y;
match=this.birthdate.match(/^([0-9]{2})[-/]([0-9]{2})[-/]([0-9]{2})$/);
if(match==null)
return undefined;
m=parseInt(match[mfirst?1:2],10)-1;
d=parseInt(match[mfirst?2:1],10);
y=parseInt(match[3],10)+1900;
if(this.age + y < (new Date()).getYear()-2)
y+=100;
return new Date(y,m,d);
});
// $Id: birthdays.js,v 1.1 2018/06/06 23:07:20 rswindell Exp $
// Find users with the specified birthday (or birthmonth)
// Usage (Birthdays in January):
......@@ -12,7 +10,6 @@
// list = load({}, "birthdays.js", new Date().getMonth(), new Date().getDate());
load("sbbsdefs.js");
load("birthdate.js");
// Returns an array of user numbers
// Note: month is 0-based, day (of month) is optional and 1-based
......@@ -21,14 +18,15 @@ function birthdays(month, day)
var u = new User;
var lastuser = system.stats.total_users;
var list = [];
month = parseInt(month, 10) + 1;
for(u.number = 1; u.number <= lastuser; u.number++) {
if(u.settings&(USER_DELETED|USER_INACTIVE))
continue;
if(u.security.restrictions&(UFLAG_Q|UFLAG_G))
continue;
if(u.birthDate.getMonth() != month)
if(u.birthmonth != month)
continue;
if(day && u.birthDate.getDate() != day)
if(day && u.birthday != day)
continue;
list.push(u.number);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment