Index: openacs-4/packages/file-storage/file-storage.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/file-storage.info,v
diff -u -r1.54.2.4 -r1.54.2.5
--- openacs-4/packages/file-storage/file-storage.info	25 Sep 2013 10:22:56 -0000	1.54.2.4
+++ openacs-4/packages/file-storage/file-storage.info	3 Oct 2013 08:33:56 -0000	1.54.2.5
@@ -7,7 +7,7 @@
     <initial-install-p>f</initial-install-p>
     <singleton-p>f</singleton-p>
     
-    <version name="5.6.0d2" url="http://openacs.org/repository/download/apm/file-storage-5.6.0d2.apm">
+    <version name="5.8.1d2" url="http://openacs.org/repository/download/apm/file-storage-5.8.1d2.apm">
         <owner url="http://openacs.org">OpenACS</owner>
         <summary>Collaborative document storage</summary>
         <release-date>2013-09-08</release-date>
@@ -17,7 +17,7 @@
         <maturity>2</maturity>
         <package_instance_name>#file-storage.file-storage#</package_instance_name>
 
-        <provides url="file-storage" version="5.6.0d3"/>
+        <provides url="file-storage" version="5.8.1d2"/>
 	<requires url="acs-kernel" version="5.8.1d1"/>
         <requires url="acs-content-repository" version="5.6.0d1"/>
         
Index: openacs-4/packages/file-storage/lib/folder-links.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/lib/folder-links.tcl,v
diff -u -r1.2.8.1 -r1.2.8.2
--- openacs-4/packages/file-storage/lib/folder-links.tcl	29 Sep 2013 11:44:20 -0000	1.2.8.1
+++ openacs-4/packages/file-storage/lib/folder-links.tcl	3 Oct 2013 08:33:57 -0000	1.2.8.2
@@ -3,23 +3,23 @@
 # @param base_url URL to prepend to the relative URL from file-storage
 #                 used to deliver content from another index.vuh than
 #                 file-storage/view/ 
