maltes
committed
on 28 Jul 06
Added upload of FS folder
openacs-4/.../www/content-page-view.tcl (+6 -1)
33 33     db_0or1row version_id_from_package_key {
34 34         select version_id
35 35           from apm_enabled_package_versions
36 36          where package_key = :package_key
37 37     }
38 38 }
39 39
40 40 if { [info exists version_id] } {
41 41     db_1row package_info_from_version_id {
42 42         select pretty_name, package_key, version_name
43 43           from apm_package_version_info
44 44          where version_id = :version_id
45 45     }
46 46     lappend context [list "package-view?version_id=$version_id&kind=content" "$pretty_name $version_name"]
47 47 }
48 48
49 49 lappend context [file tail $path]
50 50
51 51 set filename "[acs_root_dir]/$path"
52 52
  53 if {[regsub -all {[.][.]/} $filename "" shortened_filename]} {
  54     ns_log notice "INTRUDER ALERT:\n\nsomesone tried to snarf '$filename'!\n  file exists: [file exists $filename]\n  user_id: [ad_conn user_id]\n  peer: [ad_conn peeraddr]\n"
  55     set filename shortened_filename
  56 }
  57
53 58 if {![file exists $filename] || [file isdirectory $filename]} {
54 59     set file_contents "file '$filename' not found"
55 60 } else {
56 61     if { $source_p } {
57 62         if {[catch {
58 63        
59 64             set fd [open $filename r]
60 65             set file_contents [read $fd]
61 66             close $fd
62 67        
63 68         } err ]} {
64 69             set file_contents "error opening '$filename'\n$err"
65 70         } else {
66 71             set file_contents [ad_quotehtml $file_contents]
67 72         }
68 73     }
69 74
70 75     template::util::list_to_multirow xql_links [api_xql_links_list $path]
71 76 }
72 77