/** * List all files in a given Media namespace * * @see media_filelist() */ function _mod_media_filelist($ns, $auth = null, $jump = '', $fullscreenview = false, $sort = false) { global $conf; global $lang; $ns = cleanID($ns); // check auth our self if not given (needed for ajax calls) if (is_null($auth)) { $auth = auth_quickaclcheck("{$ns}:*"); } if (!$fullscreenview) { echo '<h1 id="media__ns">:' . hsc($ns) . '</h1>' . NL; } if ($auth < AUTH_READ) { // FIXME: print permission warning here instead? echo '<div class="nothing">' . $lang['nothingfound'] . '</div>' . NL; } else { if (!$fullscreenview) { media_uploadform($ns, $auth); } $dir = utf8_encodeFN(str_replace(':', '/', $ns)); $data = array(); search($data, $conf['mediadir'], 'search_media', array('showmsg' => true, 'depth' => 1), $dir, 1, $sort); if (!count($data)) { echo '<div class="nothing">' . $lang['nothingfound'] . '</div>' . NL; } else { if ($fullscreenview) { echo '<ul class="' . _media_get_list_type() . '">'; } foreach ($data as $item) { if (!$fullscreenview) { $this->_mod_media_printfile($item, $auth, $jump); } else { $this->_mod_media_printfile_thumbs($item, $auth, $jump); } } if ($fullscreenview) { echo '</ul>' . NL; } } } if (!$fullscreenview) { media_searchform($ns); } }
/** * List all files in a given Media namespace */ function media_filelist($ns, $auth = null, $jump = '') { global $conf; global $lang; $ns = cleanID($ns); // check auth our self if not given (needed for ajax calls) if (is_null($auth)) { $auth = auth_quickaclcheck("{$ns}:*"); } echo '<h1 id="media__ns">:' . hsc($ns) . '</h1>' . NL; if ($auth < AUTH_READ) { // FIXME: print permission warning here instead? echo '<div class="nothing">' . $lang['nothingfound'] . '</div>' . NL; return; } media_uploadform($ns, $auth); $dir = utf8_encodeFN(str_replace(':', '/', $ns)); $data = array(); search($data, $conf['mediadir'], 'search_media', array('showmsg' => true), $dir); if (!count($data)) { echo '<div class="nothing">' . $lang['nothingfound'] . '</div>' . NL; return; } foreach ($data as $item) { media_printfile($item, $auth, $jump); } }
/** * Prints tab that displays uploading form * * @author Kate Arzamastseva <*****@*****.**> */ function media_tab_upload($ns, $auth = null, $jump = '') { global $lang; if (is_null($auth)) { $auth = auth_quickaclcheck("{$ns}:*"); } echo '<div class="upload">' . NL; if ($auth >= AUTH_UPLOAD) { echo '<p>' . $lang['mediaupload'] . '</p>'; } media_uploadform($ns, $auth, true); echo '</div>' . NL; }
/** * Outputs a list of files for mediamanager * * @see media_filelist() in inc/media.php */ function _listMedia($ns, $auth, $jumpto) { global $conf; global $lang; print '<h1 id="media__ns">:' . hsc($ns) . '</h1>' . NL; if ($auth < AUTH_READ) { print '<div class="nothing">' . $lang['nothingfound'] . '</div>' . NL; } else { media_uploadform($ns, $auth); $dir = utf8_encodeFN(str_replace(':', '/', $ns)); $data = array(); search($data, $conf['mediadir'], 'search_media', array('showmsg' => true, 'depth' => 1), $dir); if (empty($data)) { print '<div class="nothing">' . $lang['nothingfound'] . '</div>' . NL; } else { foreach ($data as $item) { $filename = $this->_getOriginalFileName($item['id']); if ($filename !== false) { $item['file'] = utf8_encodeFN($filename); } media_printfile($item, $auth, $jumpto); } } } media_searchform($ns); }