-if {![exists_and_not_null base_url]} {
+if {(![info exists base_url] || $base_url eq "")} {
     set base_url "/view/"
 }
 # @param object_list restrict results to object_ids in object_list
-if {![exists_and_not_null object_list]} {
+if {(![info exists object_list] || $object_list eq "")} {
     set object_list {}
 }
 # @param show_all_p include subfolders and contents? default 0
-if {![exists_and_not_null show_all_p]} {
+if {(![info exists show_all_p] || $show_all_p eq "")} {
     set show_all_p 0
 }
 # @param admin_p show links to properties page for a file? default 0
-if {![exists_and_not_null admin_p]} {
+if {(![info exists admin_p] || $admin_p eq "")} {
     set admin_p 0
 }
 # @param return_url URL to add to admin links
-if {![exists_and_not_null return_url]} {
+if {(![info exists return_url] || $return_url eq "")} {
     set return_url [ad_return_url]
 }
 
@@ -49,7 +49,7 @@
 
 lassign [fs::get_folder_package_and_root $folder_id]  package_id root_folder_id 
     set fs_url [site_node::get_url_from_object_id -object_id $package_id]
-    if {![string equal $root_folder_id $folder_id] && [string equal "/view/" $base_url]} {
+    if {$root_folder_id ne $folder_id && "/view/" eq $base_url} {
 	set folder_path [db_exec_plsql get_folder_path {}]
     } else {
 	set folder_path ""
@@ -63,19 +63,19 @@
 	set last_modified_ansi [lc_time_system_to_conn $last_modified_ansi]
 	
 	set last_modified_pretty [lc_time_fmt $last_modified_ansi "%x %X"]
-	#    if {![empty_string_p $description]} {
+	#    if {$description ne ""} {
 	#	set description " - $description"
 	#    }
 	
-	if {[string equal $type "folder"]} {
+	if {$type eq "folder"} {
 	    set content_size_pretty [lc_numeric $content_size]
 	    append content_size_pretty " [_ file-storage.items]"
 	    set pretty_type "Folder"
 	} else {
 	    if {$content_size < 1024} {
 		set content_size_pretty "[lc_numeric $content_size] [_ file-storage.bytes]"
 	    } else {
-		set content_size_pretty "[lc_numeric [expr $content_size / 1024 ]] [_ file-storage.kb]"
+		set content_size_pretty "[lc_numeric [expr {$content_size / 1024 }]] [_ file-storage.kb]"
 	    }
 
 	}
Index: openacs-4/packages/file-storage/tcl/file-storage-dav-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-dav-procs.tcl,v
diff -u -r1.10 -r1.10.8.1
--- openacs-4/packages/file-storage/tcl/file-storage-dav-procs.tcl	26 May 2005 08:28:45 -0000	1.10
+++ openacs-4/packages/file-storage/tcl/file-storage-dav-procs.tcl	3 Oct 2013 08:33:57 -0000	1.10.8.1
@@ -30,7 +30,7 @@
     set root_folder_id [oacs_dav::conn folder_id]
     set uri [oacs_dav::conn uri]
 
-    if {![string equal "unlocked" [tdav::check_lock $uri]]} {
+    if {"unlocked" ne [tdav::check_lock $uri] } {
 	return [list 423]
     }
     
@@ -42,12 +42,12 @@
     array set sn [site_node::get -url $uri]
     set package_id $sn(package_id)
     ns_log debug "\n ----- \n file_storage::dav::put package_id $package_id \n parent_id $parent_id \n uri $uri \n ----- \n "
-    if {[empty_string_p $parent_id]} {
+    if {$parent_id eq ""} {
 	set response [list 409]
 	return $response
     }
     
-    if {[empty_string_p $item_id]} {
+    if {$item_id eq ""} {
         fs::add_file \
         -package_id $package_id \
         -name $name \
@@ -101,10 +101,10 @@
     set item_id [oacs_dav::conn item_id]
     set fname [oacs_dav::conn item_name]
     set parent_id [oacs_dav::item_parent_folder_id $uri]
-    if {[empty_string_p $parent_id]} {
+    if {$parent_id eq ""} {
 	return [list 409]
     }
-    if { ![empty_string_p $item_id]} {
+    if { $item_id ne ""} {
 	return [list 405]
     }
 
Index: openacs-4/packages/file-storage/tcl/file-storage-install-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-install-procs.tcl,v
diff -u -r1.13 -r1.13.2.1
--- openacs-4/packages/file-storage/tcl/file-storage-install-procs.tcl	5 Dec 2009 02:08:14 -0000	1.13
+++ openacs-4/packages/file-storage/tcl/file-storage-install-procs.tcl	3 Oct 2013 08:33:57 -0000	1.13.2.1
@@ -166,7 +166,7 @@
 
     set folder_id [fs::new_folder -name $name -pretty_name $pretty_name -parent_id $root -creation_user [ad_conn user_id] -creation_ip 127.0.0.1]
 
-    if {![string equal $id ""]} {
+    if {$id ne "" } {
       set ::install::xml::ids($id) $folder_id
     }
 }
Index: openacs-4/packages/file-storage/tcl/file-storage-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs.tcl,v
diff -u -r1.67.2.6 -r1.67.2.7
--- openacs-4/packages/file-storage/tcl/file-storage-procs.tcl	18 Sep 2013 08:39:15 -0000	1.67.2.6
+++ openacs-4/packages/file-storage/tcl/file-storage-procs.tcl	3 Oct 2013 08:33:57 -0000	1.67.2.7
@@ -10,7 +10,7 @@
 } {
     Returns the root folder for the file storage system.
 } {
-    if [empty_string_p $package_id] {
+    if {$package_id eq ""} {
 	set package_id [ad_conn package_id]
     }
 
@@ -46,10 +46,11 @@
     Returns 1 if the folder_id corresponds to a folder in the file-storage
     system.  Returns 0 otherwise.
 } {
-    if {[string equal [db_string object_type "
-    select object_type 
-    from   acs_objects
-    where  object_id = :folder_id" -default ""] "content_folder"]} {
+    if {[db_string object_type {
+	select object_type 
+	from   acs_objects
+	where  object_id = :folder_id
+    } -default ""] eq "content_folder"} {
 	return 1
     } else {
 	return 0
@@ -62,10 +63,10 @@
     Returns 1 if the file_id corresponds to a file in the file-storage
     system.  Returns 0 otherwise.
 } {
-    if {[string equal [db_string object_type "
+    if {[db_string object_type "
     select object_type 
     from   acs_objects
-    where  object_id = :file_id" -default ""] "content_item"]} {
+    where  object_id = :file_id" -default ""] eq "content_item"} {
 	return 1
     } else {
 	return 0
@@ -78,10 +79,10 @@
     Returns 1 if the version_id corresponds to a version in the file-storage
     system.  Returns 0 otherwise.
 } {
-    if {[string equal [db_string object_type "
+    if {[db_string object_type "
     select object_type 
     from   acs_objects
-    where  object_id = :version_id" -default ""] "file_storage_object"]} {
+    where  object_id = :version_id" -default ""] eq "file_storage_object"} {
 	return 1
     } else {
 	return 0
@@ -103,7 +104,7 @@
     does not have the privilege.  It returns 1 if the user has the
     privilege on every child item.
 } {
-    if [empty_string_p $user_id] {
+    if {$user_id eq ""} {
 	set user_id [ad_conn user_id]
     }
 
@@ -159,12 +160,13 @@
     item in the context bar.  Otherwise, the name corresponding to 
     item_id will be used.
 } {
-    if {[empty_string_p $root_folder_id]} {
+    if {$root_folder_id eq ""} {
         set root_folder_id [fs_get_root_folder]
     }
 
-    if {[empty_string_p $final] \
-            && !($item_id == $root_folder_id)} {
+    if {$final eq "" 
+	&& !($item_id == $root_folder_id)
+    } {
         # don't get title for last element if we are in the
         # root folder
         set start_id [db_string parent_id "
@@ -224,15 +226,15 @@
     @return folder_id of the new root folder
 } {
 
-    if {[empty_string_p $package_id]} {
+    if {$package_id eq ""} {
 	set package_id [ad_conn package_id]
     }
 
-    if {[empty_string_p $pretty_name]} {
+    if {$pretty_name eq ""} {
 	set pretty_name [apm_instance_name_from_id $package_id]
     }
 
-    if {[empty_string_p $name]} {
+    if {$name eq ""} {
 	set name "file-storage_${package_id}"
     }
 
@@ -250,7 +252,7 @@
 
     @return folder_id of the root folder retrieved
 } {
-    if {[empty_string_p $package_id]} {
+    if {$package_id eq ""} {
 	set package_id [ad_conn package_id]
     }
 
@@ -289,11 +291,11 @@
     @param no_callback defines if the callback should be called. Defaults to yes
     @return folder_id of the newly created folder
 } {
-    if {[empty_string_p $creation_user]} {
+    if {$creation_user eq ""} {
 	set creation_user [ad_conn user_id]
     }
 
-    if {[empty_string_p $creation_ip]} {
+    if {$creation_ip eq ""} {
 	set creation_ip [ns_conn peeraddr]
     }
 
@@ -454,11 +456,11 @@
 					       permission)
     @param n_past_days Mark files that are newer than the past N days as new
 } {
-    if {[empty_string_p $folder_id]} {
+    if {$folder_id eq ""} {
 	set folder_id [get_root_folder -package_id [ad_conn package_id]]
     }
 
-    if {[empty_string_p $user_id]} {
+    if {$user_id eq ""} {
 	set user_id [acs_magic_object the_public]
     }
 
@@ -490,11 +492,11 @@
     @param user_id The viewer of the contents (to make sure they have
 					       permission)
 } {
-    if {[empty_string_p $folder_id]} {
+    if {$folder_id eq ""} {
 	set folder_id [get_root_folder -package_id [ad_conn package_id]]
     }
 
-    if {[empty_string_p $user_id]} {
+    if {$user_id eq ""} {
 	set user_id [acs_magic_object the_public]
     }
 
@@ -509,7 +511,7 @@
 } {
     publish a file storage object to the file system
 } {
-    if {[empty_string_p $path]} {
+    if {$path eq ""} {
 	set path [ns_tmpnam]
     }
 
@@ -541,11 +543,11 @@
 } {
     publish the contents of a file storage folder to the file system
 } {
-    if {[empty_string_p $path]} {
+    if {$path eq ""} {
 	set path [ns_tmpnam]
     }
 
-    if {[empty_string_p $folder_name]} {
+    if {$folder_name eq ""} {
 	set folder_name [get_object_name -object_id $folder_id]
     }
     set folder_name [remove_special_file_system_characters -string $folder_name]
@@ -573,14 +575,14 @@
     publish a url object to the file system as a Windows shortcut
     (which at least KDE also knows how to handle)
 } {
-    if {[empty_string_p $path]} {
+    if {$path eq ""} {
 	set path [ns_tmpnam]
 	file mkdir $path
     }
 
     db_1row select_object_metadata {}
 
-    if {[empty_string_p $file_name]} {
+    if {$file_name eq ""} {
 	set file_name $name
     }
     set file_name "${file_name}.url"
@@ -601,7 +603,7 @@
 } {
     publish an object to the file system
 } {
-    if {[empty_string_p $path]} {
+    if {$path eq ""} {
 	set path [ns_tmpnam]
 	file mkdir $path
     }
@@ -613,7 +615,7 @@
 
     if { $like_filesystem_p } {
 	set file_name $title
-	if {[empty_string_p $file_name]} {
+	if {$file_name eq ""} {
 	    if {![info exists upload_file_name]} {
 		set file_name "unnamedfile"
 	    } else {
@@ -714,7 +716,7 @@
 } {
     Get the item_id of a file
 } {
-    if {[empty_string_p $folder_id]} {
+    if {$folder_id eq ""} {
 	set package_id [ad_conn package_id]
 	set folder_id [fs_get_root_folder -package_id $package_id]
     }
@@ -748,7 +750,7 @@
 	set indbp "f"
         set storage_type "file"
     }
-    if {[string equal "" $mime_type]} {
+    if {$mime_type eq ""} {
         set mime_type [cr_filename_to_mime_type -create -- $name]
     }
     # we have to do this here because we create the object before
@@ -779,7 +781,7 @@
 			     -mime_type "text/plain"
 			    ]
 			     
-	    if {![empty_string_p $creation_user]} {
+	    if {$creation_user ne ""} {
 		permission::grant -party_id $creation_user -object_id $item_id -privilege admin
 	    }
 
@@ -862,22 +864,22 @@
 	set indbp "f"
         set storage_type "file"
     }
-    if {![string equal "" $item_id]} {
+    if {$item_id ne ""} {
         set storage_type [db_string get_storage_type "select storage_type from cr_items where item_id=:item_id"]
     }
-    if {[empty_string_p $mime_type] } {
+    if {$mime_type eq "" } {
 	set mime_type "text/html"
     }
-    if { [empty_string_p $name] } {
+    if { $name eq "" } {
 	set name $title
     }
 
     set content_type "file_storage_object"
 
     db_transaction {
-	if {[empty_string_p $item_id] || ![db_string item_exists ""]} {
+	if {$item_id eq "" || ![db_string item_exists ""]} {
 	    set item_id [db_exec_plsql create_item ""]
-	    if {![empty_string_p $creation_user]} {
+	    if {$creation_user ne ""} {
 		permission::grant -party_id $creation_user -object_id $item_id -privilege admin
 	    }
 	    set do_notify_here_p "t"
@@ -928,20 +930,20 @@
     Create a new version of a file storage item using the content passed in content_body
     @return revision_id
 } {
-    if {[empty_string_p $package_id]} {
+    if {$package_id eq ""} {
 	set package_id [ad_conn package_id]
     }
-    if {[empty_string_p $storage_type]} {
+    if {$storage_type eq ""} {
 	set storage_type [db_string get_storage_type ""]
     }
-    if {[empty_string_p $creation_user]} {
+    if {$creation_user eq ""} {
 	set creation_user [ad_conn user_id]
     }
-    if {[empty_string_p $creation_ip]} {
+    if {$creation_ip eq ""} {
 	set creation_ip [ns_conn peeraddr]
     }
     set parent_id [fs::get_parent -item_id $item_id]
-    if {[string equal "" $storage_type]} {
+    if {$storage_type eq ""} {
         set storage_type [db_string get_storage_type "select storage_type from cr_items where item_id=:item_id"]    
     }
     switch -- $storage_type {
@@ -1019,10 +1021,10 @@
     @return revision_id
 } {
     # always use the storage type of the existing item
-    if {[string equal "" $storage_type]} {
+    if {$storage_type eq ""} {
         set storage_type [db_string get_storage_type ""]
     }
-    if {[string equal "" $mime_type]} {
+    if {$mime_type eq ""} {
         set mime_type [cr_filename_to_mime_type -create -- $name]
     }
 
@@ -1079,7 +1081,7 @@
 
     set version_name [get_object_name -object_id $item_id]
 
-    if {[empty_string_p $parent_id]} {
+    if {$parent_id eq ""} {
 	set parent_id [fs::get_parent -item_id $item_id]
     }
     
@@ -1118,7 +1120,7 @@
 	}
     }
 
-    if {[empty_string_p $parent_id]} {
+    if {$parent_id eq ""} {
 	set parent_id [fs::get_parent -item_id $folder_id]
     }
 
@@ -1162,16 +1164,16 @@
     if {  [parameter::get -parameter "UseWebDavP"] == 0 } {
 	return "ho"
     }  
-    if {[empty_string_p $package_id]} {
+    if {$package_id eq ""} {
 	set package_id [ad_conn package_id]
     }
     
-    if {[empty_string_p $root_folder_id]} {
+    if {$root_folder_id eq ""} {
 	set root_folder_id [fs::get_root_folder -package_id $package_id]
     }
 
-    if {[string equal "t" [oacs_dav::folder_enabled -folder_id $root_folder_id]]} {
-	if {[string equal $root_folder_id $item_id]} {
+    if {"t" eq [oacs_dav::folder_enabled -folder_id $root_folder_id]} {
+	if {$root_folder_id eq $item_id} {
 	    set url_stub ""
 	} else {
 	    set url_stub [content::item::get_virtual_path -root_folder_id $root_folder_id -item_id $item_id]
@@ -1209,21 +1211,21 @@
 } {
     set package_and_root [fs::get_folder_package_and_root $folder_id]
     set root_folder [lindex $package_and_root 1]
-    if {[string equal "" $package_id]} {
+    if {$package_id eq ""} {
 	set package_id [lindex $package_and_root 0]
     }
 
-    if {[string equal $action "new_file"]} {
+    if {$action eq "new_file"} {
         set action_type "[_ file-storage.New_File_Uploaded]"
-    } elseif {[string equal $action "new_url"]} {
+    } elseif {$action eq "new_url"} {
         set action_type "[_ file-storage.New_URL_Uploaded]"
-    } elseif {[string equal $action "new_version"]} {
+    } elseif {$action eq "new_version"} {
         set action_type "[_ file-storage.lt_New_version_of_file_u]"
-    } elseif {[string equal $action "delete_file"]} {
+    } elseif {$action eq "delete_file"} {
         set action_type "[_ file-storage.File_deleted]"
-    } elseif {[string equal $action "delete_url"]} {
+    } elseif {$action eq "delete_url"} {
         set action_type "[_ file-storage.URL_deleted]"
-    } elseif {[string equal $action "delete_folder"]} {
+    } elseif {$action eq "delete_folder"} {
         set action_type "[_ file-storage.Folder_deleted]"
     } else {
         error "Unknown file-storage notification action: $action"
@@ -1233,10 +1235,10 @@
     set new_content ""
     db_0or1row get_owner_name { }
 
-    if {[string equal $action "new_file"] || [string equal $action "new_url"] || [string equal $action "new_version"]} {
+    if {$action eq "new_file" || $action eq "new_url" || $action eq "new_version"} {
 
 
-        if {[string equal $action "new_version"]} {
+        if {$action eq "new_version"} {
             set sql "select description as description from cr_revisions 
                            where cr_revisions.revision_id = :item_id"
         } elseif {[string match "*folder" $action]} {
@@ -1257,7 +1259,7 @@
     set folder_name [fs_get_folder_name $folder_id]
     append text_version "[_ file-storage.lt_File-Storage_folder_f]\n"
 
-    if {[string equal $action "new_version"]} {
+    if {$action eq "new_version"} {
         append text_version "[_ file-storage.lt_New_Version_Uploaded_]\n"
     } else {
         append text_version "[_ file-storage.lt_Name_of_the_action_ty]\n"
@@ -1320,7 +1322,7 @@
 
     item::get_mime_info [content::item::get_live_revision -item_id $item_id]
 
-    if {[lsearch -exact $editable_mime_types [string tolower $mime_info(mime_type)]] != -1} {
+    if {[string tolower $mime_info(mime_type)] in $editable_mime_types} {
         set mime_info(editable_p) 1
     } else {
         set mime_info(editable_p) 0
@@ -1367,7 +1369,7 @@
 
     set user_id [ad_conn user_id]
     set root_folder_id [fs::get_root_folder]
-    if {![exists_and_not_null revision_id]} {
+    if {(![info exists revision_id] || $revision_id eq "")} {
         set revision_id [content::item::get_live_revision -item_id $file_id]
     }
 
@@ -1388,7 +1390,7 @@
     set content [db_exec_plsql get_content {
     }]
 
-    if {[string equal $file_object_info(storage_type) file]} {
+    if {$file_object_info(storage_type) eq "file"} {
         set filename [cr_fs_path $file_object_info(storage_area_key)]
         append filename $content
         set fd [open $filename]
@@ -1465,7 +1467,7 @@
 } {
     db_1row file_data {}
 
-    if {![empty_string_p $postfix]} {
+    if {$postfix ne ""} {
 	set name [lang::util::localize "[file rootname $name]_$postfix[file extension $name]"]
     }
 
@@ -1500,7 +1502,7 @@
 	set new_path [cr_create_content_file_path $new_file_id $new_file_rev_id]
 	cr_create_content_file $new_file_id $new_file_rev_id $file_path
 	
-	if {![empty_string_p $postfix]} {
+	if {$postfix ne ""} {
 	    # set postfixed new title
 	    db_dml update_title {}
 	}
@@ -1526,7 +1528,7 @@
 } {
     db_1row file_data {}
 
-    if {![empty_string_p $postfix]} {
+    if {$postfix ne ""} {
 	set name [lang::util::localize "[file rootname $name]_$postfix[file extension $name]"]
     }
 
@@ -1561,7 +1563,7 @@
 	set new_path [cr_create_content_file_path $new_file_id $new_file_rev_id]
 	cr_create_content_file $new_file_id $new_file_rev_id $file_path
 	
-	if {![empty_string_p $postfix]} {
+	if {$postfix ne ""} {
 	    # set postfixed new title
 	    db_dml update_title {}
 	}
Index: openacs-4/packages/file-storage/tcl/file-storage-rss-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-rss-procs.tcl,v
diff -u -r1.3.2.2 -r1.3.2.3
--- openacs-4/packages/file-storage/tcl/file-storage-rss-procs.tcl	11 Sep 2013 13:07:22 -0000	1.3.2.2
+++ openacs-4/packages/file-storage/tcl/file-storage-rss-procs.tcl	3 Oct 2013 08:33:57 -0000	1.3.2.3
@@ -57,7 +57,7 @@
 
     set image_url "/resources/dotlrn/logo-user.gif"
 
-    if { [empty_string_p $image_url] } {
+    if { $image_url eq "" } {
         set column_array(image) ""
     } else {
         set column_array(image) [list \
@@ -88,13 +88,13 @@
     set items [list]
     set counter 0
 
-    if { [string equal $descend_p f] } {
+    if {$descend_p eq "f"} {
         set parent_clause "parent_id = :folder_id"
     } else {
         set parent_clause [db_map descend_parent_clause]
     }
 
-    if { [string equal $include_revisions_p f] } {
+    if {$include_revisions_p eq "f"} {
         set revisions_clause "r.revision_id = o.live_revision"
     } else {
         set revisions_clause "r.item_id = o.object_id"
@@ -105,7 +105,7 @@
         set content "content"
         set description $description
 
-        if { [string equal $include_revisions_p t] } {
+        if {$include_revisions_p eq "t"} {
             append description "<br><br><b>Note:</b> This may be a new revision of an existing file."
         }
         
@@ -119,7 +119,7 @@
                           description $description \
                           timestamp $publish_timestamp ]
 
-        if { ![string equal $enclosure_match_patterns ""] } {
+        if { $enclosure_match_patterns ne "" } {
             foreach pattern $enclosure_match_patterns {
                 if { [string match $pattern $title] } {
                     lappend iteminfo \
Index: openacs-4/packages/file-storage/tcl/test/tclwebtest-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/test/tclwebtest-procs.tcl,v
diff -u -r1.4 -r1.4.6.1
--- openacs-4/packages/file-storage/tcl/test/tclwebtest-procs.tcl	29 Aug 2007 14:59:31 -0000	1.4
+++ openacs-4/packages/file-storage/tcl/test/tclwebtest-procs.tcl	3 Oct 2013 08:33:57 -0000	1.4.6.1
@@ -134,7 +134,7 @@
     if { [string match  "*\?folder*id*" $response_url] } {
 
         set list_words [split "$file_name" /]
-        set short_file_name [lindex $list_words [expr [llength $list_words]-1]]
+        set short_file_name [lindex $list_words [llength $list_words]-1]
 
         if {[catch {tclwebtest::assert text $folder_name} errmsg] || [catch {tclwebtest::link find $short_file_name} errmsg]} {
             aa_error "file_storage::twt::add_file_to_folder failed $errmsg : Didn't add a file to folder"
@@ -202,7 +202,7 @@
      if { [string match  "*\?folder*id*" $response_url] } {
 
  	set list_words [split "$file_name" /]
-         set short_file_name [lindex $list_words [expr [llength $list_words]-1]]
+         set short_file_name [lindex $list_words [llength $list_words]-1]
 
          if {[catch {tclwebtest::link find $short_file_name} errmsg]} {
              aa_error "file_storage::twt::upload_file failed $errmsg : Didn't upload a File"
@@ -234,7 +234,7 @@
 
  	# Get the short file name
  	set list_words [split "$file_name" /]
- 	set short_file_name [lindex $list_words [expr [llength $list_words]-1]]
+ 	set short_file_name [lindex $list_words [llength $list_words]-1]
 
          if {![catch {tclwebtest::link find $short_file_name} errmsg]} {
              aa_error "file_storage::twt::delete_file failed $errmsg : Didn't delete a File"
@@ -297,7 +297,7 @@
 
         # Get the short file name
         set list_words [split "$file_name" /]
-        set short_file_name [lindex $list_words [expr [llength $list_words]-1]]
+        set short_file_name [lindex $list_words [llength $list_words]-1]
 
         if {![catch {tclwebtest::link find $short_file_name} errmsg]} {
             aa_error "file_storage::twt::move_file $errmsg : Didn't move a file"
@@ -329,7 +329,7 @@
 
         # Get the short file name
         set list_words [split "$file_name" /]
-        set short_file_name [lindex $list_words [expr [llength $list_words]-1]]
+        set short_file_name [lindex $list_words [llength $list_words]-1]
 
         if {[catch {tclwebtest::link find $short_file_name} errmsg]} {
             aa_error "file_storage::twt::copy_file $errmsg : Didn't copy a file"
Index: openacs-4/packages/file-storage/www/copy.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/copy.tcl,v
diff -u -r1.9.4.1 -r1.9.4.2
--- openacs-4/packages/file-storage/www/copy.tcl	15 Sep 2013 21:03:26 -0000	1.9.4.1
+++ openacs-4/packages/file-storage/www/copy.tcl	3 Oct 2013 08:33:57 -0000	1.9.4.2
@@ -61,7 +61,7 @@
      set error_items [list]      
     template::multirow foreach copy_objects {
         db_transaction {
-            if {![string equal $type "folder"] } {
+            if {$type ne "folder" } {
                 set file_rev_id [db_exec_plsql copy_item {}]
 		callback fs::file_revision_new -package_id $package_id -file_id $object_id -parent_id $folder_id
             } else {
@@ -108,16 +108,16 @@
             }
         }
 
-    if {[empty_string_p $root_folder_id]} {
+    if {$root_folder_id eq ""} {
 	set root_folder_id [fs::get_root_folder]
     }
     set object_id $objects_to_copy
     set cancel_url "[ad_conn url]?[ad_conn query]"
     db_multirow -extend {copy_url} folder_tree get_folder_tree "" {
-        if {[lsearch [concat $not_allowed_parents $not_allowed_children] $folder_id] ne "-1" || 
-            [lsearch $not_allowed_children $parent_id] ne "-1" } {
-            
-            if {[lsearch $not_allowed_children $parent_id] ne "-1"} {
+        if {$folder_id in [concat $not_allowed_parents $not_allowed_children] 
+	    || $parent_id in $not_allowed_children
+	} {
+            if {$parent_id in $not_allowed_children} {
                 lappend not_allowed_children $folder_id
             }
             set copy_url ""
Index: openacs-4/packages/file-storage/www/file-add.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/file-add.tcl,v
diff -u -r1.17.2.2 -r1.17.2.3
--- openacs-4/packages/file-storage/www/file-add.tcl	9 Sep 2013 16:44:26 -0000	1.17.2.2
+++ openacs-4/packages/file-storage/www/file-add.tcl	3 Oct 2013 08:33:57 -0000	1.17.2.3
@@ -23,7 +23,7 @@
     instructions:onevalue
 } -validate {
     file_id_or_folder_id {
-	if {[exists_and_not_null file_id] && ![exists_and_not_null folder_id]} {
+	if {([info exists file_id] && $file_id ne "") && (![info exists folder_id] || $folder_id eq "")} {
 	    set folder_id [db_string get_folder_id "select parent_id as folder_id from cr_items where item_id=:file_id;" -default ""]
 	}
 	if {![fs_folder_p $folder_id]} {
@@ -80,7 +80,7 @@
         # To make content editable
         set revision_id [content::item::get_live_revision -item_id $file_id]
         set mime_type [db_string get_mime_type "select mime_type from cr_revisions where revision_id = :revision_id"]
-        if { [string equal $mime_type "text/html"] } {
+        if {$mime_type eq "text/html"} {
             ad_form -extend -form {
                 {edit_content:richtext(richtext),optional 
                     {label "Content"} 
@@ -95,7 +95,7 @@
     }
 }
 
-if {[exists_and_not_null return_url]} {
+if {([info exists return_url] && $return_url ne "")} {
     ad_form -extend -form {
 	{return_url:text(hidden) {value $return_url}}
     }
@@ -127,7 +127,7 @@
     }
 }
 if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } {
-     if { [exists_and_not_null file_id] } {
+     if { ([info exists file_id] && $file_id ne "") } {
 	 set categorized_object_id $file_id
      } else {
 	 # pre-populate with categories from the folder
@@ -142,10 +142,10 @@
 
 ad_form -extend -form {} -select_query_name {get_file} -new_data {
     
-  if {![exists_and_not_null unpack_p]} {
+  if {(![info exists unpack_p] || $unpack_p eq "")} {
       set unpack_p f
   }
-  if { $unpack_p && ![empty_string_p $unpack_binary] && [file extension [template::util::file::get_property filename $upload_file]] eq ".zip"  } {
+  if { $unpack_p && $unpack_binary ne "" && [file extension [template::util::file::get_property filename $upload_file]] eq ".zip"  } {
 	
 	set path [ns_tmpnam]
 	file mkdir $path
@@ -196,17 +196,17 @@
 	# and the file with the same name already exists
 	# we create a new revision
 	
-	if {[string equal $this_title ""]} {
+	if {$this_title eq ""} {
 	    set this_title $upload_file
 	}
 	
-	if {![empty_string_p $name]} {
+	if {$name ne ""} {
 	    set upload_file $name
 	}
 
 	set existing_item_id [fs::get_item_id -name $upload_file -folder_id $folder_id]
 	
-	if {![empty_string_p $existing_item_id]} {
+	if {$existing_item_id ne ""} {
 	    # file with the same name already exists in this folder
             if { [parameter::get -parameter "BehaveLikeFilesystemP" -package_id [ad_conn package_id]] } {
                 # create a new revision -- in effect, replace the existing file
@@ -253,7 +253,7 @@
 } -edit_data {
     set this_title $title
     set filename [template::util::file::get_property filename $upload_file]
-    if {[string equal $this_title ""]} {
+    if {$this_title eq ""} {
 	set this_title $filename
     }
 	
@@ -274,7 +274,7 @@
     }
 } -after_submit {
 
-    if {[exists_and_not_null return_url]} {
+    if {([info exists return_url] && $return_url ne "")} {
 	ad_returnredirect $return_url
     } else {
 	ad_returnredirect "./?[export_vars -url {folder_id}]"
@@ -284,7 +284,7 @@
 }
 
 # if title isn't passed in ignore lock_title_p
-if {[empty_string_p $title]} {
+if {$title eq ""} {
     set lock_title_p 0
 }
 
@@ -294,6 +294,6 @@
     set instructions "[_ file-storage.Add_Dup_As_New_File]"
 }
 
-set unpack_available_p [expr ![empty_string_p [string trim [parameter::get -parameter UnzipBinary]]]]
+set unpack_available_p [expr {[string trim [parameter::get -parameter UnzipBinary]] ne ""]]
 
 ad_return_template
Index: openacs-4/packages/file-storage/www/file-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/file-edit.tcl,v
diff -u -r1.10.4.1 -r1.10.4.2
--- openacs-4/packages/file-storage/www/file-edit.tcl	6 Sep 2013 16:01:48 -0000	1.10.4.1
+++ openacs-4/packages/file-storage/www/file-edit.tcl	3 Oct 2013 08:33:57 -0000	1.10.4.2
@@ -8,7 +8,7 @@
     file_id:integer,notnull
 } -validate {
     valid_file -requires {file_id} {
-        if ![fs_file_p $file_id] {
+        if {![fs_file_p $file_id]} {
             ad_complain "[_ file-storage.lt_The_specified_file_is]"
         }
     }
@@ -54,9 +54,9 @@
 ad_form -extend -form {
     {submit:text(submit) {label $submit_label}}
 } -on_submit {
-    if [catch {
+    if {[catch {
         db_dml edit_title {}
-    } errmsg] {
+    } errmsg]} {
         if { [db_string duplicate_check {}] } {
             ad_return_complaint 1 "[_ file-storage.lt_It_appears_that_there]"
         } else {
Index: openacs-4/packages/file-storage/www/file.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/file.tcl,v
diff -u -r1.32.2.1 -r1.32.2.2
--- openacs-4/packages/file-storage/www/file.tcl	6 Sep 2013 16:24:55 -0000	1.32.2.1
+++ openacs-4/packages/file-storage/www/file.tcl	3 Oct 2013 08:33:57 -0000	1.32.2.2
@@ -9,7 +9,7 @@
     {show_all_versions_p "f"}
 } -validate {
     valid_file -requires {file_id} {
-	if ![fs_file_p $file_id] {
+	if {![fs_file_p $file_id]} {
 	    ad_complain "[_ file-storage.lt_The_specified_file_is]"
 	}
     }
@@ -66,7 +66,7 @@
                  "[_ file-storage.Move_File]" [export_vars -base move {{object_id $file_id} {return_url $folder_view_url}}] "Move file" \
                  "[_ file-storage.Delete_File]" [export_vars -base delete {{object_id $file_id} {return_url $folder_view_url}}] "Delete file"]
 
-if {[string equal $delete_p "t"]} {
+if {$delete_p eq "t"} {
     lappend actions [_ file-storage.Set_Permissions] [export_vars -base permissions {{object_id $file_id}}] [_ file-storage.lt_Modify_permissions_on]
 }
 
@@ -110,12 +110,12 @@
     if {$content_size < 1024} {
 	set content_size_pretty "[lc_numeric $content_size] [_ file-storage.bytes]"
     } else {
-	set content_size_pretty "[lc_numeric [expr $content_size / 1024 ]] [_ file-storage.kb]"
+	set content_size_pretty "[lc_numeric [expr {$content_size / 1024 }]] [_ file-storage.kb]"
     }
-    if {[string equal $title ""]} {
+    if {$title eq ""} {
 	set title "[_ file-storage.untitled]"
     }
-    if {![string equal $version_id $live_revision]} {
+    if {$version_id ne $live_revision } {
         set version_url [export_vars -base "download/$title" {version_id}]
     } else {
         set version_url [export_vars -base "download/$title" {file_id}]
Index: openacs-4/packages/file-storage/www/folder-add.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-add.tcl,v
diff -u -r1.2.8.1 -r1.2.8.2
--- openacs-4/packages/file-storage/www/folder-add.tcl	9 Sep 2013 16:44:27 -0000	1.2.8.1
+++ openacs-4/packages/file-storage/www/folder-add.tcl	3 Oct 2013 08:33:57 -0000	1.2.8.2
@@ -44,7 +44,7 @@
     {upload_folder:text(text) {label \#file-storage.Upload_a_folder#} {html "size 30"} {help_text "[_ file-storage.Upload_folder_help]"}}
 }
 
-if {[exists_and_not_null return_url]} {
+if {([info exists return_url] && $return_url ne "")} {
     ad_form -extend -name file_add -form {
 	{return_url:text(hidden) {value $return_url}}
     }
@@ -76,14 +76,14 @@
 	set p_f_id $folder_id
 	set file_paths [file split [file dirname $upload_file]]
 
-	if {![string equal "." $file_paths] && [llength $file_paths]} {
+	if {"." ne $file_paths && [llength $file_paths]} {
 	    # make sure every folder exists
 	    set path ""
 	    foreach p $file_paths {
 		append path /${p}
 		if {![info exists paths($path)]} {
 		    set f_id [content::item::get_id -item_path $path -root_folder_id $p_f_id]
-		    if {[string equal "" $f_id]} {
+		    if {$f_id eq ""} {
 			set p_f_id [content::folder::new -parent_id $p_f_id -name $p -label $p]
 			set paths($path) $p_f_id
 		    }
@@ -100,7 +100,7 @@
 	
 	set existing_item_id [fs::get_item_id -name $upload_file -folder_id $this_folder_id]
 	
-	if {![empty_string_p $existing_item_id]} {
+	if {$existing_item_id ne ""} {
 	    # file with the same name already exists
 	    # in this folder, create a new revision
 	    set this_file_id $existing_item_id
@@ -121,7 +121,7 @@
 	
 	incr i
 
-	if {![empty_string_p $rev_id]} {
+	if {$rev_id ne ""} {
 	    set this_file_id [db_string get_item_id {
 		select item_id
 		from cr_revisions
@@ -137,7 +137,7 @@
  
 } -after_submit {
     
-    if {[exists_and_not_null return_url]} {
+    if {([info exists return_url] && $return_url ne "")} {
 	ad_returnredirect $return_url
     } else {
 	ad_returnredirect "./?[export_vars -url {folder_id}]"
@@ -146,6 +146,6 @@
     
 }
 
-set unpack_available_p [expr ![empty_string_p [string trim [parameter::get -parameter UnzipBinary]]]]
+set unpack_available_p [expr {[string trim [parameter::get -parameter UnzipBinary]] ne ""}]
 
 ad_return_template
\ No newline at end of file
Index: openacs-4/packages/file-storage/www/folder-chunk.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-chunk.tcl,v
diff -u -r1.48 -r1.48.4.1
--- openacs-4/packages/file-storage/www/folder-chunk.tcl	9 Jun 2009 12:37:14 -0000	1.48
+++ openacs-4/packages/file-storage/www/folder-chunk.tcl	3 Oct 2013 08:33:58 -0000	1.48.4.1
@@ -13,14 +13,14 @@
     page_num
 }
 
-if {![exists_and_not_null folder_id]} {
+if {(![info exists folder_id] || $folder_id eq "")} {
     ad_return_complaint 1 [_ file-storage.lt_bad_folder_id_folder_]
     ad_script_abort
 }
-if {![exists_and_not_null allow_bulk_actions]} {
+if {(![info exists allow_bulk_actions] || $allow_bulk_actions eq "")} {
     set allow_bulk_actions "0"
 }
-if { ![exists_and_not_null category_id] } {
+if { (![info exists category_id] || $category_id eq "") } {
     set category_id ""
 }
 set viewing_user_id [ad_conn user_id]
@@ -41,27 +41,27 @@
     set delete_p [permission::permission_p -party_id $viewing_user_id -object_id $folder_id -privilege "delete"]
 }
 
-if {![exists_and_not_null n_past_days]} {
+if {(![info exists n_past_days] || $n_past_days eq "")} {
     set n_past_days 99999
 }
 
-if {![exists_and_not_null fs_url]} {
+if {(![info exists fs_url] || $fs_url eq "")} {
     set fs_url [ad_conn package_url]
 }
 
 set folder_name [lang::util::localize [fs::get_object_name -object_id  $folder_id]]
 
 set content_size_total 0
 
-if {![exists_and_not_null format]} {
+if {(![info exists format] || $format eq "")} {
     set format table
 }
 
 #AG: We're an include file, and we may be included from outside file-storage.
 #So we need to query for the package_id rather than getting it from ad_conn.
 set package_and_root [fs::get_folder_package_and_root $folder_id]
 set package_id [lindex $package_and_root 0]
-if {![exists_and_not_null root_folder_id]} {
+if {(![info exists root_folder_id] || $root_folder_id eq "")} {
     set root_folder_id [lindex $package_and_root 1]
 }
 
@@ -88,7 +88,7 @@
 set like_filesystem_p [parameter::get -parameter BehaveLikeFilesystemP -package_id $package_id -default 1]
 
 set target_window_name [parameter::get -parameter DownloadTargetWindowName -package_id $package_id -default ""]
-if { [string equal $target_window_name ""] } {
+if {$target_window_name eq ""} {
     set target_attr ""
 } else {
     set target_attr "target=\"$target_window_name\""
@@ -165,7 +165,7 @@
     concat $elements [list views [list label "Views"]]
 }
 
-if {![exists_and_not_null return_url]} {
+if {(![info exists return_url] || $return_url eq "")} {
     set return_url [export_vars -base "index" {folder_id}]
 }
 set vars_to_export [list return_url]
@@ -214,11 +214,11 @@
 
 set orderby [template::list::orderby_clause -orderby -name contents_${folder_id}]
 
-if {[string equal $orderby ""]} {
+if {$orderby eq ""} {
     set orderby " order by fs_objects.sort_key, fs_objects.name asc"
 }
 
-if { $categories_p && [exists_and_not_null category_id] } {
+if { $categories_p && ([info exists category_id] && $category_id ne "") } {
     set categories_limitation [db_map categories_limitation]
 } else {
     set categories_limitation {}
@@ -228,7 +228,7 @@
     set last_modified_ansi [lc_time_system_to_conn $last_modified_ansi]
     
     set last_modified_pretty [lc_time_fmt $last_modified_ansi "%x %X"]
-    if {[string equal $type "folder"]} {
+    if {$type eq "folder"} {
         set content_size_pretty [lc_numeric $content_size]
         append content_size_pretty "&nbsp;[_ file-storage.items]"
         set pretty_type "#file-storage.Folder#"
@@ -238,14 +238,14 @@
         } elseif {$content_size < 1024} {
             set content_size_pretty "[lc_numeric $content_size]&nbsp;[_ file-storage.bytes]"
         } else {
-            set content_size_pretty "[lc_numeric [expr $content_size / 1024 ]]&nbsp;[_ file-storage.kb]"
+            set content_size_pretty "[lc_numeric [expr {$content_size / 1024 }]]&nbsp;[_ file-storage.kb]"
         }
 
     }
 
     set file_upload_name [fs::remove_special_file_system_characters -string $file_upload_name]
 
-    if { ![empty_string_p $content_size] } {
+    if { $content_size ne "" } {
         incr content_size_total $content_size
     }
 
@@ -293,15 +293,15 @@
             db_1row file_info {select * from fs_objects where object_id = :target_object_id}
             # because of the side effect that SQL sets TCL variables, set object_id back to the original value
             set object_id $original_object_id
-            if {[string equal $type "folder"]} {
+            if {$type eq "folder"} {
                 set content_size_pretty [lc_numeric $content_size]
                 append content_size_pretty "&nbsp;[_ file-storage.items]"
                 set pretty_type "#file-storage.Folder#"
             } else {
                 if {$content_size < 1024} {
                     set content_size_pretty "[lc_numeric $content_size]&nbsp;[_ file-storage.bytes]"
                 } else {
-                    set content_size_pretty "[lc_numeric [expr $content_size / 1024 ]]&nbsp;[_ file-storage.kb]"
+                    set content_size_pretty "[lc_numeric [expr {$content_size / 1024 }]]&nbsp;[_ file-storage.kb]"
                 }
                 
             }
Index: openacs-4/packages/file-storage/www/folder-create.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-create.tcl,v
diff -u -r1.9 -r1.9.6.1
--- openacs-4/packages/file-storage/www/folder-create.tcl	2 Feb 2008 12:20:00 -0000	1.9
+++ openacs-4/packages/file-storage/www/folder-create.tcl	3 Oct 2013 08:33:58 -0000	1.9.6.1
@@ -11,12 +11,12 @@
     folder_id:integer,optional,notnull
 } -validate {
     file_id_or_folder_id {
-	if { ![exists_and_not_null folder_id] && ![exists_and_not_null parent_id] } {
+	if { (![info exists folder_id] || $folder_id eq "") && (![info exists parent_id] || $parent_id eq "") } {
 	    ad_complain "Input error: Must either have a parent_id or a folder_id"
 	}
     }
     valid_folder -requires {parent_id:integer} {
-	if ![fs_folder_p $parent_id] {
+	if {![fs_folder_p $parent_id]} {
 	    ad_complain "[_ file-storage.lt_The_specified_parent_]"
 	}
     }
@@ -29,7 +29,7 @@
 set user_id [ad_conn user_id]
 set package_id [ad_conn package_id]
 # check that they have write permission on the parent folder or this folder if its an edit.
-if { [exists_and_not_null parent_id] } {
+if { ([info exists parent_id] && $parent_id ne "") } {
     permission::require_permission \
 	    -object_id $parent_id \
 	    -party_id $user_id \
@@ -56,9 +56,9 @@
 
 set package_id [ad_conn package_id]
 if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } {
-    if { [exists_and_not_null folder_id] } {
+    if { ([info exists folder_id] && $folder_id ne "") } {
 	set categorized_object_id $folder_id
-    } elseif { [exists_and_not_null parent_id] } {
+    } elseif { ([info exists parent_id] && $parent_id ne "") } {
 	set categorized_object_id $parent_id
     } else {
 	set categorized_object_id ""
Index: openacs-4/packages/file-storage/www/folder-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-delete.tcl,v
diff -u -r1.10.8.1 -r1.10.8.2
--- openacs-4/packages/file-storage/www/folder-delete.tcl	6 Sep 2013 16:01:48 -0000	1.10.8.1
+++ openacs-4/packages/file-storage/www/folder-delete.tcl	3 Oct 2013 08:33:58 -0000	1.10.8.2
@@ -10,7 +10,7 @@
     {confirmed_p "f"}
 } -validate {
     valid_folder -requires {folder_id:integer} {
-	if ![fs_folder_p $folder_id] {
+	if {![fs_folder_p $folder_id]} {
 	    ad_complain "[_ file-storage.lt_The_specified_folder__1]"
 	}
     }
@@ -58,7 +58,7 @@
     } -on_request {
 
     } -on_submit {
-	if {[string equal $blocked_p "f"] } {
+	if {$blocked_p eq "f"} {
 	    # they have confirmed that they want to delete the folder
 	    
 	    callback fs::folder_delete -package_id [ad_conn package_id] -folder_id $folder_id
@@ -73,7 +73,7 @@
     -export {folder_id}
    
 
-if { [string equal $confirmed_p "t"] && [string equal $blocked_p "f"] } {
+if { $confirmed_p eq "t" && $blocked_p eq "f" } {
     # they have confirmed that they want to delete the folder
 
     db_1row parent_id "
Index: openacs-4/packages/file-storage/www/folder-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-edit.tcl,v
diff -u -r1.4.6.1 -r1.4.6.2
--- openacs-4/packages/file-storage/www/folder-edit.tcl	6 Sep 2013 16:01:48 -0000	1.4.6.1
+++ openacs-4/packages/file-storage/www/folder-edit.tcl	3 Oct 2013 08:33:58 -0000	1.4.6.2
@@ -8,7 +8,7 @@
     folder_id:integer,notnull
 } -validate {
     valid_folder -requires {parent_id:integer} {
-	if ![fs_folder_p $folder_id] {
+	if {![fs_folder_p $folder_id]} {
 	    ad_complain "[_ file-storage.lt_The_specified_folder_]"
 	}
     }
Index: openacs-4/packages/file-storage/www/folder-zip-add.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-zip-add.tcl,v
diff -u -r1.4.6.2 -r1.4.6.3
--- openacs-4/packages/file-storage/www/folder-zip-add.tcl	9 Sep 2013 16:44:27 -0000	1.4.6.2
+++ openacs-4/packages/file-storage/www/folder-zip-add.tcl	3 Oct 2013 08:33:58 -0000	1.4.6.3
@@ -20,7 +20,7 @@
     lock_title_p:onevalue
 } -validate {
     file_id_or_folder_id {
-        if {[exists_and_not_null file_id] && ![exists_and_not_null folder_id]} {
+        if {([info exists file_id] && $file_id ne "") && (![info exists folder_id] || $folder_id eq "")} {
             set folder_id [db_string get_folder_id "select parent_id as folder_id from cr_items where item_id=:file_id" -default ""]
         }
         if {![fs_folder_p $folder_id]} {
@@ -61,7 +61,7 @@
     {upload_file:file {label \#file-storage.Upload_a_file\#} {html "size 30"}}
 }
 
-if {[exists_and_not_null return_url]} {
+if {([info exists return_url] && $return_url ne "")} {
     ad_form -extend -name file_add -form {
 	{return_url:text(hidden) {value $return_url}}
     }
@@ -88,14 +88,14 @@
     # create a new folder to hold the zip contents
     # TODO make sure its name is unique?
     
-    if {[empty_string_p $title]} {
+    if {$title eq ""} {
 	set title [file rootname [list [template::util::file::get_property filename $upload_file]]]
     }
     set folder_id [content::folder::new -name $title -parent_id $folder_id -label $title]
     
     set unzip_binary [string trim [parameter::get -parameter UnzipBinary]]
     
-    if { ![empty_string_p $unzip_binary] } {
+    if { $unzip_binary ne "" } {
         
         set unzip_path [ns_tmpnam]
         file mkdir $unzip_path
@@ -138,14 +138,14 @@
 	set p_f_id $folder_id
 	set file_paths [file split [file dirname $upload_file]]
 	ns_log notice "\n DAVEB1 \n '${file_paths}'"
-	if {![string equal "." $file_paths] && [llength $file_paths]} {
+	if {"." ne $file_paths && [llength $file_paths]} {
 	    # make sure every folder exists
 	    set path ""
 	    foreach p $file_paths {
 		append path /${p}
 		if {![info exists paths($path)]} {
 		    set f_id [content::item::get_id -item_path $path -root_folder_id $p_f_id]
-		    if {[string equal "" $f_id]} {
+		    if {$f_id eq ""} {
 			set p_f_id [content::folder::new -parent_id $p_f_id -name $p -label $p]
 			set paths($path) $p_f_id
 		    }
@@ -162,7 +162,7 @@
 	
 	set existing_item_id [fs::get_item_id -name $upload_file -folder_id $this_folder_id]
 	
-	if {![empty_string_p $existing_item_id]} {
+	if {$existing_item_id ne ""} {
 	    # file with the same name already exists
 	    # in this folder, create a new revision
 	    set this_file_id $existing_item_id
@@ -185,7 +185,7 @@
 	file delete $tmpfile
 	incr i
 
-	if {![empty_string_p $rev_id]} {
+	if {$rev_id ne ""} {
 	    set this_file_id [db_string get_item_id {
 		select item_id
 		from cr_revisions
@@ -198,7 +198,7 @@
 	}
 	
     }
-    if {![string equal "" $unzip_path]} {
+    if {$unzip_path ne ""} {
 	file delete -force $unzip_path
     }
     file delete $upload_file.tmpfile
@@ -214,7 +214,7 @@
     
 } -after_submit {
     
-    if {[exists_and_not_null return_url]} {
+    if {([info exists return_url] && $return_url ne "")} {
 	ad_returnredirect $return_url
     } else {
 	ad_returnredirect "./?[export_vars -url {folder_id}]"
@@ -223,6 +223,6 @@
     
 }
 
-set unpack_available_p [expr ![empty_string_p [string trim [parameter::get -parameter UnzipBinary]]]]
+set unpack_available_p [expr {[string trim [parameter::get -parameter UnzipBinary]] ne ""}]
 
 ad_return_template
\ No newline at end of file
Index: openacs-4/packages/file-storage/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/index.tcl,v
diff -u -r1.30.6.4 -r1.30.6.5
--- openacs-4/packages/file-storage/www/index.tcl	11 Sep 2013 10:16:33 -0000	1.30.6.4
+++ openacs-4/packages/file-storage/www/index.tcl	3 Oct 2013 08:33:58 -0000	1.30.6.5
@@ -98,15 +98,15 @@
 # For now I leave it in as it is.
 
 set project_item_id [application_data_link::get_linked -from_object_id $folder_id -to_object_type "content_item"]
-if {[exists_and_not_null project_item_id]} {
+if {([info exists project_item_id] && $project_item_id ne "")} {
     set project_url [pm::project::url -project_item_id $project_item_id]
     set project_name [pm::project::name -project_item_id $project_item_id]
 } else {
 
     # The folder itself was not linked. Let's try the parent folder.
     set parent_folder [content::item::get_parent_folder -item_id $folder_id]
     set project_item_id [application_data_link::get_linked -from_object_id $parent_folder -to_object_type "content_item"]
-    if {[exists_and_not_null project_item_id]} {
+    if {([info exists project_item_id] && $project_item_id ne "")} {
 	set project_url [pm::project::url -project_item_id $project_item_id]
 	set project_name [pm::project::name -project_item_id $project_item_id]
     } else {
@@ -117,7 +117,7 @@
 }
 
 # Check if the user has permissions. If not, don't care
-if {![empty_string_p $project_item_id] && ![permission::permission_p -object_id $project_item_id -privilege "read"]} {
+if {$project_item_id ne "" && ![permission::permission_p -object_id $project_item_id -privilege "read"]} {
     set project_url {}
 }
 
Index: openacs-4/packages/file-storage/www/move.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/move.tcl,v
diff -u -r1.9.4.1 -r1.9.4.2
--- openacs-4/packages/file-storage/www/move.tcl	15 Sep 2013 21:03:26 -0000	1.9.4.1
+++ openacs-4/packages/file-storage/www/move.tcl	3 Oct 2013 08:33:58 -0000	1.9.4.2
@@ -67,7 +67,7 @@
 	if {$copy_and_delete_p} {  
              # copy and delete file to move it
 	    db_transaction {
-		if {![string equal $type "folder"] } {  
+		if {$type ne "folder" } {  
 		    set file_rev_id [db_exec_plsql copy_item {}]  
 		    set file_id [content::revision::item_id -revision_id $file_rev_id]  
 		    callback fs::file_revision_new -package_id $package_id -file_id $file_id -parent_id $folder_id  
@@ -126,18 +126,18 @@
             }
         }
 
-    if {[empty_string_p $root_folder_id]} {
+    if {$root_folder_id eq ""} {
 	set root_folder_id [fs::get_root_folder]
     }
     set object_id $objects_to_move
     set cancel_url "[ad_conn url]?[ad_conn query]"
     db_multirow -extend {move_url level} folder_tree get_folder_tree "" {
 	# teadams 2003-08-22 - change level to level num to avoid 
 	# Oracle issue with key words.
-        if {[lsearch [concat $not_allowed_parents $not_allowed_children] $folder_id] ne "-1" || 
-            [lsearch $not_allowed_children $parent_id] ne "-1" } {
-            
-            if {[lsearch $not_allowed_children $parent_id] ne "-1"} {
+        if {$folder_in in [concat $not_allowed_parents $not_allowed_children]
+	    || $parent_id in $not_allowed_children
+	} {
+            if {$parent_id in $not_allowed_children} {
                 lappend not_allowed_children $folder_id
             }
             set move_url ""
Index: openacs-4/packages/file-storage/www/simple-add-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/simple-add-2.tcl,v
diff -u -r1.8.4.1 -r1.8.4.2
--- openacs-4/packages/file-storage/www/simple-add-2.tcl	6 Sep 2013 16:01:48 -0000	1.8.4.1
+++ openacs-4/packages/file-storage/www/simple-add-2.tcl	3 Oct 2013 08:33:58 -0000	1.8.4.2
@@ -11,7 +11,7 @@
     url:notnull,trim
 } -validate {
     valid_folder -requires {folder_id:integer} {
-	if ![fs_folder_p $folder_id] {
+	if {![fs_folder_p $folder_id]} {
 	    ad_complain "[_ file-storage.lt_The_specified_parent_]"
 	}
     }
Index: openacs-4/packages/file-storage/www/simple-add.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/simple-add.tcl,v
diff -u -r1.13.4.1 -r1.13.4.2
--- openacs-4/packages/file-storage/www/simple-add.tcl	6 Sep 2013 16:01:48 -0000	1.13.4.1
+++ openacs-4/packages/file-storage/www/simple-add.tcl	3 Oct 2013 08:33:58 -0000	1.13.4.2
@@ -12,7 +12,7 @@
     {lock_title_p 0}
 } -validate {
     valid_folder -requires {folder_id:integer} {
-	if ![fs_folder_p $folder_id] {
+	if {![fs_folder_p $folder_id]} {
 	    ad_complain "[_ file-storage.lt_The_specified_parent_]"
 	}
     }
@@ -28,7 +28,7 @@
 # set templating datasources
 
 set pretty_name "URL"
-if {[empty_string_p $pretty_name]} {
+if {$pretty_name eq ""} {
     return -code error "[_ file-storage.No_such_type]"
 }
 
@@ -38,7 +38,7 @@
 # double-click protection
 
 # if title isn't passed in ignore lock_title_p
-if {[empty_string_p $title]} {
+if {$title eq ""} {
     set lock_title_p 0
 }
 
Index: openacs-4/packages/file-storage/www/url-goto.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/url-goto.tcl,v
diff -u -r1.6.8.1 -r1.6.8.2
--- openacs-4/packages/file-storage/www/url-goto.tcl	6 Sep 2013 16:01:49 -0000	1.6.8.1
+++ openacs-4/packages/file-storage/www/url-goto.tcl	3 Oct 2013 08:33:58 -0000	1.6.8.2
@@ -14,7 +14,7 @@
 # Check the URL
 set url [db_string select_url {} -default {}]
 
-if {![empty_string_p $url]} {
+if {$url ne ""} {
     ad_returnredirect $url
 } else {
     return -code error [_ file-storage.no_such_URL]
Index: openacs-4/packages/file-storage/www/version-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/version-delete.tcl,v
diff -u -r1.12.8.1 -r1.12.8.2
--- openacs-4/packages/file-storage/www/version-delete.tcl	6 Sep 2013 16:01:49 -0000	1.12.8.1
+++ openacs-4/packages/file-storage/www/version-delete.tcl	3 Oct 2013 08:33:58 -0000	1.12.8.2
@@ -9,7 +9,7 @@
     {confirmed_p "f"}
 } -validate {
     valid_version -requires {version_id} {
-	if ![fs_version_p $version_id] {
+	if {![fs_version_p $version_id]} {
 	    ad_complain [_ file-storage.lt_version_not_valid]
 	}
     }
Index: openacs-4/packages/file-storage/www/admin/upload-size-limit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/admin/upload-size-limit.tcl,v
diff -u -r1.6 -r1.6.6.1
--- openacs-4/packages/file-storage/www/admin/upload-size-limit.tcl	15 May 2007 20:14:37 -0000	1.6
+++ openacs-4/packages/file-storage/www/admin/upload-size-limit.tcl	3 Oct 2013 08:33:58 -0000	1.6.6.1
@@ -12,7 +12,7 @@
 } 
 
 set max_size [ns_config "ns/server/[ns_info server]/module/nssock" maxinput]
-if { [string equal $max_size ""] } {
+if {$max_size eq ""} {
     set max_size 0
 }
 
@@ -32,7 +32,7 @@
 
 } -on_submit {
     parameter::set_value  -parameter "MaximumFileSize" -value $new_size
-    if {![empty_string_p $return_url]} {
+    if {$return_url ne ""} {
 	ad_returnredirect $return_url
     }
 }