Update of /cvs/scoop/scoop/lib
In directory lithium.sabren.com:/tmp/cvs-serv16309/lib
Modified Files:
Scoop.pm
Log Message:
Omnibus AZ patch:
* Adds new signup method where user chooses their own password. This has worked a lot better than the old way for us, and is much easier
for inexperienced users. For people upgrading, you'll need to edit a bunch of user-related blocks, most notably changing new_user_email
and adding a box call to new_user_html. Some instructions are with the control var "signup_with_password"
* Adds flexible date formatting with the vars date_format_default, date_format_short, and date_format_wmd
* Adds user signup IP tracking. Very handy for tracking down dupe accounts and persistent trolls.
Index: Scoop.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop.pm,v
retrieving revision 1.140
retrieving revision 1.141
diff -C2 -d -r1.140 -r1.141
*** Scoop.pm 21 Jan 2005 14:14:30 -0000 1.140
--- Scoop.pm 25 Jan 2005 17:15:23 -0000 1.141
***************
*** 560,563 ****
--- 560,564 ----
}
+
sub _load_event_properties_data {
my $self = shift;
***************
*** 1410,1414 ****
WHAT => 'uid',
FROM => 'users',
! WHERE => qq|nickname = $q_uname AND newpasswd = $q_cpass|
});
if ($rv !=1) {
--- 1411,1415 ----
WHAT => 'uid',
FROM => 'users',
! WHERE => qq|nickname = $q_uname AND newpasswd = $q_cpass and is_new_account = 0|
});
if ($rv !=1) {
***************
*** 1905,1981 ****
my ($adjust_time, $zone) = $S->time_localize($fieldname);
! if ($format eq 'short') {
! if(lc($S->{CONFIG}->{DBType}) eq "mysql") {
! $date_format = "%m/%d/%Y ";
! $date_format .= $S->{UI}->{VARS}->{time_24h_format} ?
! "%T" : "%r";
! $date_format .= " $zone";
! }
! else
! {
! $date_format = "MM/DD/YY ";
! $date_format .= $S->{UI}->{VARS}->{time_24h_format} ?
! "HH24:MI:SS" : "HH12:MI:SS PM \"$zone\"";
! }
! } elsif ($format eq 'WMD') {
! if(lc($S->{CONFIG}->{DBType}) eq "mysql")
! {
! $date_format = "%W %M %D";
! }
! else
! {
! $date_format = "WW MM DD";
! }
! } elsif ($format eq 'W3C') {
! # Use the subset of the ISO8601 date format standard which is described
! # in a W3C note and is the preferred format for the Dublin Core and RSS.
! # Example: YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
! # See Also: http://www.w3.org/TR/NOTE-datetime http://dublincore.org/
! # Determine whether the field is in the Scoop server's or the user's
! # time zone and how many seconds the value will be offset from UTC
! my ($offset, $offset_as_string);
! $offset = &Time::Timezone::tz_offset(lc($S->pref('time_zone')));
! # Create a string that describes the field's offset from UTC in the format
! # "+|-HH:MM" (or "Z" if the field is in UTC)
! if ($offset != 0) {
! my $sign = $offset > 0 ? "+" : "-";
! my $offset_hours = int(abs($offset) / 3600);
! my $offset_minutes = int((abs($offset) % 3600) / 60);
! # make sure offset hours and minutes are two digits long
! if ($offset_hours < 10) { $offset_hours = "0$offset_hours"; }
! if ($offset_minutes < 10) { $offset_minutes = "0$offset_minutes"; }
! $offset_as_string = "$sign$offset_hours:$offset_minutes";
! } else {
! $offset_as_string = "Z"; # shorthand for "+00:00"
! }
! if(lc($S->{CONFIG}->{DBType}) eq "mysql") {
! # MySQL date formatting string
! $date_format = "%Y-%m-%dT%H:%i:%S$offset_as_string";
! } else {
! $date_format = 'YYYY-MM-DD"T"HH:MI:SS"$offset_as_string"';
! }
!
- } else {
- if (lc($S->{CONFIG}->{DBType}) eq "mysql")
- {
- $date_format = "%a %b %D, %Y at ";
- $date_format .= $S->{UI}->{VARS}->{time_24h_format} ?
- "%T" : "%r";
- $date_format .= " $zone";
- if ($S->{CONFIG}->{mysql_version} eq '3.22') {
- $date_format = "%a %b %D, %Y %r";
- }
- } else {
- $date_format = "Dy Mon DD, YYYY at ";
- $date_format .= $S->{UI}->{VARS}->{time_24h_format} ?
- "HH24:MI:SS" : "HH12:MI:SS PM \"$zone\"";
- }
- }
my $full_str;
--- 1906,1994 ----
my ($adjust_time, $zone) = $S->time_localize($fieldname);
! # For default format strings
! my $time_format;
! if (lc($S->{CONFIG}->{DBType}) eq "mysql") {
! $time_format = $S->{UI}->{VARS}->{time_24h_format} ? "%T" : "%r";
! } else {
! $time_format = $S->{UI}->{VARS}->{time_24h_format} ? "HH24:MI:SS" : "HH12:MI:SS PM";
! }
! if ($format eq 'short') {
! # Var contains special key "zone" -- replace if it's there
! my $tmpl = $S->{UI}->{VARS}->{date_format_short};
! $tmpl =~ s/\|zone\|/$zone/g;
! if(lc($S->{CONFIG}->{DBType}) eq "mysql") {
! $date_format = $tmpl || "%m/%d/%Y $time_format $zone";
! } else {
! $date_format = $tmpl || "MM/DD/YY $time_format \"$zone\"";
! }
! } elsif ($format eq 'WMD') {
! # Var contains special key "zone" -- replace if it's there
! my $tmpl = $S->{UI}->{VARS}->{date_format_wmd};
! $tmpl =~ s/\|zone\|/$zone/g;
!
! if (lc($S->{CONFIG}->{DBType}) eq "mysql") {
! $date_format = $tmpl || "%W %M %D";
! } else {
! $date_format = $tmpl || "WW MM DD";
! }
!
! } elsif ($format eq 'W3C') {
! # Use the subset of the ISO8601 date format standard which is described
! # in a W3C note and is the preferred format for the Dublin Core and RSS.
! # Example: YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
! # See Also: http://www.w3.org/TR/NOTE-datetime http://dublincore.org/
!
! # No format changing var for this one, since it's a defined format and should be changed.
!
! # Determine whether the field is in the Scoop server's or the user's
! # time zone and how many seconds the value will be offset from UTC
! my ($offset, $offset_as_string);
! $offset = &Time::Timezone::tz_offset(lc($S->pref('time_zone')));
!
! # Create a string that describes the field's offset from UTC in the format
! # "+|-HH:MM" (or "Z" if the field is in UTC)
! if ($offset != 0) {
! my $sign = $offset > 0 ? "+" : "-";
! my $offset_hours = int(abs($offset) / 3600);
! my $offset_minutes = int((abs($offset) % 3600) / 60);
!
! # make sure offset hours and minutes are two digits long
! if ($offset_hours < 10) { $offset_hours = "0$offset_hours"; }
! if ($offset_minutes < 10) { $offset_minutes = "0$offset_minutes"; }
!
! $offset_as_string = "$sign$offset_hours:$offset_minutes";
! } else {
! $offset_as_string = "Z"; # shorthand for "+00:00"
! }
!
! if(lc($S->{CONFIG}->{DBType}) eq "mysql") {
! # MySQL date formatting string
! $date_format = "%Y-%m-%dT%H:%i:%S$offset_as_string";
! } else {
! $date_format = 'YYYY-MM-DD"T"HH:MI:SS"$offset_as_string"';
! }
!
!
! } else {
!
! # Var contains special key "zone" -- replace if it's there
! my $tmpl = $S->{UI}->{VARS}->{date_format_default};
! $tmpl =~ s/\|zone\|/$zone/g;
!
! if (lc($S->{CONFIG}->{DBType}) eq "mysql") {
! $date_format = $tmpl || "%a %b %D, %Y at $time_format $zone";
! if ($S->{CONFIG}->{mysql_version} eq '3.22') {
! $date_format = $tmpl || "%a %b %D, %Y %r";
! }
! } else {
! $date_format = $tmpl || "Dy Mon DD, YYYY at $time_format \"$zone\"";
! }
! }
my $full_str;