mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
Merge branch 'MDL-50307-master-3' of git://github.com/xow/moodle
This commit is contained in:
commit
b7759a1889
@ -110,7 +110,7 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
|
||||
$authdb = $this->db_init();
|
||||
|
||||
$rs = $authdb->Execute("SELECT {$this->config->fieldpass} AS userpass
|
||||
$rs = $authdb->Execute("SELECT {$this->config->fieldpass}
|
||||
FROM {$this->config->table}
|
||||
WHERE {$this->config->fielduser} = '".$this->ext_addslashes($extusername)."'");
|
||||
if (!$rs) {
|
||||
@ -125,7 +125,7 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
}
|
||||
|
||||
$fields = array_change_key_case($rs->fields, CASE_LOWER);
|
||||
$fromdb = $fields['userpass'];
|
||||
$fromdb = $fields[strtolower($this->config->fieldpass)];
|
||||
$rs->Close();
|
||||
$authdb->Close();
|
||||
|
||||
@ -217,18 +217,21 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
if ($selectfields) {
|
||||
$select = array();
|
||||
foreach ($selectfields as $localname=>$externalname) {
|
||||
$select[] = "$externalname AS $localname";
|
||||
$select[] = "$externalname";
|
||||
}
|
||||
$select = implode(', ', $select);
|
||||
$sql = "SELECT $select
|
||||
FROM {$this->config->table}
|
||||
WHERE {$this->config->fielduser} = '".$this->ext_addslashes($extusername)."'";
|
||||
|
||||
if ($rs = $authdb->Execute($sql)) {
|
||||
if (!$rs->EOF) {
|
||||
$fields_obj = $rs->FetchObj();
|
||||
$fields_obj = (object)array_change_key_case((array)$fields_obj , CASE_LOWER);
|
||||
foreach ($selectfields as $localname=>$externalname) {
|
||||
$result[$localname] = core_text::convert($fields_obj->{strtolower($localname)}, $this->config->extencoding, 'utf-8');
|
||||
$fields = $rs->FetchRow();
|
||||
// Convert the associative array to an array of its values so we don't have to worry about the case of its keys.
|
||||
$fields = array_values($fields);
|
||||
foreach (array_keys($selectfields) as $index => $localname) {
|
||||
$value = $fields[$index];
|
||||
$result[$localname] = core_text::convert($value, $this->config->extencoding, 'utf-8');
|
||||
}
|
||||
}
|
||||
$rs->Close();
|
||||
@ -487,15 +490,15 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
$authdb = $this->db_init();
|
||||
|
||||
// Fetch userlist.
|
||||
$rs = $authdb->Execute("SELECT {$this->config->fielduser} AS username
|
||||
$rs = $authdb->Execute("SELECT {$this->config->fielduser}
|
||||
FROM {$this->config->table} ");
|
||||
|
||||
if (!$rs) {
|
||||
print_error('auth_dbcantconnect','auth_db');
|
||||
} else if (!$rs->EOF) {
|
||||
while ($rec = $rs->FetchRow()) {
|
||||
$rec = (object)array_change_key_case((array)$rec , CASE_LOWER);
|
||||
array_push($result, $rec->username);
|
||||
$rec = array_change_key_case((array)$rec, CASE_LOWER);
|
||||
array_push($result, $rec[strtolower($this->config->fielduser)]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3502,8 +3502,7 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1
|
||||
$key = $o->name;
|
||||
break;
|
||||
}
|
||||
$val = $this->fetchMode == ADODB_FETCH_ASSOC ? $o->name : $i;
|
||||
$this->bind[$key] = $val;
|
||||
$this->bind[$key] = $i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,5 +22,9 @@ Added:
|
||||
|
||||
Our changes:
|
||||
* Removed random seed initialization from lib/adodb/adodb.inc.php:177 (see 038f546 and MDL-41198).
|
||||
* Added commit to fix associative fetch mode https://github.com/ADOdb/ADOdb/commit/97c3afacb3e4f98195908101bf3621e5cc847635
|
||||
When upgrading ADODB to 5.20 or higher, check
|
||||
whether that commit was included and if not
|
||||
remove this item
|
||||
|
||||
skodak, iarenaza, moodler, stronk7
|
||||
|
Loading…
x
Reference in New Issue
Block a user