File
class File
Properties
$trash_folder | |||
array | $curl_info | Contains the info returned by CURL when calling $this->download_file_from_url(); |
Methods
No description
No description
Copies the passed file/folder to the trash folder
UTF8 Compatible basename(), because php::basename() is still buggy (e.g.: removes all umlauts at the beginning of a filename)
No description
Check a file for virus If a virus is found TRUE is returned, otherwise FALSE To use this function ClamAV (Daemon) had to be installed and the user belonged to the webserver group
Checks files uploaded through forms for:
Complete an URL to be absolute
Converts a PHP INI Size as memory_limit size string to a byte value
No description
No description
callback function for getting header values from curl, used by download_file_from_url
No description
Downloads a file from a url.
No description
Include / Enable a certain stream wrapper Example: "smb://user:pass@server/share/path"
No description
Checks if the passed file exists, cached for the current call
No description
No description
No description
Get File Information
No description
Returns a cascaded path based on the passed id to prevent file system storage limitations. 10.000 files per folder will be used.
Returns the content of a file or url by curl.
No description
Editable File Types for XOI or directly via MS-Office
Returns the charset of the given file. This method uses exec() to
No description
No description
Returns the encoding of the file.
No description
No description
No description
No description
No description
Get friendly filesize
No description
No description
No description
No description
Creates a temporary folder for backup data and returns the path.
No description
No description
No description
function used by get_max_upload_size to convert the ini values to a byte values
No description
No description
Checks if the passed PHP file is encoded via Ioncube
Check if Filename meets the nonstrict security guidelines
No description
No description
Returns an array with all files in the given directory (Recursive)
No description
No description
No description
No description
No description
No description
Replaces the passed vars in the given file The file must contain markers in the format {{VARNAME}} The engine currently supports DOCX and TXT formats for replacement
Returns all files for given path recursive. It is allowed to use glob pattern to restrict the result.
No description
No description
No description
Send file to client/browser
Sends the passed file from the HDD to the user (supports even large files!) (Execution stops after this command!)
Set permissions for files writable system user only Should be applied to files in class, modules, etc -> readable for web and writable to system only \XF_SYSTEM_UID and \XF_WEBSERVER_UID
Set permissions for files writable to the web user and system user Should be applied to files in _log, _files, etc -> readable and writable to system AND web \XF_SYSTEM_UID and \XF_WEBSERVER_UID
Unzip and extract files from given source to target path.
Details
at line 21
__construct()
No description
at line 34
__destruct()
No description
at line 160
bool
backup_to_trash($file_or_folder, $force = false)
Copies the passed file/folder to the trash folder
at line 1224
string
basename(string $string)
UTF8 Compatible basename(), because php::basename() is still buggy (e.g.: removes all umlauts at the beginning of a filename)
at line 493
string
change_file_extension(string $filename, string $new_ext)
No description
at line 836
bool
check_for_virus(string $filename, bool $RemoveInfectedFile = false)
Check a file for virus If a virus is found TRUE is returned, otherwise FALSE To use this function ClamAV (Daemon) had to be installed and the user belonged to the webserver group
at line 802
void
check_uploaded_file(string $tempName, string $name)
Checks files uploaded through forms for:
- antivirus (if endbaled) and removes infected files
- file extension whitelist (if set)
Logging and user interaction is the calling functions responsibility
- example catch exception and output/log message
at line 1253
string
complete_absolute_url(string $url)
Complete an URL to be absolute
at line 1200
static int
convertIniSizeToBytes($val)
Converts a PHP INI Size as memory_limit size string to a byte value
at line 114
bool
cp(string $file, string $target)
No description
at line 92
bool
cp_r(string $source, string $target)
No description
at line 1399
int
curl_header_cb(mixed $ch, mixed $header)
callback function for getting header values from curl, used by download_file_from_url
at line 974
string
decode_file(string $filename, string $password, bool $copy_to_tmp = false)
No description
at line 1284
array|string|false
download_file_from_url(string $url, bool $return_data = false)
Downloads a file from a url.
If the URL is placed on the current host it will be requested using the current user session Note: Please make sure to set the PHP timeout if you expect to download large files. The download is aborted if it takes longer than 5 minutes.
at line 919
string
du(string $path)
No description
at line 1531
bool
enable_stream_wrapper(string $wrapper)
Include / Enable a certain stream wrapper Example: "smb://user:pass@server/share/path"
at line 943
string
encode_file(string $filename, string $password, bool $copy_to_tmp = false)
No description
at line 1552
file_exists_cached($file)
Checks if the passed file exists, cached for the current call
at line 345
filter_by_extension($filelist, $extension_filter = false)
No description
at line 379
filter_by_wildcard($filelist, $wildcard, $match_full_path = false)
No description
at line 402
filter_onlyfiles($filelist)
No description
at line 1842
array
getFileInfo(string $fsPath)
Get File Information
at line 766
string
get_cache_file(string $prefix, string $filename, array|bool $partition_index = false)
No description
at line 750
get_cascaded_folder(int $id)
Returns a cascaded path based on the passed id to prevent file system storage limitations. 10.000 files per folder will be used.
e.g. IDs 1-9999 will be in folder k0/[1-9999]/ and 10000 to 19999 will be in folder k1/[10000-19999]/
at line 603
bool|mixed|string
get_contents(string $target, int $request_timeout = 20, int $connection_timeout = 5)
Returns the content of a file or url by curl.
at line 728
bool|string
get_document_temp_folder($instance, $document_id, int $post_type = 0, bool $return_alternative_temp_folder = true)
No description
at line 1482
array
get_editable_file_types()
Editable File Types for XOI or directly via MS-Office
at line 585
mixed|null
get_file_charset(string|bool $file_path)
Returns the charset of the given file. This method uses exec() to
at line 630
array
get_file_contents(array|string $filelist)
No description
at line 508
array|false
get_file_details(string|string[] $filelist, bool $details = false)
No description
at line 565
null|string
get_file_encoding(string $file_path)
Returns the encoding of the file.
at line 460
string
get_file_extension(string $filename)
No description
at line 477
string|bool
get_file_extension_by_mime(string $mime)
No description
at line 445
string
get_filename_without_extension(string $filename)
No description
at line 1089
string
get_first_file_found(array $files, bool|string $path = false)
No description
at line 1003
string
get_friendly_filename(string $file)
No description
at line 1023
get_friendly_filesize(mixed $file)
Get friendly filesize
at line 1180
int
get_max_upload_size()
No description
at line 432
bool|mixed
get_mime(string $file)
No description
at line 417
bool|mixed
get_mime_by_extension(string $extension)
No description
at line 1033
string
get_secure_filename(string $filename, bool $strict = true)
No description
at line 711
string
get_temp_backup_folder()
Creates a temporary folder for backup data and returns the path.
at line 686
string
get_temp_folder(bool $delete_on_destruction = false)
No description
at line 672
string
get_temp_name(bool $delete_on_destruction = false)
No description
at line 28
init()
No description
at line 1191
int
inival_to_bytes(string $val)
function used by get_max_upload_size to convert the ini values to a byte values
at line 877
bool
isEmptyDirectory(string $dir)
No description
at line 908
bool
is_image(string $filepath)
No description
at line 1072
is_ioncube_encoded($filename)
Checks if the passed PHP file is encoded via Ioncube
at line 1063
bool
is_secure_filename(string $filename)
Check if Filename meets the nonstrict security guidelines
at line 860
bool
is_subfolder($subfolder, $parent)
No description
at line 252
array|mixed
ll(string $dirname, array|bool $extension_filter = false, bool $skip_directories = true)
No description
at line 317
array
ll_r(string $dir, array|bool $extension_filter = false, bool $return_folders = false, bool $limit = null)
Returns an array with all files in the given directory (Recursive)
at line 54
bool
mkdir(int $pathname, int $mode = 0777, bool $recursive = false)
No description
at line 79
bool
mkdir_r($dirname, int $mode = 0777)
No description
at line 661
bool
mv(string $source, string $target)
No description
at line 649
int
put_file_contents(string $file, mixed $content)
No description
at line 890
string
relativize_path(string $subfolder, $parent)
internal | param string $parentParent Folder, e.g. /server/dev/ |
No description
at line 932
bool
rename(string $current_name, string $new_name)
No description
at line 1120
string
replace_vars_in_file(mixed $filename, mixed $vars = array(), int $ext = 'auto', mixed $send_file = false)
Replaces the passed vars in the given file The file must contain markers in the format {{VARNAME}} The engine currently supports DOCX and TXT formats for replacement
at line 287
array
rglob(string $path, int $flags = 0, int $stop_after = null)
Returns all files for given path recursive. It is allowed to use glob pattern to restrict the result.
E.g. /server/xelos/modules/*.yml return all YAML files.
at line 124
rm(string $filename)
No description
at line 144
mixed
rmdir(string $dirname)
No description
at line 208
array|bool
rmdir_r(string $dirname)
No description
at line 1574
bool|mixed|string
send_file($path_to_file, false $filename = false, false $download_params = false)
Send file to client/browser
at line 1413
send_file_old(string $file_path, bool|string $file_name = false, bool|string $file_mime = false)
Sends the passed file from the HDD to the user (supports even large files!) (Execution stops after this command!)
at line 1812
setPermissionsSystem(string $path)
Set permissions for files writable system user only Should be applied to files in class, modules, etc -> readable for web and writable to system only \XF_SYSTEM_UID and \XF_WEBSERVER_UID
at line 1778
setPermissionsWeb(string $path)
Set permissions for files writable to the web user and system user Should be applied to files in _log, _files, etc -> readable and writable to system AND web \XF_SYSTEM_UID and \XF_WEBSERVER_UID
at line 1764
unzip(string $source, string $target)
Unzip and extract files from given source to target path.