Index: openacs-4/packages/general-comments/www/file-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/file-add-2.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/general-comments/www/file-add-2.tcl 1 Mar 2005 00:01:37 -0000 1.6 +++ openacs-4/packages/general-comments/www/file-add-2.tcl 27 Oct 2014 16:41:43 -0000 1.7 @@ -13,22 +13,22 @@ @creation-date 2000-10-12 @cvs-id $Id$ } { - attach_id:integer,notnull - parent_id:integer,notnull + attach_id:naturalnum,notnull + parent_id:naturalnum,notnull title:notnull upload_file:notnull upload_file.tmpfile:tmpfile { return_url {} } } -validate { allow_file_attachments { - set allow_files_p [ad_parameter AllowFileAttachmentsP {general-comments} {t}] + set allow_files_p [parameter::get -parameter AllowFileAttachmentsP -default {t}] if { $allow_files_p != "t" } { ad_complain "[_ general-comments.lt_Attaching_files_to_co]" } } check_file_size { set tmp_size [file size ${upload_file.tmpfile}] - set max_file_size [ad_parameter MaxFileSize {general-comments} {0}] + set max_file_size [parameter::get -parameter MaxFileSize -default {0}] if { $tmp_size > $max_file_size && $max_file_size > 0 } { ad_complain "[_ general-comments.lt_Your_file_is_too_larg] [_ general-comments.The_publisher_of] [ad_system_name] [_ general-comments.lt_has_chosen_to_limit_a] [util_commify_number $max_file_size] [_ general-comments.bytes].\n" } @@ -43,7 +43,7 @@ set user_id [ad_conn user_id] # check to see if the user can create comments -ad_require_permission $parent_id write +permission::require_permission -object_id $parent_id -privilege write # get the file extension set tmp_filename ${upload_file.tmpfile} @@ -54,21 +54,21 @@ set guessed_file_type [cr_filename_to_mime_type -create $upload_file] # strip off the C:\directories... crud and just get the file name -if ![regexp {([^/\\]+)$} $upload_file match client_filename] { +if {![regexp {([^/\\]+)$} $upload_file match client_filename]} { # couldn't find a match set client_filename $upload_file } set what_aolserver_told_us "" -if { $file_extension == "jpeg" || $file_extension == "jpg" } { +if { $file_extension eq "jpeg" || $file_extension eq "jpg" } { catch { set what_aolserver_told_us [ns_jpegsize $tmp_filename] } -} elseif { $file_extension == "gif" } { +} elseif { $file_extension eq "gif" } { catch { set what_aolserver_told_us [ns_gifsize $tmp_filename] } } # the AOLserver jpegsize command has some bugs where the height comes # through as 1 or 2 -if { ![empty_string_p $what_aolserver_told_us] && [lindex $what_aolserver_told_us 0] > 10 && [lindex $what_aolserver_told_us 1] > 10 } { +if { $what_aolserver_told_us ne "" && [lindex $what_aolserver_told_us 0] > 10 && [lindex $what_aolserver_told_us 1] > 10 } { set original_width [lindex $what_aolserver_told_us 0] set original_height [lindex $what_aolserver_told_us 1] } else { @@ -81,7 +81,7 @@ set creation_ip [ad_conn peeraddr] set is_live "t" db_transaction { - if { $file_extension == "jpeg" || $file_extension == "jpg" || $file_extension == "gif" } { + if { $file_extension eq "jpeg" || $file_extension eq "jpg" || $file_extension eq "gif" } { db_exec_plsql insert_image { begin :1 := acs_message.new_image ( @@ -140,5 +140,5 @@ } -ad_returnredirect "view-comment?comment_id=$parent_id&[export_url_vars return_url]" +ad_returnredirect "view-comment?comment_id=$parent_id&[export_vars -url {return_url}]"