From svnnotify → sourceforge.jp Mon Oct 15 13:52:41 2007 From: svnnotify → sourceforge.jp (svnnotify → sourceforge.jp) Date: Mon, 15 Oct 2007 13:52:41 +0900 Subject: [Slashdotjp-dev 677] [181] remove garbage file Message-ID: <1192423961.879569.6971.nullmailer@users.sourceforge.jp> Revision: 181 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=181 Author: tach Date: 2007-10-15 13:52:41 +0900 (Mon, 15 Oct 2007) Log Message: ----------- remove garbage file Removed Paths: ------------- slashjp/branches/upstream/current/svn-commit.tmp -------------- next part -------------- Deleted: slashjp/branches/upstream/current/svn-commit.tmp =================================================================== --- slashjp/branches/upstream/current/svn-commit.tmp 2007-10-15 04:49:46 UTC (rev 180) +++ slashjp/branches/upstream/current/svn-commit.tmp 2007-10-15 04:52:41 UTC (rev 181) @@ -1,4 +0,0 @@ -import new version --- 仇及墊動票反拑骰今木引允 -- - -A . From svnnotify → sourceforge.jp Mon Oct 15 14:33:59 2007 From: svnnotify → sourceforge.jp (svnnotify → sourceforge.jp) Date: Mon, 15 Oct 2007 14:33:59 +0900 Subject: [Slashdotjp-dev 678] [183] reverse sort of related stories Message-ID: <1192426439.517482.514.nullmailer@users.sourceforge.jp> Revision: 183 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=183 Author: tach Date: 2007-10-15 14:33:58 +0900 (Mon, 15 Oct 2007) Log Message: ----------- reverse sort of related stories Modified Paths: -------------- slashjp/trunk/Slash/DB/MySQL/MySQL.pm -------------- next part -------------- Modified: slashjp/trunk/Slash/DB/MySQL/MySQL.pm =================================================================== --- slashjp/trunk/Slash/DB/MySQL/MySQL.pm 2007-10-15 04:54:42 UTC (rev 182) +++ slashjp/trunk/Slash/DB/MySQL/MySQL.pm 2007-10-15 05:33:58 UTC (rev 183) @@ -13645,7 +13645,7 @@ } my $i = 1; - foreach my $rel (sort keys %$rel_sid_hr) { + foreach my $rel (reverse sort keys %$rel_sid_hr) { my $rel_stoid = $self->getStoidFromSidOrStoid($rel); $self->sqlInsert("related_stories", { stoid => $stoid, From svnnotify → sourceforge.jp Mon Oct 15 15:15:43 2007 From: svnnotify → sourceforge.jp (svnnotify → sourceforge.jp) Date: Mon, 15 Oct 2007 15:15:43 +0900 Subject: [Slashdotjp-dev 679] [184] merged from otp code Message-ID: <1192428943.163099.17483.nullmailer@users.sourceforge.jp> Revision: 184 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=184 Author: tach Date: 2007-10-15 15:15:42 +0900 (Mon, 15 Oct 2007) Log Message: ----------- merged from otp code Modified Paths: -------------- slashjp/trunk/plugins/Admin/admin.pl slashjp/trunk/plugins/Admin/dump slashjp/trunk/plugins/Login/login.pl -------------- next part -------------- Modified: slashjp/trunk/plugins/Admin/admin.pl =================================================================== --- slashjp/trunk/plugins/Admin/admin.pl 2007-10-15 05:33:58 UTC (rev 183) +++ slashjp/trunk/plugins/Admin/admin.pl 2007-10-15 06:15:42 UTC (rev 184) @@ -1162,9 +1162,11 @@ $storyref->{commentstatus} = $form->{commentstatus}; $storyref->{uid} ||= $user->{uid}; - $storyref->{dept} =~ s/[-\s]+/-/g; - $storyref->{dept} =~ s/^-//; - $storyref->{dept} =~ s/-$//; + if ($constants->{use_dept_space2dash}){ + $storyref->{dept} =~ s/[-\s]+/-/g; + $storyref->{dept} =~ s/^-//; + $storyref->{dept} =~ s/-$//; + } my($related_sids_hr, $related_urls_hr, $related_cids_hr) = extractRelatedStoriesFromForm($form); $storyref->{related_sids_hr} = $related_sids_hr; @@ -1345,7 +1347,7 @@ $authors->{$storyref->{uid}} = $slashdb->getUser($storyref->{uid}, 'nickname') if $storyref->{uid} && !defined($authors->{$storyref->{uid}}); my $author_select = createSelect('uid', $authors, $storyref->{uid}, 1); - $storyref->{dept} =~ s/ /-/gi; + $storyref->{dept} =~ s/ /-/gi if $constants->{use_dept_space2dash}; $locktest = lockTest($storyref->{title}); @@ -1927,7 +1929,7 @@ my $tid_ref; my $default_set = 0; - $form->{dept} =~ s/ /-/g; + $form->{dept} =~ s/ /-/g if $constants->{use_dept_space2dash}; $form->{aid} = $slashdb->getStory($form->{sid}, 'aid', 1) unless $form->{aid}; @@ -2254,7 +2256,7 @@ my $tid_ref; my $default_set = 0; - $form->{dept} =~ s/ /-/g; + $form->{dept} =~ s/ /-/g if $constants->{use_dept_space2dash}; my($chosen_hr) = extractChosenFromForm($form); my($tids) = $slashdb->getTopiclistFromChosen($chosen_hr); Modified: slashjp/trunk/plugins/Admin/dump =================================================================== --- slashjp/trunk/plugins/Admin/dump 2007-10-15 05:33:58 UTC (rev 183) +++ slashjp/trunk/plugins/Admin/dump 2007-10-15 06:15:42 UTC (rev 184) @@ -41,6 +41,7 @@ INSERT INTO menus(id, menu, label, sel_label, value, seclev, showanon, menuorder) VALUES (NULL,'security','Config','config','[% gSkin.rootdir %]/admin.pl?op=topics',10000,0,9); INSERT INTO vars (name, value, description) VALUES ('admin_maxdays_divider', '14', 'Max number of days on the admin.pl story list to bother showing the day-dividers'); +INSERT INTO vars (name, value, description) VALUES ('use_dept_space2dash','1','convert spaces to dashes in dept. field'); INSERT INTO vars (name, value, description) VALUES ('ispell', 'ispell', 'Location of ispell binary or empty string to turn off'); INSERT INTO vars (name, value, description) VALUES ('ispell_is_really_aspell_with_lang', '', 'Some systems install aspell and a script that mimics the behavior of ispell; if yours does, set this to your preferred language name, e.g. "english"'); INSERT INTO vars (name, value, description) VALUES ('similarstorydays', '30', 'Number of days to look back for uncommon words when determining similar stories'); Modified: slashjp/trunk/plugins/Login/login.pl =================================================================== --- slashjp/trunk/plugins/Login/login.pl 2007-10-15 05:33:58 UTC (rev 183) +++ slashjp/trunk/plugins/Login/login.pl 2007-10-15 06:15:42 UTC (rev 184) @@ -11,6 +11,7 @@ use Slash::Utility; use Slash::XML; use Slash::LDAPDB; + use vars qw($VERSION); ($VERSION) = ' $Revision$ ' =~ /\$Revision:\s+([^\s]+)/; From svnnotify → sourceforge.jp Mon Oct 15 20:10:51 2007 From: svnnotify → sourceforge.jp (svnnotify → sourceforge.jp) Date: Mon, 15 Oct 2007 20:10:51 +0900 Subject: [Slashdotjp-dev 680] [185] remove miniAdminMenu: unnessesary Message-ID: <1192446651.344047.7389.nullmailer@users.sourceforge.jp> Revision: 185 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=185 Author: tach Date: 2007-10-15 20:10:51 +0900 (Mon, 15 Oct 2007) Log Message: ----------- remove miniAdminMenu: unnessesary Removed Paths: ------------- slashjp/trunk/themes/slashcode/templates/miniAdminMenu;users;default -------------- next part -------------- Deleted: slashjp/trunk/themes/slashcode/templates/miniAdminMenu;users;default =================================================================== --- slashjp/trunk/themes/slashcode/templates/miniAdminMenu;users;default 2007-10-15 06:15:42 UTC (rev 184) +++ slashjp/trunk/themes/slashcode/templates/miniAdminMenu;users;default 2007-10-15 11:10:51 UTC (rev 185) @@ -1,28 +0,0 @@ -__section__ -default -__description__ -A little admin menu ... should this be deleted? Is it used anymore? - -No specially passed variables. -__title__ - -__page__ -users -__lang__ -en_US -__name__ -miniAdminMenu -__template__ -
- -__seclev__ -10000 -__version__ -$Id$ From svnnotify → sourceforge.jp Tue Oct 16 12:05:01 2007 From: svnnotify → sourceforge.jp (svnnotify → sourceforge.jp) Date: Tue, 16 Oct 2007 12:05:01 +0900 Subject: [Slashdotjp-dev 681] [186] fix default maxstories value ( but user defined value has not been used yet) Message-ID: <1192503901.198733.31912.nullmailer@users.sourceforge.jp> Revision: 186 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=186 Author: tach Date: 2007-10-16 12:05:00 +0900 (Tue, 16 Oct 2007) Log Message: ----------- fix default maxstories value (but user defined value has not been used yet) Modified Paths: -------------- slashjp/trunk/themes/slashcode/htdocs/users.pl -------------- next part -------------- Modified: slashjp/trunk/themes/slashcode/htdocs/users.pl =================================================================== --- slashjp/trunk/themes/slashcode/htdocs/users.pl 2007-10-15 11:10:51 UTC (rev 185) +++ slashjp/trunk/themes/slashcode/htdocs/users.pl 2007-10-16 03:05:00 UTC (rev 186) @@ -2759,6 +2759,7 @@ my $user = getCurrentUser(); my $form = getCurrentForm(); my $constants = getCurrentStatic(); + my $gSkin = getCurrentSkin(); my($uid, $error); if ($user->{is_admin}) { @@ -2927,7 +2928,7 @@ slashboxes => checkList($slashboxes, 1024), - maxstories => (($form->{maxstories} > 0 && $form->{maxstories} <= 90) ? $form->{maxstories} : 30), + maxstories => (($form->{maxstories} > 0 && $form->{maxstories} <= 90) ? $form->{maxstories} : ($gSkin->{artcount_max} || 30)), noboxes => ($form->{useslashboxes} ? 0 : 1), lowbandwidth => ($form->{lowbandwidth} ? 1 : 0), simpledesign => ($form->{simpledesign} ? 1 : 0), @@ -2981,8 +2982,8 @@ getOtherUserParams($user_edits_table); if ($form->{restore_defaults}) { setToDefaults($user_edits_table, {}, { - maxstories => 30, - tzcode => "EST", + maxstories => $gSkin->{artcount_max} || 30, + tzcode => "JST", # XXX shouldn't this reset ALL the defaults, # not just these two? }); From svnnotify → sourceforge.jp Tue Oct 16 12:05:40 2007 From: svnnotify → sourceforge.jp (svnnotify → sourceforge.jp) Date: Tue, 16 Oct 2007 12:05:40 +0900 Subject: [Slashdotjp-dev 682] [187] merged from otp(slash original?) code Message-ID: <1192503940.566802.403.nullmailer@users.sourceforge.jp> Revision: 187 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=187 Author: tach Date: 2007-10-16 12:05:40 +0900 (Tue, 16 Oct 2007) Log Message: ----------- merged from otp(slash original?) code Modified Paths: -------------- slashjp/trunk/themes/slashcode/htdocs/index.pl -------------- next part -------------- Modified: slashjp/trunk/themes/slashcode/htdocs/index.pl =================================================================== --- slashjp/trunk/themes/slashcode/htdocs/index.pl 2007-10-16 03:05:00 UTC (rev 186) +++ slashjp/trunk/themes/slashcode/htdocs/index.pl 2007-10-16 03:05:40 UTC (rev 187) @@ -780,7 +780,7 @@ } if ($user->{seclev} >= 100) { - push @links, [ "$gSkin->{absolutedir}/admin.pl?op=edit&sid=$story->{sid}", getData('edit'), '', 'edit' ]; + push @links, [ "$gSkin->{rootdir}/admin.pl?op=edit&sid=$story->{sid}", getData('edit'), '', 'edit' ]; if ($constants->{plugin}{Ajax}) { my $signoff = slashDisplay("signoff", { stoid => $story->{stoid}, storylink => 1 }, { Return => 1 } ); push @links, $signoff; From svnnotify → sourceforge.jp Tue Oct 16 12:14:55 2007 From: svnnotify → sourceforge.jp (svnnotify → sourceforge.jp) Date: Tue, 16 Oct 2007 12:14:55 +0900 Subject: [Slashdotjp-dev 683] [188] * Change running time for JST Message-ID: <1192504495.553397.7222.nullmailer@users.sourceforge.jp> Revision: 188 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=188 Author: tach Date: 2007-10-16 12:14:55 +0900 (Tue, 16 Oct 2007) Log Message: ----------- * Change running time for JST * Fix line folding nums (calc correctly for double-width charactors) - However, This fix will break renderd text format Modified Paths: -------------- slashjp/trunk/themes/slashcode/tasks/daily.pl slashjp/trunk/themes/slashcode/tasks/run_portald.pl -------------- next part -------------- Modified: slashjp/trunk/themes/slashcode/tasks/daily.pl =================================================================== --- slashjp/trunk/themes/slashcode/tasks/daily.pl 2007-10-16 03:05:40 UTC (rev 187) +++ slashjp/trunk/themes/slashcode/tasks/daily.pl 2007-10-16 03:14:55 UTC (rev 188) @@ -16,7 +16,7 @@ # GMT if you installed everything correctly. So 2:00 AM GMT is a good # sort of midnightish time for the Western Hemisphere. Adjust for # your audience and admins. -$task{$me}{timespec} = '2 0 * * *'; +$task{$me}{timespec} = '5 0 * * *'; # 9:05 AM JST $task{$me}{timespec_panic_2} = ''; # if major panic, dailyStuff can wait $task{$me}{fork} = SLASHD_NOWAIT; $task{$me}{code} = sub { @@ -117,7 +117,15 @@ my $asciitext = $story{introtext}; $asciitext .= "\n\n" . $story{bodytext} if $constants->{newsletter_body}; - ($story{asciitext}, @ref) = html2text($asciitext, 74); + if ($constants->{tweak_japanese}) { + require Jcode; + @ref = (); + $story{asciitext} = strip_notags($asciitext); + $story{asciitext} =~ tr/\n//; + $story{asciitext} = Encode::decode('utf-8', join("\n", Jcode->new(Encode::encode('utf-8', $story{asciitext}), 'utf8')->jfold(74))); + } else { + ($story{asciitext}, @ref) = html2text($asciitext, 74); + } $story{refs} = \@ref; push @$stories, \%story; Modified: slashjp/trunk/themes/slashcode/tasks/run_portald.pl =================================================================== --- slashjp/trunk/themes/slashcode/tasks/run_portald.pl 2007-10-16 03:05:40 UTC (rev 187) +++ slashjp/trunk/themes/slashcode/tasks/run_portald.pl 2007-10-16 03:14:55 UTC (rev 188) @@ -10,7 +10,7 @@ use vars qw( %task $me ); -$task{$me}{timespec} = '37 * * * *'; +$task{$me}{timespec} = '7,37 * * * *'; $task{$me}{timespec_panic_1} = ''; # not that important $task{$me}{fork} = SLASHD_NOWAIT; $task{$me}{code} = sub { From svnnotify → sourceforge.jp Tue Oct 16 13:15:40 2007 From: svnnotify → sourceforge.jp (svnnotify → sourceforge.jp) Date: Tue, 16 Oct 2007 13:15:40 +0900 Subject: [Slashdotjp-dev 684] [189] merge senna search code from OTP Message-ID: <1192508140.686652.10826.nullmailer@users.sourceforge.jp> Revision: 189 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=189 Author: tach Date: 2007-10-16 13:15:40 +0900 (Tue, 16 Oct 2007) Log Message: ----------- merge senna search code from OTP Modified Paths: -------------- slashjp/trunk/plugins/Search/Search.pm slashjp/trunk/plugins/Search/search.pl slashjp/trunk/plugins/Search/templates/searchform;search;default -------------- next part -------------- Modified: slashjp/trunk/plugins/Search/Search.pm =================================================================== --- slashjp/trunk/plugins/Search/Search.pm 2007-10-16 03:14:55 UTC (rev 188) +++ slashjp/trunk/plugins/Search/Search.pm 2007-10-16 04:15:40 UTC (rev 189) @@ -38,9 +38,10 @@ # select comment ID, comment Title, Author, Email, link to comment # and SID, article title, type and a link to the article $form->{query} = $self->_cleanQuery($form->{query}); - my $query = $self->sqlQuote($form->{query}); + my $query = $self->_fixupQuerySql($form->{query}); my $constants = getCurrentStatic(); my $columns; + $columns .= "SQL_CALC_FOUND_ROWS "; $columns .= "primaryskid, url, discussions.uid AS author_uid, discussions.title AS title, "; $columns .= "pid, subject, ts, date, comments.uid AS uid, cid, "; $columns .= "discussions.id AS did, dkid, discussions.sid"; @@ -91,6 +92,7 @@ $other .= " LIMIT $start, $limit" if $limit; my $search = $self->sqlSelectAllHashrefArray($columns, $tables, $where, $other ); + $self->sqlDo('SET @totalhits = FOUND_ROWS();'); my $desc = $reader->getDescriptions('discussion_kinds'); foreach my $c (@$search) { @@ -111,10 +113,10 @@ # userSearch REALLY doesn't need to be ordered by keyword since you # only care if the substring is found. $form->{query} = $self->_cleanQuery($form->{query}); - my $query = $self->sqlQuote($form->{query}); + my $query = $self->_fixupQuerySql($form->{query}); my $constants = getCurrentStatic(); - my $columns = 'fakeemail,nickname,users.uid as uid,journal_last_entry_date '; + my $columns = 'SQL_CALC_FOUND_ROWS fakeemail,nickname,users.uid as uid,journal_last_entry_date '; $columns .= ", TRUNCATE( " . $self->_score('nickname', $form->{query}, $constants->{search_method}) . ", 1) as score " if $form->{query}; @@ -138,6 +140,7 @@ $other .= " LIMIT $start, $limit" if $limit; my $users = $self->sqlSelectAllHashrefArray($columns, $tables, $where, $other ); + $self->sqlDo('SET @totalhits = FOUND_ROWS();'); return $users; } @@ -150,9 +153,10 @@ my $constants = getCurrentStatic(); $form->{query} = $self->_cleanQuery($form->{query}); - my $query = $self->sqlQuote($form->{query}); + my $query = $self->_fixupQuerySql($form->{query}); my $columns; - $columns .= "title, stories.stoid AS stoid, sid, "; + $columns .= "SQL_CALC_FOUND_ROWS "; + $columns .= "title, stories.stoid AS stoid, sid, dept, "; $columns .= "time, commentcount, stories.primaryskid AS skid, "; $columns .= "introtext "; if ($form->{query}) { @@ -196,7 +200,7 @@ map { $reader->sqlQuote($_) } grep { $_ != $gSkin->{skid} } # allow searching on THIS skid @{$constants->{search_ignore_skids}}; - $where .= " AND primaryskid NOT IN ($skid_list) "; + $where .= " AND primaryskid NOT IN ($skid_list) " if ($skid_list); } my $skin = $reader->getSkin($form->{section} || $gSkin->{skid}); @@ -269,6 +273,7 @@ $other .= " LIMIT $start, $limit" if $limit; my $stories = $self->sqlSelectAllHashrefArray($columns, $tables, $where, $other); + $self->sqlDo('SET @totalhits = FOUND_ROWS();'); # Don't return just one topic id in tid, also return an arrayref # in tids, with all topic ids in the preferred order. @@ -305,8 +310,9 @@ my $constants = getCurrentStatic(); $form->{query} = $self->_cleanQuery($form->{query}); - my $query = $self->sqlQuote($form->{query}); + my $query = $self->_fixupQuerySql($form->{query}); my $columns; + $columns .= "SQL_CALC_FOUND_ROWS "; $columns .= "users.nickname as nickname, journals.description as description, "; $columns .= "journals.id as id, date, users.uid as uid, article"; $columns .= ", TRUNCATE((( " . $self->_score('description', $form->{query}, $constants->{search_method}) . " + " . $self->_score('article', $form->{query}, $constants->{search_method}) .") / 2), 1) as score " @@ -334,6 +340,7 @@ $other .= " LIMIT $start, $limit" if $limit; my $stories = $self->sqlSelectAllHashrefArray($columns, $tables, $where, $other ); + $self->sqlDo('SET @totalhits = FOUND_ROWS();'); return $stories; } @@ -345,8 +352,8 @@ my $constants = getCurrentStatic(); $form->{query} = $self->_cleanQuery($form->{query}); - my $query = $self->sqlQuote($form->{query}); - my $columns = "*"; + my $query = $self->_fixupQuerySql($form->{query}); + my $columns = "SQL_CALC_FOUND_ROWS *"; $columns .= ", TRUNCATE( " . $self->_score('question', $form->{query}, $constants->{search_method}) . ", 1) as score " if $form->{query}; my $tables = "pollquestions"; @@ -377,6 +384,7 @@ $other .= " LIMIT $start, $limit" if $limit; my $stories = $self->sqlSelectAllHashrefArray($columns, $tables, $where, $other); + $self->sqlDo('SET @totalhits = FOUND_ROWS();'); return $stories; } @@ -389,8 +397,8 @@ my $reader = getObject('Slash::DB', { db_type => 'reader' }); $form->{query} = $self->_cleanQuery($form->{query}); - my $query = $self->sqlQuote($form->{query}); - my $columns = "*"; + my $query = $self->_fixupQuerySql($form->{query}); + my $columns = "SQL_CALC_FOUND_ROWS *"; $columns .= ", TRUNCATE( " . $self->_score('subj,story', $form->{query}, $constants->{search_method}) . ", 1) as score " if $form->{query}; my $tables = "submissions"; @@ -421,6 +429,7 @@ $other .= " LIMIT $start, $limit" if $limit; my $stories = $self->sqlSelectAllHashrefArray($columns, $tables, $where, $other ); + $self->sqlDo('SET @totalhits = FOUND_ROWS();'); return $stories; } @@ -432,8 +441,8 @@ my $constants = getCurrentStatic(); $form->{query} = $self->_cleanQuery($form->{query}); - my $query = $self->sqlQuote($form->{query}); - my $columns = "title, link, description, created"; + my $query = $self->_fixupQuerySql($form->{query}); + my $columns = "SQL_CALC_FOUND_ROWS title, link, description, created"; $columns .= ", TRUNCATE( " . $self->_score('title,description', $form->{query}, $constants->{search_method}) . ", 1) as score " if $form->{query}; my $tables = "rss_raw"; @@ -455,6 +464,7 @@ $other .= " LIMIT $start, $limit" if $limit; my $stories = $self->sqlSelectAllHashrefArray($columns, $tables, $where, $other ); + $self->sqlDo('SET @totalhits = FOUND_ROWS();'); return $stories; } @@ -463,11 +473,11 @@ sub findDiscussion { my($self, $form, $start, $limit, $sort) = @_; $form->{query} = $self->_cleanQuery($form->{query}); - my $query = $self->sqlQuote($form->{query}); + my $query = $self->_fixupQuerySql($form->{query}); my $constants = getCurrentStatic(); $start ||= 0; - my $columns = "*"; + my $columns = "SQL_CALC_FOUND_ROWS *"; $columns .= ", TRUNCATE( " . $self->_score('title', $form->{query}, $constants->{search_method}) . ", 1) as score " if $form->{query}; my $tables = "discussions"; @@ -509,6 +519,7 @@ $other .= " LIMIT $start, $limit" if $limit; # print STDERR "select $columns from $tables where $where $other\n"; my $stories = $self->sqlSelectAllHashrefArray($columns, $tables, $where, $other ); + $self->sqlDo('SET @totalhits = FOUND_ROWS();'); return $stories; } @@ -557,7 +568,7 @@ } return "($method($col, $terms))"; } else { - $query = $self->sqlQuote($query); + $query = $self->_fixupQuerySql($query); return "\n(MATCH ($col) AGAINST ($query))\n"; } } @@ -567,17 +578,25 @@ my ($self, $query) = @_; # This next line could be removed -Brian # get rid of bad characters - $query =~ s/[^A-Z0-9'. :\/_]/ /gi; + #$query =~ s/[^A-Z0-9'. :\/_]/ /gi; + $query =~ s/[\x00-\x20\x27\x60\x7f]+/ /gi; # This should be configurable -Brian # truncate query length - if (length($query) > 40) { - $query = substr($query, 0, 40); + if (length($query) > 200) { + $query = substr($query, 0, 200); } return $query; } +sub _fixupQuerySql { + my ($self, $query) = @_; + if (substr($query, 0, 1) ne '*') { + $query = "*D+ ${query}"; + } + return $self->sqlQuote($query) . ' IN BOOLEAN MODE'; +} ################################################################# sub DESTROY { Modified: slashjp/trunk/plugins/Search/search.pl =================================================================== --- slashjp/trunk/plugins/Search/search.pl 2007-10-16 03:14:55 UTC (rev 188) +++ slashjp/trunk/plugins/Search/search.pl 2007-10-16 04:15:40 UTC (rev 189) @@ -81,7 +81,7 @@ $form->{op} = 'stories' if !exists($ops_rss{$form->{op}}); $ops_rss{$form->{op}}->($form, $constants, $slashdb, $searchDB, $gSkin); } else { - my $text = strip_notags($form->{query}); + my $text = strip_attribute($form->{query}); my $header_title = getData('search_header_title', { text => $text }); my $titlebar_title = getData('search_titlebar_title', { text => $text }); header($header_title) or return; @@ -171,6 +171,7 @@ my $start = $form->{start} || 0; my $comments = $searchDB->findComments($form, $start, $constants->{search_default_display} + 1, $form->{sort}); + my $totalhits = $searchDB->sqlSelect('@totalhits'); my $formats = $slashdb->getDescriptions('threshcodes'); my $threshold_select = createSelect( @@ -186,6 +187,7 @@ 'sort' => _sort(), threshhold => 1, threshold_select => $threshold_select, + totalhits => $totalhits, }); if ($comments && @$comments) { @@ -216,6 +218,7 @@ forward => $forward, args => _buildargs($form), start => $start, + totalhits => $totalhits, }); } else { print getData('nocomments'); @@ -228,10 +231,12 @@ my $start = $form->{start} || 0; my $users = $searchDB->findUsers($form, $start, $constants->{search_default_display} + 1, $form->{sort}, $form->{journal_only}); + my $totalhits = $searchDB->sqlSelect('@totalhits'); slashDisplay('searchform', { op => $form->{op}, 'sort' => _sort(), journal_option => 1, + totalhits => $totalhits, }); if ($users && @$users) { @@ -261,6 +266,7 @@ back => $back, forward => $forward, args => _buildargs($form), + totalhits => $totalhits, }); } else { print getData('nousers'); @@ -273,6 +279,7 @@ my $start = $form->{start} || 0; my $stories = $searchDB->findStory($form, $start, $constants->{search_default_display} + 1, $form->{sort}); + my $totalhits = $searchDB->sqlSelect('@totalhits'); my $topic_ref = $form->{tid} ? $slashdb->getTopic($form->{tid}) : { }; slashDisplay('searchform', { @@ -282,6 +289,7 @@ op => $form->{op}, authors => _authors(), 'sort' => _sort(), + totalhits => $totalhits, }); if ($stories && @$stories) { @@ -316,6 +324,7 @@ forward => $forward, args => _buildargs($form), start => $start, + totalhits => $totalhits, }); } else { print getData('nostories'); @@ -328,6 +337,7 @@ my $start = $form->{start} || 0; my $polls = $searchDB->findPollQuestion($form, $start, $constants->{search_default_display} + 1, $form->{sort}); + my $totalhits = $searchDB->sqlSelect('@totalhits'); my $topic_ref = $form->{tid} ? $slashdb->getTopic($form->{tid}) : { }; slashDisplay('searchform', { op => $form->{op}, @@ -335,6 +345,7 @@ # sections => 1, # _skins(), tref => $topic_ref, 'sort' => _sort(), + totalhits => $totalhits, }); if ($polls && @$polls) { @@ -365,6 +376,7 @@ forward => $forward, args => _buildargs($form), start => $start, + totalhits => $totalhits, }); } else { print getData('nopolls'); @@ -522,9 +534,11 @@ my $start = $form->{start} || 0; my $entries = $searchDB->findJournalEntry($form, $start, $constants->{search_default_display} + 1, $form->{sort}); + my $totalhits = $searchDB->sqlSelect('@totalhits'); slashDisplay('searchform', { op => $form->{op}, 'sort' => _sort(), + totalhits => $totalhits, }); # check for extra articles ... we request one more than we need @@ -559,6 +573,7 @@ forward => $forward, args => _buildargs($form), start => $start, + totalhits => $totalhits, }); } else { print getData('nojournals'); @@ -603,6 +618,7 @@ my $start = $form->{start} || 0; my $entries = $searchDB->findSubmission($form, $start, $constants->{search_default_display} + 1, $form->{sort}); + my $totalhits = $searchDB->sqlSelect('@totalhits'); my $topic_ref = $form->{tid} ? $slashdb->getTopic($form->{tid}) : { }; slashDisplay('searchform', { op => $form->{op}, @@ -611,6 +627,7 @@ submission_notes => $slashdb->getDescriptions('submission-notes'), tref => $topic_ref, 'sort' => _sort(), + totalhits => $totalhits, }); # check for extra articles ... we request one more than we need @@ -645,6 +662,7 @@ forward => $forward, args => _buildargs($form), start => $start, + totalhits => $totalhits, }); } else { print getData('nosubmissions'); Modified: slashjp/trunk/plugins/Search/templates/searchform;search;default =================================================================== --- slashjp/trunk/plugins/Search/templates/searchform;search;default 2007-10-16 03:14:55 UTC (rev 188) +++ slashjp/trunk/plugins/Search/templates/searchform;search;default 2007-10-16 04:15:40 UTC (rev 189) @@ -22,9 +22,9 @@