public
Description: Slash is the code that runs Slashdot and other discussion sites. Slash is Free Software under the GPLv2.
Homepage: http://www.slashcode.com/
Clone URL: git://github.com/scc/slash.git
Anchor sids
pudge (author)
Fri May 23 23:36:02 -0700 2008
commit  fda1c295ac0f45938e48f57f40605cb2dc8033cc
tree    e29ac11790aabcd70eab745016658b6aae7f72bd
parent  3e4e3c128645c68f69dbff347cc90345c5bfdf61
...
8749
8750
8751
8752
 
8753
8754
8755
...
8749
8750
8751
 
8752
8753
8754
8755
0
@@ -8749,7 +8749,7 @@ sub getStoidFromSidOrStoid {
0
 sub getStoidFromSid {
0
   my($self, $sid) = @_;
0
   return undef if !$sid;
0
- return undef if $sid !~ regexSid();
0
+ return undef if $sid !~ regexSid(1);
0
   if (my $stoid = $self->{_sid_conversion_cache}{$sid}) {
0
     return $stoid;
0
   }
...
174
175
176
177
 
 
 
178
179
180
...
174
175
176
 
177
178
179
180
181
182
0
@@ -174,7 +174,9 @@ sub nick2matchname {
0
 # NOTE: sid is also used for discussion ID (and maybe stoid too?),
0
 # such as in comments.pl, so that's what the \d{1,8} is for. -- pudge
0
 sub regexSid {
0
- return qr{\b(\d{2}/\d{2}/\d{2}/\d{3,8}|\d{1,8})\b};
0
+ my $anchor = shift;
0
+ my $sid = '(\d{2}/\d{2}/\d{2}/\d{3,8}|\d{1,8})';
0
+ return $anchor ? qr{^$sid$} : qr{\b$sid\b};
0
 }
0
 
0
 #========================================================================
...
1871
1872
1873
1874
 
1875
1876
1877
...
1871
1872
1873
 
1874
1875
1876
1877
0
@@ -1871,7 +1871,7 @@ Hashref of cleaned-up data.
0
     logtoken  => sub { $_[0] = '' unless
0
            $_[0] =~ m|^\d+::[A-Za-z0-9]{22}$|    },
0
     sid    => sub { $_[0] = '' unless
0
- $_[0] =~ Slash::Utility::Data::regexSid() },
0
+ $_[0] =~ Slash::Utility::Data::regexSid(1) },
0
     flags    => sub { $_[0] =~ s|[^a-z0-9_,]||g      },
0
     query    => sub { $_[0] =~ s|[\000-\040<>\177-\377]+| |g;
0
           $_[0] =~ s|\s+| |g;        },
...
1347
1348
1349
1350
 
1351
1352
1353
...
1347
1348
1349
 
1350
1351
1352
1353
0
@@ -1347,7 +1347,7 @@ sub countDailyStoriesAccessRSS {
0
     "op='slashdot-it' AND query_string LIKE '%from=rssbadge'",
0
     'GROUP BY query_string');
0
   my $sid_hr = { };
0
- my $regex_sid = regexSid();
0
+ my $regex_sid = regexSid(1);
0
   for my $qs (keys %$qs_hr) {
0
     my($sid) = $qs =~ m{sid=\b([\d/]+)\b};
0
     next unless $sid =~ $regex_sid;

Comments

    No one has commented yet.