diff --git a/mod/glossary/edit.php b/mod/glossary/edit.php index 67054721e1b..45e84a91e2c 100644 --- a/mod/glossary/edit.php +++ b/mod/glossary/edit.php @@ -32,12 +32,6 @@ if (! $glossary = get_record("glossary", "id", $cm->instance)) { error("Course module is incorrect"); } -if ($CFG->dbtype == 'postgres7' ) { - $lcase = 'lower'; -} else { - $lcase = 'lcase'; -} - if ($e) { // if entry is sepcified require_capability('mod/glossary:manageentries', $context); } else { // new entry @@ -139,7 +133,7 @@ if ( $confirm ) { $permissiongranted = 1; if ( !$glossary->allowduplicatedentries ) { - if ($dupentries = get_records("glossary_entries","$lcase(concept)", moodle_strtolower($newentry->concept))) { + if ($dupentries = get_records("glossary_entries","lower(concept)", moodle_strtolower($newentry->concept))) { foreach ($dupentries as $curentry) { if ( $glossary->id == $curentry->glossaryid ) { if ( $curentry->id != $e ) { @@ -179,7 +173,7 @@ if ( $confirm ) { $permissiongranted = 1; if ( !$glossary->allowduplicatedentries ) { - if ($dupentries = get_record("glossary_entries","$lcase(concept)", moodle_strtolower($newentry->concept), "glossaryid", $glossary->id)) { + if ($dupentries = get_record("glossary_entries","lower(concept)", moodle_strtolower($newentry->concept), "glossaryid", $glossary->id)) { $permissiongranted = 0; } } diff --git a/mod/glossary/exportentry.php b/mod/glossary/exportentry.php index d7f60bd22ef..bc3e0c79627 100644 --- a/mod/glossary/exportentry.php +++ b/mod/glossary/exportentry.php @@ -23,12 +23,6 @@ } } - if ($CFG->dbtype == 'postgres7' ) { - $lcase = 'lower'; - } else { - $lcase = 'lcase'; - } - $context = get_context_instance(CONTEXT_MODULE, $cm->id); require_capability('mod/glossary:export', $context); @@ -61,7 +55,7 @@ } else { if ( ! $mainglossary->allowduplicatedentries ) { - $dupentry = get_record('glossary_entries','glossaryid', $mainglossary->id, $lcase.'(concept)',moodle_strtolower(addslashes($entry->concept))); + $dupentry = get_record('glossary_entries','glossaryid', $mainglossary->id, 'lower(concept)',moodle_strtolower(addslashes($entry->concept))); if ( $dupentry ) { $PermissionGranted = 0; } diff --git a/mod/glossary/import.php b/mod/glossary/import.php index f91bd6d846d..1a83a4bca34 100644 --- a/mod/glossary/import.php +++ b/mod/glossary/import.php @@ -226,11 +226,7 @@ if ( $newentry->casesensitive ) { $dupentry = get_record("glossary_entries","concept",$newentry->concept,"glossaryid",$glossary->id); } else { - if ($CFG->dbtype == 'postgres7') { - $dupentry = get_record("glossary_entries","lower(concept)",moodle_strtolower($newentry->concept),"glossaryid",$glossary->id); - }else { - $dupentry = get_record("glossary_entries","lcase(concept)",moodle_strtolower($newentry->concept),"glossaryid",$glossary->id); - } + $dupentry = get_record("glossary_entries","lower(concept)",moodle_strtolower($newentry->concept),"glossaryid",$glossary->id); } if ($dupentry) { $permissiongranted = 0; diff --git a/mod/glossary/sql.php b/mod/glossary/sql.php index 75d51e6b316..a8c83715117 100644 --- a/mod/glossary/sql.php +++ b/mod/glossary/sql.php @@ -95,7 +95,7 @@ } else { $usernamefield = sql_fullname('u.lastname' , 'u.firsttname'); } - $where = "AND left(ucase($usernamefield)," . $textlib->strlen($hook, current_charset()) . ") = '$hook'"; + $where = "AND left(upper($usernamefield)," . $textlib->strlen($hook, current_charset()) . ") = '$hook'"; break; } if ( $hook == 'ALL' ) { @@ -121,7 +121,7 @@ $where = 'AND substr(upper(concept),1,' . $textlib->strlen($hook, current_charset()) . ') = \'' . $textlib->strtoupper($hook, current_charset()) . '\''; break; case 'mysql': - $where = 'AND left(ucase(concept),' . $textlib->strlen($hook, current_charset()) . ") = '$hook'"; + $where = 'AND left(upper(concept),' . $textlib->strlen($hook, current_charset()) . ") = '$hook'"; break; } } @@ -251,7 +251,7 @@ $where = 'AND substr(upper(concept),1,' . $textlib->strlen($hook, current_charset()) . ') = \'' . $textlib->strtoupper($hook, current_charset()) . '\''; break; case 'mysql': - $where = 'AND left(ucase(concept),' . $textlib->strlen($hook, current_charset()) . ") = '" . $textlib->strtoupper($hook, current_charset()) . "'"; + $where = 'AND left(upper(concept),' . $textlib->strlen($hook, current_charset()) . ") = '" . $textlib->strtoupper($hook, current_charset()) . "'"; break; } } @@ -270,7 +270,7 @@ $where = 'AND substr(upper(concept),1,1) NOT IN (' . $textlib->strtoupper($sqlalphabet, current_charset()) . ')'; break; case 'mysql': - $where = 'AND left(ucase(concept),1) NOT IN (' . $textlib->strtoupper($sqlalphabet, current_charset()) . ')'; + $where = 'AND left(upper(concept),1) NOT IN (' . $textlib->strtoupper($sqlalphabet, current_charset()) . ')'; break; } }