#87 added subsection ability to index.pl

closed-rejected
Chris Nandor
2
2003-01-21
2002-09-11
Simon Austin
No

Changed index.pl to allow subsection, topic, sid, and
exclude_sid to be passed in from the url.

e.g. index.pl?section=blah&subsection=7 will now only
display story summaries with section blah and subsection 7.

It can also be narrowed down by topic, sid and exclude_sid.

I also had to change MySQL.pm slightly. There was a
pair of single quotes missing in it.

###This is the diff for MySQL.pm version 1.219#####
###diff for index.pl follows. ###

--- MySQL.pm Wed Sep 11 15:59:34 2002
+++ /usr/local/lib/perl/5.6.1/Slash/DB/MySQL.pm Wed Sep
11 16:00:47 2002
@@ -4297,7 +4297,8 @@
$where .= " AND tid='$tid' " if $tid;
$where .= " AND sid = '$misc->{sid}' " if
$misc->{sid};
$where .= " AND sid != '$misc->{exclude_sid}' "
if $misc->{exclude_sid};
- $where .= " AND subsection=$misc->{subsection}
" if $misc->{subsection};
+ # Simon added quotes here->|<- and here
->|<- sept 11/02
+ $where .= " AND
subsection='$misc->{subsection}' " if $misc->{subsection};

# User Config Vars
$where .= " AND tid not in ($user->{extid}) "

###This is the diff for index.pl version 1.47. ####
###This file is also attached ####

--- /var/www.sav/index2.pl Wed Sep 11 15:45:57 2002
+++ /etc/slash/site/seestheday.dsl.ca/htdocs/index.pl
Wed Sep 11 15:51:38 2002
@@ -15,8 +15,21 @@
my $user = getCurrentUser();
my $form = getCurrentForm();

+ #Line added by Simon sept 11/02
+ my %misc;

my($stories, $Stories, $section);
+
+ # Line added by Simon sept 11/02 to add
subsection functionality
+ #
+ # The sid and exclude_sid lines are not needed
for subsection to work
+ # I just left them there in case
+ %misc = (
+ subsection => $form->{subsection},
+ sid => $form->{sid},
+ exclude_sid => $form->{exclude_sid}
+ );
+
if ($form->{op} eq 'userlogin' &&
!$user->{is_anon}) {
my $refer = $form->{returnto} ||
$ENV{SCRIPT_NAME};
redirect($refer);
@@ -53,9 +66,15 @@
} else {
$fetchdb = $slashdb;
}
+
+
+ # added $form->{topic} so we can specify topic
for index.pl --Simon
+ # added $misc so we can get subsection. sept 11/02
$stories = $fetchdb->getStoriesEssentials(
$limit, $form->{section},
- '',
+ $form->{topic}, \%misc
+ );
+
# this makes sure that existing sites don't
# have to worry about being affected by this
# change

Discussion

  • Simon Austin
    Simon Austin
    2002-09-11

    diff file for index.pl version 1.47

     
    Attachments
  • Chris Nandor
    Chris Nandor
    2002-11-19

    Logged In: YES
    user_id=3660

    Krow, please tell me if this is something we want, and then
    assign it back to me. If it is something we want, I'll
    clean up and apply the patch (it's a security hazard as-is,
    but I can fix that :-).

     
  • Chris Nandor
    Chris Nandor
    2002-11-19

    • labels: 310623 --> Development branch
    • assigned_to: nobody --> krow
     
  • Brian Aker
    Brian Aker
    2002-11-19

    • assigned_to: krow --> pudge
     
  • Brian Aker
    Brian Aker
    2002-11-19

    Logged In: YES
    user_id=25967

    I could care less. We use subsection with Slash::Page, not
    with index.pl. I don't think this is something we will ever
    use for Slashdot but I am not against it.
    Really low priority.

     
  • Chris Nandor
    Chris Nandor
    2002-11-19

    • priority: 5 --> 2
     
  • Chris Nandor
    Chris Nandor
    2002-11-19

    Logged In: YES
    user_id=3660

    Consider also using something like this to turn
    ask.slashdot.org into a section that contains all the other
    sections, but only shows the "ask" subsection stories.

     
  • Simon Austin
    Simon Austin
    2002-11-19

    Logged In: YES
    user_id=609823

    pudge, how is it a security hazard? I'd like to know
    because it's on my site. You can respond to me directly by
    email if you would like.

    Simon
    (Submitter)

     
  • Rob Malda
    Rob Malda
    2003-01-21

    • status: open --> closed-rejected