Index: openacs-4/packages/xotcl-core/xotcl-core.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/xotcl-core.info,v diff -u -r1.106.2.36 -r1.106.2.37 --- openacs-4/packages/xotcl-core/xotcl-core.info 9 Jan 2022 17:51:01 -0000 1.106.2.36 +++ openacs-4/packages/xotcl-core/xotcl-core.info 23 Mar 2022 09:03:40 -0000 1.106.2.37 @@ -10,7 +10,7 @@ t xotcl - + Gustaf Neumann XOTcl library functionality (e.g. thread handling, online documentation, Generic Form and List Classes) 2021-09-16 @@ -42,7 +42,7 @@ BSD-Style 2 - + Index: openacs-4/packages/xotcl-core/tcl/cr-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/cr-procs.tcl,v diff -u -r1.76.2.57 -r1.76.2.58 --- openacs-4/packages/xotcl-core/tcl/cr-procs.tcl 23 Feb 2022 18:40:12 -0000 1.76.2.57 +++ openacs-4/packages/xotcl-core/tcl/cr-procs.tcl 23 Mar 2022 09:03:41 -0000 1.76.2.58 @@ -132,7 +132,7 @@ ::xo::dc 1row -prepare integer get_parent "select parent_id from cr_items where item_id = :item_id" return $parent_id } - + CrClass ad_proc get_name { -item_id:required } { @@ -148,6 +148,27 @@ return $name } + CrClass ad_proc id_belongs_to_package { + {-item_id:integer 0} + {-revision_id:integer 0} + -package_id:integer,required + } { + Check if the provided item_id or revision_id belongs to the provided package. + @return boolean success + } { + set id [expr {$revision_id ? $revision_id : $item_id}] + if {$id eq 0} { + return 0 + } + set what [expr {$item_id != 0 ? "item_id" : "revision_id"}] + return [::xo::dc 0or1row -prepare integer,integer check_package [subst { + select 1 from cr_items, acs_objects + where $what = :$what and object_id = :$what + and package_id = :package_id + fetch first 1 rows only + }]] + } + CrClass ad_proc get_child_item_ids { -item_id:required } { Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -r1.180.2.89 -r1.180.2.90 --- openacs-4/packages/xowiki/xowiki.info 4 Mar 2022 21:11:05 -0000 1.180.2.89 +++ openacs-4/packages/xowiki/xowiki.info 23 Mar 2022 09:03:40 -0000 1.180.2.90 @@ -10,7 +10,7 @@ t xowiki - + Gustaf Neumann A xotcl-based enterprise wiki system with multiple object types 2021-09-15 @@ -55,8 +55,8 @@ BSD-Style 2 - - + + Index: openacs-4/packages/xowiki/www/admin/import.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/import.tcl,v diff -u -r1.28.2.9 -r1.28.2.10 --- openacs-4/packages/xowiki/www/admin/import.tcl 23 Mar 2022 08:33:32 -0000 1.28.2.9 +++ openacs-4/packages/xowiki/www/admin/import.tcl 23 Mar 2022 09:03:41 -0000 1.28.2.10 @@ -11,26 +11,14 @@ {-return_url:localurl ../} {-parent_id:object_id 0} } - if {$parent_id ne 0} { - set success 0 - try { - ::xo::db::CrClass get_instance_from_db -item_id $parent_id - } on ok {parentObj} { - if {[$parentObj package_id] == $package_id} { - set success 1 - } - } on error {errorMsg} { - ns_log warning "import.tcl sees invalid parent_id '$parent_id'" - } - if {!$success} { + set success [::xo::db::CrClass id_belongs_to_package -item_id $parent_id -package_id $package_id] + if {!$success} { ad_return_complaint 1 "provided parent_id is invalid" - ns_log notice STILL ad_script_abort } } - set msg "" ad_form \ -name upload_form \