Code cleanup: For cleanliness, remove code that allows site
administrators to force users to signify their agreement with the TOS if it
changes. Note: new users signing up to the service will still need to say they
agree with the TOS.
Patch by kareila.
diffs (482 lines):
diff -r b05f4b46fd8d -r 0a9810fcc06f bin/upgrading/en.dat
--- a/bin/upgrading/en.dat Tue Jun 15 14:53:42 2010 +0800
+++ b/bin/upgrading/en.dat Tue Jun 15 15:04:07 2010 +0800
@@ -3679,12 +3679,6 @@ time.ago.second=[[num]] [[?num|second|se
time.ago.week=[[num]] [[?num|week|weeks]] ago
-tos.error=You must read and agree to the terms of service.
-
-tos.haveread=I have read and agree to the Terms of Service.
-
-tos.mustread=Before continuing you must read and agree to the <a
[[aopts]]>Terms of Service.</a>
-
userlinkbar.addsub=Subscribe
userlinkbar.addsub.title.loggedout=You must be logged in to subscribe to this
account
diff -r b05f4b46fd8d -r 0a9810fcc06f bin/upgrading/proplists.dat
--- a/bin/upgrading/proplists.dat Tue Jun 15 14:53:42 2010 +0800
+++ b/bin/upgrading/proplists.dat Tue Jun 15 15:04:07 2010 +0800
@@ -493,14 +493,6 @@ userproplist.latest_optout:
indexed: 0
multihomed: 0
prettyname: Latest Updates Opt Out
-
-userproplist.legal_tosagree:
- cldversion: 4
- datatype: char
- des: Comma separated: Unix time user agreed to the Terms of Service,
revision number
- indexed: 0
- multihomed: 1
- prettyname: Agreed to Terms of Service
userproplist.mailencoding:
cldversion: 4
diff -r b05f4b46fd8d -r 0a9810fcc06f cgi-bin/LJ/ConfCheck/General.pm
--- a/cgi-bin/LJ/ConfCheck/General.pm Tue Jun 15 14:53:42 2010 +0800
+++ b/cgi-bin/LJ/ConfCheck/General.pm Tue Jun 15 15:04:07 2010 +0800
@@ -708,9 +708,6 @@ add_conf('%FILEEDIT_VIA_DB',
add_conf('%FILEEDIT_VIA_DB',
type => '',
des => "");
-add_conf('%REQUIRED_TOS',
- type => '',
- des => "");
add_conf('%SETTER',
type => '',
des => "");
@@ -759,7 +756,6 @@ my %bools = (
'USER_VHOSTS' => "Let (at least some) users get *.\$USER_DOMAIN
URLs. They'll also need the 'userdomain' cap.",
'USER_EMAIL' => "Let (at least some) users get email aliases on
the site. They'll also need the 'useremail' cap. See also \$USER_DOMAIN",
'USERPIC_BLOBSERVER' => "Store userpics on the 'blobserver'.
This is old. MogileFS is the future. You might want to use this option,
though, for development, as blobserver in local-filesystem-mode is easy to
setup.",
- 'TOS_CHECK' => 'Make users agree to the Terms of Service.',
'TRACK_URL_ACTIVE' => "record in memcached what URL a given
host/pid is working on",
'TRUST_X_HEADERS' => "LiveJournal should trust the upstream's
X-Forwarded-For and similar headers. Default is off (for direct connection to
the net). If behind your own reverse proxies, you should enable this.",
'UNICODE' => "Unicode support is enabled. The default has been
'on' for ages, and turning it off is nowadays not recommended or even known to
be working/reliable. Keep it enabled.",
diff -r b05f4b46fd8d -r 0a9810fcc06f cgi-bin/LJ/Talk.pm
--- a/cgi-bin/LJ/Talk.pm Tue Jun 15 14:53:42 2010 +0800
+++ b/cgi-bin/LJ/Talk.pm Tue Jun 15 15:04:07 2010 +0800
@@ -1184,7 +1184,6 @@ sub talkform {
# ditemid: init->ditemid
# form: optional full form hashref
# do_captcha: optional toggle for creating a captcha challenge
- # require_tos: optional toggle to include TOS requirement form
# errors: optional error arrayref
my $opts = shift;
return "Invalid talkform values." unless ref $opts eq 'HASH';
@@ -1250,12 +1249,6 @@ sub talkform {
my $chal = $opts->{ditemid} . "-$journalu->{userid}-$time-$rchars";
my $res = Digest::MD5::md5_hex($secret . $chal);
$ret .= LJ::html_hidden("chrp1", "$chal-$res");
- }
-
- # if we know the user who is posting (error on talkpost_do POST action),
- # then see if we
- if ($opts->{require_tos}) {
- $ret .= LJ::tosagree_html('comment', $form->{agree_tos},
BML::ml('tos.error'));
}
my $oid_identity = $remote ? $remote->openid_identity : undef;
diff -r b05f4b46fd8d -r 0a9810fcc06f cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm Tue Jun 15 14:53:42 2010 +0800
+++ b/cgi-bin/LJ/User.pm Tue Jun 15 15:04:07 2010 +0800
@@ -1842,55 +1842,6 @@ sub timezone {
}
-sub tosagree_set
-{
- my ($u, $err) = @_;
- return undef unless $u;
-
- unless (-f "$LJ::HOME/htdocs/inc/legal-tos") {
- $$err = "TOS include file could not be found";
- return undef;
- }
-
- my $rev;
- open (TOS, "$LJ::HOME/htdocs/inc/legal-tos");
- while ((!$rev) && (my $line = <TOS>)) {
- my $rcstag = "Revision";
- if ($line =~ /\$$rcstag:\s*(\S+)\s*\$/) {
- $rev = $1;
- }
- }
- close TOS;
-
- # if the required version of the tos is not available, error!
- my $rev_req = $LJ::REQUIRED_TOS{rev};
- if ($rev_req > 0 && $rev ne $rev_req) {
- $$err = "Required Terms of Service revision is $rev_req, but system
version is $rev.";
- return undef;
- }
-
- my $newval = join(', ', time(), $rev);
- my $rv = $u->set_prop("legal_tosagree", $newval);
-
- # set in $u object for callers later
- $u->{legal_tosagree} = $newval if $rv;
-
- return $rv;
-}
-
-
-sub tosagree_verify {
- my $u = shift;
- return 1 unless $LJ::TOS_CHECK;
-
- my $rev_req = $LJ::REQUIRED_TOS{rev};
- return 1 unless $rev_req > 0;
-
- my $rev_cur = (split(/\s*,\s*/, $u->prop("legal_tosagree")))[1];
- return $rev_cur eq $rev_req;
-}
-
-
########################################################################
### 7. Userprops, Caps, and Displaying Content to Others
diff -r b05f4b46fd8d -r 0a9810fcc06f cgi-bin/LJ/Widget/CreateAccount.pm
--- a/cgi-bin/LJ/Widget/CreateAccount.pm Tue Jun 15 14:53:42 2010 +0800
+++ b/cgi-bin/LJ/Widget/CreateAccount.pm Tue Jun 15 15:04:07 2010 +0800
@@ -536,12 +536,6 @@ sub handle_post {
body => $body,
});
- if ( $LJ::TOS_CHECK ) {
- my $err = "";
- $nu->tosagree_set(\$err)
- or return LJ::bad_input($err);
- }
-
$nu->make_login_session;
# we're all done; mark the invite code as used
diff -r b05f4b46fd8d -r 0a9810fcc06f cgi-bin/ljdefaults.pl
--- a/cgi-bin/ljdefaults.pl Tue Jun 15 14:53:42 2010 +0800
+++ b/cgi-bin/ljdefaults.pl Tue Jun 15 15:04:07 2010 +0800
@@ -179,18 +179,6 @@
# Default to allow all reproxying.
%REPROXY_DISABLE = () unless %REPROXY_DISABLE;
- # Terms of Service revision requirements
- foreach (
- [ rev => '0.0' ],
- [ title => 'Terms of Service agreement required' ],
- [ html => '' ],
- [ text => '' ]
- )
- {
- $LJ::REQUIRED_TOS{$_->[0]} = $_->[1]
- unless defined $LJ::REQUIRED_TOS{$_->[0]};
- }
-
# setup default minimal style information
$MINIMAL_USERAGENT{$_} ||= 1 foreach qw(Links Lynx w BlackBerry WebTV); #
w is for w3m
$MINIMAL_BML_SCHEME ||= 'lynx';
diff -r b05f4b46fd8d -r 0a9810fcc06f cgi-bin/ljprotocol.pl
--- a/cgi-bin/ljprotocol.pl Tue Jun 15 14:53:42 2010 +0800
+++ b/cgi-bin/ljprotocol.pl Tue Jun 15 15:04:07 2010 +0800
@@ -64,10 +64,6 @@ my %e = (
"153" => [ E_PERM, "Incorrect time value" ],
"154" => [ E_PERM, "Can't add a redirected account as a friend" ],
"155" => [ E_TEMP, "Non-authenticated email address" ],
- "156" => [ E_TEMP, sub { # to reload w/o restart
- LJ::tosagree_str('protocol' => 'text') ||
- LJ::tosagree_str('protocol' => 'title')
- } ],
"157" => [ E_TEMP, "Tags error" ],
# Client Errors
@@ -2920,10 +2916,6 @@ sub authenticate
return fail( $err, 101 );
}
- # if there is a require TOS revision, check for it now
- return fail( $err, 156, LJ::tosagree_str( protocol => 'text' ) )
- unless $u->tosagree_verify;
-
# remember the user record for later.
$flags->{u} = $u;
return 1;
diff -r b05f4b46fd8d -r 0a9810fcc06f cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl Tue Jun 15 14:53:42 2010 +0800
+++ b/cgi-bin/weblib.pl Tue Jun 15 15:04:07 2010 +0800
@@ -349,43 +349,6 @@ sub warning_list
return $ret;
}
-sub tosagree_widget {
- my ($checked, $errstr) = @_;
-
- return
- "<div class='formitemDesc'>" .
- BML::ml('tos.mustread',
- { aopts => "target='_new' href='$LJ::SITEROOT/legal/tos'" }) .
- "</div>" .
- "<iframe width='684' height='300' src='/legal/tos-mini' " .
- "style='border: 1px solid gray;'></iframe>" .
- "<div>" . LJ::html_check({ name => 'agree_tos', id => 'agree_tos',
- value => '1', selected => $checked }) .
- "<label for='agree_tos'>" . BML::ml('tos.haveread') . "</label></div>"
.
- ($errstr ? "<?inerr $errstr inerr?>" : '');
-}
-
-sub tosagree_html {
- my $domain = shift;
-
- my $ret = "<?h1 $LJ::REQUIRED_TOS{title} h1?>";
-
- my $html_str = LJ::tosagree_str($domain => 'html');
- $ret .= "<?p $html_str p?>" if $html_str;
-
- $ret .= "<div style='margin-left: 40px; margin-bottom: 20px;'>";
- $ret .= LJ::tosagree_widget(@_);
- $ret .= "</div>";
-
- return $ret;
-}
-
-sub tosagree_str {
- my ($domain, $key) = @_;
-
- return ref $LJ::REQUIRED_TOS{$domain} &&
$LJ::REQUIRED_TOS{$domain}->{$key} ?
- $LJ::REQUIRED_TOS{$domain}->{$key} : $LJ::REQUIRED_TOS{$key};
-}
# <LJFUNC>
# name: LJ::did_post
diff -r b05f4b46fd8d -r 0a9810fcc06f etc/config.pl
--- a/etc/config.pl Tue Jun 15 14:53:42 2010 +0800
+++ b/etc/config.pl Tue Jun 15 15:04:07 2010 +0800
@@ -59,48 +59,6 @@
###
### Policy Options
###
-
- $TOS_CHECK = 0; # require users to agree to TOS
-
- %REQUIRED_TOS =
- (
- # revision must be found in first line of your htdocs/inc/legal-tos
include file:
- # <!-- $Revision: 12440 $ -->
-
- # set required version to enable tos version requirement mechanism
- #rev => '1.0',
-
- # these are the defaults and are used if no "domain"-specific
- # values are defined below
- title => 'Configurable Title for TOS requirement',
- html => 'Configurable HTML for TOS requirement',
- text => 'Configurable text error message for TOS requirement',
-
- # text/html to use when message displayed for a login action
- login => {
- html => "Before logging in, you must update your TOS agreement",
- },
-
- # ... an update action
- update => {
- html => "HTML to use in update.bml",
- },
-
- # ... posting a comment (this will just use the defaults above)
- comment => {
- },
-
- # ... protocol actions
- protocol => {
- text => "Please visit $LJ::SITEROOT/legal/tos.bml to update your
TOS agreement",
- },
-
- # ... support requests
- support => {
- html => "Text to use when viewing a support request",
- },
-
- );
# filter comments for spam using this list of regular expressions:
#...@talkspam = (
diff -r b05f4b46fd8d -r 0a9810fcc06f htdocs/login.bml
--- a/htdocs/login.bml Tue Jun 15 14:53:42 2010 +0800
+++ b/htdocs/login.bml Tue Jun 15 15:04:07 2010 +0800
@@ -95,7 +95,6 @@ _c?>
return;
}
- my $require_tos = 0;
my $login_html = sub {
my $nojs = $GET{'nojs'};
@@ -123,15 +122,6 @@ _c?>
}
$body .= "<table cellpadding='0' cellspacing='0'><tr><td
style='padding-right:20px; vertical-align: top'>";
- if ($require_tos) {
- my $err_code = (ref $require_tos eq 'HASH') ? $require_tos->{code}
: 'tos_required';
- return if $want_fail_redirect->($err_code);
-
- $body .= "<div style='margin-left: 40px; margin-bottom: 20px;'>";
- my $tos_err = ref $require_tos eq 'HASH' ? $require_tos->{err} :
undef;
- $body .= LJ::tosagree_html('login', $POST{agree_tos}, $tos_err);
- $body .= "</div>";
- }
if ($remote) {
my $base = $remote->journal_base;
@@ -267,12 +257,6 @@ _c?>
$do_change = 0;
}
- if ($do_change && ! $remote->tosagree_verify) {
- $do_change = 0;
- $do_logout = 1;
- $require_tos = 1;
- }
-
if ($do_logout) {
$logout_remote->();
$title = BML::ml(".login.title", { 'sitename' =>
$LJ::SITENAMESHORT} );
@@ -343,23 +327,7 @@ _c?>
}
# at this point, $u is known good
- $u->preload_props( "browselang", "schemepref", "legal_tosagree" );
-
- unless ($u->tosagree_verify) {
- if ($POST{agree_tos}) {
- my $err = "";
- unless ($u->tosagree_set(\$err)) {
- # failed to save userprop, why?
- $require_tos = { err => $err , code =>
'fail_tosagree_set'};
- return $login_html->();
- }
- # else, successfully set... log them in
- } else {
- # didn't check agreement checkbox
- $require_tos = { err => $ML{'tos.error'}, code =>
'tos_required' };
- return $login_html->();
- }
- }
+ $u->preload_props( "browselang", "schemepref" );
my $exptype = ($POST{'expire'} eq "never" || $POST{'remember_me'})
? "long" : "short";
my $bindip = ($POST{'bindip'} eq "yes") ? BML::get_remote_ip() :
"";
@@ -393,14 +361,6 @@ _c?>
return if $want_success_redirect->();
- # otherwise if it's a get request, and the user is logged in
- # but has agreed to an old terms of service, log them out
- # and force a TOS validation
- if ($remote && ! LJ::did_post() && ! $remote->tosagree_verify) {
- $require_tos = 1;
- $logout_remote->();
- }
-
$login_html->();
return;
}
diff -r b05f4b46fd8d -r 0a9810fcc06f htdocs/support/append_request.bml
--- a/htdocs/support/append_request.bml Tue Jun 15 14:53:42 2010 +0800
+++ b/htdocs/support/append_request.bml Tue Jun 15 15:04:07 2010 +0800
@@ -39,21 +39,6 @@ body<=
unless (LJ::Support::can_append($sp, $remote, $FORM{'auth'}) || $remote) {
return "<?needlogin?>";
- }
-
- if ($remote && ! $remote->tosagree_verify) {
- my $ret = "<?h1 " . LJ::tosagree_str('support' => 'title') . " h1?>";
-
- my $html_str = LJ::tosagree_str('support' => 'html');
- if ($html_str) {
- $ret .= "<?p $html_str p?>";
- } else {
- $ret .= BML::ml
- ('tos.mustread',
- { aopts => "target='_new' href='$LJ::SITEROOT/legal/tos'" });
- }
-
- return $ret;
}
my $scat = $sp->{_cat};
diff -r b05f4b46fd8d -r 0a9810fcc06f htdocs/talkpost_do.bml
--- a/htdocs/talkpost_do.bml Tue Jun 15 14:53:42 2010 +0800
+++ b/htdocs/talkpost_do.bml Tue Jun 15 15:04:07 2010 +0800
@@ -143,15 +143,7 @@ body<=
# Required for challenge/response login, since we also need to regenerate
an auth token.
# We repopulate what we can via hidden fields - however the objects
(journalu & parpost) must be recreated here.
- # if the user leaving the comment hasn't agreed to the current TOS, and
they
- # didn't click the agreement checkbox, return the form back to them
- my $require_tos = 0;
- my $commentu = $init ? $init->{comment}->{u} : undef;
- if ($init && ! $POST{agree_tos} && $commentu && !
$commentu->tosagree_verify) {
- $require_tos = 1;
- }
-
- if (! $init || $require_tos) {
+ unless ( $init ) {
my ($sth, $parpost);
my $dbcr = LJ::get_cluster_def_reader($journalu);
return LJ::bad_input('No database connection present. Please go back
and try again.') unless $dbcr;
@@ -169,18 +161,9 @@ body<=
'parpost' => $parpost,
'replyto' => $POST{replyto} ||
$POST{parenttalkid},
'ditemid' => $POST{itemid},
- 'require_tos' => $require_tos,
'do_captcha' => $need_captcha,
'errors' => \...@errors,
'form' => \%POST });
- }
-
- # checked $POST{agree_tos} was checked above if it was necessary,
- # now we just need to save the userprop
- if ($commentu && ! $commentu->tosagree_verify && $POST{agree_tos}) {
- my $err = "";
- return LJ::bad_input($err)
- unless $commentu->tosagree_set(\$err);
}
diff -r b05f4b46fd8d -r 0a9810fcc06f htdocs/update.bml
--- a/htdocs/update.bml Tue Jun 15 14:53:42 2010 +0800
+++ b/htdocs/update.bml Tue Jun 15 15:04:07 2010 +0800
@@ -286,10 +286,6 @@ _c?>
$$body .= "\n\n<form method='post' action='update$getextra'
id='updateForm' name='updateForm'>\n\n";
$$body .= LJ::form_auth();
- if ($opts->{require_tos}){
- $$body .= LJ::tosagree_html('update', $POST{agree_tos},
$errors->{require_tos});
- }
-
$$body .= LJ::entry_form($entry, \$$head, $onload, $errors);
$$body .= "</form><!-- end #updateForm -->\n";
@@ -328,23 +324,6 @@ _c?>
$flags = { 'noauth' => 1, 'u' => $remote };
$user = $remote->{'user'};
$u = $remote;
- }
-
- if ($u && ! $u->tosagree_verify) {
- if ($POST{agree_tos}) {
- my $err = "";
- unless ($u->tosagree_set(\$err)) {
- # error
- $errors->{require_tos} = $err;
- $print_entry_form->({ require_tos => 1 });
- return;
- }
- # successfully set
- } else {
- $errors->{require_tos} = $ML{'tos.error'};
- $print_entry_form->({ require_tos => 1 });
- return;
- }
}
# Check if the account they're posting to is read-only
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog