Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
bfa25336
Commit
bfa25336
authored
Feb 19, 2009
by
Richard Mansfield
Browse files
Notify admins if file upload fails because /tmp is too small
parent
98fa9c87
Changes
2
Show whitespace changes
Inline
Side-by-side
htdocs/lang/en.utf8/mahara.php
View file @
bfa25336
...
...
@@ -519,6 +519,16 @@ $string['filetypenotallowed'] = 'You are not allowed to upload files of this typ
$string
[
'virusrepeatsubject'
]
=
'Warning: %s is a repeat virus uploader.'
;
$string
[
'virusrepeatmessage'
]
=
'The user %s has uploaded multiple files which have been scanned by a virus checker and found to be infected.'
;
$string
[
'phpuploaderror'
]
=
'An error occurred during file upload: %s (Error code %s)'
;
$string
[
'phpuploaderror_1'
]
=
'The uploaded file exceeds the upload_max_filesize directive in php.ini.'
;
$string
[
'phpuploaderror_2'
]
=
'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.'
;
$string
[
'phpuploaderror_3'
]
=
'The uploaded file was only partially uploaded.'
;
$string
[
'phpuploaderror_4'
]
=
'No file was uploaded.'
;
$string
[
'phpuploaderror_6'
]
=
'Missing a temporary folder.'
;
$string
[
'phpuploaderror_7'
]
=
'Failed to write file to disk.'
;
$string
[
'phpuploaderror_8'
]
=
'File upload stopped by extension.'
;
$string
[
'adminphpuploaderror'
]
=
'A file upload error was probably caused by your server configuration.'
;
$string
[
'youraccounthasbeensuspended'
]
=
'Your account has been suspended'
;
$string
[
'youraccounthasbeensuspendedtext2'
]
=
'Your account at %s has been suspended by %s.'
;
// @todo: more info?
$string
[
'youraccounthasbeensuspendedreasontext'
]
=
"Your account at %s has been suspended by %s. Reason:
\n\n
%s"
;
...
...
htdocs/lib/uploadmanager.php
View file @
bfa25336
...
...
@@ -75,9 +75,24 @@ class upload_manager {
return
get_string
(
'uploadedfiletoobig'
);
}
if
(
$file
[
'error'
]
==
1
)
{
if
(
$file
[
'error'
]
!=
UPLOAD_ERR_OK
)
{
$errormsg
=
get_string
(
'phpuploaderror'
,
'mahara'
,
get_string
(
'phpuploaderror_'
.
$file
[
'error'
]),
$file
[
'error'
]);
log_debug
(
$errormsg
);
if
(
$file
[
'error'
]
==
UPLOAD_ERR_NO_TMP_DIR
||
$file
[
'error'
]
==
UPLOAD_ERR_CANT_WRITE
)
{
// The admin probably needs to fix this; notify them
// @TODO: Create a new activity type for general admin messages.
$message
=
(
object
)
array
(
'users'
=>
get_column
(
'usr'
,
'id'
,
'admin'
,
1
),
'subject'
=>
get_string
(
'adminphpuploaderror'
),
'message'
=>
$errormsg
,
);
require_once
(
'activity.php'
);
activity_occurred
(
'maharamessage'
,
$message
);
}
else
if
(
$file
[
'error'
]
==
UPLOAD_ERR_INI_SIZE
||
$file
[
'error'
]
==
UPLOAD_ERR_FORM_SIZE
)
{
return
get_string
(
'uploadedfiletoobig'
);
}
}
if
(
!
is_uploaded_file
(
$file
[
'tmp_name'
]))
{
return
get_string
(
'notphpuploadedfile'
);
...
...
Write
Preview
Supports
Markdown
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