Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
193f5d40
Commit
193f5d40
authored
Sep 16, 2015
by
Marina Glancy
Committed by
David Monllaó
Sep 16, 2015
Browse files
MDL-46705 admin: Validate unique shortname for frontpage course
parent
685aa0b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/adminlib.php
View file @
193f5d40
...
...
@@ -3969,12 +3969,13 @@ class admin_setting_sitesettext extends admin_setting_configtext {
* @return mixed true or message string
*/
public
function
validate
(
$data
)
{
global
$DB
;
global
$DB
,
$SITE
;
$cleaned
=
clean_param
(
$data
,
PARAM_TEXT
);
if
(
$cleaned
===
''
)
{
return
get_string
(
'required'
);
}
if
(
$this
->
name
===
'shortname'
&&
$DB
->
record_exists
(
'course'
,
array
(
'shortname'
=>
$data
)))
{
if
(
$this
->
name
===
'shortname'
&&
$DB
->
record_exists_sql
(
'SELECT id from {course} WHERE shortname = ? AND id <> ?'
,
array
(
$data
,
$SITE
->
id
)))
{
return
get_string
(
'shortnametaken'
,
'error'
,
$data
);
}
if
(
"
$data
"
==
"
$cleaned
"
)
{
// implicit conversion to string is needed to do exact comparison
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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