Defined in
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
-
No testcase defined.
Source code:
upvar name name
if {$data eq ""} {
unset data
set form ::xowiki::f1 ;
$form instvar data
}
$data instvar package_id
set cc [::$package_id context]
set old_name [$cc form_parameter __object_name:signed,convert ""]
if {[$data istype ::xowiki::File]
&& [$data exists upload_file]
&& [$data exists mime_type]} {
set name [$data build_name $name [$data set upload_file]]
set package_id [$cc package_id]
set computed_link [export_vars -base [::$package_id package_url] {{edit-new 1} name
{object_type ::xowiki::File}}]
set granted [::$package_id check_permissions -link $computed_link $package_id edit-new]
if {!$granted} {
util_user_message -message "User not authorized to create a file named $name"
return 0
}
} else {
if {![$data istype ::xowiki::File] && [regexp {^[a-zA-Z][a-zA-Z]:$} $name]} {
return 0
}
$data name $name
set nls_language [$data form_parameter nls_language:token [$data form_parameter _nls_language:token]]
if {$nls_language eq ""} {
set nls_language en_US
} elseif {$nls_language ni [lang::system::get_locales]} {
if {$nls_language ni [lang::system::get_locales -all]} {
set message "'$nls_language' not defined in the system, call back to 'en_US'"
set severity warning
set nls_language en_US
} else {
set severity notice
set message "'$nls_language' not enabled in the system"
}
ns_log $severity "suspect content of form variable nls_language: $message"
}
set name [$data build_name -nls_language $nls_language]
}
if {$name ne ""} {
set prefixed_page_p [expr {![$data is_folder_page] && ![$data is_link_page]}]
set name [::$package_id normalize_name -with_prefix $prefixed_page_p $name]
}
if {$name eq $old_name && $name ne ""} {
return 1
}
if {[$data form_parameter __new_p:boolean 0]
|| $old_name ne $name
} {
if {[::xo::db::CrClass lookup -name $name -parent_id [$data parent_id]] == 0} {
return 1
}
if {[$data istype ::xowiki::PageInstance]} {
set anon_instances [$data get_from_template anon_instances f]
if {$anon_instances} {
set basename [::xowiki::autoname basename [[$data page_template] name]]
$data log "validate_name: have anon_instances basename '$basename' name '$name'"
if {[string match $basename* $name]} {
set name [::xowiki::autoname new -name $basename -parent_id [$data parent_id]]
$data name $name
$data log "validate_name: changed data name to '$name'"
return 1
}
}
}
return 0
}
return 1
XQL Not present:Generic, PostgreSQL, Oracle