Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Undo a large commit earlier today, at 2002/07/17 16:04:57 GMT (as wel…

…l as

a few other changes committed today), while keeping the other changes made
today.  Tag before *this* commit is "rb20020717a" (rb for "rollback"),
tag after this commit will be "rb20020717b".
  • Loading branch information...
commit b92be6222eb675856dd377488bb809cf201e11e5 1 parent a2ed0df
@jamiemccarthy jamiemccarthy authored
Showing with 237 additions and 350 deletions.
  1. +7 −13 Slash/DB/MySQL/MySQL.pm
  2. +2 −1  Slash/Slash.pm
  3. +2 −2 Slash/Utility/Access/Access.pm
  4. +2 −4 Slash/Utility/Anchor/Anchor.pm
  5. +75 −50 plugins/Admin/admin.pl
  6. +0 −7 plugins/Admin/templates/blockEdit;admin;default
  7. +7 −14 plugins/Admin/templates/editStory;admin;default
  8. +9 −6 plugins/Admin/templates/listStories;admin;default
  9. +1 −1  plugins/Page/page.pl
  10. +1 −7 plugins/Search/Search.pm
  11. +0 −1  plugins/Search/dump
  12. +13 −33 plugins/Stats/Stats.pm
  13. +59 −68 plugins/Stats/adminmail.pl
  14. +1 −3 plugins/Stats/mysql_schema
  15. +2 −5 plugins/Stats/templates/display;adminmail;default
  16. +4 −4 plugins/Submit/submit.pl
  17. +2 −10 sbin/portald
  18. +1 −9 sql/mysql/defaults.sql
  19. +4 −3 sql/mysql/slashschema_create.sql
  20. +1 −33 sql/mysql/upgrades
  21. +12 −20 themes/slashcode/htdocs/comments.pl
  22. +20 −9 themes/slashcode/htdocs/index.pl
  23. +7 −18 themes/slashcode/htdocs/users.pl
  24. +3 −21 themes/slashcode/tasks/new_headfoot.pl
  25. +0 −1  themes/slashcode/tasks/rss_submit.pl
  26. +1 −1  themes/slashcode/templates/data;comments;default
  27. +0 −3  themes/slashcode/templates/edit_comment;comments;default
  28. +0 −2  themes/slashcode/templates/getUserAdmin;users;default
  29. +1 −1  themes/slashcode/templates/newdiscussion;comments;default
