This is a TNG mod directive file
%name:Unused Media%
%version:v13.0.0.9%
%description:Adds a tab (Unused Media) to the Admin > Media page. Lists files which are present in the media folders on the server, but not registered with TNG.
Mod developer is Warren S Gilbert.%
%wikipage:Unused_Media%
%target:customconfig.php%
%location:%
?>
%end:%
%insert:before%
// Unused Media, v13.0.0.9
$excludefile = "$extspath/unusedmedia.txt";
$unusedmediatemp = "$extspath/unusedmediatemp.txt";
// End of Unused Media
%end:%
%target:admin_media.php%
%location:%
$mediatabs[5] = array($allow_media_add,"admin_mediaupload.php",$admtext['upload'],"upload");
%end:%
%insert:after%
$mediatabs[6] = array(1,"admin_unusedmedia.php?rebuild=1",$admtext['unusedmedia'],"unusedmedia");
%end:%
%target:admin_editmedia.php%
%location:%
$mediatabs[6] = array($allow_media_edit,"#",$admtext['edit'],"edit");
%end:%
%replace:%
$mediatabs[6] = array(1,"admin_unusedmedia.php?rebuild=1",$admtext['unusedmedia'],"unusedmedia");
$mediatabs[7] = array($allow_media_edit,"#",$admtext['edit'],"edit");
%end:%
%target:admin_mediaupload.php%
%location:%
$mediatabs[5] = array($allow_media_add,"admin_mediaupload.php",$admtext['upload'],"upload");
%end:%
%insert:after%
$mediatabs[6] = array(1,"admin_unusedmedia.php?rebuild=1",$admtext['unusedmedia'],"unusedmedia");
%end:%
%target:admin_newmedia.php%
%location:%
$mediatabs[5] = array($allow_media_add,"admin_mediaupload.php",$admtext['upload'],"upload");
%end:%
%insert:after%
$mediatabs[6] = array(1,"admin_unusedmedia.php?rebuild=1",$admtext['unusedmedia'],"unusedmedia");
%end:%
%target:admin_ordermediaform.php%
%location:%
$mediatabs[5] = array($allow_media_add,"admin_mediaupload.php",$admtext['upload'],"upload");
%end:%
%insert:after%
$mediatabs[6] = array(1,"admin_unusedmedia.php?rebuild=1",$admtext['unusedmedia'],"unusedmedia");
%end:%
%target:admin_photoimport.php%
%location:%
$mediatabs[5] = array($allow_media_add && !$assignedtree,"admin_mediaupload.php",$admtext['upload'],"upload");
%end:%
%insert:after%
$mediatabs[6] = array(1,"admin_unusedmedia.php?rebuild=1",$admtext['unusedmedia'],"unusedmedia");
%end:%
%target:admin_thumbnails.php%
%location:%
$mediatabs[5] = array($allow_media_add && !$assignedtree,"admin_mediaupload.php",$admtext['upload'],"upload");
%end:%
%insert:after%
$mediatabs[6] = array(1,"admin_unusedmedia.php?rebuild=1",$admtext['unusedmedia'],"unusedmedia");
%end:%
%target:languages/English/media_help.php%
%location:%
Upload
%end:%
%replace:%
Upload |
Unused Media
%end:%
%location:%
%end:%
%replace:%
Unused Media
PurposeThe Unused Media tab will list files which are present in the media folders on the server, but not registered with TNG.
Mod Options are available to ignore specific files, folders or file extensions.
There is an option to delay the search until values have been entered.
Also an option to allow selection of a single folder to be searched.
By default, all unused media files will be displayed.
Search forLimit the files displayed to those with names containing characters typed here.
File ext.Limit the files displayed to those with the extension typed here.
Restrict search to this folderIf the Mod Option to Allow the search to be limited to a single folder? is set to true, a drop down list of folders will be displayed to allow further selection.
Rebuild folder listIf the Delay search AND Allow the search to be limited to a single folder? Mod Options are both set to true, a check box will be displayed. Check the box, click on Go and the list will be rebuilt. This should be used when media folders have been added or deleted.
GoStart a search or rebuild the folder list (if selected).
ResetReset will clear the Search for box and File ext box, uncheck the Show excluded files and Check hidden (dot) files/folders boxes, and perform a new Search.
Show excluded filesExcluded files can be displayed by checking the Show excluded files box before doing a Search. When excluded files are displayed, they can be removed from the excluded files list by clicking Include file in report icon relating to the file.
Check hidden (dot) files/foldersHidden (dot) files and folders can be included or excluded by checking or not the Check hidden (dot) files/folders box.
Select AllSelect all files listed for further action.
Clear AllClear all files previously selected.
Delete SelectedTo delete multiple files, check the box in the Select column relating to the file, then click the Delete Selected button at the top of the report.
Exclude SelectedExclude files selected from the list. The names of files excluded will be written to a file in the extensions folder.
DeleteFiles can be deleted from the server individually by clicking on the Delete icon relating to the file.
IncludeA previously excluded file can be re-included by clicking on its include button.
Display itemFiles can be displayed (in a new tab or new window) by clicking on the filename.
''"; $result = tng_query($query); while ($row = tng_fetch_assoc($result)) { $mediatypeID = $row['mediatypeID']; $usefolder = $row['usecollfolder'] ? $mediatypes_assoc[$mediatypeID] : $mediapath; $in_database[] = "$usefolder/".stripslashes($row['path']); } tng_free_result($result); // Get list of files to be excluded from the check $excluded = array(); if (file_exists($excludefile)) { $fp = @fopen($excludefile, "r"); while (!feof($fp)) { $line = trim(fgets($fp)); if ($line) { $excluded[] = $line; } } fclose($fp); } // Get list of files on disk but not in database, that also match the search string if present // The search string matching could be achieved using function stripos, but this is PHP 5 and later (TNG now requires php 5.3 or higher) for ($i = 0; $i < count($on_disk); $i++) { // Add a check below for match file extension if (!in_array($on_disk[$i], $in_database) && (!$searchstring || strpos(strtoupper(substr($on_disk[$i], strrpos($on_disk[$i], "/")+1)), strtoupper($originalstring)) !== false)) { if ($showexcluded || !in_array($on_disk[$i], $excluded)) { $folders[] = substr($on_disk[$i], 0, strrpos($on_disk[$i], "/")); $file[] = substr($on_disk[$i], strrpos($on_disk[$i], "/")+1); if (!in_array($on_disk[$i], $excluded)) { $excludeflag[] = 'N'; } else { $excludeflag[] = 'Y'; } } } } $totrows = count($folders); if ($offsetplus > $totrows) { $tngpage = $tngpage - 1; $offset = $offset - $maxsearchresults; $offsetplus = $offset + 1; } $numrows = $totrows - $offset; if ($numrows > $maxsearchresults) $numrows = $maxsearchresults; $numrowsplus = $numrows + $offset; if (!$numrowsplus) $offsetplus = 0; echo displayListLocation($offsetplus,$numrowsplus,$totrows); $pagenav = get_browseitems_nav($totrows, "admin_unusedmedia.php?searchstring=$searchstring&fileext=$fileext&offset", $maxsearchresults, 5); echo " $pagenav"; ?> |
class="smallicon"/> | = | class="smallicon"/> | = |