Update of /cvs/scoop/scoop/struct/patch-files/current
In directory sodium.sabren.com:/tmp/cvs-serv5844/struct/patch-files/current
Modified Files:
README
Added Files:
patch-04-UserPrefs.sql script-04-post.pl script-04-pre.pl
Log Message:
New flexible user preferences stuff.
-janra
--- NEW FILE: script-04-pre.pl ---
#!/usr/bin/perl
use strict;
use Getopt::Std;
use DBI;
my $args = &get_args();
my $db_user = $args->{u};
my $db_pass = $args->{p};
my $db_port = $args->{o};
my $db_name = $args->{d};
my $db_host = $args->{h};
my $QUIET = $args->{q} || 0;
my $dsn = "DBI:mysql:database=$db_name:host=$db_host:port=$db_port";
my $dbh = DBI->connect($dsn, $db_user, $db_pass);
my ($query, $sth, $rv);
$|++;
mesg("\nStarting user info migration...\n");
# fields to rescue from users table: fakeemail, homepage, bio, publickey, admin_notes, sig
$query = "SELECT uid,fakeemail,homepage,bio,publickey,admin_notes,sig FROM users";
$sth = $dbh->prepare($query);
$sth->execute;
my $user_data = $sth->fetchall_hashref('uid');
$sth->finish;
mesg("\nGot info from users table...\n");
#now insert all that data into the userprefs table
mesg("\nPutting user info into userprefs table...\n");
foreach my $uid (sort keys %{$user_data}) {
foreach my $key (keys %{$user_data->{$uid}}) {
next unless $user_data->{$uid}->{$key};
my $err = &insert_pref($dbh, $uid, $key, $user_data->{$uid}->{$key});
mesg("\nError inserting $key ($user_data->{$uid}->{$key}) for UID $uid: $err\n") if $err;
}
}
mesg("\nDone user info migration...\n");
# utility functions follow from here
sub insert_pref {
my ($dbh, $uid, $pref, $value) = @_;
my $q_uid = $dbh->quote($uid);
my $q_pref = $dbh->quote($pref);
my $q_value = $dbh->quote($value);
my $query = "INSERT INTO userprefs VALUES ($q_uid, $q_pref, $q_value)";
my $sth = $dbh->prepare($query);
$sth->execute;
return ($dbh->errstr) ? $dbh->errstr : '';
}
sub grab_var {
my ($dbh, $id) = @_;
my $query = "SELECT value FROM vars WHERE name = " . $dbh->quote($id);
my $sth = $dbh->prepare($query);
$sth->execute;
my ($contents) = $sth->fetchrow_array;
$sth->finish;
return $contents;
}
sub update_var {
my ($dbh, $id, $contents) = @_;
my $query = "UPDATE vars SET value = ? WHERE name = ?";
my $sth = $dbh->prepare($query);
$sth->execute($contents, $id);
$sth->finish;
}
sub grab_block {
my ($dbh, $bid) = @_;
my $query = "SELECT block FROM blocks WHERE bid = " . $dbh->quote($bid);
my $sth = $dbh->prepare($query);
$sth->execute;
my ($contents) = $sth->fetchrow_array;
$sth->finish;
return $contents;
}
sub update_block {
my ($dbh, $bid, $contents) = @_;
my $query = "UPDATE blocks SET block = ? WHERE bid = ?";
my $sth = $dbh->prepare($query);
$sth->execute($contents, $bid);
$sth->finish;
}
sub grab_box {
my ($dbh, $box) = @_;
my $query = "SELECT content FROM box WHERE boxid = " . $dbh->quote($box);
my $sth = $dbh->prepare($query);
$sth->execute;
my ($contents) = $sth->fetchrow_array;
$sth->finish;
return $contents;
}
sub update_box {
my ($dbh, $box, $contents) = @_;
my $query = "UPDATE box SET content = ? WHERE boxid = ?";
my $sth = $dbh->prepare($query);
$sth->execute($contents, $box);
$sth->finish;
}
sub mesg {
print @_ unless $QUIET;
}
sub get_args {
my %info;
my @neededargs;
getopts("u:p:d:h:o:vqD", \%info);
# now first generate an array of hashrefs that tell us what we
# still need to get
foreach my $arg ( qw( u p d h o ) ) {
next if ( $info{$arg} and $info{$arg} ne '' );
if( $arg eq 'u' ) {
push( @neededargs, {arg => 'u',
q => 'db username? ',
default => 'nobody'} );
} elsif( $arg eq 'p' ) {
push( @neededargs, {arg => 'p',
q => 'db password? ',
default => 'password'} );
} elsif( $arg eq 'd' ) {
push( @neededargs, {arg => 'd',
q => 'db name? ',
default => 'scoop'} );
} elsif( $arg eq 'h' ) {
push( @neededargs, {arg => 'h',
q => 'db hostname? ',
default => 'localhost'} );
} elsif( $arg eq 'o' ) {
push( @neededargs, {arg => 'o',
q => 'db port? ',
default => '3306'} );
}
}
foreach my $h ( @neededargs ) {
my $answer = '';
print "$h->{q}"."[$h->{default}] ";
chomp( $answer = <STDIN> );
$answer = $h->{default} unless( $answer && $answer ne '' );
$info{ $h->{arg} } = $answer;
}
return \%info;
}
--- NEW FILE: script-04-post.pl ---
#!/usr/bin/perl
use strict;
use Getopt::Std;
use DBI;
my $args = &get_args();
my $db_user = $args->{u};
my $db_pass = $args->{p};
my $db_port = $args->{o};
my $db_name = $args->{d};
my $db_host = $args->{h};
my $QUIET = $args->{q} || 0;
my $dsn = "DBI:mysql:database=$db_name:host=$db_host:port=$db_port";
my $dbh = DBI->connect($dsn, $db_user, $db_pass);
my ($query, $sth, $rv);
my $default;
$|++;
mesg("\nMoving pref default values from Site Controls to userpref definitions...\n");
# default_comment_order -> commentorder
$default = &grab_var($dbh,'default_comment_order');
$default = 'oldest' unless $default =~ /newest|oldest/;
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='commentorder'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'default_comment_order');
# default_comment_sort -> commentrating
$default = &grab_var($dbh,'default_comment_sort');
$default = 'dontcare' unless $default =~ /unrate_highest|highest|lowest|dontcare/;
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='commentrating'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'default_comment_sort');
# default_comment_view -> commenttype
$default = &grab_var($dbh,'default_comment_view');
$default = 'mixed' unless $default =~ /mixed|topical|editorial|all|none/;
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='commenttype'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'default_comment_view');
# default_hidingchoice -> hidingchoice
$default = &grab_var($dbh,'default_hidingchoice');
$default = 'untilrating' unless $default =~ /yes|no|untilrating/;
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='hidingchoice'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'default_hidingchoice');
# default_post_type -> posttype
$default = &grab_var($dbh,'default_post_type');
$default = 'auto' unless $default =~ /text|html|auto/;
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='posttype'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'default_post_type');
# default_sig_behavior -> sig_behavior
$default = &grab_var($dbh,'default_sig_behavior');
$default = 'retroactive' unless $default =~ /retroactive|sticky|none/;
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='sig_behavior'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'default_sig_behavior');
# default_textarea_cols -> textarea_cols
$default = &grab_var($dbh,'default_textarea_cols');
$default = '60' unless $default =~ /\d+/;
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='textarea_cols'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'default_textarea_cols');
# default_textarea_rows -> textarea_rows
$default = &grab_var($dbh,'default_textarea_rows');
$default = '20' unless $default =~ /\d+/;
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='textarea_rows'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'default_textarea_rows');
# spellcheck_default -> spellcheck_default
$default = &grab_var($dbh,'spellcheck_default');
$default = ($default) ? 'on' : 'off';
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='spellcheck_default'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'spellcheck_default');
# spellcheck_spelling -> speling
$default = &grab_var($dbh,'spellcheck_spelling');
$default = 'american' unless $default =~ /american|canadian|british/;
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='speling'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'spellcheck_spelling');
# topic_images_default -> show_topic
$default = &grab_var($dbh,'topic_images_default');
$default = ($default) ? 'on' : 'off';
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='show_topic'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'topic_images_default');
# user_theme_default -> theme
$default = &grab_var($dbh,'user_theme_default');
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='theme'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'user_theme_default');
# default_comment_display -> commentmode & commentmode_overflow
$default = &grab_var($dbh,'default_comment_display');
# it seems that the code expected 'threaded' but the docs said 'thread'
# my mistake...
$default = 'threaded' if $default eq 'thread';
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='commentmode' OR prefname='commentmode_overflow'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'default_comment_display');
# cookie_expire
$default = &grab_var($dbh,'cookie_expire');
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='cookie_expire'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'cookie_expire');
# maxstories
$default = &grab_var($dbh,'maxstories');
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='maxstories'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'maxstories');
# maxtitles
$default = &grab_var($dbh,'maxtitles');
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='maxtitles'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'maxtitles');
# imagedir
$default = &grab_var($dbh,'imagedir');
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='imagedir'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'imagedir');
# upload_user_quota
$default = &grab_var($dbh,'upload_user_quota');
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='upload_user_quota'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'upload_user_quota');
# upload_max_file_size
$default = &grab_var($dbh,'upload_max_file_size');
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='upload_max_file_size'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
&delete_var($dbh,'upload_max_file_size');
# time_zone
$default = &grab_var($dbh,'time_zone');
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='time_zone'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
# don't delete this var, as it's also the system time zone
mesg("\nFixing font prefs...\n");
my $font_tag = &grab_block($dbh,'norm_font');
my ($font_face, $font_size);
if ( $font_tag =~ /face="(.*?)"/ ) {
$font_face = $1;
$font_tag =~ s/$1/%%norm_font_face%%/;
} else {
mesg("No font face set in block norm_font, skipping. To allow users to select their own font face however it is set, place the key |norm_font_face| where the font name(s) should appear. Don't forget to set the default value correctly in the Prefs Admin Tool\n");
}
if ( $font_tag =~ /size="(.*?)"/ ) {
$font_size = $1;
$font_tag =~ s/$1/%%norm_font_size%%/;
} else {
mesg("No font size set in block norm_font, skipping. To allow users to select their own font size however it is set, place the key |norm_font_size| where the font size should appear. Don't forget to set the default value correctly in the Prefs Admin Tool\n");
}
&update_block($dbh,'norm_font',$font_tag);
# now update the defaults for the font size & face prefs if they were dealt with above
if ( $font_face ) {
$query = qq{UPDATE pref_items SET default_value='$font_face' WHERE prefname='norm_font_face'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
}
if ( $font_size ) {
$query = qq{UPDATE pref_items SET default_value='$font_size' WHERE prefname='norm_font_size'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
}
mesg("\nFixing displayed boxes pref...\n");
# first get a list of boxes that may be set in this pref
$query = qq{SELECT boxid FROM box WHERE user_choose='1'};
$sth = $dbh->prepare($query);
$sth->execute;
my @boxes = ();
while (my ($box) = $sth->fetchrow_array) {
push (@boxes, $box);
}
$sth->finish;
# next set the default for the pref to all of those boxes, comma-separated
$default = join(',', at boxes);
$query = qq{UPDATE pref_items SET default_value='$default' WHERE prefname='displayed_boxes'};
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
# next change the value of the userprefs that are set to be a list of boxes shown,
# instead of boxes not shown
$query = qq{SELECT * from userprefs WHERE prefname='displayed_boxes'};
$sth = $dbh->prepare($query);
$sth->execute;
my %box_prefs;
while (my $row = $sth->fetchrow_hashref) {
my @user_boxes = ();
foreach my $option (@boxes) {
next if $row->{prefvalue} =~ /$option/;
push (@user_boxes, $option);
}
$box_prefs{$row->{uid}} = join(',', at user_boxes);
}
$sth->finish;
# now put the modified userprefs back in
foreach my $uid (keys %box_prefs) {
$query = qq|UPDATE userprefs SET prefvalue='$box_prefs{$uid}' WHERE prefname='displayed_boxes' AND uid='$uid'|;
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
}
mesg("\nFixing boxes to use new pref scheme... ");
# changes to whos_online, ad_box, and user_box
my $box_content;
$box_content = &grab_box($dbh,'ad_box');
unless ($box_content =~ /showad/) {
$box_content = q{return '' if( $S->pref('showad') eq 'off' );
} . $box_content;
}
$box_content =~ s/Yes/on/;
&update_box($dbh,'ad_box',$box_content);
# ok, this box has changed quite a bit without the changes showing up in patches...
# so the only changes I'll make are the two pref-related ones.
mesg("ad_box");
$box_content = &grab_box($dbh,'user_box');
$box_content =~ s#interface/prefs#my/prefs/Interface#;
$box_content =~ s#interface/comments#my/prefs/Comments#;
&update_box($dbh,'user_box',$box_content);
mesg(", user_box");
$box_content = &grab_box($dbh,'whos_online');
$box_content =~ s#online_cloak}\)#online_cloak} eq 'on'\)#;
$box_content =~ s#interface/prefs#my/prefs/Interface#;
&update_box($dbh,'whos_online',$box_content);
mesg(", whos_online\n");
mesg("\nUpdating comment mode userprefs for all users...\n");
# first get the overflow values, those are the easiest
$query = qq|SELECT * from userprefs WHERE prefvalue = '+' AND prefname LIKE '%_to'|;
$sth = $dbh->prepare($query);
$sth->execute;
my $overflow_pref = $sth->fetchall_hashref('uid');
$sth->finish;
foreach my $uid (keys %{$overflow_pref}) {
my $overflow_value = $overflow_pref->{$uid}->{prefname};
$overflow_value =~ s/_to//;
$overflow_value =~ s/comment_//;
&insert_pref($dbh, $uid, 'commentmode_overflow', $overflow_value);
&insert_pref($dbh, $uid, 'commentmode', 'use_overflow');
# if they have a non-overflow value set, it'll get overridden
# and if not, we don't want to mess them up
}
$query = qq|DELETE from userprefs WHERE prefvalue = '+' AND prefname LIKE '%_to'|;
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
# next get the rest of the values
$query = qq|SELECT * from userprefs WHERE prefname LIKE '%_to'|;
$sth = $dbh->prepare($query);
$sth->execute;
my %mode_prefs;
my %overflow_number;
while ( my $c_mode = $sth->fetchrow_hashref() ) {
if ( $c_mode->{prefvalue} > $overflow_number{$c_mode->{uid}} ) {
$overflow_number{$c_mode->{uid}} = $c_mode->{prefvalue};
$mode_prefs{$c_mode->{uid}} = $c_mode->{prefname};
$mode_prefs{$c_mode->{uid}} =~ s/_to//;
$mode_prefs{$c_mode->{uid}} =~ s/comment_//;
}
}
foreach my $uid (keys %overflow_number) {
&update_pref($dbh, $uid, 'commentmode', $mode_prefs{$uid});
&insert_pref($dbh, $uid, 'commentmode_overflow_at', $overflow_number{$uid});
}
# have to patch the new_user_html (and description) so required prefs show up if used
mesg("Updating new_user_html block...\n");
my $new_user_html = &grab_block($dbh,'new_user_html');
$new_user_html =~ s/(<input type="submit")/%%required_prefs%%<br>$1/;
&update_block($dbh,'new_user_html',$new_user_html);
# and the description...
$query = "SELECT description FROM blocks WHERE bid='new_user_html'";
$sth = $dbh->prepare($query);
$sth->execute;
my ($new_user_html_desc) = $sth->fetchrow_array;
$sth->finish;
$new_user_html_desc =~ s/(<\/dl>)$/ <dt>required_prefs<\/dt><dd>The controls for any user preferences marked as "required"<\/dd>$1/;
my $new_desc_q = $dbh->quote($new_user_html_desc);
$query = "UPDATE blocks SET description=$new_desc_q WHERE bid='new_user_html'";
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
# utility functions follow from here
sub insert_pref {
my ($dbh, $uid, $pref, $value) = @_;
my $q_uid = $dbh->quote($uid);
my $q_pref = $dbh->quote($pref);
my $q_value = $dbh->quote($value);
my $query = "INSERT INTO userprefs VALUES ($q_uid, $q_pref, $q_value)";
my $sth = $dbh->prepare($query);
$sth->execute;
return ($dbh->errstr) ? $dbh->errstr : '';
}
sub update_pref {
my ($dbh, $uid, $pref, $value) = @_;
my $q_uid = $dbh->quote($uid);
my $q_pref = $dbh->quote($pref);
my $q_value = $dbh->quote($value);
my $query = "UPDATE userprefs SET uid=$q_uid, prefname=$q_pref, prefvalue=$q_value WHERE uid=$q_uid AND prefname=$q_pref";
my $sth = $dbh->prepare($query);
$sth->execute;
return ($dbh->errstr) ? $dbh->errstr : '';
}
sub delete_var {
my ($dbh, $id) = @_;
my $query = "DELETE FROM vars WHERE name=" . $dbh->quote($id);
my $sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
}
sub grab_var {
my ($dbh, $id) = @_;
my $query = "SELECT value FROM vars WHERE name = " . $dbh->quote($id);
my $sth = $dbh->prepare($query);
$sth->execute;
my ($contents) = $sth->fetchrow_array;
$sth->finish;
return $contents;
}
sub update_var {
my ($dbh, $id, $contents) = @_;
my $query = "UPDATE vars SET value = ? WHERE name = ?";
my $sth = $dbh->prepare($query);
$sth->execute($contents, $id);
$sth->finish;
}
sub grab_block {
my ($dbh, $bid) = @_;
my $query = "SELECT block FROM blocks WHERE bid = " . $dbh->quote($bid);
my $sth = $dbh->prepare($query);
$sth->execute;
my ($contents) = $sth->fetchrow_array;
$sth->finish;
return $contents;
}
sub update_block {
my ($dbh, $bid, $contents) = @_;
my $query = "UPDATE blocks SET block = ? WHERE bid = ?";
my $sth = $dbh->prepare($query);
$sth->execute($contents, $bid);
$sth->finish;
}
sub grab_box {
my ($dbh, $box) = @_;
my $query = "SELECT content FROM box WHERE boxid = " . $dbh->quote($box);
my $sth = $dbh->prepare($query);
$sth->execute;
my ($contents) = $sth->fetchrow_array;
$sth->finish;
return $contents;
}
sub update_box {
my ($dbh, $box, $contents) = @_;
my $query = "UPDATE box SET content = ? WHERE boxid = ?";
my $sth = $dbh->prepare($query);
$sth->execute($contents, $box);
$sth->finish;
}
sub mesg {
print @_ unless $QUIET;
}
sub get_args {
my %info;
my @neededargs;
getopts("u:p:d:h:o:vqD", \%info);
# now first generate an array of hashrefs that tell us what we
# still need to get
foreach my $arg ( qw( u p d h o ) ) {
next if ( $info{$arg} and $info{$arg} ne '' );
if( $arg eq 'u' ) {
push( @neededargs, {arg => 'u',
q => 'db username? ',
default => 'nobody'} );
} elsif( $arg eq 'p' ) {
push( @neededargs, {arg => 'p',
q => 'db password? ',
default => 'password'} );
} elsif( $arg eq 'd' ) {
push( @neededargs, {arg => 'd',
q => 'db name? ',
default => 'scoop'} );
} elsif( $arg eq 'h' ) {
push( @neededargs, {arg => 'h',
q => 'db hostname? ',
default => 'localhost'} );
} elsif( $arg eq 'o' ) {
push( @neededargs, {arg => 'o',
q => 'db port? ',
default => '3306'} );
}
}
foreach my $h ( @neededargs ) {
my $answer = '';
print "$h->{q}"."[$h->{default}] ";
chomp( $answer = <STDIN> );
$answer = $h->{default} unless( $answer && $answer ne '' );
$info{ $h->{arg} } = $answer;
}
return \%info;
}
Index: README
===================================================================
RCS file: /cvs/scoop/scoop/struct/patch-files/current/README,v
retrieving revision 1.94
retrieving revision 1.95
diff -C2 -d -r1.94 -r1.95
*** README 18 Jul 2004 19:45:49 -0000 1.94
--- README 4 Aug 2004 21:49:49 -0000 1.95
***************
*** 29,34 ****
Moves the comment post form to a block
! Any problems, email scoop-help at lists.sourceforge.net (don't forget to join!)
! join here: http://sourceforge.net/mail/?group_id=4901
or if you irc look in #scoop on irc.slashnet.org or #kuro5hin if nobody is
--- 29,37 ----
Moves the comment post form to a block
! Aug 4 14:17 patch-04-UserPrefs.sql
! New flexible user preferences. Both -pre and -post scripts are required
!
! Any problems, email scoop-help at lists.kuro5hin.org (don't forget to join!)
! join here: http://lists.kuro5hin.org/mailman/listinfo/scoop-help
or if you irc look in #scoop on irc.slashnet.org or #kuro5hin if nobody is
--- NEW FILE: patch-04-UserPrefs.sql ---
-- Table structure for userprefs definitions
CREATE TABLE pref_items (
prefname varchar(32) NOT NULL default '',
title varchar(50) NOT NULL default '',
description text,
visible int(1) default '0',
html int(1) default '0',
perm_view varchar(32),
perm_edit varchar(32),
var varchar(32),
req_tu int(1) default '0',
default_value text,
length int(5),
regex text,
page varchar(50),
field text,
display_order int(5),
template varchar(30),
display_fmt text,
enabled int(1) default '1',
required int(1) default '0',
PRIMARY KEY (prefname),
KEY page_idx (page)
);
-- field req_tu is "temporary" until perms are re-done so that TU status can give somebody arbitrary perms, one of which is seeing hidden comments
-- pref_items data
-- default values for some prefs will be pulled from vars in the -post script
-- but are set to sensible values here in case of missing vars in the target db.
-- User Info page stuff
INSERT INTO pref_items VALUES ('admin_notes', 'Admin Notes', 'Information about the user that only site administrators can see', '1', '1', 'edit_user', 'edit_user', 'allow_admin_notes', '0', '', '', '', 'User Info', '<textarea COLS="50" ROWS="5" NAME="admin_notes" WRAP="soft">%%value%%</textarea>','3', 'text_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('fakeemail', 'Email', 'This is the address that will be displayed in comments and in your user info. It will not be used to email forgotten passwords. You may want to add some kind of spam protection so that harvesters cannot parse it.', '1', '0', '', '', '', '0', '', '50', '', 'User Info', '<input TYPE="text" SIZE="50" NAME="fakeemail" VALUE="%%value%%">', '5', 'text_pref', '<A href="mailto:%%value%%">%%value%%</A>', '1', '0');
INSERT INTO pref_items VALUES ('homepage', 'Homepage', 'If you have a homepage, enter the address here and it will be added to your comments and user info. The full path is required: remember the "http://"!', '1', '0', '', '', '', '0', '', '100', '^http', 'User Info', '<input TYPE="text" SIZE="50" NAME="homepage" VALUE="%%value%%">', '6', 'text_pref', '<A href="%%value%%">%%value%%</A>', '1', '0');
INSERT INTO pref_items VALUES ('bio', 'Bio', 'Enter any kind of biographical information you want other users to see about yourself here.', '1', '1', '', '', '', '0', '', '255', '', 'User Info', '<textarea COLS="50" ROWS="5" WRAP="soft" NAME="bio">%%value%%</textarea>', '7', 'text_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('publickey', 'Public Key', 'If you have a PGP/GPG public key (used for encrypting and signing email), paste it in here.', '1', '0', '', '', '', '0', '', '', '', 'User Info', '<textarea COLS="50" ROWS="5" NAME="publickey">%%value%%</textarea>', '8', 'text_pref', '<pre>%%value%%</pre>', '1', '0');
-- Interface page stuff
INSERT INTO pref_items VALUES ('upload_user_quota', 'Disk Quota', 'The maximum amount of space this user can take up with his uploaded files (in kb)', '0', '0', '', 'edit_user', 'allow_uploads', '0', '0', '', '\\d+', 'Interface', '<INPUT type="text" name="upload_user_quota" value="%%value%%" size="5">', '0', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('upload_max_file_size', 'Max File Size', 'The maximum size a single file can be (in kb)', '0', '0', '', 'edit_user', 'allow_uploads', '0', '0', '', '\\d+', 'Interface', '<INPUT type="text" name="upload_max_file_size" value="%%value%%" size="5">', '0', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('digest', 'Story Digest', 'Story headlines and intros can be emailed to you at your real email address on the schedule you choose.', '0', '0', '', '', 'enable_story_digests', '0', 'Never', '10', '(Never|Daily|Weekly|Monthly)', 'Interface', '%%BOX,pref_selectbox,digest,%%value%%,Never,Daily,Weekly,Monthly%%', '1', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('time_zone', 'Your Time Zone', 'Setting your (non-daylight savings) time zone here will make the site display all times and dates in your local time', '0', '0', '', '', '', '0', 'est', '4', '[a-zA-z]+', 'Interface', '%%BOX,time_zone_pref,%%value%%%%', '2', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('maxstories', 'Number of story summaries to show', '(on front page)', '0', '0', '', '', '', '0', '8', '3', '\\d+', 'Interface', '<input type="text" size="5" name="maxstories" value="%%value%%">', '3', 'text_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('maxtitles', 'Number of story titles to show', '(in "older stories" box)', '0', '0', '', '', '', '0', '10', '3', '\\d+', 'Interface', '<input type="text" size="5" name="maxtitles" value="%%value%%">', '4', 'text_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('textarea_cols', 'Text box width', 'This allows you to set how big of a text box you have to type stories and comments into.', '0', '0', '', '', '', '0', '60', '4', '\\d+', 'Interface', '<input type="text" size="5" name="textarea_cols" value="%%value%%">', '5', 'text_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('textarea_rows', 'Text box height', 'This allows you to set how big of a text box you have to type stories and comments into.', '0', '0', '', '', '', '0', '20', '4', '\\d+', 'Interface', '<input type="text" size="5" name="textarea_rows" value="%%value%%">', '6', 'text_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('norm_font_face', 'Font Face', '', '0', '0', '', '', '', '0', 'verdana, arial, helvetica, sans-serif', '', '[a-zA-z,\\s]', 'Interface', '<input type="text" size="30" name="norm_font_face" value="%%value%%" />', '7', 'text_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('norm_font_size', 'Font Size', '', '0', '0', '', '', '', '0', '2', '5', '\\w+', 'Interface', '<input type="text" size="5" name="norm_font_size" value="%%value%%">', '8', 'text_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('showad', 'Show ads', '', '0', '0', '', 'ad_opt_out', 'use_ads', '0', 'All', '16', '^(on|off)$', 'Interface', '%%BOX,pref_checkbox,showad,%%value%%%%', '9', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('ad_open_new_win', 'Open advertisement clicks in new window', '', '0', '0', '', '', 'use_ads', '0', 'off', '3', '^(on|off)$', 'Interface', '%%BOX,pref_checkbox,ad_open_new_win,%%value%%%%', '10', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('show_topic', 'Show topic images with stories', '', '0', '0', '', '', 'use_topics', '0', 'on', '3', '^(on|off)$', 'Interface', '%%BOX,pref_checkbox,show_topic,%%value%%%%', '11', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('start_page', 'Start page', '', '0', '0', '', '', '', '0', '__main__', '', '\\w+', 'Interface', '%%BOX,startpage_pref,%%value%%%%', '12', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('online_cloak', 'Hide yourself in the Who\'s Online box', '', '0', '0', '', '', 'use_whosonline', '0', 'off', '3', '^(on|off)$', 'Interface', '%%BOX,pref_checkbox,online_cloak,%%value%%%%', '13', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('dynamic_interface', 'Use dynamic interface elements', 'This turns on javascript-driven items such as dynamic comment mode', '0', '0', '', '', 'allow_dynamic_comment_mode', '0', 'off', '3', '^(on|off)$', 'Interface', '%%BOX,pref_checkbox,dynamic_interface,%%value%%%%', '14', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('spellcheck_default', 'Spellcheck posts by default', '', '0', '0', '', 'use_spellcheck', 'spellcheck_enabled', '0', 'off', '3', '^(on|off)$', 'Interface', '%%BOX,pref_checkbox,spellcheck_default,%%value%%%%', '15', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('speling', 'Spelling variant', '', '0', '0', '', 'use_spellcheck', 'spellcheck_enabled', '0', 'American', '8', '(American|Canadian|British)', 'Interface', '%%BOX,pref_selectbox,speling,%%value%%,American,Canadian,British%%', '16', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('imagedir', 'Preferred image server', 'Choose an image server closest to you for the quickest page load times', '0', '0', '', '', 'use_alt_image_servers', '0', '/images', '', '', 'Interface', '%%BOX,img_server_pref,%%value%%%%', '17', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('theme', 'Use which theme', '', '0', '0', '', '', 'allow_user_themes', '0', '', '', '\\w+', 'Interface', '%%BOX,user_theme_pref,%%value%%%%', '18', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('cookie_expire', 'Cookie Expiry', 'How long does your login cookie last?', '0', '0', '', '', '', '', '2592000', '', '', 'Interface', '%%BOX,cookie_expire_pref,%%value%%%%', '19', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('displayed_boxes', 'Boxes', '', '0', '0', '', '', '', '', 'hotlist_box,poll_box,rdf_feeds,whos_online', '', '', 'Interface', '%%BOX,box_pref,%%value%%%%', '20', 'text_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('max_rdf_titles', 'Maximum headlines per feed', '', '0', '0', '', '', 'use_rdf_feeds', '0', '15', '2', '\\d+', 'Interface', '<input type="text" name="max_rdf_titles" value="%%value%%" size="5">', '21', 'text_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('rdf_feeds', 'External Feeds', '[<a href="%%rootdir%%/submitrdf">Submit New Feed</A>]', '0', '0', '', '', 'use_rdf_feeds', '', '', '', '', 'Interface', '%%BOX,rdf_pref,%%value%%%%', '22', 'text_pref', '', '1', '0');
-- Comment prefs page stuff
INSERT INTO pref_items VALUES ('commentmode', 'Comment display mode', '', '0', '0', '', '', '', '0', 'threaded', '', '(use_overflow|minimal|dminimal|threaded|dthreaded|nested|flat|flat_unthread)', 'Comments', '%%BOX,commentmode_pref,%%value%%%%', '1', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('commentmode_overflow_at', 'Change to overflow mode at', '', '0', '0', '', '', '', '0', '200', '', '\\d+', 'Comments', '<input type="text" size="10" name="commentmode_overflow_at" value="%%value%%">', '2', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('commentmode_overflow', 'Comment display mode (overflow)', 'Comment display modes:\n<UL>\n <LI>flat (unthreaded): straight chronological order</LI>\n <LI>flat: comments and replies grouped, but not indented</LI>\n <LI>minimal: titles only, replies indented</LI>\n <LI>threaded: top-level comments expanded, all other titles only, replies indented</LI>\n <LI>nested: all comments shown in full, replies indented</LI>\n</UL>', '0', '0', '', '', '', '0', 'threaded', '', '(minimal|dminimal|threaded|dthreaded|nested|flat|flat_unthread)', 'Comments', '%%BOX,commentmode_overflow_pref,%%value%%%%', '3', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('commenttype', 'Types of comments to display', '', '0', '0', '', '', '', '0', 'mixed', '10', '(mixed|topical|editorial|all|none)', 'Comments', '%%BOX,pref_selectbox,commenttype,%%value%%,mixed,topical,editorial,all,none%%', '4', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('commentrating', 'Sorting based on comment ratings', '', '0', '0', '', '', 'use_ratings', '0', 'highest', '15', '(unrate_highest|highest|lowest|dontcare)', 'Comments', '%%BOX,rating_order_pref,%%value%%%%', '5', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('commentorder', 'Sorting based on comment age', '', '0', '0', '', '', '', '0', 'oldest', '6', '(newest|oldest)', 'Comments', '%%BOX,pref_selectbox,commentorder,%%value%%,newest,oldest%%', '6', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('ratingchoice', 'Rate comments', '', '0', '0', '', 'comment_rate', 'use_ratings', '0', 'yes', '4', '(yes|no|hide)', 'Comments', '%%BOX,pref_selectbox,ratingchoice,%%value%%,yes,no,hide%%', '7', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('hidingchoice', 'Show hidden comments', '', '0', '0', '', '', 'use_ratings', '1', 'yes', '11', '(yes|no|untilrating)', 'Comments', '%%BOX,show_hidden_pref,%%value%%%%', '8', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('posttype', 'Post mode', '', '0', '0', '', '', '', '0', 'auto', '4', '(text|html|auto)', 'Comments', '%%BOX,postmode_pref,%%value%%%%', '9', 'selectbox_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('sig', 'Signature', 'This will get attached to your comments. Sigs are typically used for quotations or links', '0', '1', '', 'comment_post', '', '0', '', '160', '', 'Comments', '<textarea COLS="50" ROWS="5" WRAP="soft" NAME="sig">%%value%%</textarea>', '10', 'text_pref', '', '1', '0');
INSERT INTO pref_items VALUES ('sig_behavior', 'Signature type', '', '0', '0', '', 'comment_post', 'allow_sig_behavior', '0', 'retroactive', '11', '(retroactive|sticky|none)', 'Comments', '%%BOX,pref_selectbox,sig_behavior,%%value%%,retroactive,sticky,none%%', '11', 'selectbox_pref', '', '1', '0');
-- changes to users table
-- data in these fields will be fetched from users table and put into userprefs table in -pre script
ALTER TABLE users DROP COLUMN fakeemail;
ALTER TABLE users DROP COLUMN homepage;
ALTER TABLE users DROP COLUMN bio;
ALTER TABLE users DROP COLUMN publickey;
ALTER TABLE users DROP COLUMN admin_notes;
ALTER TABLE users DROP COLUMN sig;
-- fields that don't seem to be used at all
-- (all null, blank, or 0 in the db, not used in code or box as far as I can tell)
ALTER TABLE users DROP COLUMN realname;
ALTER TABLE users DROP COLUMN mode;
ALTER TABLE users DROP COLUMN posttype;
ALTER TABLE users DROP COLUMN mailreplies;
ALTER TABLE users DROP COLUMN threshold;
ALTER TABLE users DROP COLUMN score;
ALTER TABLE users DROP COLUMN points;
ALTER TABLE users DROP COLUMN commentsort;
ALTER TABLE users DROP COLUMN defaultpoints;
ALTER TABLE users DROP COLUMN perms;
-- admin tools entry
INSERT INTO admin_tools (tool, pos, dispname, menuname, perm, func, is_box) VALUES ('prefs', '21', 'User Preferences', 'User Preferences', 'edit_prefs', 'edit_prefs', '0');
-- new blocks
INSERT INTO blocks (bid, block, aid, description, category, theme, language) VALUES ('invalid_user_msg', 'Sorry, I can\'t seem to find that user', '1', '<P>The error message displayed when somebody requests a page for a user that doesn\'t exist</P>', 'Accounts', 'default', 'en');
INSERT INTO blocks (bid, block, aid, description, category, theme, language) VALUES ('selectbox_pref', '<DIV class="item">\r\n<P><B>%%required%%%%title%%:</B> %%control%%\r\n<BR>%%description%%</P>\r\n</DIV>', '1', '<P>The preference item template generally used for selectboxes. This should be a self-contained bit of HTML as it is used to display a single user preference, both on the user info page and the preferences edit forms. The following special keys are recognised:</P>\n<DL>\n <DT>required</DT>\n <DD>If the preference is required, the contents of <B>required_pref_marker</B>, otherwise blank</DD>\n <DT>title</DT>\n <DD>The displayed title of the preference, as set in the User Preferences Admin Tool</DD>\n <DT>control</DT>\n <DD>On the preferences edit form, this is the form field required for the preference, as set in the User Preferences Admin Tool. On the user info page, this is the value of the preference</DD>\n <DT>description</DT>\n <DD>On the preferences edit!
form, this is the description as entered in the User Preferences Admin Tool. On the user info page, this is not displayed.</DD>\n <DT>allowed_html</DT>\n <DD>If the preference supports HTML, displays the "Allowed HTML" string.</DD>\n</DL>', 'Accounts', 'default', 'en');
INSERT INTO blocks (bid, block, aid, description, category, theme, language) VALUES ('text_pref', '<DIV class="item">\r\n<P><B>%%required%%%%title%%:</B> %%description%%\r\n<BR>%%allowed_html%%\r\n<BR>%%control%%</P>\r\n</DIV>', '1', '<P>The preference item template generally used for text boxes. This should be a self-contained bit of HTML as it is used to display a single user preference, both on the user info page and the preferences edit forms. The following special keys are recognised:</P>\n<DL>\n <DT>required</DT>\n <DD>If the preference is required, the contents of <B>required_pref_marker</B>, otherwise blank</DD>\n <DT>title</DT>\n <DD>The displayed title of the preference, as set in the User Preferences Admin Tool</DD>\n <DT>control</DT>\n <DD>On the preferences edit form, this is the form field required for the preference, as set in the User Preferences Admin Tool. On the user info page, this is the value of the preference</DD>\n <DT>description</DT>\n <DD>On th!
e preferences edit form, this is the description as entered in the User Preferences Admin Tool. On the user info page, this is not displayed.</DD>\n <DT>allowed_html</DT>\n <DD>If the preference supports HTML, displays the "Allowed HTML" string.</DD>\n</DL>', 'Accounts', 'default', 'en');
INSERT INTO blocks (bid, block, aid, description, category, theme, language) VALUES ('user_admin', '<DIV class="admin_prefs">\r\n<P><B>Nickname:</B> <INPUT type="text" length="30" name="nickname" value="%%nickname%%">\r\n</P>\r\n<P><B>User ID:</B> %%uid%%</P>\r\n<P><B>User group:</B> %%BOX,user_group_box,%%perm_group%%%%</P>\r\n<P><B>Original Email:</B> %%origemail%%</P>\r\n<P><B>Created At:</B> %%creation_time%%</P>\r\n<P><B>Original IP:</B> %%creation_ip%%</P>\r\n<P><B>User\'s current mojo:</B> %%mojo%%</P>\r\n</DIV>', '1', '<P>This block displays admin-only user info on the Protected user preference page. This should be a self-contained block of HTML. It is displayed just above the real email and password fields on the Protected user preference page for users with the <B>edit_user</B> perm only. The following special keys are recognised:</P>\n<DL>\n <DT>nickname</DT>\n <DD>The nickname of the user being edited</DD>\n <DT>perm_group</DT>\n <DD>The current group of the us!
er being edited</DD>\n <DT>origemail</DT>\n <DD>The email address used when the account was created</DD>\n <DT>creation_time</DT>\n <DD>The date and time the account was created</DD>\n <DT>creation_ip</DT>\n <DD>The IP address the account was created from</DD>\n <DT>mojo</DT>\n <DD>The user\'s current mojo</DD>\n</DL>', 'Accounts', 'default', 'en');
INSERT INTO blocks (bid, block, aid, description, category, theme, language) VALUES ('user_pass', '<DIV class="prefs">\r\n<P><B><font color="#ff0000">Protected settings</font></B>\r\n%%passwd%%\r\n<P><B>Real Email:</B> <INPUT type="text" name="realemail" value="%%realemail%%">\r\n<BR>This is the address that will be used to email forgotten passwords. It will not be shown anywhere. Please do not insert any kind of spam protection here, or you will not be able to get a new password!</P>\r\n\r\n<P><B>New Password:</B> Leave both fields blank for no change. This is asked twice to detect typos.\r\n<BR>New Password: <INPUT TYPE="password" SIZE="30" NAME="pass1">\r\n<BR>Confirm: <INPUT TYPE="password" SIZE="30" NAME="pass2">\r\n</DIV>', '1', '<P>This block displays the user portion of the Protected user preferences page. The following special keys are recognised:</P>\n<DL>\n <DT>passwd</DT>\n <DD>The entire form field for password entry. If it is a user\'s first login, the form fi!
eld is hidden.</DD>\n <DT>realemail</DT>\n <DD>The current value of the user\'s real email</DD>\n</DL>', 'Accounts', 'default', 'en');
INSERT INTO blocks (bid, block, aid, description, category, theme, language) VALUES ('user_info_page', '%%title_font%%User Info%%title_font_end%%\r\n%%BOX,userpref_menu%%\r\n<DIV>\r\n%%trusted_msg%%\r\n%%BOX,subscriber%%\r\n%%itemlist%%\r\n</DIV>', '1', '<P>This block contains the content column template for the displayed user info page. It should be self-contained HTML and contain the page title (the title bar most pages have, just under the header). The following special keys are recognised:</P>\n<DL>\n <DT>trusted_msg</DT>\n <DD>If the user is trusted and viewing his own user info page, the contents of the block <B>trusted_info_message</B> are displayed.</DD>\n <DT>itemlist</DT>\n <DD>Those user preferences which are visible and have some value, each formatted by their pref template</DD>\n</DL>', 'Accounts', 'default', 'en');
INSERT INTO blocks (bid, block, aid, description, category, theme, language) VALUES ('user_pref_page', '%%title_font%%User Preferences: %%page%%%%title_font_end%%\r\n%%BOX,userpref_menu%%\r\n%%message%%\r\n<DIV>\r\n<FORM action="%%rootdir%%/user/%%nick%%/prefs/%%page%%" method="post">\r\n%%formkey%%\r\n\r\n%%itemlist%%\r\n\r\n<INPUT type="submit" name="write" value="Save Preferences">\r\n%%userpref_reset%%\r\n</FORM>\r\n</DIV>', '1', '<P>This block contains the content column template for the user preference edit pages. It should be self-contained HTML and contain the page title (the title bar most pages have, just under the header). The following special keys are recognised:</P>\n<DL>\n <DT>page</DT>\n <DD>The name of the preference page currently being edited</DD>\n <DT>nick</DT>\n <DD>The nickname of the user currently being edited</DD>\n <DT>formkey</DT>\n <DD>A formkey, for a bit of security (mostly against double-clicks on the save button)</DD>\n <DT>message</DT>\n !
<DD>Any status or error messages generated by an attempt to save or reset the preferences</DD>\n <DT>itemlist</DT>\n <DD>The preferences for this page, formatted by their pref item templates</DD>\n <DT>userpref_reset</DT>\n <DD>The contents of the block <B>userpref_reset</B> (a reset button) if the current page is anything other than Protected; the Protected page has no reset button.</DD>\n</DL>', 'Accounts', 'default', 'en');
INSERT INTO blocks (bid, block, aid, description, category, theme, language) VALUES ('firstlogin_message', '<p><b>Welcome to %%sitename%%!</b> As this is your first login, you probably want to change your password below or some of the settings on the other preference pages. None of these changes are required, but we do recommend at least changing your password. Enjoy your stay.</p>\r\n<p>If you don\'t want to make any changes, you can <a href="%%rootdir%%/">go to the front page</a>.</p>', '1', '<P>This block is displayed at the top of the Protected settings page the first time a user logs in, if the variable <B>show_prefs_on_first_login</B> is on. It should be self-contained HTML that encourages the new user to change his password and explore the other preference pages. There are no special keys.</P>', 'Accounts', 'default', 'en');
INSERT INTO blocks (bid, block, aid, description, category, theme, language) VALUES ('formkey_err', 'Invalid form key. You probably tried to save your settings more than once. Do not hit "BACK"! If you are certain that your settings have not been saved, try to save them from this screen.', '1', '<P>The error message displayed if there is a formkey error, such as a user double-clicking a button or going too long between loading the form and submitting it.</P>', 'Accounts', 'default', 'en');
INSERT IGNORE INTO blocks (bid, block, aid, description, category, theme, language) VALUES ('empty_box', '%%content%%', '1', '<P>A box template with nothing but the content special key</P>', 'Box Templates', 'default', 'en');
INSERT INTO blocks (bid, block, aid, description, category, theme, language) VALUES ('edit_prefs','%%title_font%%Edit User Preferences%%title_font_end%%\r\n\r\n<P>%%err_font%%%%update_msg%%%%err_font_end%%</P>\r\n\r\n<FORM action="%%rootdir%%/admin/prefs" method="post">\r\n<INPUT type="submit" name="save" value="Save">\r\n<INPUT type="submit" name="get" value="Get">\r\n\r\n<TABLE border="0">\r\n <TR>\r\n <TD><B>Select Preference:</B></TD>\r\n <TD>%%pref_selectbox%%</TD>\r\n </TR>\r\n <TR>\r\n <TD colspan="2"><B>Delete:</B> <INPUT type="checkbox" name="delete" value="1"> Many prefs should be disabled (not deleted) if you want to prevent users from changing them, as Scoop requires their default values in order to run correctly.</TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Name:</B></TD>\r\n <TD><INPUT type="text" size="20" maxlength="32" name="prefname" value="%%pref_name%%"> <B>Enabled:</B><INPUT type="checkbox" name="enabled" value="1"%%pref_enabled%%> <B>Required:!
</B><INPUT type="checkbox" name="required" value="1"%%pref_required%%></TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Title:</B></TD>\r\n <TD><INPUT type="text" size="50" maxlength="50" name="title" value="%%pref_title%%"></TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Description:</B>\r\n <BR>The description may contain any HTML or normal block reference.</TD>\r\n <TD><TEXTAREA rows="%%rows%%" cols="%%cols%%" name="description">%%pref_desc%%</TEXTAREA></TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Default Value:</B></TD>\r\n <TD><INPUT type="text" size="30" name="default_value" value="%%pref_default%%"></TD>\r\n </TR>\r\n <TR>\r\n <TD colspan="2"> </TD>\r\n </TR>\r\n <TR>\r\n <TD colspan="2"><B>Preference Display Settings</B></TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Preferences page:</B></TD>\r\n <TD><INPUT type="text" size="20" maxlength="50" name="page" value="%%pref_page%%"></TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Order on page:</B></TD>\r\n <TD><INPUT typ!
e="text" size="5" maxlength="5" name="display_order" value="%%pref_ord
er%%"></TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Control to display:</B>\r\n <BR>Special key <I>value</I> is the current value of the preference</TD>\r\n <TD><INPUT type="text" size="50" name="field" value="%%pref_field%%"></TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Template:</B></TD>\r\n <TD>%%pref_template%%</TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Visible on public user info page?</B></TD>\r\n <TD><INPUT type="checkbox" name="visible" value="1"%%pref_visible%%></TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Formatting to apply to value</B></TD>\r\n <TD><INPUT type="text" name="display_fmt" value="%%pref_fmt%%" size="50"></TD>\r\n </TR>\r\n <TR>\r\n <TD colspan="2"> </TD>\r\n </TR>\r\n <TR>\r\n <TD colspan="2"><B>Requires</B></TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Site Control:</B></TD>\r\n <TD>%%pref_var%%</TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Perm to view:</B></TD>\r\n <TD>%%pref_perm_view%%</TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Perm to edit!
:</B></TD>\r\n <TD>%%pref_perm_edit%%</TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Trusted User status:</B></TD>\r\n <TD><INPUT type="checkbox" name="req_tu" value="1"%%pref_tu%%></TD>\r\n </TR>\r\n <TR>\r\n <TD colspan="2"> </TD>\r\n </TR>\r\n <TR>\r\n <TD colspan="2"><B>Validation</B> (blank to allow anything)</TD>\r\n </TR>\r\n <TR>\r\n <TD><B>HTML allowed?</B></TD>\r\n <TD><INPUT type="checkbox" name="html" value="1"%%pref_html%%></TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Field length:</B></TD>\r\n <TD><INPUT type="text" size="5" maxlength="5" name="length" value="%%pref_length%%"></TD>\r\n </TR>\r\n <TR>\r\n <TD><B>Regular expression:</B>\r\n <BR>Perl regexp - but you must escape pipes</TD>\r\n <TD><INPUT type="text" size="50" name="regex" value="%%pref_regex%%"></TD>\r\n </TR>\r\n</TABLE>\r\n\r\n<INPUT type="submit" name="save" value="Save">\r\n<INPUT type="submit" name="get" value="Get">\r\n</FORM>\r\n','1','','Admin Pages','defau!
lt','en');
INSERT INTO blocks (bid, block, aid, description, category, theme, language) VALUES ('userpref_reset', '<INPUT type="submit" name="reset" value="Reset Preferences">', '1', '<P>This block contains the reset button for the userpref pages. The button must be named "reset" but you can otherwise change how it looks.</p>', 'Accounts', 'default', 'en');
INSERT INTO blocks (bid, block, aid, description, category, theme, language) VALUES ('userpref_oldpass_field', 'You must enter your account password to change protected settings.\r\n<BR><B>Password:</B><INPUT TYPE="password" SIZE="30" NAME="verify_me"></P>\r\n', '1', '<P>This block is the description and form element in which the user enters his old password to change protected settings. On the user\'s first login, the block <B>userpref_oldpass_hidden</B> is used instead.</P>', 'Accounts', 'default', 'en');
INSERT INTO blocks (bid, block, aid, description, category, theme, language) VALUES ('userpref_oldpass_hidden', '<INPUT TYPE="hidden" NAME="verify_me" value="%%pass%%">', '1', '<P>This block is the hidden form element containing the user\'s old password. It is only used on the user\'s first login; the block <B>userpref_oldpass_field</B> is used the rest of the time.</P>', 'Accounts', 'default', 'en');
INSERT INTO blocks (bid, block, aid, description, category, theme, language) VALUES ('required_pref_marker', '<FONT color="#ff0000">*</FONT>', '1', '', 'Accounts', 'default', 'en');
-- new boxes
INSERT INTO box (boxid, title, content, description, template) VALUES ('userpref_menu', '', 'my $edit = 0;\r\nmy $return = \'\';\r\nmy $nick = $S->param->{nick};\r\nmy $tool = $S->param->{tool} || \'info\';\r\nmy $admin_edit = \'\';\r\n\r\n# first, do we have permission to edit \r\n# this user\'s prefs?\r\n\r\nif ( $S->{UID} == $S->param->{uid} || $S->have_perm(\'edit_user\') ) {\r\n $edit = 1;\r\n}\r\n\r\n$admin_edit = qq{[<A href="%%rootdir%%/user/$nick/prefs">edit user</A>]} if ($S->have_perm(\'edit_user\'));\r\n\r\n# links to create\r\nmy $links = "<P>$admin_edit ${nick}\'s ";\r\n\r\n# user info pages\r\nif ( $tool eq \'info\' ) {\r\n $links .= qq{\r\n <A href="%%rootdir%%/user/$nick">Info</A>};\r\n $links .= qq{\r\n <A href="%%rootdir%%/user/$nick/comments">Comments</A>};\r\n $links .= qq{\r\n <A href="%%rootdir%%/user/$nick/stories">Stories</A>};\r\n\r\n if ( $S->{UI}->{VARS}->{use_diaries} ) {\r\n $links .= qq{\r\n <A href="%%rootdir%%/user/$ni!
ck/diary">Diary</A>};\r\n }\r\n\r\n if ( $S->{UI}->{VARS}->{use_ratings} ) {\r\n $links .= qq{\r\n <A href="%%rootdir%%/user/$nick/ratings">Ratings</A>};\r\n }\r\n\r\n if ( $S->{UI}->{VARS}->{allow_uploads} ) {\r\n $links .= qq{\r\n <A href="%%rootdir%%/user/$nick/files">Files</A>};\r\n }\r\n\r\n if ( $S->{UI}->{VARS}->{use_ads} ) {\r\n $links .= qq{\r\n <A href="%%rootdir%%/user/$nick/ads">Ads</A>};\r\n }\r\n\r\n $return = $links . "</P>";\r\n} elsif ( $edit && $tool eq \'prefs\' ) {\r\n my %editlinks;\r\n my ($rv, $sth) = $S->db_select({\r\n WHAT => \'page\',\r\n FROM => \'pref_items\',\r\n GROUP_BY => \'page\'\r\n });\r\n while (my ($item) = $sth->fetchrow_array()) {\r\n $editlinks{"$item"} = "%%rootdir%%/user/$nick/prefs/$item";\r\n }\r\n $links .= qq{\r\n <A href="%%rootdir%%/user/$nick/prefs/Protected">Protected</A>};\r\n\r\n foreach my $item (sort {$b cmp $a} keys %editlinks) {\r\n !
$links .= qq{\r\n <A href="$editlinks{$item}">$item</A>};\r\n }\r
\n $return = $links . "</P>";\r\n}\r\n\r\nreturn $return;\r\n', 'navigation for user pref pages', 'empty_box');
INSERT INTO box (boxid, title, content, description, template) VALUES ('pref_selectbox', '', 'my $prefname = shift @ARGS;\r\nmy $choice = shift @ARGS;\r\nmy @choices = @ARGS;\r\n\r\nmy $select = qq{\r\n <SELECT name="$prefname" size="1">};\r\n\r\nforeach my $c (@choices) {\r\n my $checked = ($c eq $choice) ? \' SELECTED\' : \'\';\r\n $select .= qq{\r\n <OPTION value="$c"$checked>$c</OPTION>};\r\n}\r\n\r\n$select .= qq{\r\n </SELECT>};\r\n\r\nreturn $select;', 'Generic select box for user preferences. takes parameters name,value,option1,option2,...\r\nNot suitable for select boxes with code-generated option lists.', 'empty_box');
INSERT INTO box (boxid, title, content, description, template) VALUES ('pref_checkbox', '', 'my $prefname = $ARGS[0];\r\nmy $choice = $ARGS[1];\r\n\r\nmy $selected = ($choice eq \'on\') ? \' CHECKED\' : \'\';\r\n\r\nreturn qq{<INPUT type="checkbox" name="$prefname" value="on"$selected>};', 'a generic checkbox. Takes two arguments, the pref name and the current pref value.', 'empty_box');
INSERT INTO box (boxid, title, content, description, template) VALUES ('time_zone_pref', '', 'my %zones = $S->_timezone_hash();\r\nmy $S_zone = $ARGS[0];\r\n\r\nmy $select = qq{\r\n <SELECT name="time_zone" size="1">};\r\n\r\nforeach my $zone (sort keys %zones) {\r\n my $z = uc($zone);\r\n my $selected = \'\';\r\n if ($z eq $S_zone) {\r\n $selected = \' SELECTED\';\r\n }\r\n $select .= qq{\r\n <OPTION value="$z"$selected>[$z] $zones{$zone}</OPTION>};\r\n}\r\n\r\n$select .= "\r\n </SELECT>";\r\n\r\nreturn $select;', 'timezone selectbox', 'empty_box');
INSERT INTO box (boxid, title, content, description, template) VALUES ('startpage_pref', '', 'my $choice = $ARGS[0];\r\n\r\nmy @choices = sort keys %{ $S->{SECTION_DATA} };\r\nunshift(@choices, \'__main__\', \'__all__\');\r\n\r\nmy $select = qq{\r\n <SELECT name="start_page" size="1"};\r\n\r\nforeach my $c (@choices) {\r\n my $name;\r\n if ( $c eq \'__main__\' ) {\r\n $name = \'Front Page\';\r\n } elsif ( $c eq \'__all__\' ) {\r\n $name = \'Everything\';\r\n } else {\r\n $name = $S->{SECTION_DATA}->{$c}->{title};\r\n }\r\n my $checked = ($c eq $choice) ? \' SELECTED\' : \'\';\r\n $select .= qq{\r\n <OPTION value="$c"$checked>$name</OPTION>};\r\n}\r\n\r\n$select .= qq{\r\n </SELECT>};\r\nreturn $select;', '', 'empty_box');
INSERT INTO box (boxid, title, content, description, template) VALUES ('img_server_pref','','my $current = $ARGS[0];\r\n\r\nreturn unless $S->var(\'image_mirrors\');\r\nmy @mirrors = split /\\n/, $S->var(\'image_mirrors\');\r\nmy $default_imgdir = $S->{PREF_ITEMS}->{imagedir}->{default_value};\r\n\r\nmy (%servers, $name, $url);\r\n\r\nforeach my $server (@mirrors) {\r\n ($name, $url) = split /,/, $server;\r\n $url =~ s/\\r//;\r\n $servers{$name} = $url;\r\n}\r\n\r\nmy $selected = ( $current eq $default_imgdir ) ? \' SELECTED\' : \'\';\r\n\r\nmy $select = qq{\r\n <SELECT name=\"imagedir\" size=\"1\">\r\n <OPTION value=\"$default_imgdir\"$selected>Default</OPTION>};\r\n\r\nforeach my $server (sort keys %servers) {\r\n $selected = ( $current eq $servers{$server} ) ? \' SELECTED\' : \'\';\r\n $select .= qq{\r\n <OPTION value=\"$servers{$server}\"$selected>$server</A>};\r\n}\r\n\r\n$select .= qq{\r\n </SELECT>};\r\n\r\nreturn $select;','','empty_box');
INSERT INTO box (boxid, title, content, description, template) VALUES ('user_theme_pref', '', 'my $choice = $ARGS[0];\r\nmy $themes = $S->{UI}->{VARS}->{user_themes};\r\nmy @themes = split ( /,\\s*/, $themes );\r\n\r\nmy $select = qq{\r\n <SELECT name="theme">};\r\n\r\nunless ( $S->{PREF_ITEMS}->{theme}->{default_value} ) {\r\n my $checked = ($choice eq \'\') ? \' SELECTED\' : \'\';\r\n $select .= qq{\r\n <OPTION value=""$checked>none</OPTION>};\r\n}\r\n\r\nforeach my $t (@themes) {\r\n my $checked = ($t eq $choice) ? \' SELECTED\' : \'\';\r\n $select .= qq{\r\n <OPTION value="$t"$checked>$t</OPTION>};\r\n}\r\n\r\n$select .= qq{\r\n </SELECT>};\r\n\r\nreturn $select;', '', 'empty_box');
INSERT INTO box (boxid, title, content, description, template) VALUES ('box_pref', '', 'my @choice = @ARGS;\r\n\r\nmy %boxes = %{$S->{BOX_DATA}};\r\nmy $current_prefs;\r\nmy $return = \'\';\r\n\r\n# convert the comma-separated list into a hash\r\nforeach my $i (@choice) {\r\n $current_prefs->{$i} = 1;\r\n}\r\n\r\nmy $col = 0;\r\n\r\nforeach my $c (keys %boxes) {\r\n next unless $boxes{$c}->{user_choose};\r\n $return .= qq{\r\n <TR>} unless $col;\r\n my $checked = $current_prefs->{$c} ? " CHECKED" : "";\r\n $return .= qq{\r\n <TD><input type="checkbox" name="displayed_boxes" value="$c"$checked /></TD>\r\n <TD>$boxes{$c}->{title}</TD>};\r\n $return .= qq{\r\n </TR>} if $col;\r\n $col = ($col) ? "0" : "1";\r\n}\r\n\r\n$return .= "<TD></TD><TD></TD></TR>" if $col;\r\n\r\n$return = qq{\r\n<TABLE border="0">\r\n$return\r\n</TABLE>};\r\n\r\nreturn $return;', '', 'empty_box');
INSERT INTO box (boxid, title, content, description, template) VALUES ('rdf_pref', '', 'my @choice = @ARGS;\r\n\r\nmy $channels = $S->rdf_channels();\r\nmy $current_prefs;\r\nmy $return = \'\';\r\n\r\n# convert the comma-separated list into a hash\r\nforeach my $i (@choice) {\r\n $current_prefs->{$i} = 1;\r\n}\r\n\r\nmy $col = 0;\r\n\r\nforeach my $c (@{$channels}) {\r\n $return .= qq{\r\n <TR>} unless $col;\r\n next unless $c->{enabled} && $c->{title} && !$c->{submitted};\r\n my $checked = $current_prefs->{$c->{rid}} ? " CHECKED" : "";\r\n $return .= qq{\r\n <TD><input type="checkbox" name="rdf_feeds" value="$c->{rid}"$checked /></TD>\r\n <TD><a href="%%rootdir%%/special/rdf_preview/?rdf=$c->{rid}">$c->{title}</a></TD>};\r\n $return .= qq{\r\n </TR>} if $col;\r\n $col = ($col) ? "0" : "1";\r\n}\r\n\r\n$return .= "<TD></TD><TD></TD></TR>" if $col;\r\n\r\n$return = qq{\r\n<TABLE border="0">\r\n$return\r\n</TABLE>};\r\n\r\nreturn $return;', '', 'empty_bo!
x');
INSERT INTO box (boxid, title, content, description, template) VALUES ('rating_order_pref', '', 'my $choice = $ARGS[0];\r\n\r\nmy %choices = ( "unrate_highest", "Unrated, then Highest", "highest", "Highest rated first", "lowest", "Lowest rated first", "dontcare", "Ignore ratings" );\r\n\r\nmy $select = qq{\r\n <SELECT name="commentrating" size="1">};\r\n\r\nforeach my $c (keys %choices) {\r\n my $checked = ($c eq $choice) ? \' SELECTED\' : \'\';\r\n $select .= qq{\r\n <OPTION value="$c"$checked>$choices{$c}</OPTION>};\r\n}\r\n\r\n$select .= qq{\r\n </SELECT>};\r\n\r\nreturn $select;', '', 'empty_box');
INSERT INTO box (boxid, title, content, description, template) VALUES ('postmode_pref', '', 'my $choice = $ARGS[0];\r\n\r\nmy %choices = ( "text", "Plain Text", "html", "HTML Formatted", "auto", "Autoformat" );\r\n\r\nmy $select = qq{\r\n <SELECT name="posttype" size="1">};\r\n\r\nforeach my $c (keys %choices) {\r\n my $checked = ($c eq $choice) ? \' SELECTED\' : \'\';\r\n $select .= qq{\r\n <OPTION value="$c"$checked>$choices{$c}</OPTION>};\r\n}\r\n\r\n$select .= qq{\r\n </SELECT>};\r\n\r\nreturn $select;', '', 'empty_box');
INSERT INTO box (boxid, title, content, description, template) VALUES ('show_hidden_pref', '', 'my $current = $ARGS[0];\r\n\r\nmy $choices = {\r\n \'yes\' => \'Yes\',\r\n \'no\' => \'No\',\r\n \'untilrating\' => "Show until I\'ve rated"\r\n};\r\n\r\nmy $select = qq{\r\n <SELECT name="hidingchoice" size="1">};\r\n\r\nforeach my $choice (keys %{$choices}) {\r\n my $selected = $choice eq $current ? \' SELECTED\' : \'\';\r\n $select .= qq{\r\n <OPTION value="$choice"$selected>$choices->{$choice}</OPTION>};\r\n}\r\n\r\n$select .= qq{\r\n </SELECT>};\r\n\r\nreturn $select;', '', 'empty_box');
INSERT INTO box (boxid, title, content, description, template) VALUES ('user_group_box','','my ($curr_id) = $ARGS[0];\r\n\r\nmy ($rv, $sth) = $S->db_select({\r\n WHAT => \'perm_group_id\',\r\n FROM => \'perm_groups\',\r\n DEBUG => 0});\r\n\r\nmy $selector = qq{\r\n<SELECT NAME="perm_group_id" SIZE=1>};\r\n\r\nmy $selected = \'\';\r\n\r\nwhile (my $group = $sth->fetchrow()) {\r\n $selected = \'\';\r\n $selected = " SELECTED" if ($group eq $curr_id);\r\n $selector .= qq{\r\n <OPTION VALUE="$group"$selected>$group};\r\n}\r\n\r\n$selector .= "</SELECT>";\r\n\r\nreturn $selector;\r\n','','empty_box');
INSERT INTO box (boxid, title, content, description, template) VALUES ('subscriber','','return unless ($S->{UID} == $S->param->{uid});\r\nreturn unless ($S->have_perm(\'allow_subscription\'));\r\nreturn unless ($S->{UI}->{VARS}->{use_subscriptions});\r\n\r\nmy $user = $S->user_data($S->{UID});\r\n\r\nwarn "(subscriber) active subscription? $user->{sub}->{active}";\r\n\r\nif ( $user->{sub}->{active} ) {\r\n my $expires = $user->{sub}->{expires};\r\n my $now = time;\r\n my $remaining_days = (int((($expires - $now) / 86400)) + 1);\r\n return qq{Thank you for subscribing. Your subscription expires in $remaining_days days};\r\n} else {\r\n return qq{\r\n<P>You are not currently a subscriber. Why not <A href="%%rootdir%%/subscribe">become one</A>?};\r\n}','','empty_box');
INSERT INTO box (boxid, title, content, description, template) VALUES ('commentmode_overflow_pref', '', 'my $choice = $ARGS[0];\r\n\r\nmy %choices = ( "minimal", "Minimal", "threaded", "Threaded", "nested", "Nested", "flat", "Flat", "flat_unthread", "Flat (unthread)" );\r\n\r\nif ( $S->var(\'allow_dynamic_comment_mode\') && $S->pref(\'dynamic_interface\') eq \'on\' ) {\r\n $choices{\'dminimal\'} = "Dynamic Minimal";\r\n $choices{\'dthreaded\'} = "Dynamic Threaded";\r\n} else {\r\n $choice =~ s/^d//;\r\n}\r\n\r\nmy $select = qq{\r\n <SELECT name="commentmode_overflow" size="1">};\r\n\r\nforeach my $c (sort keys %choices) {\r\n my $checked = ($c eq $choice) ? \' SELECTED\' : \'\';\r\n $select .= qq{\r\n <OPTION value="$c"$checked>$choices{$c}</OPTION>};\r\n}\r\n\r\n$select .= qq{\r\n </SELECT>};\r\n\r\nreturn $select;', '', 'empty_box');
INSERT INTO box (boxid, title, content, description, template) VALUES ('commentmode_pref', '', 'my $choice = $ARGS[0];\r\n\r\nmy %choices = ( "use_overflow", "Always use overflow mode", "minimal", "Minimal", "threaded", "Threaded", "nested", "Nested", "flat", "Flat", "flat_unthread", "Flat (unthreaded)" );\r\n\r\nif ( $S->var(\'allow_dynamic_comment_mode\') && $S->pref(\'dynamic_interface\') eq \'on\' ) {\r\n $choices{\'dminimal\'} = "Dynamic Minimal";\r\n $choices{\'dthreaded\'} = "Dynamic Threaded";\r\n} else {\r\n $choice =~ s/^d//;\r\n}\r\n\r\nmy $select = qq{\r\n <SELECT name="commentmode" size="1">};\r\n\r\nforeach my $c (sort keys %choices) {\r\n my $checked = ($c eq $choice) ? \' SELECTED\' : \'\';\r\n $select .= qq{\r\n <OPTION value="$c"$checked>$choices{$c}</OPTION>};\r\n}\r\n\r\n$select .= qq{\r\n </SELECT>};\r\n\r\nreturn $select;', '', 'empty_box');
INSERT INTO box (boxid, title, content, description, template) VALUES ('cookie_expire_pref', '', 'my $choice = $ARGS[0];\r\n\r\nmy %choices = ( "3600", "1 hour", "86400", "1 day", "604800", "1 week", "1209600", "2 weeks", "2592000", "1 month (30 days)", "5184000", "2 months" );\r\n\r\nmy $select = qq{\r\n <SELECT name="cookie_expire" size="1">};\r\n\r\nforeach my $c (sort {$a <=> $b} keys %choices) {\r\n my $checked = ($c eq $choice) ? \' SELECTED\' : \'\';\r\n $select .= qq{\r\n <OPTION value="$c"$checked>$choices{$c}</OPTION>};\r\n}\r\n\r\n$select .= qq{\r\n </SELECT>};\r\n\r\nreturn $select;', '', 'empty_box');
-- new vars
INSERT INTO vars (name, value, description, type, category) VALUES ('use_alt_image_dir', '1', '<P>This variable determines whether or not Scoop will use the alternate image servers listed in the variable <B>image_mirrors</B>. Turning this on when there are no alternate image servers listed will have no effect.</p>', 'bool', 'General');
INSERT INTO vars (name, value, description, type, category) VALUES ('use_ratings', '1', '<P>This variable turns the entire rating system on and off. FIXME: not implemented yet.</P>', 'bool', 'Comments');
INSERT INTO vars (name, value, description, type, category) VALUES ('image_mirrors','Australia,http://au.example.com/images\r\nEurope,http://www.bigmirrorsite.fi/scoopsite/images','<P>This variable defines the names and URLs of any alternate image servers you may have, so the users can choose an image server closer to them if necessary. This variable has no effect unless the variable <B>use_alt_image_dir</B> is set to 1.</P>\r\n\r\n<P>The format for this variable is one image mirror per line; each line consists of a descriptive name, a comma, and the URL of the mirrored image directory, without a trailing slash. The default value is invalid.</P>\r\n\r\n<P>The default value for the image directory is set in the User Preferences Admin Tool, in the \'imagedir\' preference.</P>','tarea','General');
INSERT INTO vars (name, value, description, type, category) VALUES ('first_login_page_order', 'Protected, User Info', '<P>This variable determines which prefs page(s) the user sees first when first logging in, if the variable <B>show_prefs_on_first_login</b> is set. The possible values are any list of valid prefs page names, separated by commas. The default value is \'Protected, User Info\'. This value is strongly recommended as it encourages the user to change his password immediately.</p>', 'text', 'General');
-- get rid of interface op since we don't need it anymore
DELETE FROM ops WHERE op='interface';
-- get rid of default_uid var, since defaults for all prefs can be set in the new tool
DELETE FROM vars WHERE name='default_uid';
-- get rid of font face/size blocks
DELETE FROM blocks WHERE bid='norm_font_face';
DELETE FROM blocks WHERE bid='norm_font_size';
-- add perms ad_opt_out, edit_prefs
UPDATE vars SET value = CONCAT(value,',\nad_opt_out,\nedit_prefs') WHERE name='perms';
UPDATE perm_groups SET group_perms = CONCAT(group_perms,',ad_opt_out,edit_prefs') WHERE perm_group_id IN ('Superuser','Admins','Editors');
-- add hook pref_change
UPDATE vars SET value = CONCAT(value,'\npref_change(uid,pref,newvalue)') WHERE name='hooks';
-- change description of var time_zone
UPDATE vars SET description='<P>This variable tells Scoop which time zone the server\'s clock is set to. The possible values are any valid time zone string. The default value is EST.<BR>\nIf this variable is set incorrectly, all display times will be wrong, leading to much confusion.</p>' WHERE name='time_zone';
-- change description of the block norm_font
UPDATE blocks SET description='<P>This block is used extensively in the default install. It should be a complete opening tag, or blank. It must match the closing tag set in the block <B>norm_font_end</b>. The following special keys are recognised:</p>\n<DL>\n <DT>norm_font_face</DT>\n <DD>The font face specification set in a user\'s prefs or, if not set, the default value for that preference as set in the User Preferences Admin Tool.</DD>\n <DT>norm_font_size</DT>\n <DD>The font size specification set in a user\'s prefs or, if not set, the default value for that preference as set in the User Preferences Admin Tool.</DD>\n</DL>' WHERE bid='norm_font';