Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-filestorage
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-filestorage
Commits
f903548e
Commit
f903548e
authored
Apr 09, 2017
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Remove outdated code
parent
736b9e32
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
267 deletions
+0
-267
download.tcl
www/filestorage/download.tcl
+0
-51
index.tcl
www/filestorage/index.tcl
+0
-9
upload-2.tcl
www/filestorage/upload-2.tcl
+0
-134
upload.tcl
www/filestorage/upload.tcl
+0
-73
No files found.
www/filestorage/download.tcl
deleted
100755 → 0
View file @
736b9e32
# /file-storage/download.tcl
ad_page_contract
{
see if this person is authorized to read the file in question
guess the MIME type from the original client filename
have the Oracle driver grab the BLOB and write it to the connection
@author aure@arsdigita.com
@creation-date July 1999
@cvs-id download.tcl,v 3.4.2.3 2000/07/27 21:22:13 jwong Exp
modified by randyg@arsdigita.com, January 2000 to use the general
permissions module
}
{
file_name:notnull
project_id:integer
}
-errors
{
file_name:notnull
{
No file was specified
}
project_id:integer
{
The project_id specified doesn't look like an integer.
}
}
set
user_id
[
auth::require_login
]
set
project_path
[
im_filestorage_project_path
$project
_id
]
set
file
"
$project
_path/
$file
_name"
set
guessed_file_type
[
ns_guesstype
$file
]
ns_log notice
"file_name=
$file
_name"
ns_log notice
"file=
$file
"
ns_log notice
"file_type=
$guessed
_file_type"
db_dml insert_action
"
insert into im_fs_actions (
action_type_id
user_id
action_date
file_name
) values (
[
im_file_action_download
]
,
:user_id,
now(),
:file_name
)"
if
{[
file
readable
$file
]}
{
ad_returnfile 200
$guessed
_file_type
$file
}
else
{
ad_returnredirect
"/error.tcl"
}
www/filestorage/index.tcl
deleted
100755 → 0
View file @
736b9e32
# /www/intranet/filestorage/index.tcl
ad_page_contract
{
Show the content a specific subdirectory
}
{
}
doc_return 200 text/html
"ok"
www/filestorage/upload-2.tcl
deleted
100755 → 0
View file @
736b9e32
ad_page_contract
{
insert a file into the file system
}
{
folder
{
folder_type
""
}
project_id:integer
return_url
upload_file
{
file_title:trim
""
}
{
description
""
}
}
set user_id
[
auth::require_login
]
set
user_is_admin_p
[
im_is_user_site_wide_or_intranet_admin
$user
_id
]
set
page_title
"Upload into '
$folder
'"
set
context_bar
[
im_context_bar
[
list
"/intranet/projects/"
"Projects"
]
[
list
"/intranet/projects/view?group_id=
$project
_id"
"One Project"
]
"Upload File"
]
# check the user input first
#
set
exception_text
""
set
exception_count 0
if
{
!$user_is_admin_p && !
[
im_biz_object_member_p
$user
_id
$project
_id
]
}
{
append exception_text
"<li>You are not a member of this project.
\n
"
incr exception_count
}
if
{
""
==
$folder
_type
}
{
append exception_text
"<LI>Internal Error: folder_type not specified"
incr exception_count
}
if
{
$exception
_count > 0
}
{
ad_return_complaint
$exception
_count
$exception
_text
return 0
}
# Get the file from the user.
# number_of_bytes is the upper-limit
set
max_n_bytes
[
im_parameter -package_id
[
im_package_filestorage_id
]
MaxNumberOfBytes
""
0
]
set
tmp_filename
[
ns_queryget upload_file.tmpfile
]
im_security_alert_check_tmpnam -location
"upload-2.tcl"
-value
$tmp
_filename
ns_log Notice
"upload-2: tmp_filename=
$tmp
_filename"
if
{
$max
_n_bytes &&
([
file
size
$tmp
_filename
]
>
$max
_n_bytes
)
}
{
ad_return_complaint 1
"Your file is larger than the maximum permissible upload size:
[
util_commify_number
$max
_n_bytes
]
bytes"
return 0
}
set
file_extension
[
string
tolower
[
file
extension
$upload
_file
]]
# remove the first . from the file extension
regsub
"
\.
"
$file
_extension
""
file_extension
set
guessed_file_type
[
ns_guesstype
$upload
_file
]
set
n_bytes
[
file
size
$tmp
_filename
]
# strip off the C:\directories... crud and just get the file name
if
{
!
[
regexp
{([
^//
\\
]
+
)
$
}
$upload
_file match client_filename
]}
{
# couldn't find a match
set client_filename
$upload
_file
}
if
{[
regexp
{
\.\.
}
$client
_filename
]}
{
set error
"<li>Path contains forbidden characters<br>
Please don't use '.' characters."
ad_return_complaint
"User Error"
$error
}
# ---------- Determine the location where to save the file -----------
switch
$folder
_type
{
"project"
{
set project_path
[
im_filestorage_project_path
$project
_id
]
set dest_path
"
$project
_path/
$folder
/
$client
_filename"
}
"company"
{
set path
[
im_filestorage_company_path
$project
_id
]
set dest_path
"
$path
/
$folder
/
$client
_filename"
}
"user"
{
set path
[
im_filestorage_user_path
$project
_id
]
set dest_path
"
$path
/
$folder
/
$client
_filename"
}
default
{
ad_return_complaint 1
"<LI>Unknown folder type
\"
$folder
_type
\"
."
return
}
}
# --------------- Let's copy the file into the FS --------------------
if
{
[
catch
{
ns_log Notice
"/bin/cp
$tmp
_filename
$dest
_path"
exec /bin/cp
$tmp
_filename
$dest
_path
}
err_msg
]
}
{
# Probably some permission errors
ad_return_complaint
"Error writing upload file"
$err
_msg
return
}
# --------------- Log the interaction --------------------
db_dml insert_action
"
insert into im_fs_actions (
action_type_id
user_id
action_date
file_name
) values (
[
im_file_action_upload
]
,
:user_id,
now(),
'
$dest
_path/
$client
_filename'
)"
set
page_content
"
<H2>Upload Successful</H2>
You have successfully uploaded
$n
_bytes bytes of '
$client
_filename'.<br>
You can now return to the project page.
<P>
<form method=post action=
\"
$return
_url
\"
>
<input type=submit value=
\"
Return to Previous Page
\"
>
</form>
"
db_release_unused_handles
doc_return 200 text/html
[
im_return_template
]
www/filestorage/upload.tcl
deleted
100755 → 0
View file @
736b9e32
# /intranet/filestorage/upload.tcl
ad_page_contract
{
Serve the user a form to upload a new file or URL
@author aure@arsdigita.com
@author frank.bergmann@project-open.com
@creation-date 030909
}
{
folder:notnull
{
folder_type
""
}
project_id:notnull
return_url:notnull
}
set
user_id
[
auth::require_login
]
set
page_title
"Upload New File/URL"
set
context_bar
[
im_context_bar
[
list
"/intranet/projects/"
"Projects"
]
[
list
"/intranet/projects/view?group_id=
$project
_id"
"One Project"
]
"Upload File"
]
if
{
""
==
$folder
_type
}
{
ad_return_complaint 1
"<LI>Internal Error: folder_type not specified"
return
}
# replace the "root" folder "/" with an empty string
if
{
$folder
eq
"/"
}
{
set folder
""
}
set
alt_msg
"Use the "Browse..." button to locate your file, then click "Open"."
set
page_content
"
<form enctype=multipart/form-data method=POST action=upload-2.tcl>
[
export_vars -form
{
folder folder_type project_id return_url
}]
<table border=0>
<tr>
<td align=right>Filename: </td>
<td>
<input type=file name=upload_file size=30>
<img src=/images/help.gif width=16 height=16 title=
\"
$alt
_msg
\"
alt=
\"
$alt
_msg
\"
>
</td>
</tr>
<!--
<tr>
<td align=right> Title: </td>
<td>
<input size=40 name=file_title>
</td>
</tr>
<tr>
<td valign=top align=right>Comments: </td>
<td colspan=2>
<textarea rows=5 cols=50 name=description wrap></textarea>
</td>
</tr>
-->
<tr>
<td></td>
<td>
<input type=submit value=
\"
Submit and Upload
\"
>
</td>
</tr>
</table>
</form>
"
db_release_unused_handles
set
page_title
"Upload into '
$folder
'"
doc_return 200 text/html
[
im_return_template
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment