]> git.mjollnir.org Git - moodle.git/commitdiff
Prevent +/- operators (REGEXP) on messages search. MDL-7312
authorstronk7 <stronk7>
Tue, 31 Oct 2006 20:22:10 +0000 (20:22 +0000)
committerstronk7 <stronk7>
Tue, 31 Oct 2006 20:22:10 +0000 (20:22 +0000)
Merged from MOODLE_17_STABLE

message/lib.php

index 52edb75e4c0d1eaceef9050a19f0cb56411a70b5..72a9aa612fea1f8bfdb04ad47edd135cfccae668 100644 (file)
@@ -739,6 +739,12 @@ function message_search($searchterms, $fromme=true, $tome=true, $courseid='none'
         if (strlen($searchterm) < 2) {
             continue;
         }
+    /// Under Oracle and MSSQL, trim the + and - operators and perform
+    /// simpler LIKE search
+        if ($CFG->dbtype == 'oci8po' || $CFG->dbtype == 'mssql' || $CFG->dbtype == 'mssql_n' || $CFG->dbtype == 'odbc_mssql') {
+            $searchterm = trim($searchterm, '+-');
+        }
+
         if ($messagesearch) {
             $messagesearch .= " AND ";
         }