View
20 Slash/DB/MySQL/MySQL.pm
@@ -2409,23 +2409,17 @@ sub updateFormkeyVal {
# use this in case the function you call fails prior to updateFormkey
# but after updateFormkeyVal
sub resetFormkey {
- my($self, $formkey, $formname) = @_;
+ my($self, $formkey) = @_;
my $constants = getCurrentStatic();
# reset the formkey to 0, and reset the ts
-
- my $update_ref = {
- -value => 0,
- -idcount => '(idcount -1)',
- ts => time(),
- submit_ts => '0',
- };
- $update_ref->{formname} = $formname if $formname;
-
- my $updated = $self->sqlUpdate("formkeys",
- $update_ref,
- "formkey=" . $self->sqlQuote($formkey));
+ my $updated = $self->sqlUpdate("formkeys", {
+ -value => 0,
+ -idcount => '(idcount -1)',
+ ts => time(),
+ submit_ts => '0',
+ }, "formkey=" . $self->sqlQuote($formkey));
print STDERR "RESET formkey $updated\n" if $constants->{DEBUG};
return($updated);
View
3  Slash/Slash.pm
@@ -932,7 +932,8 @@ hashref of author data, and hashref of topic data.
=cut
sub displayStory {
- my($sid, $full, $other) = @_;
+ # caller is the pagename of the calling script
+ my($sid, $full, $other) = @_; # , $caller no longer needed? -- pudge
my $slashdb = getCurrentDB();
my $story = $slashdb->getStory($sid);
View
4 Slash/Utility/Access/Access.pm
@@ -288,12 +288,12 @@ sub formkeyHandler {
$slashdb->updateFormkeyId($formname, $formkey, $user->{uid}, $form->{rlogin}, $form->{upasswd});
} elsif ($formkey_op eq 'valid_check') {
my $valid = $slashdb->validFormkey($formname, $options);
-print STDERR "formkeyHandler valid_check formname $formname valid '$valid'\n";
+#print STDERR "formkeyHandler valid_check valid '$valid'\n";
if ($valid eq 'ok') {
# All is well.
} else {
$msg = formkeyError($valid, $formname);
-print STDERR "formkeyHandler valid_check valid '$valid' formname '$formname' msg '$msg'\n";
+#print STDERR "formkeyHandler valid_check valid '$valid' formname '$formname' msg '$msg'\n";
if ($valid eq 'invalidhcretry'
|| $valid eq 'invalidhc') {
# It's OK, the user can retry.
View
6 Slash/Utility/Anchor/Anchor.pm
@@ -158,12 +158,10 @@ sub header {
# $adhtml = getAd(1);
# }
- # pass section - otherwise, static pages will get 'index' as the section
- # PMG 7/12/02
if ($options->{admin} && $user->{is_admin}) {
- slashDisplay('header-admin', { title => $title, section => $section});
+ slashDisplay('header-admin', $title);
} else {
- slashDisplay('header', { title => $title, section => $section} );
+ slashDisplay('header', $title);
}
if ($constants->{admin_check_clearpass}
View
125 plugins/Admin/admin.pl
@@ -25,10 +25,6 @@ sub main {
my($tbtitle);
my $ops = {
- slashd => {
- function => \&displaySlashd,
- seclev => 500,
- },
edit_keyword => {
function => \&editKeyword,
seclev => 10000,
@@ -51,7 +47,7 @@ sub main {
},
'delete' => {
function => \&listStories,
- seclev => 100,
+ seclev => 10000,
},
preview => {
function => \&editStory,
@@ -67,7 +63,7 @@ sub main {
function => \&blockEdit,
- seclev => 100,
+ seclev => 500,
},
colors => { # colored,colorpreview,colorsave,colorrevert,
# colororig,colorsavedef,
@@ -107,6 +103,14 @@ sub main {
function => \&varEdit,
seclev => 10000,
},
+ slashd => {
+ function => \&displaySlashd,
+ seclev => 500,
+ },
+ recent => {
+ function => \&displayRecent,
+ seclev => 500,
+ },
};
# admin.pl is not for regular users
@@ -427,8 +431,6 @@ sub templateDelete {
sub blockEdit {
my($form, $slashdb, $user, $constants) = @_;
- my $section = $user->{section} || $form->{section};
-
my($bid);
if ($form->{blocksave} || $form->{blocksavedef}) {
@@ -478,7 +480,7 @@ sub blockEdit {
my($static_blocks, $portal_blocks);
if ($user->{section}) {
$static_blocks = $slashdb->getDescriptions('static_block_section', { seclev => $user->{seclev}, section => $user->{section} }, 1);
- $portal_blocks = $slashdb->getDescriptions('portald_block_section', { seclev => $user->{seclev}, section => $user->{section} }, 1);
+ $static_blocks = $slashdb->getDescriptions('portald_block_section', { seclev => $user->{seclev}, section => $user->{section} }, 1);
} else {
$static_blocks = $slashdb->getDescriptions('static_block', $user->{seclev}, 1);
$portal_blocks = $slashdb->getDescriptions('portald_block', $user->{seclev}, 1);
@@ -710,7 +712,7 @@ sub topicEdit {
$form->{nexttid} ? $form->{nexttid} : $constants->{defaulttopic}, 1);
my $sections = {};
if ($user->{section} && $user->{seclev} <= 9000) {
- $sections->{$user->{section}} = $slashdb->getSection($user->{section},'title','',1);
+ $sections->{$user->{section}} = $slashdb->getSection($user->{section},'title');
} else {
$sections = $slashdb->getDescriptions('sections-contained', '', 1);
}
@@ -734,7 +736,7 @@ sub topicEdit {
if (!$form->{topicdelete}) {
if (!$form->{topicnew} && $form->{nexttid}) {
- $topic = $slashdb->getTopic($form->{nexttid});
+ $topic = $slashdb->getTopic($form->{nexttid}, 0, 1);
} else {
$topic = {};
}
@@ -1026,11 +1028,10 @@ sub editStory {
my $extracolref = {};
my($fixquotes_check, $autonode_check,
$fastforward_check, $shortcuts_check) =
- ('','','','');
+ ('','','','');
my($multi_topics, $story_topics);
my $page = 'index';
- # my $section = $user->{section} ? $user->{section} : '';
- my $section = $constants->{section} || $storyref->{section};
+ my $section = $user->{section} ? $user->{section} : '';
for (keys %{$form}) { $storyref->{$_} = $form->{$_} }
@@ -1130,15 +1131,7 @@ sub editStory {
$story_topics->{$storyref->{tid}} ||= 1 ;
}
- if ($constants->{use_alt_topic}) {
- $topic_select = createSelect('tid',$slashdb->getDescriptions('topics_section_type', $section, $constants->{use_alt_topic}),$storyref->{tid},1);
- } else {
- if ($section) {
- $topic_select = createSelect('tid', $slashdb->getDescriptions('topics_section', $section),$storyref->{tid}, 1);
- } else {
- $topic_select = createSelect('tid', $slashdb->getDescriptions('topics'),$storyref->{tid}, 1);
- }
- }
+ $topic_select = selectTopic('tid', $storyref->{tid}, $storyref->{section}, 1);
$section_select = selectSection('section', $storyref->{section}, $sections, 1) unless $user->{section};
@@ -1153,11 +1146,10 @@ sub editStory {
$locktest = lockTest($storyref->{title});
- my $display_codes = $user->{section} ? 'displaycodes_sectional' : 'displaycodes';
-
- $description = $slashdb->getDescriptions($display_codes);
- $displaystatus_select = createSelect('displaystatus', $description, $storyref->{displaystatus}, 1);
-
+ unless ($user->{section}) {
+ $description = $slashdb->getDescriptions('displaycodes');
+ $displaystatus_select = createSelect('displaystatus', $description, $storyref->{displaystatus}, 1);
+ }
$description = $slashdb->getDescriptions('commentcodes');
$commentstatus_select = createSelect('commentstatus', $description, $storyref->{commentstatus}, 1);
@@ -1323,7 +1315,8 @@ sub listStories {
}
for (@$storylist) {
- my($hits, $comments, $sid, $title, $aid, $time_plain, $topic, $subsection,$section,
+ my($hits, $comments, $sid, $title, $aid, $time_plain, $topic,
+ $subsection, $section,
$displaystatus, $writestatus) = @$_;
my $time = timeCalc($time_plain, '%H:%M', 0);
my $td = timeCalc($time_plain, '%A %B %d', 0);
@@ -1345,7 +1338,6 @@ sub listStories {
'time' => $time,
canedit => $canedit,
topic => $topic,
- subsection => $subsection,
section => $section,
td => $td,
td2 => $td2,
@@ -1447,7 +1439,12 @@ sub updateStory {
my $tid_ref;
my $default_set = 0;
- my $topic = $form->{tid};
+
+ # Some users can only post to a fixed section
+ if (my $section = getCurrentUser('section')) {
+ $form->{section} = $section;
+ $form->{displaystatus} = 1;
+ }
$form->{dept} =~ s/ /-/g;
@@ -1461,10 +1458,6 @@ sub updateStory {
? $slashdb->getTime()
: $form->{'time'};
- if ($constants->{use_alt_topic} && $constants->{enable_index_topic} && $constants->{organise_stories}) {
- $topic = $form->{$constants->{organise_stories}};
- }
-
if ($constants->{multitopics_enabled}) {
for my $k (keys %$form) {
if ($k =~ /tid_(.*)/) {
@@ -1472,9 +1465,9 @@ sub updateStory {
}
}
for (@{$tid_ref}) {
- $default_set++ if ($_ eq $topic && $topic);
+ $default_set++ if ($_ eq $form->{tid} && $form->{tid});
}
- push @$tid_ref, $topic if !$default_set;
+ push @$tid_ref, $form->{tid} if !$default_set;
$slashdb->setStoryTopics($form->{sid}, $tid_ref);
}
@@ -1488,7 +1481,7 @@ sub updateStory {
sid => $form->{sid},
title => $form->{title},
section => $form->{section},
- tid => $topic,
+ tid => $form->{tid},
dept => $form->{dept},
'time' => $time,
displaystatus => $form->{displaystatus},
@@ -1551,14 +1544,51 @@ sub displaySlashd {
}
##################################################################
+sub displayRecent {
+ my($form, $slashdb, $user, $constants) = @_;
+ my($min, $max) = (undef, undef);
+ $min = $form->{min} if defined($form->{min});
+ $max = $form->{max} if defined($form->{max});
+ my $startat = $form->{startat} || undef;
+
+ my $max_cid = $slashdb->sqlSelect("MAX(cid)", "comments");
+ my $recent_comments = $slashdb->getRecentComments({
+ min => $min,
+ max => $max,
+ startat => $startat,
+ num => 30,
+ }) || [ ];
+
+ my $id_vislen = $constants->{id_md5_vislength};
+ my $subj_vislen = 30;
+ for my $comm (@$recent_comments) {
+ $comm->{ipid_vis} = substr($comm->{ipid}, 0, $id_vislen);
+ $comm->{subject_vis} = substr($comm->{subject}, 0, $subj_vislen);
+ $comm->{date} = substr($comm->{date}, 5); # strip off year
+ }
+
+ slashDisplay('recent', {
+ startat => $startat,
+ max_cid => $max_cid,
+ recent_comments => $recent_comments,
+ min => $min,
+ max => $max,
+ });
+}
+
+##################################################################
sub saveStory {
my($form, $slashdb, $user, $constants) = @_;
my $edituser = $slashdb->getUser($form->{uid});
my $tid_ref;
- my $topic = $form->{tid};
my $default_set = 0;
+ # In the previous form of this, a section only
+ # editor could assign a story to a different user
+ # and bypass their own restrictions for what section
+ # they could post to. -Brian
+ $form->{displaystatus} ||= 1 if ($user->{section} || $edituser->{section});
if ($user->{section} || $edituser->{section}) {
$form->{section} = $user->{section} ? $user->{section} : $edituser->{section};
}
@@ -1575,11 +1605,6 @@ sub saveStory {
? $slashdb->getTime()
: $form->{'time'};
-
- if ($constants->{use_alt_topic} && $constants->{enable_index_topic} && $constants->{organise_stories}) {
- $topic = $form->{$constants->{organise_stories}};
- }
-
# used to just pass $form to createStory, which is not
# a good idea because you end up getting form values
# such as op and apache_request saved into story_param
@@ -1589,7 +1614,7 @@ sub saveStory {
title => $form->{title},
section => $form->{section},
submitter => $form->{submitter},
- tid => $topic,
+ tid => $form->{tid},
dept => $form->{dept},
'time' => $time,
displaystatus => $form->{displaystatus},
@@ -1608,6 +1633,7 @@ sub saveStory {
$data->{$key} = $form->{$key} if $form->{$key};
}
}
+#use Data::Dumper; print STDERR "saveStory createStory extras '@$extras' data " . Dumper($data);
my $sid = $slashdb->createStory($data);
# we can use multiple values in forms now, we don't
@@ -1619,23 +1645,22 @@ sub saveStory {
}
}
for (@{$tid_ref}) {
- $default_set++ if $_ eq $topic;
+ $default_set++ if $_ eq $form->{tid};
}
- push @$tid_ref, $topic if !$default_set;
+ push @$tid_ref, $form->{tid} if !$default_set;
$slashdb->setStoryTopics($sid, $tid_ref);
}
if ($sid) {
-
my $section = $slashdb->getSection($form->{section});
my $rootdir = $section->{rootdir} || $constants->{rootdir};
my $id = $slashdb->createDiscussion( {
title => $form->{title},
section => $form->{section},
- topic => $topic,
- url => "$rootdir/article.pl?sid=$sid&tid=$topic",
+ topic => $form->{tid},
+ url => "$rootdir/article.pl?sid=$sid&tid=$form->{tid}",
sid => $sid,
ts => $form->{'time'}
});
View
7 plugins/Admin/templates/blockEdit;admin;default
@@ -36,7 +36,6 @@ __template__
</UL>
</P>
<TABLE>
-[% IF block_select1 %]
<TR>
<TD><B>Static and Color Blocks</B></TD><TD>
[% block_select1 %]
@@ -44,10 +43,7 @@ __template__
</TD>
<TD><INPUT TYPE="SUBMIT" VALUE="Edit Block" NAME="blocked1"></TD>
<TD><INPUT TYPE="SUBMIT" VALUE="Delete Block" NAME="blockdelete1"></TD>
-
</TR>
-[% END %]
-[% IF block_select2 %]
<TR>
<TD><B>Portald Blocks</B></TD>
<TD>
@@ -56,7 +52,6 @@ __template__
<TD><INPUT TYPE="SUBMIT" VALUE="Edit Block" NAME="blocked2"></TD>
<TD><INPUT TYPE="SUBMIT" VALUE="Delete Block" NAME="blockdelete2"></TD>
</TR>
-[% END %]
</TABLE>
[% END %]
@@ -86,7 +81,6 @@ __template__
<TD><B>Ordernum</B></TD>
<TD COLSPAN="2"><INPUT TYPE="TEXT" SIZE="3" NAME="ordernum" VALUE="[% blockref.ordernum %]"></TD>
</TR>
- [% IF blockref.type == 'portald' %]
<TR>
<TD><B>Portal - check if this is a slashbox.</B></TD>
<TD COLSPAN="2"><INPUT TYPE="CHECKBOX" VALUE="1" NAME="portal" [% portal_checked %]></TD>
@@ -127,7 +121,6 @@ __template__
<TD><B>Max RSS Items</B></TD>
<TD COLSPAN="2"><INPUT TYPE="TEXT" SIZE="5" NAME="items" VALUE="[% blockref.items %]"><BR></TD>
</TR>
- [% END %]
[% IF blockedit_flag %]
<INPUT TYPE="HIDDEN" NAME="save_existing" VALUE="1">
View
21 plugins/Admin/templates/editStory;admin;default
@@ -115,10 +115,7 @@ __template__
<TD BGCOLOR="[% user.bg.3 %]">
<FONT COLOR="[% user.fg.3 %]">
[% PROCESS editbuttons %]
-
- [% IF topic_select %]
[% topic_select %]
- [% END %]
[% UNLESS user.section %]
[% section_select %]
@@ -161,7 +158,6 @@ __template__
<TR>
<TD BGCOLOR="[% user.bg.3 %]"><FONT COLOR="[% user.fg.3 %]">
[% # yeah, I know... %]
- <!-- extra.2 [% extra.2 %] -->
<B>[% extra.0 %]</B> </FONT></TD>
[% IF extra.2 == 'text' %]
<TD BGCOLOR="[% user.bg.2 %]">
@@ -172,11 +168,9 @@ __template__
[% pulldown = "$extra.3:$extra.1" %]
[% Slash.createSelect(extra.1, Slash.db.getDescriptions('genericstring',pulldown), storyref.${extra.1}, 1, 1) %]
[% ELSE %]
- [% pulldown = extra.1 %]
<TD BGCOLOR="[% user.bg.2 %]">
- [% pulldown_section = form.section || user.section || storyref.section %]
- <!-- pulldown [% pulldown %] pulldown section [% pulldown_section %] -->
- [% Slash.createSelect(pulldown, Slash.db.getDescriptions('topics_section_type', pulldown_section, pulldown), storyref.$pulldown, 1, 1) %]
+ [% type = extra.1 %]
+ [% Slash.createSelect(type, Slash.db.getDescriptions('topics_section_type', section, type), storyref.$type, 1, 1) %]
[% END %]
</TD>
</TR>
@@ -187,9 +181,9 @@ __template__
<TD BGCOLOR="[% user.bg.2 %]"><FONT COLOR="[% user.fg.2 %]">
[% locktest %]
- [% # UNLESS user.section %]
+ [% UNLESS user.section %]
[% displaystatus_select %]
- [% # END %]
+ [% END %]
[% commentstatus_select %]
<INPUT TYPE="TEXT" NAME="time" VALUE="[% storyref.time %]" size="16"><BR>
@@ -243,9 +237,8 @@ storyref.bodytext_wordcount %] word[% IF storyref.bodytext_wordcount != 1; "s";
<B>Story Topics:</B>
</FONT></TD>
<TD BGCOLOR="[% user.bg.2 %]">
- [% FOREACH topic = multi_topics.sort %]
- [% name = "tid_$topic" %]
- <INPUT TYPE="checkbox" NAME="[% name %]" VALUE="[% multi_topics.$topic %]" [% IF story_topics.$topic || form.$name %] CHECKED [% END %]>[% multi_topics.$topic %]<BR>
+ [% FOREACH topic = multi_topics.keys %]
+ <INPUT TYPE="checkbox" NAME="tid_[% topic %]" VALUE="[% multi_topics.$topic %]" [% IF story_topics.$topic %] CHECKED [% END %]>[% multi_topics.$topic %]<BR>
[% END %]
</TD>
</TR>
@@ -258,4 +251,4 @@ storyref.bodytext_wordcount %] word[% IF storyref.bodytext_wordcount != 1; "s";
</FORM>
__seclev__
-10000
+500
View
15 plugins/Admin/templates/listStories;admin;default
@@ -23,7 +23,9 @@ __template__
<TD><B>Section</B></TD>
[% END %]
- <TD><B>Subsection</B></TD>
+ [% IF constants.enable_index_topic %]
+ <TD><B>Index topic</B></TD>
+ [% END %]
<TD><B>Hits</B></TD>
<TD><B>Comments</B></TD>
<TD><B>Date</B></TD>
@@ -72,11 +74,10 @@ END %]
<TD>
<FONT SIZE="2">
<A HREF="[% constants.rootdir %]/article.pl?sid=[% story.sid %]">
- [% story.title %]&nbsp;</A>
+ [% story.title %]&nbsp;</A>
</FONT>
</TD>
<TD><FONT SIZE="2"><B>[% story.aid %]</B></FONT></TD>
-
<TD><FONT SIZE="2">[% story.topic.substr(0, 5) %]</FONT></TD>
[% UNLESS user.section || form.section %]
@@ -90,9 +91,11 @@ END %]
[% IF constants.enable_index_topic %]
<TD>
<FONT SIZE="2">
- <!-- subsection [% story.subsection %] -->
- [% IF story.subsection ; subsection_name = Slash.db.getSubSection(story.subsection,'title'); %]
- [% subsection_name %] ([% story.subsection %])
+ [%
+ index_topic = Slash.db.getStory(story.sid,constants.enable_index_topic);
+ index_topic_name = Slash.db.getTopic(index_topic,'alttext');
+ IF index_topic_name ;%]
+ [% index_topic_name %] ([% index_topic %])
[% ELSE ;%]
n/a
[% END;
View
2  plugins/Page/page.pl
@@ -28,7 +28,7 @@ sub main {
my $title = getData('head', { section => $section });
header($title, $section->{section});
- slashDisplay('index', { section => $section->{section}, index => $index});
+ slashDisplay('index', { index => $index});
footer();
View
8 plugins/Search/Search.pm
@@ -296,8 +296,6 @@ sub findStory {
$where .= " AND stories.section = " . $self->sqlQuote($section->{section});
}
}
-
- $where .= " AND sections.isolate != 1 " unless $constants->{sectional_site};
if (ref($form->{_multi}{tid}) eq 'ARRAY') {
$where .= " AND tid IN (" . join(",", @{$form->{_multi}{tid}}) . ") ";
@@ -479,7 +477,7 @@ sub findDiscussion {
my $other;
if ($form->{query} && $sort == 2) {
$other = " ORDER BY score DESC";
- } elsif ($sort == 3) {
+ } elsif ($form->{query} && $sort == 3) {
$other = " ORDER BY last_update DESC";
} else {
$other = " ORDER BY ts DESC";
@@ -494,12 +492,8 @@ sub findDiscussion {
if $form->{type};
$where .= " AND topic=" . $self->sqlQuote($form->{tid})
if $form->{tid};
- $where .= " AND section=" . $self->sqlQuote($form->{section})
- if $form->{section};
$where .= " AND uid=" . $self->sqlQuote($form->{uid})
if $form->{uid};
- $where .= " AND approved = $form->{approved}"
- if $form->{approved};
$other .= " LIMIT $start, $limit" if $limit;
my $stories = $self->sqlSelectAllHashrefArray($columns, $tables, $where, $other );
View
1  plugins/Search/dump
@@ -1,5 +1,4 @@
INSERT INTO vars (name, value, description) VALUES ('search_db_user', '', 'Enter a valid DBIx::Password user if you want search to run on a different DB then the default');
INSERT INTO vars (name, value, description) VALUES ('search_default_display', '30', 'Default number of entries to display on Search page');
INSERT INTO vars (name, value, description) VALUES ('search_journal_enabled', '1', 'Turns on searching journals.');
-INSERT INTO vars (name, value, description) VALUES ('sectional_site','0','is this site a sectional site cotaining all isolated sections?');
INSERT INTO vars (name, value, description) VALUES ('search_rss_enabled', '1', 'Turns on searching rss.');
View
46 plugins/Stats/Stats.pm
@@ -36,14 +36,13 @@ sub new {
########################################################
sub createStatDaily {
- my($self, $day, $name, $value, $section) = @_;
+ my($self, $day, $name, $value) = @_;
$value = 0 unless $value;
$self->sqlInsert('stats_daily', {
'day' => $day,
'name' => $name,
'value' => $value,
- 'section' => $section,
}, { ignore => 1 });
}
@@ -105,22 +104,19 @@ sub getSlaveDBLagCount {
########################################################
sub getCommentsByDistinctIPID {
- my($self, $yesterday, $section) = @_;
+ my($self, $yesterday) = @_;
my $used = $self->sqlSelectColArrayref(
- 'ipid', 'comments,discussions',
- "date BETWEEN '$yesterday 00:00' AND '$yesterday 23:59:59' AND discussions.sid = comments.pid AND discussions.section = '$section'",
+ 'ipid', 'comments',
+ "date BETWEEN '$yesterday 00:00' AND '$yesterday 23:59:59'",
'',
- { distinct => 1 }
+ {distinct => 1}
);
}
########################################################
sub getAdminModsInfo {
- my($self, $yesterday, $weekago, $section) = @_;
- # this takes a section arg, but I don't know how that's
- # going to work - need to do a join to make it work.
- # hold off for now.
+ my($self, $yesterday, $weekago) = @_;
# First get the count of upmods and downmods performed by each admin.
my $m1_uid_val_hr = $self->sqlSelectAllHashref(
@@ -299,29 +295,24 @@ sub getAdminModsInfo {
########################################################
sub countSubmissionsByDay {
- my($self, $yesterday, $section) = @_;
+ my($self, $yesterday) = @_;
- my $where = "time BETWEEN '$yesterday 00:00' AND '$yesterday 23:59:59'";
- $where .= " AND section = '$section'" if $section;
my $used = $self->sqlCount(
'submissions',
- $where
+ "time BETWEEN '$yesterday 00:00' AND '$yesterday 23:59:59'"
);
}
########################################################
sub countSubmissionsByCommentIPID {
- my($self, $yesterday, $ipids, $section) = @_;
+ my($self, $yesterday, $ipids) = @_;
return unless @$ipids;
my $slashdb = getCurrentDB();
my $in_list = join(",", map { $slashdb->sqlQuote($_) } @$ipids);
- my $where = "(time BETWEEN '$yesterday 00:00' AND '$yesterday 23:59:59') AND ipid IN ($in_list)";
- $where .= " AND section = '$section'";
-
my $used = $self->sqlCount(
'submissions',
- $where
+ "(time BETWEEN '$yesterday 00:00' AND '$yesterday 23:59:59') AND ipid IN ($in_list)"
);
}
@@ -342,7 +333,7 @@ sub countModeratorLogHour {
########################################################
sub countCommentsDaily {
- my($self, $yesterday, $section) = @_;
+ my($self, $yesterday) = @_;
# Count comments posted yesterday... using a primary key,
# if it'll save us a table scan. On Slashdot this cuts the
@@ -409,32 +400,21 @@ sub countDailyByPageDistinctIPID {
$where .= "ts BETWEEN '$yesterday 00:00' AND '$yesterday 23:59:59'";
$self->sqlSelect("count(DISTINCT host_addr)", "accesslog", $where);
}
-########################################################
-sub countDailyByOPDistinctUID {
- # This is so lame, and so not ANSI SQL -Brian
- my($self, $op, $yesterday) = @_;
- $self->sqlSelect("count(DISTINCT uid)", "accesslog",
- "op='$op' AND ts BETWEEN '$yesterday 00:00' AND '$yesterday 23:59:59'");
-}
########################################################
sub countDaily {
- my($self, $section) = @_;
+ my($self) = @_;
my %returnable;
my $constants = getCurrentStatic();
- my $where = "TO_DAYS(NOW()) - TO_DAYS(ts) = 1";
- $where .= " AND section = '$section'" if $section;
-
my($min_day_id, $max_day_id) = $self->sqlSelect(
"MIN(id), MAX(id)",
"accesslog",
- $where
+ "TO_DAYS(NOW()) - TO_DAYS(ts)=1"
);
$min_day_id ||= 1; $max_day_id ||= 1;
my $yesterday_clause = "(id BETWEEN $min_day_id AND $max_day_id)";
- $yesterday_clause .= " AND section = '$section'" if $section,
# For counting the total, we used to just do a COUNT(*) with the
# TO_DAYS clause. If we separate out the count of each op, we can
View
127 plugins/Stats/adminmail.pl
@@ -3,7 +3,6 @@
use strict;
use Slash::Constants qw( :messages :slashd );
use Slash::Display;
-use Date::Calc qw( Today Add_Delta_Days);
use vars qw( %task $me );
@@ -72,14 +71,13 @@
my $modlog_rows = $stats->sqlCount('moderatorlog');
my $metamodlog_rows = $stats->sqlCount('metamodlog');
- my $mod_points = $stats->getPoints if $constants->{mod_stats};
-
- my @todaytime = Today();
- my @yesttime = Add_Delta_Days(@todaytime,-1);
- my @weekagotime = Add_Delta_Days(@todaytime,-7);
- my $yesterday = sprintf "%4d-%02d-%02d",@yesttime;
- my $weekago = sprintf "%4d-%02d-%02d", @weekagotime;
-
+ my $mod_points = $stats->getPoints;
+ my @yesttime = localtime(time-86400);
+ my @weekagotime = localtime(time-86400*7);
+ my $yesterday = sprintf "%4d-%02d-%02d",
+ $yesttime[5] + 1900, $yesttime[4] + 1, $yesttime[3];
+ my $weekago = sprintf "%4d-%02d-%02d",
+ $weekagotime[5] + 1900, $weekagotime[4] + 1, $weekagotime[3];
my $used = $stats->countModeratorLog($yesterday);
my $modlog_hr = $stats->countModeratorLogHour($yesterday);
my $distinct_comment_ipids = $stats->getCommentsByDistinctIPID($yesterday);
@@ -96,9 +94,9 @@
$data{"${_}_ipids"} = sprintf("%8d", $uniq);
$data{"${_}_bytes"} = sprintf("%0.1f MB",$bytes/(1024*1024));
$data{"${_}_page"} = sprintf("%8d", $pages);
- $statsSave->createStatDaily($yesterday, "${_}_ipids", $uniq, '');
- $statsSave->createStatDaily($yesterday, "${_}_bytes", $bytes, '');
- $statsSave->createStatDaily($yesterday, "${_}_page", $pages, '');
+ $statsSave->createStatDaily($yesterday, "${_}_ipids", $uniq);
+ $statsSave->createStatDaily($yesterday, "${_}_bytes", $bytes);
+ $statsSave->createStatDaily($yesterday, "${_}_page", $pages);
}
# Not yet
@@ -131,9 +129,9 @@
$temp->{bytes} = sprintf("%8.1f MB",$bytes/(1024*1024));
$temp->{page} = sprintf("%8d", $pages);
$temp->{users} = sprintf("%8d", $users);
- $statsSave->createStatDaily($yesterday, "section_${section}_ipids", $uniq, $section);
- $statsSave->createStatDaily($yesterday, "section_${section}_bytes", $bytes, $section);
- $statsSave->createStatDaily($yesterday, "section_${section}_page", $pages, $section);
+ $statsSave->createStatDaily($yesterday, "section_${section}_ipids", $uniq);
+ $statsSave->createStatDaily($yesterday, "section_${section}_bytes", $bytes);
+ $statsSave->createStatDaily($yesterday, "section_${section}_page", $pages);
for (qw| article search comments palm rss|) {
my $uniq = $stats->countDailyByPageDistinctIPID($_, $yesterday, { section => $section });
@@ -144,10 +142,10 @@
$temp->{$_}{bytes} = sprintf("%8.1f MB",$bytes/(1024*1024));
$temp->{$_}{page} = sprintf("%8d", $pages);
$temp->{$_}{users} = sprintf("%8d", $users);
- $statsSave->createStatDaily($yesterday, "section_${section}_${_}_ipids", $uniq, '');
- $statsSave->createStatDaily($yesterday, "section_${section}_${_}_bytes", $bytes, '');
- $statsSave->createStatDaily($yesterday, "section_${section}_${_}_page", $pages, '');
- $statsSave->createStatDaily($yesterday, "section_${section}_${_}_user", $users, '');
+ $statsSave->createStatDaily($yesterday, "section_${section}_${_}_ipids", $uniq);
+ $statsSave->createStatDaily($yesterday, "section_${section}_${_}_bytes", $bytes);
+ $statsSave->createStatDaily($yesterday, "section_${section}_${_}_page", $pages);
+ $statsSave->createStatDaily($yesterday, "section_${section}_${_}_user", $users);
}
push(@{$data{sections}}, $temp);
}
@@ -155,43 +153,39 @@
my $total_bytes = $stats->countBytesByPage('',$yesterday);
- my $admin_mods;
+ my $admin_mods = $stats->getAdminModsInfo($yesterday, $weekago);
my $admin_mods_text = "";
- if($constants->{mod_stats}) {
- $admin_mods = $stats->getAdminModsInfo($yesterday, $weekago);
- my($num_admin_mods, $num_mods) = (0, 0);
- if ($admin_mods) {
- for my $nickname (sort { lc($a) cmp lc($b) } keys %$admin_mods) {
- $admin_mods_text .= sprintf("%13.13s: %26s %-46s\n",
- $nickname,
- $admin_mods->{$nickname}{m1_text},
- $admin_mods->{$nickname}{m2_text}
- );
- if ($nickname eq '~Day Total') {
- $num_mods += $admin_mods->{$nickname}{m1_up};
- $num_mods += $admin_mods->{$nickname}{m1_down};
- } else {
- $num_admin_mods += $admin_mods->{$nickname}{m1_up};
- $num_admin_mods += $admin_mods->{$nickname}{m1_down};
- }
+ my($num_admin_mods, $num_mods) = (0, 0);
+ if ($admin_mods) {
+ for my $nickname (sort { lc($a) cmp lc($b) } keys %$admin_mods) {
+ $admin_mods_text .= sprintf("%13.13s: %26s %-46s\n",
+ $nickname,
+ $admin_mods->{$nickname}{m1_text},
+ $admin_mods->{$nickname}{m2_text}
+ );
+ if ($nickname eq '~Day Total') {
+ $num_mods += $admin_mods->{$nickname}{m1_up};
+ $num_mods += $admin_mods->{$nickname}{m1_down};
+ } else {
+ $num_admin_mods += $admin_mods->{$nickname}{m1_up};
+ $num_admin_mods += $admin_mods->{$nickname}{m1_down};
}
- $admin_mods_text =~ s/ +$//gm;
- $admin_mods_text .= sprintf("%13.13s: %4d of %4d (%6.2f%%)\n",
- "Admin Mods", $num_admin_mods, $num_mods,
- ($num_mods ? $num_admin_mods*100/$num_mods : 0));
}
+ $admin_mods_text =~ s/ +$//gm;
+ $admin_mods_text .= sprintf("%13.13s: %4d of %4d (%6.2f%%)\n",
+ "Admin Mods", $num_admin_mods, $num_mods,
+ ($num_mods ? $num_admin_mods*100/$num_mods : 0));
}
- $statsSave->createStatDaily($yesterday, "total", $count->{total}, '');
- $statsSave->createStatDaily($yesterday, "total_bytes", $total_bytes, '');
- $statsSave->createStatDaily($yesterday, "unique", $count->{unique}, '');
- $statsSave->createStatDaily($yesterday, "unique_users", $count->{unique_users}, '');
- $statsSave->createStatDaily($yesterday, "comments", $comments, '');
- $statsSave->createStatDaily($yesterday, "homepage", $count->{index}{index}, '');
- $statsSave->createStatDaily($yesterday, "distinct_comment_ipids", $distinct_comment_ipids, '');
+ $statsSave->createStatDaily($yesterday, "total", $count->{total});
+ $statsSave->createStatDaily($yesterday, "total_bytes", $total_bytes);
+ $statsSave->createStatDaily($yesterday, "unique", $count->{unique});
+ $statsSave->createStatDaily($yesterday, "unique_users", $count->{unique_users});
+ $statsSave->createStatDaily($yesterday, "comments", $comments);
+ $statsSave->createStatDaily($yesterday, "homepage", $count->{index}{index});
+ $statsSave->createStatDaily($yesterday, "distinct_comment_ipids", $distinct_comment_ipids);
- if ($constants->{mod_stats}) {
- for my $nickname (keys %$admin_mods) {
+ for my $nickname (keys %$admin_mods) {
my $uid = $admin_mods->{$nickname}{uid};
# Each stat writes one row into stats_daily for each admin who
# modded anything, which is a lot of rows, but we want all the
@@ -201,9 +195,8 @@
? "_admin_$uid"
: "_total";
my $val = $admin_mods->{$nickname}{$stat};
- $statsSave->createStatDaily($yesterday, "$stat$suffix", $val, '');
+ $statsSave->createStatDaily($yesterday, "$stat$suffix", $val);
}
- }
}
$data{total} = sprintf("%8d", $count->{total});
@@ -212,19 +205,17 @@
$data{users} = sprintf("%8d", $count->{unique_users});
$data{accesslog} = sprintf("%8d", $accesslog_rows);
$data{formkeys} = sprintf("%8d", $formkeys_rows);
- if ($constants->{mod_stats}) {
- $data{modlog} = sprintf("%8d", $modlog_rows);
- $data{metamodlog} = sprintf("%8d", $metamodlog_rows);
- $data{xmodlog} = sprintf("%.1fx", ($modlog_rows ? $metamodlog_rows/$modlog_rows : 0));
- $data{mod_points} = sprintf("%8d", $mod_points);
- $data{used_total} = sprintf("%8d", $modlog_total);
- $data{used_total_pool} = sprintf("%.1f", ($mod_points ? $modlog_total*100/$mod_points : 0));
- $data{used_total_comments} = sprintf("%.1f", ($comments ? $modlog_total*100/$comments : 0));
- $data{used_minus_1} = sprintf("%8d", $modlog_hr->{-1}{count});
- $data{used_minus_1_percent} = sprintf("%.1f", ($modlog_total ? $modlog_hr->{-1}{count}*100/$modlog_total : 0) );
- $data{used_plus_1} = sprintf("%8d", $modlog_hr->{1}{count});
- $data{used_plus_1_percent} = sprintf("%.1f", ($modlog_total ? $modlog_hr->{1}{count}*100/$modlog_total : 0));
- }
+ $data{modlog} = sprintf("%8d", $modlog_rows);
+ $data{metamodlog} = sprintf("%8d", $metamodlog_rows);
+ $data{xmodlog} = sprintf("%.1fx", ($modlog_rows ? $metamodlog_rows/$modlog_rows : 0));
+ $data{mod_points} = sprintf("%8d", $mod_points);
+ $data{used_total} = sprintf("%8d", $modlog_total);
+ $data{used_total_pool} = sprintf("%.1f", ($mod_points ? $modlog_total*100/$mod_points : 0));
+ $data{used_total_comments} = sprintf("%.1f", ($comments ? $modlog_total*100/$comments : 0));
+ $data{used_minus_1} = sprintf("%8d", $modlog_hr->{-1}{count});
+ $data{used_minus_1_percent} = sprintf("%.1f", ($modlog_total ? $modlog_hr->{-1}{count}*100/$modlog_total : 0) );
+ $data{used_plus_1} = sprintf("%8d", $modlog_hr->{1}{count});
+ $data{used_plus_1_percent} = sprintf("%.1f", ($modlog_total ? $modlog_hr->{1}{count}*100/$modlog_total : 0));
$data{comments} = sprintf("%8d", $comments);
$data{IPIDS} = sprintf("%8d", scalar(@$distinct_comment_ipids));
$data{submissions} = sprintf("%8d", $submissions);
@@ -258,8 +249,8 @@
# $data{sections} = \@sections;
$data{lazy} = \@lazy;
$data{admin_clearpass_warning} = $admin_clearpass_warning;
- $data{admin_mods_text} = $admin_mods_text if $constants->{mod_stats};
- $data{tailslash} = `$constants->{slashdir}/bin/tailslash -u $virtual_user -y today` if $constants->{tailslash_stats};
+ $data{admin_mods_text} = $admin_mods_text;
+ $data{tailslash} = `$constants->{slashdir}/bin/tailslash -u $virtual_user -y today`;
$data{backup_lag} = "";
for my $slave_name (qw( backup search )) {
@@ -277,6 +268,7 @@
my $email = slashDisplay('display', \%data, {
Return => 1, Page => 'adminmail', Nocomm => 1
});
+#print "\n$email\n";
# Send a message to the site admin.
my $messages = getObject('Slash::Messages');
@@ -288,7 +280,6 @@
$data{template_page} = 'adminmail';
my $message_users = $messages->getMessageUsers(MSG_CODE_ADMINMAIL);
for (@$message_users) {
-
$messages->create($_, MSG_CODE_ADMINMAIL, \%data);
}
}
View
4 plugins/Stats/mysql_schema
@@ -4,8 +4,6 @@ CREATE TABLE stats_daily (
day date NOT NULL,
name varchar(32) DEFAULT '' NOT NULL,
value FLOAT DEFAULT 0 NOT NULL,
- section varchar(30) NOT NULL,
UNIQUE day_key_pair (day,name),
- PRIMARY KEY (id),
- FOREIGN KEY (section) REFERENCES sections(section)
+ PRIMARY KEY (id)
) TYPE = myisam;
View
7 plugins/Stats/templates/display;adminmail;default
@@ -87,12 +87,9 @@ For [% section.section_name %]
[% item %]
[% END %]
-[% IF constants.tailslash_stats %]
+-----------------------
-[% tailslash %]
-
------------------------
-[% END %]
+[% tailslash %]
-----------------------
View
8 plugins/Submit/submit.pl
@@ -219,11 +219,11 @@ sub submissionEd {
$cur_section = $form->{section} || $def_section;
}
$cur_note = $form->{note} || $def_note;
- $sections = $slashdb->getSubmissionsSections($user->{section});
+ $sections = $slashdb->getSubmissionsSections();
for (@$sections) {
my($section, $note, $cnt) = @$_;
- $all_sections{$section} = 1 if ! $user->{section};
+ $all_sections{$section} = 1;
$note ||= $def_note;
$all_notes{$note} = 1;
$sn{$section}{$note} = $cnt;
@@ -236,13 +236,13 @@ sub submissionEd {
}
}
- $all_sections{$def_section} = 1 if ! $user->{section};
+ $all_sections{$def_section} = 1;
# self documentation, right?
@sections = map { [$_->[0], ($_->[0] eq $def_section ? '' : $_->[0])] }
sort { $a->[1] cmp $b->[1] }
map { [$_, ($_ eq $def_section ? '' : $_)] }
- keys %all_sections if ! $user->{section};
+ keys %all_sections;
@notes = map { [$_->[0], ($_->[0] eq $def_note ? '' : $_->[0])] }
sort { $a->[1] cmp $b->[1] }
View
12 sbin/portald
@@ -149,7 +149,6 @@ sub getRDF {
my($bid, $url, $other) = @_;
my $rss = new XML::RSS;
- $rss->strict(0);
my $template_name ||= $slashdb->getBlock($bid, 'rss_template');
my $items ||= $slashdb->getBlock($bid, 'items');
$items ||= $constants->{max_items};
@@ -161,16 +160,9 @@ sub getRDF {
portaldLog("failed to get $bid: $@");
return;
}
- $d =~ s/&(?!#?[a-zA-Z0-9]+;)/&amp;/g;
+ $d =~ s/&(?!#?[a-zA-Z0-9]+;)/&amp;/g;
- eval { $rss->parse($d) };
-
- # to compensate for sf.net's broken rss
- if ($@) {
- $d =~ s/[^[:print:]]//g;
-
- eval { $rss->parse($d) }
- }
+ eval { $rss->parse($d) };
if ($@) {
portaldLog("$bid did not parse properly:$@");
View
10 sql/mysql/defaults.sql
@@ -40,8 +40,6 @@ INSERT INTO code_param (type, code, name) VALUES ('discussiontypes',2,'Read Only
INSERT INTO code_param (type, code, name) VALUES ('displaycodes',0,'Always Display');
INSERT INTO code_param (type, code, name) VALUES ('displaycodes',1,'Only Display Within Section');
INSERT INTO code_param (type, code, name) VALUES ('displaycodes',-1,'Never Display');
-INSERT INTO code_param (type, code, name) VALUES ('displaycodes_sectional',1,'Display');
-INSERT INTO code_param (type, code, name) VALUES ('displaycodes_sectional',-1,'Don\'t display');
INSERT INTO code_param (type, code, name) VALUES ('isolatemodes',0,'Part of Site');
INSERT INTO code_param (type, code, name) VALUES ('isolatemodes',1,'Standalone');
INSERT INTO code_param (type, code, name) VALUES ('issuemodes',0,'Neither');
@@ -85,7 +83,7 @@ INSERT INTO code_param (type, code, name) VALUES ('postmodes',1,'Plain Old Text'
INSERT INTO code_param (type, code, name) VALUES ('postmodes',2,'HTML Formatted');
INSERT INTO code_param (type, code, name) VALUES ('postmodes',3,'Extrans (html tags to text)');
INSERT INTO code_param (type, code, name) VALUES ('postmodes',4,'Code');
-INSERT INTO code_param (type, code, name) VALUES ('section_topic_type',1,'default');
+INSERT INTO code_param (type, code, name) VALUES ('section_topic_types',1,'default');
INSERT INTO code_param (type, code, name) VALUES ('extra_types', 1, 'text');
INSERT INTO code_param (type, code, name) VALUES ('extra_types', 2, 'list');
@@ -695,8 +693,6 @@ INSERT INTO vars (name, value, description) VALUES ('do_expiry','1','Flag which
INSERT INTO vars (name, value, description) VALUES ('down_moderations','-6','number of how many comments you can post that get down moderated');
INSERT INTO vars (name, value, description) VALUES ('draconian_charrefs','0','Enable strictest-possible rules for disallowing HTML entities/character references?');
INSERT INTO vars (name, value, description) VALUES ('enable_index_topic','','set this to the value in string param for index topic \(something like "topic_4"\)');
-INSERT INTO vars (name, value, description) VALUES ('enable_discussion_topic','','discussion topic type');
-INSERT INTO vars (name, value, description) VALUES ('enable_repository_topic','','repository topic type');
INSERT INTO vars (name, value, description) VALUES ('fancyboxwidth','200','What size should the boxes be in?');
INSERT INTO vars (name, value, description) VALUES ('feature_story_enabled','0','Simple Boolean to determine if homepage prints feature story');
INSERT INTO vars (name, value, description) VALUES ('formkey_timeframe','14400','The time frame that we check for a formkey');
@@ -825,7 +821,6 @@ INSERT INTO vars (name, value, description) VALUES ('submit_forgetip_hours','720
INSERT INTO vars (name, value, description) VALUES ('submit_forgetip_maxrows','100000','Max number of rows to forget IPs of at once');
INSERT INTO vars (name, value, description) VALUES ('submit_forgetip_minsubid','0','Minimum subid to start forgetting IP at');
INSERT INTO vars (name, value, description) VALUES ('submit_show_weight', '0', 'Display optional weight field in submission admin.');
-INSERT INTO vars (name, value, description) VALUES ('tailslash_stats','1','true/false log tailslash in adminmail');
INSERT INTO vars (name, value, description) VALUES ('template_cache_request','0','Special boolean to cache templates only for a single request');
INSERT INTO vars (name, value, description) VALUES ('template_cache_size','0','Number of templates to store in cache (0 = unlimited)');
INSERT INTO vars (name, value, description) VALUES ('template_post_chomp','0','Chomp whitespace after directives (0 = no, 1 = yes, 2 = collapse; 0 or 2 recommended)');
@@ -849,6 +844,3 @@ INSERT INTO vars (name, value, description) VALUES ('users_bio_length','1024','L
INSERT INTO vars (name, value, description) VALUES ('users_show_info_seclev','0','Minimum seclev to view a user\s info');
INSERT INTO vars (name, value, description) VALUES ('users_speed_limit','20','How fast a user can change their prefs');
INSERT INTO vars (name, value, description) VALUES ('writestatus','ok','Simple Boolean to determine if homepage needs rewriting');
-INSERT INTO vars (name, value, description) VALUES ('use_alt_topic','0','Simple Boolean to make is so editStory uses the categorise story value to set topic');
-INSERT INTO vars (name,value,description) VALUES ('newest_stories','0','how many of the newest stories to print on index');
-INSERT INTO vars (name,value,description) VALUES ('newest_stories_category','0','how many of the newest stories per category to print');
View
7 sql/mysql/slashschema_create.sql
@@ -125,6 +125,7 @@ CREATE TABLE blocks (
KEY section (section)
) TYPE = myisam;
+
#
# Table structure for table 'code_param'
#
@@ -302,7 +303,7 @@ DROP TABLE IF EXISTS menus;
CREATE TABLE menus (
id mediumint(5) UNSIGNED NOT NULL auto_increment,
menu varchar(20) DEFAULT '' NOT NULL,
- label varchar(255) DEFAULT '' NOT NULL,
+ label varchar(200) DEFAULT '' NOT NULL,
value text,
seclev mediumint UNSIGNED NOT NULL,
menuorder mediumint(5),
@@ -430,7 +431,7 @@ CREATE TABLE rss_raw (
description_signature char(32) DEFAULT '' NOT NULL,
link varchar(255) NOT NULL,
title varchar(255) NOT NULL,
- description text,
+ description varchar(255) NOT NULL,
subid mediumint UNSIGNED,
bid varchar(30),
created datetime,
@@ -506,7 +507,7 @@ CREATE TABLE section_extras (
section varchar(30) NOT NULL,
name varchar(100) NOT NULL,
value varchar(100) NOT NULL,
- type enum("text","list", "topics") DEFAULT 'text' NOT NULL,
+ type enum("text","list") DEFAULT 'text' NOT NULL,
FOREIGN KEY (section) REFERENCES sections(section),
UNIQUE extra (section,name),
PRIMARY KEY (param_id)
View
34 sql/mysql/upgrades
@@ -346,20 +346,12 @@ ALTER TABLE submissions MODIFY COLUMN email varchar(255) DEFAULT '' NOT NULL;
UPDATE vars SET value=100 WHERE name="authors_unlimited";
-# this is to have the ability to not have the
-# topic pulldown show up in editStory and for
-# saveStory to use categorise_stories value be
-# what topic is set to
-INSERT INTO vars (name, value, description) VALUES ('use_alt_topic','0','Simple Boolean to make is so editStory uses the categorise story value to set topic');
#Needed for search, not used in submissions "yet"
INSERT INTO string_param (type, code, name) VALUES ('submission-notes','','Unclassified');
INSERT INTO string_param (type, code, name) VALUES ('submission-notes','Hold','Hold');
INSERT INTO string_param (type, code, name) VALUES ('submission-notes','Quick','Quick');
INSERT INTO string_param (type, code, name) VALUES ('submission-notes','Back','Back');
-# FOUNDRIES UPDATED 4/22/02
-# SLASHCODE/USEPERL LAST UPDATED HERE
-# FOUNDRIES UPDATED 4/25/02
#
# Table structure for table 'subsections'
#
@@ -375,19 +367,12 @@ CREATE TABLE subsections (
PRIMARY KEY (id)
) TYPE = myisam;
-ALTER TABLE stories ADD category SMALLINT UNSIGNED DEFAULT 0 NOT NULL;
-# ALTER TABLE sections DROP feature_story;
-# FOUNDRIES UPDATED 4/30/02
-INSERT INTO vars (name,value,description) VALUES ('newest_stories','0','how many of the newest stories to print on index');
-INSERT INTO vars (name,value,description) VALUES ('newest_stories_category','0','how many of the newest stories per category to print');
-=======
# End of T_2_3_0_22, Start of T_2_3_0_23
# If using HumanConf...
ALTER TABLE humanconf_pool ADD COLUMN inuse TINYINT DEFAULT '0' NOT NULL AFTER lastused;
ALTER TABLE stories ADD subsection SMALLINT UNSIGNED DEFAULT 0 NOT NULL;
-# LINUX.COM
ALTER TABLE sections DROP feature_story;
ALTER TABLE accesslog ADD bytes mediumint UNSIGNED DEFAULT 0 NOT NULL;
INSERT INTO message_codes (code, type, seclev, modes) VALUES (10, 'Daily Site Stats', 100, '');
@@ -401,14 +386,8 @@ ALTER TABLE stories ADD last_update timestamp;
INSERT INTO vars (name, value, description) VALUES ('recent_topic_img_count','5','Number of recent topics to store in the template "recentTopics"');
INSERT INTO vars (name, value, description) VALUES ('recent_topic_txt_count','5','Number of recent topics to store in the block "recenttopics"');
-# SLASHCODE LAST UPDATED HERE
-INSERT INTO code_param (type, code, name) VALUES ('displaycodes_sectional', -1,'Don't Display');
-INSERT INTO code_param (type, code, name) VALUES ('displaycodes_sectional', 1,'Display');
-# Foundries test site last updated
-
-# For plugins/Admin
-INSERT INTO vars (name, value, description) VALUES ('discussion_sort_order', '3', 'sort code to feed to findDiscussions');
+# For plugins/Admin (ignore if not using that plugin)
INSERT INTO vars (name, value, description) VALUES ('similarstorydays', '30', 'Number of days to look back for uncommon words');
INSERT INTO vars (name, value, description) VALUES ('similarstorymaxwords', '30', 'Maximum number of top-weighted scores to search for in previous stories');
INSERT INTO vars (name, value, description) VALUES ('similarstoryminweight', '4', 'Minimum weight necessary for a story to be displayed as similar');
@@ -425,7 +404,6 @@ INSERT INTO vars (name, value, description) VALUES ('uncommonstoryword_thresh',
# Added for Pat for discussions -Brian
ALTER TABLE discussions ADD approved tinyint UNSIGNED DEFAULT 0 NOT NULL;
INSERT INTO vars (name, value, description) VALUES ('discussion_approval', '0', 'If this is set to 1, set all user created discussions when created to 0 so that they must be approved');
-# FOUNDRIES UPDATED
# For pudge -brian
ALTER TABLE templates ADD last_update timestamp;
@@ -469,9 +447,6 @@ INSERT INTO vars (name, value, description) VALUES ('lonetags','P|LI|BR|IMG','Ta
INSERT INTO vars (name, value, description) VALUES ('top10comm_num','10','Number of comments wanted for the Top 10 Comments slashbox (if not 10, you ought to rename it maybe)');
INSERT INTO vars (name, value, description) VALUES ('anon_name_alt','An anonymous coward','Name of anonymous user to be displayed in stories');
-# SLASHDOT LAST UPDATED HERE
-# FOUNDRIES LAST UPDATED HERE
-
# End of T_2_3_0_28, Start of T_2_3_0_29
INSERT INTO vars (name, value, description) VALUES ('karma_adj','-10=Terrible|-1=Bad|0=Neutral|12=Positive|25=Good|99999=Excellent','Adjectives that describe karma, used if karma_obfuscate is set (best to keep aligned with badkarma, m2_maxbonus, and goodkarma)');
@@ -496,14 +471,12 @@ INSERT INTO vars (name, value, description) VALUES ('approved_url_schemes','ftp|
# End of T_2_3_0_29, Start of T_2_3_0_30
-# FOUNDRIES LAST UPDATED
# OSDNTEST LAST UPDATED HERE
# OSDN LAST UPDATED HERE
# Forgot this one a little while ago too.
# For plugins/Stats (ignore if you're not using that plugin):
INSERT INTO vars (name, value, description) VALUES ('mod_stats','1','Include stats on moderation in the daily admin mail?');
-INSERT INTO vars (name, value, description) VALUES ('tailslash_stats','1','true/false log tailslash in adminmail');
# End of R_2_3_0_30, Start of T_2_3_0_31
@@ -520,11 +493,6 @@ CREATE TABLE sections_contained (
ALTER TABLE sections ADD rewrite mediumint UNSIGNED DEFAULT '3600' NOT NULL;
ALTER TABLE sections ADD last_update timestamp;
-# fixes rss being truncated in autosubmit
-ALTER TABLE rss_raw modify column description text;
-
-# FOUNDRIES LAST UPDATE 7/13
-
# For plugins/Email ONLY (LC, Slashcode, etc -- NOT SLASHDOT!)
INSERT INTO message_codes (code, type, seclev, modes) VALUES (11, 'Email Story', 1, 0);
View
32 themes/slashcode/htdocs/comments.pl
@@ -79,7 +79,7 @@ sub main {
formname => 'discussions',
checks =>
[ qw ( max_post_check valid_check interval_check
- formkey_check generate_formkey) ],
+ formkey_check regen_formkey ) ],
},
reply => {
function => \&editComment,
@@ -113,14 +113,16 @@ sub main {
function => \&submitComment,
seclev => 0,
post => 1,
- formname => $form->{new_discussion} ? 'discussions' : 'comments',
- checks => $form->{new_discussion} ? [] :
+ formname => 'comments',
+ checks =>
[ qw ( response_check update_formkeyid max_post_check valid_check interval_check
formkey_check ) ],
},
};
$ops->{default} = $ops->{display} ;
+ # This is here to save a function call, even though the
+ # function can handle the situation itself
my ($discussion, $section);
if ($form->{sid}) {
@@ -147,7 +149,7 @@ sub main {
$form->{pid} ||= "0";
- header($discussion ? $discussion->{'title'} : 'Comments', $form->{section});
+ header($discussion ? $discussion->{'title'} : 'Comments', $section);
if ($user->{is_anon} && length($form->{upasswd}) > 1) {
print getError('login error');
@@ -184,7 +186,8 @@ sub main {
$formname = $ops->{$op}{formname};
for my $check (@{$ops->{$op}{checks}}) {
$ops->{$op}{update_formkey} = 1 if $check eq 'formkey_check';
- $error_flag = formkeyHandler($check, $formname, $formkey,undef,$options);
+ $error_flag = formkeyHandler($check, $formname, $formkey,
+ undef, $options);
if ($error_flag == -1) {
# Special error: submit failed, go back to
# previewing. If the error was retryable,
@@ -409,15 +412,10 @@ sub commentIndexUserCreated {
my($form, $slashdb, $user, $constants) = @_;
my $label = getData('label');
+ titlebar("90%", getData('user_discussions'));
my $searchdb = getObject('Slash::Search', $constants->{search_db_user});
my $start = $form->{start} || 0;
- my $hashref = {};
- $hashref->{section} = $form->{section} if $form->{section};
- $hashref->{tid} = $form->{tid} if $form->{tid};
- $hashref->{type} = 'recycle';
- $hashref->{approved} = '1';
-
- my $discussions = $searchdb->findDiscussion($hashref, $constants->{discussion_display_limit} + 1, $start, $constants->{discussion_sort_order});
+ my $discussions = $searchdb->findDiscussion({ section => $form->{section}, type => 'recycle' }, $constants->{discussion_display_limit} + 1, $start, $constants->{discussion_sort_order});
if ($discussions && @$discussions) {
my $forward;
if (@$discussions == $constants->{discussion_display_limit} + 1) {
@@ -437,15 +435,9 @@ sub commentIndexUserCreated {
$back = -1;
}
-
- my $title = getData('user_discussions');
-
- $title .= ": " . $slashdb->getTopic($form->{tid},'alttext') . " ($form->{tid})" if $form->{tid};
-
slashDisplay('udiscuss_list', {
- title => $title,
discussions => $discussions,
- label => $label,
+ 'label' => $label,
forward => $forward,
args => _buildargs($form),
start => $start,
@@ -647,7 +639,7 @@ sub createDiscussion {
});
}
- # commentIndex(@_);
+ commentIndex(@_);
}
##################################################################
View
29 themes/slashcode/htdocs/index.pl
@@ -8,6 +8,7 @@
use Slash;
use Slash::Display;
use Slash::Utility;
+use Data::Dumper;
sub main {
my $slashdb = getCurrentDB();
@@ -16,7 +17,7 @@ sub main {
my $form = getCurrentForm();
- my($stories, $Stories, $section);
+ my($stories, $Stories, $storystruct, $section);
if ($form->{op} eq 'userlogin' && !$user->{is_anon}) {
my $refer = $form->{returnto} || $ENV{SCRIPT_NAME};
redirect($refer);
@@ -39,7 +40,6 @@ sub main {
my $artcount = $user->{is_anon} ? $section->{artcount} : $user->{maxstories};
my $title = getData('head', { section => $section });
-
header($title, $section->{section});
my $limit = $section->{type} eq 'collected' ?
@@ -63,13 +63,15 @@ sub main {
# this makes sure that existing sites don't
# have to worry about being affected by this
# change
- $Stories = displayStories($stories);
+ $storystruct = displayStories($stories);
+ $Stories = $storystruct->{stories}{full};
my $StandardBlocks = displayStandardBlocks($section, $stories);
slashDisplay('index', {
is_moderator => scalar $slashdb->checkForMetaModerator($user),
stories => $Stories,
+ storystruct => $storystruct,
boxes => $StandardBlocks,
});
@@ -241,14 +243,25 @@ sub displayStories {
# shift them off, so we do not display them in the Older
# Stuff block later (simulate the old cursor-based
# method)
-
while ($_ = shift @{$stories}) {
my($sid, $thissection, $title, $time, $cc, $d, $hp, $secs, $tid) = @{$_};
- my($tmpreturn, $category, $feature_sid, $other, @links);
+ my($tmpreturn, $category, $other, @links);
my @threshComments = split m/,/, $hp; # posts in each threshold
+ if ($constants->{organise_stories}) {
+ $category = $slashdb->getStory($sid,$constants->{organise_stories});
+ }
+ $category ||= 'stories';
+ $counter->{$category} ||= $x;
+
my($storytext, $story) = displayStory($sid, '', $other);
+ if ($constants->{get_titles}) {
+ my $titlelink = slashDisplay('storyTitleOnly', { story => $story }, {Return => 1});
+
+ $return->{$category}{titles} .= $titlelink;
+ }
+
$tmpreturn .= $storytext;
push @links, linkStory({
@@ -322,13 +335,11 @@ sub displayStories {
sid => $sid,
}, { Return => 1});
- $return .= $tmpreturn;
-
+ $return->{$category}{full} .= $tmpreturn;
my($w) = join ' ', (split m/ /, $time)[0 .. 2];
$today ||= $w;
-
- last if ++$x > $cnt && $today ne $w;
+ last if ++$counter->{$category} > $cnt && $today ne $w;
}
return $return;
View
25 themes/slashcode/htdocs/users.pl
@@ -26,10 +26,6 @@ sub main {
my $suadmin_flag = $user->{seclev} >= 10000 ? 1 : 0 ;
my $postflag = $user->{state}{post};
my $op = lc($form->{op});
- print STDERR "OP $op\n";
- for (keys %$form) {
- print STDERR "main FORM key $_ value $form->{$_}\n";
- }
# savepasswd is a special case, because once it's called, you
# have to reload the form, and you don't want to do any checks if
@@ -43,7 +39,7 @@ sub main {
my $ops = {
admin => {
function => \&adminDispatch,
- seclev => 100, # if this should be lower,
+ seclev => 10000, # if this should be lower,
# then something else is
# broken, because it allows
# anyone with this seclev
@@ -518,7 +514,7 @@ sub newUser {
uid => $uid
});
- mailPasswd({ uid => $uid }) if getCurrentStatic('mail_passwd');
+ mailPasswd({ uid => $uid });
return;
} else {
@@ -575,9 +571,7 @@ sub mailPasswd {
tempnick => $tempnick
}, 1);
- print STDERR "sending email to $uid $emailtitle\n";
doEmail($uid, $emailtitle, $msg) if $user_edit->{nickname};
- print STDERR "sent email to $uid $emailtitle\n";
print getMessage('mailpasswd_mailed_msg', { name => $user_edit->{nickname} });
}
@@ -1489,11 +1483,6 @@ sub saveUserAdmin {
my $banned = 0;
my $banref;
- print STDERR "saveUserAmin\n";
- for (keys %$form) {
- print STDERR "FORM key $_ value $form->{$_}\n";
- }
-
if ($form->{uid}) {
$user_editfield_flag = 'uid';
$id = $form->{uid};
@@ -1564,11 +1553,11 @@ sub saveUserAdmin {
if ($user->{is_admin} && ($user_editfield_flag eq 'uid' ||
$user_editfield_flag eq 'nickname')) {
- $user_edits_table->{seclev} = $form->{seclev} if $user->{seclev} >= 10000;
- $user_edits_table->{section} = $form->{usersection} if $user->{seclev} >= 10000;
+ $user_edits_table->{seclev} = $form->{seclev};
+ $user_edits_table->{section} = $form->{section};
$user_edits_table->{rtbl} = $form->{rtbl} eq 'on' ? 1 : 0 ;
$user_edits_table->{rtbl_reason} = $form->{rtbl} eq 'on' ? $form->{rtbl_reason} : '' ;
- $user_edits_table->{author} = $form->{author} && $user->{seclev} >= 10000 ? 1 : 0 ;
+ $user_edits_table->{author} = $form->{author} ? 1 : 0 ;
$user_edits_table->{defaultpoints} = $form->{defaultpoints};
my $was_author = ($slashdb->getAuthor($id)->{author}) ? 1 : 0;
@@ -2246,14 +2235,14 @@ sub getUserAdmin {
$user_editfield = $user_edit->{uid};
$checked->{expired} = $slashdb->checkExpired($user_edit->{uid}) ? ' CHECKED' : '';
$iplist = $slashdb->getNetIDList($user_edit->{uid});
- $section_select = createSelect('usersection', $sectionref, $user_edit->{section}, 1);
+ $section_select = createSelect('section', $sectionref, $user_edit->{section}, 1);
} elsif ($field eq 'nickname') {
$user_edit = $slashdb->getUser($slashdb->getUserUID($id));
$user_editfield = $user_edit->{nickname};
$checked->{expired} = $slashdb->checkExpired($user_edit->{uid}) ? ' CHECKED' : '';
$iplist = $slashdb->getNetIDList($user_edit->{uid});
- $section_select = createSelect('usersection', $sectionref, $user_edit->{section}, 1);
+ $section_select = createSelect('section', $sectionref, $user_edit->{section}, 1);
} elsif ($field eq 'md5id') {
$user_edit->{nonuid} = 1;
View
24 themes/slashcode/tasks/new_headfoot.pl
@@ -16,25 +16,13 @@
# exiting
local *SO = *STDOUT;
- # With the new section code, this is most-likely no longer necessary.
- #sectionHeaders(@_, "");
-
+ sectionHeaders(@_, "");
my $sections = $slashdb->getSections();
for (keys %$sections) {
my($section) = $sections->{$_}{section};
mkpath "$constants->{basedir}/$section", 0, 0755;
sectionHeaders(@_, $sections->{$_});
}
-
- # Now since we've iterated thru all sections, just now,
- # $user->{currentSection} is now set to the last section processed...
- # whatever that is [since header() sets $user->{currentSection}]. We
- # must undo this since this may affect template retrieval for other
- # tasks.
- #
- # Now the actual question: undef() or delete(). I'm assuming delete().
- # - Cliff 2002/05/22
- delete $user->{currentSection};
*STDOUT = *SO;
@@ -53,21 +41,15 @@ sub sectionHeaders {
setCurrentForm('ssi', 1);
my $fh = gensym();
-
open $fh, ">$constants->{basedir}/$section/slashhead.inc"
- or
- die "Can't open $constants->{basedir}/$section/slashhead.inc: $!";
-
+ or die "Can't open $constants->{basedir}/$section/slashhead.inc: $!";
*STDOUT = $fh;
header("", $section, { noheader => 1 });
close $fh;
setCurrentForm('ssi', 0);
-
open $fh, ">$constants->{basedir}/$section/slashfoot.inc"
- or
- die "Can't open $constants->{basedir}/$section/slashfoot.inc: $!";
-
+ or die "Can't open $constants->{basedir}/$section/slashfoot.inc: $!";
*STDOUT = $fh;
footer();
close $fh;
View
1  themes/slashcode/tasks/rss_submit.pl
@@ -32,7 +32,6 @@
my $block = $slashdb->getBlock($rss->{bid});
my $description = $rss->{description} ? $rss->{description} : $rss->{title};
if ($block->{'autosubmit'} eq 'yes') {
- print "getting rss\ntitle $rss->{title}\ndescription\n$description\n";
my $submission = {
email => $rss->{link},
name => $block->{title},
View
2  themes/slashcode/templates/data;comments;default
@@ -16,7 +16,7 @@ __name__
data
__template__
[%
- label = 'forum';
+ label = 'discussion';
%]
[% SWITCH value %]
View
3  themes/slashcode/templates/edit_comment;comments;default
@@ -45,9 +45,6 @@ __template__
[% IF form.formkey %]
<INPUT TYPE="HIDDEN" NAME="formkey" VALUE="[% form.formkey %]">
[% END %]
-[% IF new_discussion %]
- <INPUT TYPE="HIDDEN" NAME="new_discussion" VALUE="new_discussion">
-[% END %]
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1">
[% userlink = '' %]
View
2  themes/slashcode/templates/getUserAdmin;users;default
@@ -112,7 +112,6 @@ __template__
[% IF authoredit_flag && seclev_field && ! useredit.nonuid %]
- [% IF user.seclev >= 10000 %]
<TR>
<TD><B>Seclev</B></TD>
<TD COLSPAN="4">
@@ -135,7 +134,6 @@ __template__
<TR>
<TD><B>Section</B></TD><TD>[% section_select %]</TD>
</TR>
- [% END %]
<TR>
<TD><B>Default points (threshcode)</B></TD><TD>[% thresh_select %]</TD><TD>&nbsp;</TD>
</TR>
View
2  themes/slashcode/templates/newdiscussion;comments;default
@@ -23,7 +23,7 @@ __template__
has been created. Go to <A HREF="[% constants.rootdir %]/comments.pl?sid=[% id %]">[% constants.absolutedir %]/comments.pl?sid=[% id %]</A> to begin posting. Remember this URL!</P>
<P><B>Please note, without a comment your [% label %] will not be listed in any indexes.</B></P>
<P>
-[% PROCESS edit_comment sid => id, new_discussion => 1 %]
+[% PROCESS edit_comment sid => id %]
<P>
[% ELSE %]
[% IF error; error; ELSE; PROCESS titlebar width => "95%", title => "Unknown error" %]
Please sign in to comment.
Something went wrong with that request. Please try again.