Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/uploadlib.php File Reference

Go to the source code of this file.

Data Structures

class  upload_manager

Namespaces

namespace  core
namespace  moodlecore

Functions

 clam_handle_infected_file ($file, $userid=0, $basiconly=false)
 clam_replace_infected_file ($file)
 clam_scan_moodle_file (&$file, $course)
 clam_message_admins ($notice)
 get_clam_error_code ($returncode)
 clam_log_upload ($newfilepath, $course=null, $nourl=false)
 clam_log_infected ($oldfilepath='', $newfilepath='', $userid=0)
 clam_change_log ($oldpath, $newpath, $update=true)

Function Documentation

clam_change_log ( oldpath,
newpath,
update = true 
)

Some of the modules allow moving attachments (glossary), in which case we need to hunt down an original log and change the path.

object

Parameters:
string$oldpathThe old path to the file (should be in the log)
string$newpathThe new path to the file
boolean$updateIf true this function will overwrite old record (used for forum moving etc).

Definition at line 805 of file uploadlib.php.

clam_handle_infected_file ( file,
userid = 0,
basiconly = false 
)

Deals with an infected file - either moves it to a quarantinedir (specified in CFG->quarantinedir) or deletes it.

If moving it fails, it deletes it.

object object

Parameters:
string$fileFull path to the file
int$useridIf not used, defaults to $USER->id (there in case called from cron)
boolean$basiconlyAdmin level reporting or user level reporting.
Returns:
string Details of what the function did.

Definition at line 521 of file uploadlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

clam_log_infected ( oldfilepath = '',
newfilepath = '',
userid = 0 
)

This function logs to error_log and to the log table that an infected file has been found and what's happened to it.

object

Parameters:
string$oldfilepathFull path to the infected file before it was moved.
string$newfilepathFull path to the infected file since it was moved to the quarantine directory (if the file was deleted, leave empty).
int$useridThe user id of the user who uploaded the file.

Definition at line 780 of file uploadlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

clam_log_upload ( newfilepath,
course = null,
nourl = false 
)

Adds a file upload to the log table so that clam can resolve the filename to the user later if necessary

object object

Parameters:
string$newfilepath?
course$course$COURSE
boolean$nourl?
Todo:
Finish documenting this function

Definition at line 758 of file uploadlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

clam_message_admins ( notice)

Emails admins about a clam outcome

Parameters:
string$noticeThe body of the email to be sent.

Definition at line 692 of file uploadlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Replaces the given file with a string.

The replacement string is used to notify that the original file had a virus This is to avoid missing files but could result in the wrong content-type.

Parameters:
string$fileFull path to the file.
Returns:
boolean

Definition at line 584 of file uploadlib.php.

clam_scan_moodle_file ( &$  file,
course 
)

If $CFG->runclamonupload is set, we scan a given file. (called from preprocess_files())

This function will add on a uploadlog index in $file.

object object

Parameters:
mixed$fileThe file to scan from $files. or an absolute path to a file.
course$course$COURSE
Returns:
int 1 if good, 0 if something goes wrong (opposite from actual error code from clam)

Definition at line 607 of file uploadlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_clam_error_code ( returncode)

Returns the string equivalent of a numeric clam error code

Parameters:
int$returncodeThe numeric error code in question. return string The definition of the error code

Definition at line 720 of file uploadlib.php.

Here is the caller graph for this function:

 All Data Structures Namespaces Files Functions Variables Enumerations