Lines Matching refs:file

28  * Lists pages which currently use a media file selected for deletion
220 * Convenience function to check if a media file is still in use
244 * Handles media file deletions
265 $file = mediaFN($id);
270 $data['name'] = PhpString::basename($file);
271 $data['path'] = $file;
272 $data['size'] = (file_exists($file)) ? filesize($file) : 0;
278 $old = @filemtime($file);
279 if (!file_exists(mediaFN($id, $old)) && file_exists($file)) {
284 $data['unl'] = @unlink($file);
303 * Handle file uploads via XMLHttpRequest
307 * @return false|string false on error, id of the new file on success
345 * Handles media file uploads
352 * @param bool|array $file $_FILES member, $_FILES['upload'] if false
353 * @return false|string false on error, id of the new file on success
355 function media_upload($ns, $auth, $file = false)
361 // get file and id
363 if (!$file) $file = $_FILES['upload'];
364 if (empty($id)) $id = $file['name'];
367 if ($file['error']) return false;
370 [$fext, $fmime] = mimetype($file['name']);
383 'name' => $file['tmp_name'],
420 * Action plugins are allowed to pre/postprocess the uploaded file.
424 * $data[0] fn_tmp: the temporary file name (read from $_FILES)
425 * $data[1] fn: the file name of the uploaded file
426 * $data[2] id: the future directory id of the uploaded file
427 * $data[3] imime: the mimetype of the uploaded file
428 * $data[4] overwrite: if an existing file is going to be overwritten
433 * @param array $file
440 function media_save($file, $id, $ow, $auth, $move)
446 if (!isset($file['mime']) || !isset($file['ext'])) {
448 if (!isset($file['mime'])) {
449 $file['mime'] = $mime;
451 if (!isset($file['ext'])) {
452 $file['ext'] = $ext;
470 // because a temp file was created already
482 $ok = media_contentcheck($file['name'], $file['mime']);
484 return [sprintf($lang['uploadbadcontent'], '.' . $file['ext']), -1];
493 $data[0] = $file['name'];
496 $data[3] = $file['mime'];
523 * Saves an uploaded media file
588 * Moves the current version of media file to the media_attic
608 // there is no log entry for current version of file
644 * @param string $file path to file
648 function media_contentcheck($file, $mime)
652 $fh = @fopen($file, 'rb');
662 $info = @getimagesize($file);
664 return -1; // uploaded content did not match the file extension
673 $TEXT = io_readFile($file);
687 * @param string $file path to file
691 function media_notify($id, $file, $mime, $old_rev = false, $current_rev = false)
1295 * Shows difference between two revisions of file
1312 * Callback for media file diff
1361 * Restores an old revision of a media file
1366 * @return string - file's id
1426 //if we use globbing file name must match entirely but may be preceded by arbitrary namespace
1488 $icon = DOKU_BASE . 'lib/images/fileicons/' . $size . '/file.png';
1571 ->attrs(['type' => 'file']);
1774 * @param string $file filename, path to file
1781 function media_mod_image($file, $ext, $w, $h = 0, $crop = false)
1786 if ($w > 2000 || $h > 2000) return $file;
1795 $cache = new CacheImageMod($file, $w, $h, $ext, $crop);
1798 Slika::run($file, $options)
1805 return $file;
1817 * @param string $file filename, path to file
1823 function media_resize_image($file, $ext, $w, $h = 0)
1825 return media_mod_image($file, $ext, $w, $h, false);
1833 * @param string $file filename, path to file
1839 function media_crop_image($file, $ext, $w, $h = 0)
1841 return media_mod_image($file, $ext, $w, $h, true);
1871 * Download a remote file and return local filename
1873 * returns false if download fails. Uses cached file if available and
1882 * @return false|string path to cached file
1920 * @param string $file path to file in which to put the downloaded content
1923 function media_image_download($url, $file)
1936 $fileexists = file_exists($file);
1937 $fp = @fopen($file, "w");
1941 if (!$fileexists && $conf['fperm']) chmod($file, $conf['fperm']);
1944 $info = @getimagesize($file);
1946 @unlink($file);
1960 * @param string $from filename path to file
1963 * @param string $to path to resized file
1994 * @param string $from filename path to file
1997 * @param string $to path to resized file
2033 * @param string $from filename path to file
2036 * @param string $to path to resized file
2151 * @param string $src - ID of media file
2153 * @return array - array(mime type => file ID)
2166 $file = mediaFN($fileid);
2167 if (file_exists($file)) {
2168 [/* fileExt */, $fileMime] = mimetype($file);
2178 * @param string $mime - mimetype of media file
2211 * @param string $src - ID of media file