Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
2f1e464a
Commit
2f1e464a
authored
Aug 06, 2013
by
Petr Škoda
Browse files
MDL-40438 migrate all collatorlib:: and textlib:: uses
parent
e7c21ac3
Changes
127
Hide whitespace changes
Inline
Side-by-side
admin/blocks.php
View file @
2f1e464a
...
...
@@ -115,7 +115,7 @@
$blocknames
[
$blockid
]
=
$blockname
;
}
}
collator
lib
::
asort
(
$blocknames
);
core_
collator
::
asort
(
$blocknames
);
foreach
(
$blocknames
as
$blockid
=>
$strblockname
)
{
$block
=
$blocks
[
$blockid
];
...
...
admin/localplugins.php
View file @
2f1e464a
...
...
@@ -55,7 +55,7 @@ foreach (core_component::get_plugin_list('local') as $plugin => $plugindir) {
}
$plugins
[
$plugin
]
=
$strpluginname
;
}
collator
lib
::
asort
(
$plugins
);
core_
collator
::
asort
(
$plugins
);
foreach
(
$plugins
as
$plugin
=>
$name
)
{
$uninstall
=
''
;
...
...
admin/mnet/access_control.php
View file @
2f1e464a
...
...
@@ -103,7 +103,7 @@ if ($form = data_submitted() and confirm_sesskey()) {
$usernames
=
explode
(
','
,
$form
->
username
);
foreach
(
$usernames
as
$username
)
{
$username
=
trim
(
text
lib
::
strtolower
(
$username
));
$username
=
trim
(
core_
text
::
strtolower
(
$username
));
if
(
!
empty
(
$username
))
{
if
(
mnet_update_sso_access_control
(
$username
,
$form
->
mnet_host_id
,
$form
->
accessctrl
))
{
if
(
$form
->
accessctrl
==
'allow'
)
{
...
...
admin/registration/forms.php
View file @
2f1e464a
...
...
@@ -137,8 +137,8 @@ class hub_selector_form extends moodleform {
$options
=
array
();
foreach
(
$hubs
as
$hub
)
{
//to not display a name longer than 100 character (too big)
if
(
text
lib
::
strlen
(
$hub
[
'name'
])
>
100
)
{
$hubname
=
text
lib
::
substr
(
$hub
[
'name'
],
0
,
100
);
if
(
core_
text
::
strlen
(
$hub
[
'name'
])
>
100
)
{
$hubname
=
core_
text
::
substr
(
$hub
[
'name'
],
0
,
100
);
$hubname
=
$hubname
.
"..."
;
}
else
{
$hubname
=
$hub
[
'name'
];
...
...
@@ -287,7 +287,7 @@ class site_registration_form extends moodleform {
$mform
->
addHelpButton
(
'description'
,
'sitedesc'
,
'hub'
);
$languages
=
get_string_manager
()
->
get_list_of_languages
();
collator
lib
::
asort
(
$languages
);
core_
collator
::
asort
(
$languages
);
$mform
->
addElement
(
'select'
,
'language'
,
get_string
(
'sitelang'
,
'hub'
),
$languages
);
$mform
->
setType
(
'language'
,
PARAM_ALPHANUMEXT
);
...
...
admin/reports.php
View file @
2f1e464a
...
...
@@ -57,7 +57,7 @@ foreach (core_component::get_plugin_list('report') as $plugin => $plugindir) {
}
$plugins
[
$plugin
]
=
$strpluginname
;
}
collator
lib
::
asort
(
$plugins
);
core_
collator
::
asort
(
$plugins
);
$like
=
$DB
->
sql_like
(
'plugin'
,
'?'
,
true
,
true
,
false
,
'|'
);
$params
=
array
(
'report|_%'
);
...
...
admin/roles/classes/define_role_table_advanced.php
View file @
2f1e464a
...
...
@@ -99,8 +99,8 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
$shortname
=
optional_param
(
'shortname'
,
null
,
PARAM_RAW
);
if
(
!
is_null
(
$shortname
))
{
$this
->
role
->
shortname
=
$shortname
;
$this
->
role
->
shortname
=
text
lib
::
specialtoascii
(
$this
->
role
->
shortname
);
$this
->
role
->
shortname
=
text
lib
::
strtolower
(
clean_param
(
$this
->
role
->
shortname
,
PARAM_ALPHANUMEXT
));
$this
->
role
->
shortname
=
core_
text
::
specialtoascii
(
$this
->
role
->
shortname
);
$this
->
role
->
shortname
=
core_
text
::
strtolower
(
clean_param
(
$this
->
role
->
shortname
,
PARAM_ALPHANUMEXT
));
if
(
empty
(
$this
->
role
->
shortname
))
{
$this
->
errors
[
'shortname'
]
=
get_string
(
'errorbadroleshortname'
,
'core_role'
);
}
...
...
admin/tool/uploadcourse/classes/helper.php
View file @
2f1e464a
...
...
@@ -117,18 +117,18 @@ class tool_uploadcourse_helper {
switch
(
$block
[
1
])
{
case
'+'
:
$repl
=
text
lib
::
strtoupper
(
$repl
);
$repl
=
core_
text
::
strtoupper
(
$repl
);
break
;
case
'-'
:
$repl
=
text
lib
::
strtolower
(
$repl
);
$repl
=
core_
text
::
strtolower
(
$repl
);
break
;
case
'~'
:
$repl
=
text
lib
::
strtotitle
(
$repl
);
$repl
=
core_
text
::
strtotitle
(
$repl
);
break
;
}
if
(
!
empty
(
$block
[
2
]))
{
$repl
=
text
lib
::
substr
(
$repl
,
0
,
$block
[
2
]);
$repl
=
core_
text
::
substr
(
$repl
,
0
,
$block
[
2
]);
}
return
$repl
;
...
...
admin/tool/uploadcourse/classes/step1_form.php
View file @
2f1e464a
...
...
@@ -57,7 +57,7 @@ class tool_uploadcourse_step1_form extends tool_uploadcourse_base_form {
$mform
->
setDefault
(
'delimiter_name'
,
'comma'
);
}
$choices
=
text
lib
::
get_encodings
();
$choices
=
core_
text
::
get_encodings
();
$mform
->
addElement
(
'select'
,
'encoding'
,
get_string
(
'encoding'
,
'tool_uploadcourse'
),
$choices
);
$mform
->
setDefault
(
'encoding'
,
'UTF-8'
);
...
...
admin/tool/uploadcourse/cli/uploadcourse.php
View file @
2f1e464a
...
...
@@ -145,7 +145,7 @@ if (!file_exists($options['file'])) {
}
// Encoding.
$encodings
=
text
lib
::
get_encodings
();
$encodings
=
core_
text
::
get_encodings
();
if
(
!
isset
(
$encodings
[
$options
[
'encoding'
]]))
{
echo
get_string
(
'invalidencoding'
,
'tool_uploadcourse'
)
.
"
\n
"
;
echo
$help
;
...
...
admin/tool/uploaduser/locallib.php
View file @
2f1e464a
...
...
@@ -183,7 +183,7 @@ function uu_validate_user_upload_columns(csv_import_reader $cir, $stdfields, $pr
$processed
=
array
();
foreach
(
$columns
as
$key
=>
$unused
)
{
$field
=
$columns
[
$key
];
$lcfield
=
text
lib
::
strtolower
(
$field
);
$lcfield
=
core_
text
::
strtolower
(
$field
);
if
(
in_array
(
$field
,
$stdfields
)
or
in_array
(
$lcfield
,
$stdfields
))
{
// standard fields are only lowercase
$newfield
=
$lcfield
;
...
...
@@ -295,18 +295,18 @@ function uu_process_template_callback($username, $firstname, $lastname, $block)
switch
(
$block
[
1
])
{
case
'+'
:
$repl
=
text
lib
::
strtoupper
(
$repl
);
$repl
=
core_
text
::
strtoupper
(
$repl
);
break
;
case
'-'
:
$repl
=
text
lib
::
strtolower
(
$repl
);
$repl
=
core_
text
::
strtolower
(
$repl
);
break
;
case
'~'
:
$repl
=
text
lib
::
strtotitle
(
$repl
);
$repl
=
core_
text
::
strtotitle
(
$repl
);
break
;
}
if
(
!
empty
(
$block
[
2
]))
{
$repl
=
text
lib
::
substr
(
$repl
,
0
,
$block
[
2
]);
$repl
=
core_
text
::
substr
(
$repl
,
0
,
$block
[
2
]);
}
return
$repl
;
...
...
admin/tool/uploaduser/user_form.php
View file @
2f1e464a
...
...
@@ -53,7 +53,7 @@ class admin_uploaduser_form1 extends moodleform {
$mform
->
setDefault
(
'delimiter_name'
,
'comma'
);
}
$choices
=
text
lib
::
get_encodings
();
$choices
=
core_
text
::
get_encodings
();
$mform
->
addElement
(
'select'
,
'encoding'
,
get_string
(
'encoding'
,
'tool_uploaduser'
),
$choices
);
$mform
->
setDefault
(
'encoding'
,
'UTF-8'
);
...
...
admin/tool/xmldb/actions/check_oracle_semantics/check_oracle_semantics.class.php
View file @
2f1e464a
...
...
@@ -75,8 +75,8 @@ class check_oracle_semantics extends XMLDBCheckAction {
// Get current semantic from dictionary, we only will process B (BYTE) ones
// suplying the SQL code to change them to C (CHAR) semantic
$params
=
array
(
'table_name'
=>
text
lib
::
strtoupper
(
$DB
->
get_prefix
()
.
$xmldb_table
->
getName
()),
'column_name'
=>
text
lib
::
strtoupper
(
$xmldb_field
->
getName
()),
'table_name'
=>
core_
text
::
strtoupper
(
$DB
->
get_prefix
()
.
$xmldb_table
->
getName
()),
'column_name'
=>
core_
text
::
strtoupper
(
$xmldb_field
->
getName
()),
'data_type'
=>
'VARCHAR2'
);
$currentsemantic
=
$DB
->
get_field_sql
(
'
SELECT char_used
...
...
admin/tools.php
View file @
2f1e464a
...
...
@@ -57,7 +57,7 @@ foreach (core_component::get_plugin_list('tool') as $plugin => $plugindir) {
}
$plugins
[
$plugin
]
=
$strpluginname
;
}
collator
lib
::
asort
(
$plugins
);
core_
collator
::
asort
(
$plugins
);
$like
=
$DB
->
sql_like
(
'plugin'
,
'?'
,
true
,
true
,
false
,
'|'
);
$params
=
array
(
'tool|_%'
);
...
...
auth/cas/auth.php
View file @
2f1e464a
...
...
@@ -61,7 +61,7 @@ class auth_plugin_cas extends auth_plugin_ldap {
*/
function
user_login
(
$username
,
$password
)
{
$this
->
connectCAS
();
return
phpCAS
::
isAuthenticated
()
&&
(
trim
(
text
lib
::
strtolower
(
phpCAS
::
getUser
()))
==
$username
);
return
phpCAS
::
isAuthenticated
()
&&
(
trim
(
core_
text
::
strtolower
(
phpCAS
::
getUser
()))
==
$username
);
}
/**
...
...
@@ -381,15 +381,15 @@ class auth_plugin_cas extends auth_plugin_ldap {
set_config
(
'ldapencoding'
,
trim
(
$config
->
ldapencoding
),
$this
->
pluginconfig
);
set_config
(
'pagesize'
,
(
int
)
trim
(
$config
->
pagesize
),
$this
->
pluginconfig
);
set_config
(
'contexts'
,
trim
(
$config
->
contexts
),
$this
->
pluginconfig
);
set_config
(
'user_type'
,
text
lib
::
strtolower
(
trim
(
$config
->
user_type
)),
$this
->
pluginconfig
);
set_config
(
'user_attribute'
,
text
lib
::
strtolower
(
trim
(
$config
->
user_attribute
)),
$this
->
pluginconfig
);
set_config
(
'user_type'
,
core_
text
::
strtolower
(
trim
(
$config
->
user_type
)),
$this
->
pluginconfig
);
set_config
(
'user_attribute'
,
core_
text
::
strtolower
(
trim
(
$config
->
user_attribute
)),
$this
->
pluginconfig
);
set_config
(
'search_sub'
,
$config
->
search_sub
,
$this
->
pluginconfig
);
set_config
(
'opt_deref'
,
$config
->
opt_deref
,
$this
->
pluginconfig
);
set_config
(
'bind_dn'
,
trim
(
$config
->
bind_dn
),
$this
->
pluginconfig
);
set_config
(
'bind_pw'
,
$config
->
bind_pw
,
$this
->
pluginconfig
);
set_config
(
'ldap_version'
,
$config
->
ldap_version
,
$this
->
pluginconfig
);
set_config
(
'objectclass'
,
trim
(
$config
->
objectclass
),
$this
->
pluginconfig
);
set_config
(
'memberattribute'
,
text
lib
::
strtolower
(
trim
(
$config
->
memberattribute
)),
$this
->
pluginconfig
);
set_config
(
'memberattribute'
,
core_
text
::
strtolower
(
trim
(
$config
->
memberattribute
)),
$this
->
pluginconfig
);
set_config
(
'memberattribute_isdn'
,
$config
->
memberattribute_isdn
,
$this
->
pluginconfig
);
set_config
(
'attrcreators'
,
trim
(
$config
->
attrcreators
),
$this
->
pluginconfig
);
set_config
(
'groupecreators'
,
trim
(
$config
->
groupecreators
),
$this
->
pluginconfig
);
...
...
@@ -409,7 +409,7 @@ class auth_plugin_cas extends auth_plugin_ldap {
return
false
;
}
$extusername
=
text
lib
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extusername
=
core_
text
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
// Test for group creator
if
(
!
empty
(
$this
->
config
->
groupecreators
))
{
...
...
auth/db/auth.php
View file @
2f1e464a
...
...
@@ -58,8 +58,8 @@ class auth_plugin_db extends auth_plugin_base {
function
user_login
(
$username
,
$password
)
{
global
$CFG
,
$DB
;
$extusername
=
text
lib
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
extencoding
);
$extpassword
=
text
lib
::
convert
(
$password
,
'utf-8'
,
$this
->
config
->
extencoding
);
$extusername
=
core_
text
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
extencoding
);
$extpassword
=
core_
text
::
convert
(
$password
,
'utf-8'
,
$this
->
config
->
extencoding
);
if
(
$this
->
is_internal
())
{
// Lookup username externally, but resolve
...
...
@@ -176,7 +176,7 @@ class auth_plugin_db extends auth_plugin_base {
function
get_userinfo
(
$username
)
{
global
$CFG
;
$extusername
=
text
lib
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
extencoding
);
$extusername
=
core_
text
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
extencoding
);
$authdb
=
$this
->
db_init
();
...
...
@@ -199,7 +199,7 @@ class auth_plugin_db extends auth_plugin_base {
$fields_obj
=
$rs
->
FetchObj
();
$fields_obj
=
(
object
)
array_change_key_case
((
array
)
$fields_obj
,
CASE_LOWER
);
foreach
(
$selectfields
as
$localname
=>
$externalname
)
{
$result
[
$localname
]
=
text
lib
::
convert
(
$fields_obj
->
{
$localname
},
$this
->
config
->
extencoding
,
'utf-8'
);
$result
[
$localname
]
=
core_
text
::
convert
(
$fields_obj
->
{
$localname
},
$this
->
config
->
extencoding
,
'utf-8'
);
}
}
$rs
->
Close
();
...
...
@@ -426,7 +426,7 @@ class auth_plugin_db extends auth_plugin_base {
// Init result value.
$result
=
false
;
$extusername
=
text
lib
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
extencoding
);
$extusername
=
core_
text
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
extencoding
);
$authdb
=
$this
->
db_init
();
...
...
@@ -501,7 +501,7 @@ class auth_plugin_db extends auth_plugin_base {
global
$CFG
,
$DB
;
//just in case check text case
$username
=
trim
(
text
lib
::
strtolower
(
$username
));
$username
=
trim
(
core_
text
::
strtolower
(
$username
));
// get the current user record
$user
=
$DB
->
get_record
(
'user'
,
array
(
'username'
=>
$username
,
'mnethostid'
=>
$CFG
->
mnet_localhost_id
));
...
...
@@ -569,7 +569,7 @@ class auth_plugin_db extends auth_plugin_base {
return
false
;
}
$extusername
=
text
lib
::
convert
(
$olduser
->
username
,
'utf-8'
,
$this
->
config
->
extencoding
);
$extusername
=
core_
text
::
convert
(
$olduser
->
username
,
'utf-8'
,
$this
->
config
->
extencoding
);
$authdb
=
$this
->
db_init
();
...
...
@@ -586,7 +586,7 @@ class auth_plugin_db extends auth_plugin_base {
}
$nuvalue
=
$newuser
->
$key
;
if
(
$nuvalue
!=
$value
)
{
$update
[]
=
$this
->
config
->
{
"field_map_
$key
"
}
.
"='"
.
$this
->
ext_addslashes
(
text
lib
::
convert
(
$nuvalue
,
'utf-8'
,
$this
->
config
->
extencoding
))
.
"'"
;
$update
[]
=
$this
->
config
->
{
"field_map_
$key
"
}
.
"='"
.
$this
->
ext_addslashes
(
core_
text
::
convert
(
$nuvalue
,
'utf-8'
,
$this
->
config
->
extencoding
))
.
"'"
;
}
}
if
(
!
empty
(
$update
))
{
...
...
auth/ldap/auth.php
View file @
2f1e464a
...
...
@@ -168,8 +168,8 @@ class auth_plugin_ldap extends auth_plugin_base {
return
false
;
}
$extusername
=
text
lib
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extpassword
=
text
lib
::
convert
(
$password
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extusername
=
core_
text
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extpassword
=
core_
text
::
convert
(
$password
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
// Before we connect to LDAP, check if this is an AD SSO login
// if we succeed in this block, we'll return success early.
...
...
@@ -250,7 +250,7 @@ class auth_plugin_ldap extends auth_plugin_base {
* @return mixed array with no magic quotes or false on error
*/
function
get_userinfo
(
$username
)
{
$extusername
=
text
lib
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extusername
=
core_
text
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$ldapconnection
=
$this
->
ldap_connect
();
if
(
!
(
$user_dn
=
$this
->
ldap_find_userdn
(
$ldapconnection
,
$extusername
)))
{
...
...
@@ -298,9 +298,9 @@ class auth_plugin_ldap extends auth_plugin_base {
continue
;
// wrong data mapping!
}
if
(
is_array
(
$entry
[
$value
]))
{
$newval
=
text
lib
::
convert
(
$entry
[
$value
][
0
],
$this
->
config
->
ldapencoding
,
'utf-8'
);
$newval
=
core_
text
::
convert
(
$entry
[
$value
][
0
],
$this
->
config
->
ldapencoding
,
'utf-8'
);
}
else
{
$newval
=
text
lib
::
convert
(
$entry
[
$value
],
$this
->
config
->
ldapencoding
,
'utf-8'
);
$newval
=
core_
text
::
convert
(
$entry
[
$value
],
$this
->
config
->
ldapencoding
,
'utf-8'
);
}
if
(
!
empty
(
$newval
))
{
// favour ldap entries that are set
$ldapval
=
$newval
;
...
...
@@ -351,7 +351,7 @@ class auth_plugin_ldap extends auth_plugin_base {
* @param string $username
*/
function
user_exists
(
$username
)
{
$extusername
=
text
lib
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extusername
=
core_
text
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
// Returns true if given username exists on ldap
$users
=
$this
->
ldap_get_userlist
(
'('
.
$this
->
config
->
user_attribute
.
'='
.
ldap_filter_addslashes
(
$extusername
)
.
')'
);
...
...
@@ -367,8 +367,8 @@ class auth_plugin_ldap extends auth_plugin_base {
* @param mixed $plainpass Plaintext password
*/
function
user_create
(
$userobject
,
$plainpass
)
{
$extusername
=
text
lib
::
convert
(
$userobject
->
username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extpassword
=
text
lib
::
convert
(
$plainpass
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extusername
=
core_
text
::
convert
(
$userobject
->
username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extpassword
=
core_
text
::
convert
(
$plainpass
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
switch
(
$this
->
config
->
passtype
)
{
case
'md5'
:
...
...
@@ -393,7 +393,7 @@ class auth_plugin_ldap extends auth_plugin_base {
}
foreach
(
$values
as
$value
)
{
if
(
!
empty
(
$userobject
->
$key
)
)
{
$newuser
[
$value
]
=
text
lib
::
convert
(
$userobject
->
$key
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$newuser
[
$value
]
=
core_
text
::
convert
(
$userobject
->
$key
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
}
}
}
...
...
@@ -637,7 +637,7 @@ class auth_plugin_ldap extends auth_plugin_base {
function
password_expire
(
$username
)
{
$result
=
0
;
$extusername
=
text
lib
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extusername
=
core_
text
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$ldapconnection
=
$this
->
ldap_connect
();
$user_dn
=
$this
->
ldap_find_userdn
(
$ldapconnection
,
$extusername
);
...
...
@@ -735,7 +735,7 @@ class auth_plugin_ldap extends auth_plugin_base {
if
(
$entry
=
@
ldap_first_entry
(
$ldapconnection
,
$ldap_result
))
{
do
{
$value
=
ldap_get_values_len
(
$ldapconnection
,
$entry
,
$this
->
config
->
user_attribute
);
$value
=
text
lib
::
convert
(
$value
[
0
],
$this
->
config
->
ldapencoding
,
'utf-8'
);
$value
=
core_
text
::
convert
(
$value
[
0
],
$this
->
config
->
ldapencoding
,
'utf-8'
);
$this
->
ldap_bulk_insert
(
$value
);
}
while
(
$entry
=
ldap_next_entry
(
$ldapconnection
,
$entry
));
}
...
...
@@ -945,7 +945,7 @@ class auth_plugin_ldap extends auth_plugin_base {
$user
->
mnethostid
=
$CFG
->
mnet_localhost_id
;
// get_userinfo_asobj() might have replaced $user->username with the value
// from the LDAP server (which can be mixed-case). Make sure it's lowercase
$user
->
username
=
trim
(
text
lib
::
strtolower
(
$user
->
username
));
$user
->
username
=
trim
(
core_
text
::
strtolower
(
$user
->
username
));
if
(
empty
(
$user
->
lang
))
{
$user
->
lang
=
$CFG
->
lang
;
}
...
...
@@ -991,7 +991,7 @@ class auth_plugin_ldap extends auth_plugin_base {
global
$CFG
,
$DB
;
// Just in case check text case
$username
=
trim
(
text
lib
::
strtolower
(
$username
));
$username
=
trim
(
core_
text
::
strtolower
(
$username
));
// Get the current user record
$user
=
$DB
->
get_record
(
'user'
,
array
(
'username'
=>
$username
,
'mnethostid'
=>
$CFG
->
mnet_localhost_id
));
...
...
@@ -1040,7 +1040,7 @@ class auth_plugin_ldap extends auth_plugin_base {
function
ldap_bulk_insert
(
$username
)
{
global
$DB
,
$CFG
;
$username
=
text
lib
::
strtolower
(
$username
);
// usernames are __always__ lowercase.
$username
=
core_
text
::
strtolower
(
$username
);
// usernames are __always__ lowercase.
$DB
->
insert_record_raw
(
'tmp_extuser'
,
array
(
'username'
=>
$username
,
'mnethostid'
=>
$CFG
->
mnet_localhost_id
),
false
,
true
);
echo
'.'
;
...
...
@@ -1053,7 +1053,7 @@ class auth_plugin_ldap extends auth_plugin_base {
* @return boolean result
*/
function
user_activate
(
$username
)
{
$extusername
=
text
lib
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extusername
=
core_
text
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$ldapconnection
=
$this
->
ldap_connect
();
...
...
@@ -1103,7 +1103,7 @@ class auth_plugin_ldap extends auth_plugin_base {
return
null
;
}
$extusername
=
text
lib
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extusername
=
core_
text
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$ldapconnection
=
$this
->
ldap_connect
();
...
...
@@ -1161,7 +1161,7 @@ class auth_plugin_ldap extends auth_plugin_base {
return
true
;
}
$extoldusername
=
text
lib
::
convert
(
$olduser
->
username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extoldusername
=
core_
text
::
convert
(
$olduser
->
username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$ldapconnection
=
$this
->
ldap_connect
();
...
...
@@ -1223,9 +1223,9 @@ class auth_plugin_ldap extends auth_plugin_base {
$ambiguous
=
false
;
}
$nuvalue
=
text
lib
::
convert
(
$newuser
->
$profilefield
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$nuvalue
=
core_
text
::
convert
(
$newuser
->
$profilefield
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
empty
(
$nuvalue
)
?
$nuvalue
=
array
()
:
$nuvalue
;
$ouvalue
=
text
lib
::
convert
(
$olduser
->
$profilefield
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$ouvalue
=
core_
text
::
convert
(
$olduser
->
$profilefield
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
foreach
(
$ldapkeys
as
$ldapkey
)
{
$ldapkey
=
$ldapkey
;
...
...
@@ -1321,8 +1321,8 @@ class auth_plugin_ldap extends auth_plugin_base {
$result
=
false
;
$username
=
$user
->
username
;
$extusername
=
text
lib
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extpassword
=
text
lib
::
convert
(
$newpassword
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extusername
=
core_
text
::
convert
(
$username
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
$extpassword
=
core_
text
::
convert
(
$newpassword
,
'utf-8'
,
$this
->
config
->
ldapencoding
);
switch
(
$this
->
config
->
passtype
)
{
case
'md5'
:
...
...
@@ -1498,13 +1498,13 @@ class auth_plugin_ldap extends auth_plugin_base {
foreach
(
$userfields
as
$field
)
{
if
(
!
empty
(
$this
->
config
->
{
"field_map_
$field
"
}))
{
$moodleattributes
[
$field
]
=
text
lib
::
strtolower
(
trim
(
$this
->
config
->
{
"field_map_
$field
"
}));
$moodleattributes
[
$field
]
=
core_
text
::
strtolower
(
trim
(
$this
->
config
->
{
"field_map_
$field
"
}));
if
(
preg_match
(
'/,/'
,
$moodleattributes
[
$field
]))
{
$moodleattributes
[
$field
]
=
explode
(
','
,
$moodleattributes
[
$field
]);
// split ?
}
}
}
$moodleattributes
[
'username'
]
=
text
lib
::
strtolower
(
trim
(
$this
->
config
->
user_attribute
));
$moodleattributes
[
'username'
]
=
core_
text
::
strtolower
(
trim
(
$this
->
config
->
user_attribute
));
return
$moodleattributes
;
}
...
...
@@ -1555,7 +1555,7 @@ class auth_plugin_ldap extends auth_plugin_base {
$users
=
ldap_get_entries_moodle
(
$ldapconnection
,
$ldap_result
);
// Add found users to list.
for
(
$i
=
0
;
$i
<
count
(
$users
);
$i
++
)
{
$extuser
=
text
lib
::
convert
(
$users
[
$i
][
$this
->
config
->
user_attribute
][
0
],
$extuser
=
core_
text
::
convert
(
$users
[
$i
][
$this
->
config
->
user_attribute
][
0
],
$this
->
config
->
ldapencoding
,
'utf-8'
);
array_push
(
$fresult
,
$extuser
);
}
...
...
@@ -1696,7 +1696,7 @@ class auth_plugin_ldap extends auth_plugin_base {
// (according to my reading of RFC-1945, RFC-2616 and RFC-2617 and
// my local tests), so we need to convert the REMOTE_USER value
// (i.e., what we got from the HTTP WWW-Authenticate header) into UTF-8
$username
=
text
lib
::
convert
(
$_SERVER
[
'REMOTE_USER'
],
'iso-8859-1'
,
'utf-8'
);
$username
=
core_
text
::
convert
(
$_SERVER
[
'REMOTE_USER'
],
'iso-8859-1'
,
'utf-8'
);
switch
(
$this
->
config
->
ntlmsso_type
)
{
case
'ntlm'
:
...
...
@@ -1715,7 +1715,7 @@ class auth_plugin_ldap extends auth_plugin_base {
return
false
;
// Should never happen!
}
$username
=
text
lib
::
strtolower
(
$username
);
// Compatibility hack
$username
=
core_
text
::
strtolower
(
$username
);
// Compatibility hack
set_cache_flag
(
$this
->
pluginconfig
.
'/ntlmsess'
,
$sesskey
,
$username
,
AUTH_NTLMTIMEOUT
);
return
true
;
}
...
...
@@ -1924,7 +1924,7 @@ class auth_plugin_ldap extends auth_plugin_base {
// Try to remove duplicates before storing the contexts (to avoid problems in sync_users()).
$config
->
contexts
=
explode
(
';'
,
$config
->
contexts
);
$config
->
contexts
=
array_map
(
create_function
(
'$x'
,
'return text
lib
::strtolower(trim($x));'
),
$config
->
contexts
=
array_map
(
create_function
(
'$x'
,
'return
core_
text::strtolower(trim($x));'
),
$config
->
contexts
);
$config
->
contexts
=
implode
(
';'
,
array_unique
(
$config
->
contexts
));
...
...
@@ -1934,8 +1934,8 @@ class auth_plugin_ldap extends auth_plugin_base {
set_config
(
'ldapencoding'
,
trim
(
$config
->
ldapencoding
),
$this
->
pluginconfig
);
set_config
(
'pagesize'
,
(
int
)
trim
(
$config
->
pagesize
),
$this
->
pluginconfig
);
set_config
(
'contexts'
,
$config
->
contexts
,
$this
->
pluginconfig
);
set_config
(
'user_type'
,
text
lib
::
strtolower
(
trim
(
$config
->
user_type
)),
$this
->
pluginconfig
);
set_config
(
'user_attribute'
,
text
lib
::
strtolower
(
trim
(
$config
->
user_attribute
)),
$this
->
pluginconfig
);
set_config
(
'user_type'
,
core_
text
::
strtolower
(
trim
(
$config
->
user_type
)),
$this
->
pluginconfig
);
set_config
(
'user_attribute'
,
core_
text
::
strtolower
(
trim
(
$config
->
user_attribute
)),
$this
->
pluginconfig
);
set_config
(
'search_sub'
,
$config
->
search_sub
,
$this
->
pluginconfig
);
set_config
(
'opt_deref'
,
$config
->
opt_deref
,
$this
->
pluginconfig
);
set_config
(
'preventpassindb'
,
$config
->
preventpassindb
,
$this
->
pluginconfig
);
...
...
@@ -1943,15 +1943,15 @@ class auth_plugin_ldap extends auth_plugin_base {
set_config
(
'bind_pw'
,
$config
->
bind_pw
,
$this
->
pluginconfig
);
set_config
(
'ldap_version'
,
$config
->
ldap_version
,
$this
->
pluginconfig
);
set_config
(
'objectclass'
,
trim
(
$config
->
objectclass
),
$this
->
pluginconfig
);
set_config
(
'memberattribute'
,
text
lib
::
strtolower
(
trim
(
$config
->
memberattribute
)),
$this
->
pluginconfig
);
set_config
(
'memberattribute'
,
core_
text
::
strtolower
(
trim
(
$config
->
memberattribute
)),
$this
->
pluginconfig
);
set_config
(
'memberattribute_isdn'
,
$config
->
memberattribute_isdn
,
$this
->
pluginconfig
);
set_config
(
'creators'
,
trim
(
$config
->
creators
),
$this
->
pluginconfig
);
set_config
(
'create_context'
,
trim
(
$config
->
create_context
),
$this
->
pluginconfig
);
set_config
(
'expiration'
,
$config
->
expiration
,
$this
->
pluginconfig
);
set_config
(
'expiration_warning'
,
trim
(
$config
->
expiration_warning
),
$this
->
pluginconfig
);
set_config
(
'expireattr'
,
text
lib
::
strtolower
(
trim
(
$config
->
expireattr
)),
$this
->
pluginconfig
);
set_config
(
'expireattr'
,
core_
text
::
strtolower
(
trim
(
$config
->
expireattr
)),
$this
->
pluginconfig
);
set_config
(
'gracelogins'
,
$config
->
gracelogins
,
$this
->
pluginconfig
);
set_config
(
'graceattr'
,
text
lib
::
strtolower
(
trim
(
$config
->
graceattr
)),
$this
->
pluginconfig
);
set_config
(
'graceattr'
,
core_
text
::
strtolower
(
trim
(
$config
->
graceattr
)),
$this
->
pluginconfig
);
set_config
(
'auth_user_create'
,
$config
->
auth_user_create
,
$this
->
pluginconfig
);
set_config
(
'forcechangepassword'
,
$config
->
forcechangepassword
,
$this
->
pluginconfig
);
set_config
(
'stdchangepassword'
,
$config
->
stdchangepassword
,
$this
->
pluginconfig
);
...
...
backup/converter/moodle1/handlerlib.php
View file @
2f1e464a
...
...
@@ -1222,7 +1222,7 @@ class moodle1_question_bank_handler extends moodle1_xml_handler {
// replay the upgrade step 2010080901 - updating question image
if
(
!
empty
(
$data
[
'image'
]))
{
if
(
text
lib
::
substr
(
text
lib
::
strtolower
(
$data
[
'image'
]),
0
,
7
)
==
'http://'
)
{
if
(
core_
text
::
substr
(
core_
text
::
strtolower
(
$data
[
'image'
]),
0
,
7
)
==
'http://'
)
{
// it is a link, appending to existing question text
$data
[
'questiontext'
]
.
=
' <img src="'
.
$data
[
'image'
]
.
'" />'
;
...
...
backup/converter/moodle1/lib.php
View file @
2f1e464a
...
...
@@ -1233,7 +1233,7 @@ class moodle1_file_manager implements loggable {
}
$filepath
=
clean_param
(
$filepath
,
PARAM_PATH
);
if
(
text
lib
::
strlen
(
$filepath
)
>
255
)
{
if
(
core_
text
::
strlen
(
$filepath
)
>
255
)
{
throw
new
moodle1_convert_exception
(
'file_path_longer_than_255_chars'
);
}
...
...
backup/util/dbops/backup_plan_dbops.class.php
View file @
2f1e464a
...
...
@@ -204,7 +204,7 @@ abstract class backup_plan_dbops extends backup_dbops {
global
$DB
;
// Calculate backup word
$backupword
=
str_replace
(
' '
,
'_'
,
text
lib
::
strtolower
(
get_string
(
'backupfilename'
)));
$backupword
=
str_replace
(
' '
,
'_'
,
core_
text
::
strtolower
(
get_string
(
'backupfilename'
)));
$backupword
=
trim
(
clean_filename
(
$backupword
),
'_'
);
// Not $useidonly, lets fetch the name
...
...
@@ -228,7 +228,7 @@ abstract class backup_plan_dbops extends backup_dbops {
break
;
}
$shortname
=
str_replace
(
' '
,
'_'
,
$shortname
);
$shortname
=
text
lib
::
strtolower
(
trim
(
clean_filename
(
$shortname
),
'_'
));
$shortname
=
core_
text
::
strtolower
(
trim
(
clean_filename
(
$shortname
),
'_'
));
}
// The name will always contain the ID, but we append the course short name if requested.
...
...
@@ -240,7 +240,7 @@ abstract class backup_plan_dbops extends backup_dbops {
// Calculate date
$backupdateformat
=
str_replace
(
' '
,
'_'
,
get_string
(
'backupnameformat'
,
'langconfig'
));
$date
=
userdate
(
time
(),
$backupdateformat
,
99
,
false
);
$date
=
text
lib
::
strtolower
(
trim
(
clean_filename
(
$date
),
'_'
));
$date
=
core_
text
::
strtolower
(
trim
(
clean_filename
(
$date
),
'_'
));
// Calculate info
$info
=
''
;
...
...
backup/util/helper/backup_cron_helper.class.php
View file @
2f1e464a
...
...
@@ -554,7 +554,7 @@ abstract class backup_cron_automated_helper {
return
true
;
}
$backupword
=
str_replace
(
' '
,
'_'
,
text
lib
::
strtolower
(
get_string
(
'backupfilename'
)));
$backupword
=
str_replace
(
' '
,
'_'
,
core_
text
::
strtolower
(
get_string
(
'backupfilename'
)));
$backupword
=
trim
(
clean_filename
(
$backupword
),
'_'
);
if
(
!
file_exists
(
$dir
)
||
!
is_dir
(
$dir
)
||
!
is_writable
(
$dir
))
{
...
...
Prev
1
2
3
4
5
…
7
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment