Browse code

modules/challenges/otherresults.php: change filter to match other patched modules

Clarissa Walker authored on 2026/11/03 14:45:51
Showing 1 changed files
... ...
@@ -50,10 +50,10 @@ if(is_array($catid) && count($catid) > 0) {
50 50
 	// Now implode the SQL list
51 51
 	if(!empty($cats)) $chalquery[] = "(".implode(" OR ", $cats).")";
52 52
 }
53
+if($searchterm !== false) $searchterm = str_replace(array('%', '_'), array('\\%', '\\_'), escapestring($searchterm));
53 54
 if($searchterm) {
54
-	$ef_st = escapestring(str_replace(array('\\', '%', '_'), array('\\\\', '\\%', '\\_'), stripslashes($searchterm)));
55
-	if($searchtype == "title") $chalquery[] = "title LIKE '%$ef_st%'";
56
-	if($searchtype == "summary") $chalquery[] = "summary LIKE '%$ef_st%'";
55
+	if($searchtype == "title") $chalquery[] = "title LIKE '%$searchterm%'";
56
+	if($searchtype == "summary") $chalquery[] = "summary LIKE '%$searchterm%'";
57 57
 }
58 58
 if(count($chalquery) > 0) {
59 59
 	$chalquery = "WHERE ".implode(" AND ", $chalquery);
Browse code

Security patches from upstream - and general cleanup of old hacks

Clarissa Walker authored on 2026/10/31 20:10:45
Showing 1 changed files
... ...
@@ -51,8 +51,9 @@ if(is_array($catid) && count($catid) > 0) {
51 51
 	if(!empty($cats)) $chalquery[] = "(".implode(" OR ", $cats).")";
52 52
 }
53 53
 if($searchterm) {
54
-	if($searchtype == "title") $chalquery[] = "title LIKE '%$searchterm%'";
55
-	if($searchtype == "summary") $chalquery[] = "summary LIKE '%$searchterm%'";
54
+	$ef_st = escapestring(str_replace(array('\\', '%', '_'), array('\\\\', '\\%', '\\_'), stripslashes($searchterm)));
55
+	if($searchtype == "title") $chalquery[] = "title LIKE '%$ef_st%'";
56
+	if($searchtype == "summary") $chalquery[] = "summary LIKE '%$ef_st%'";
56 57
 }
57 58
 if(count($chalquery) > 0) {
58 59
 	$chalquery = "WHERE ".implode(" AND ", $chalquery);
... ...
@@ -63,4 +64,4 @@ if(count($chalquery) > 0) {
63 64
 }
64 65
 	unset($where, $query, $chars, $cats);
65 66
 }
66
-?>
67 67
\ No newline at end of file
68
+?>
Browse code

3.5.6 efiction version

Jimako authored on 2024/03/09 16:09:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,66 @@
1
+<?php
2
+// ----------------------------------------------------------------------
3
+// Copyright (c) 2007 by Tammy Keefer
4
+// Based on eFiction 1.1
5
+// Copyright (C) 2003 by Rebecca Smallwood.
6
+// http://efiction.sourceforge.net/
7
+// ----------------------------------------------------------------------
8
+// LICENSE
9
+//
10
+// This program is free software; you can redistribute it and/or
11
+// modify it under the terms of the GNU General Public License (GPL)
12
+// as published by the Free Software Foundation; either version 2
13
+// of the License, or (at your option) any later version.
14
+//
15
+// This program is distributed in the hope that it will be useful,
16
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
+// GNU General Public License for more details.
19
+//
20
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
21
+// ----------------------------------------------------------------------
22
+
23
+if(!defined("_CHARSET")) exit( );
24
+
25
+if(file_exists(_BASEDIR."modules/challenges/languages/{$language}.php")) include_once(_BASEDIR."modules/challenges/languages/{$language}.php");
26
+else include_once(_BASEDIR."modules/challenges/languages/en.php");
27
+if(empty($type) || $type != "challenges") { // If you're already browsing challenges no sense putting them in the other results.
28
+$chalquery = array( );
29
+if(isset($charid)) {
30
+	if(!is_array($charid)) $charid = array($charid);
31
+	if(count($charid) > 0) {
32
+		foreach($charid as $c) {
33
+			$chars[] = "FIND_IN_SET('$c', characters) > 0";
34
+		}
35
+		$chalquery[] = implode(" OR ", $chars);
36
+	}
37
+}
38
+if(is_array($catid) && count($catid) > 0) {
39
+	$categories = array( );
40
+	// Get the recursive list.
41
+	foreach($catid as $cat) {
42
+		if($cat == "false" || empty($cat) || $cat == -1) continue;
43
+		$categories = array_merge($categories, recurseCategories($cat));
44
+	}
45
+	// Now format the SQL
46
+	$cats = array( );
47
+	foreach($categories as $cat) {
48
+		$cats[] = "FIND_IN_SET($cat, catid) > 0 ";
49
+	}
50
+	// Now implode the SQL list
51
+	if(!empty($cats)) $chalquery[] = "(".implode(" OR ", $cats).")";
52
+}
53
+if($searchterm) {
54
+	if($searchtype == "title") $chalquery[] = "title LIKE '%$searchterm%'";
55
+	if($searchtype == "summary") $chalquery[] = "summary LIKE '%$searchterm%'";
56
+}
57
+if(count($chalquery) > 0) {
58
+	$chalquery = "WHERE ".implode(" AND ", $chalquery);
59
+	$query = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_challenges $chalquery");
60
+	$challenges = dbnumrows($query);
61
+
62
+	if($challenges > 0) $otherresults[] = "<a href='browse.php?type=challenges&amp;$terms'>$challenges "._CHALLENGES."</a>";
63
+}
64
+	unset($where, $query, $chars, $cats);
65
+}
66
+?>
0 67
\ No newline at end of file