* The purpose of this file is to delete the selected files. * * * Include the file with the logfunction */ include "settings.php"; include "functions.php"; /** * Go through the selected checkboxes and remove the files. */ if (count($_POST['Subtitle']) == "0" or !isset($_POST['Subtitle'])) { USMLog("error", "[" . __FILE__ . " Line:" . __LINE__ . "] Subtitle POST empty.\n"); } else { foreach ($_POST['Subtitle'] as $Subtitle) { list($MediaID, $SubtitleID, $Filename) = explode(":", $Subtitle); USMLog("info", "[" . __FILE__ . " Line:" . __LINE__ . "] Request to delete SubFileID(" . $SubtitleID . ") belonging to MediaID(" . $MediaID . ") with Filename(" . $Filename . ")."); $ReturnValue = file_get_contents($Server . "/utils/devtools?Func=DelSub&Secret=" . $DevToolsSecret . "&MediaID=" . $MediaID . "&SubFileID=" . $SubtitleID); if ($ReturnValue == "ok") { USMLog("info", "[" . __FILE__ . " Line:" . __LINE__ . "] Successfully deleted subtitle: " . $Filename); } else { USMLog("error", "[" . __FILE__ . " Line:" . __LINE__ . "] Failed deleting subtitle: " . $Filename . " Returnvalue: " . $ReturnValue); } } } /** * After completion, reload the page. */ ?> <script> window.parent.location.href = window.parent.location.href; </script>
<?php session_start(); /** * The purpose of this file is to delete the selected files. * * * Include the file with the logfunction */ include "settings.php"; include "functions.php"; $ReturnValue = file_get_contents($Server . "/library/sections/" . $_GET['LibraryID'] . "/refresh?force=1"); USMLog("info", "[" . __FILE__ . " Line:" . __LINE__ . "] Forced refresh started on the current section (SectionID: " . $_GET['LibraryID'] . "). This can't be monitord but will take a while to complete. Can be seen in Plex Activity Log"); ?> /** * After completion, reload the page. */ ?> <script> window.parent.location.href = window.parent.location.href; </script>
} if ($Video->getActiveSubtitle() > 0 and (int) $Video->getActiveSubtitle() == (int) $Subtitle->getID()) { $Active = "Selected subtitle in Plex"; $AddClass = "Active"; } if ($Subtitle->getIsDouble() and $_SESSION['Option_AutoCheck']['set']) { $IsChecked = "checked"; } if ($Subtitle->getPath() !== false) { $View = "<a target=\"_NEW\" href=\"ReadFile.php?FileToOpen=" . $Subtitle->getPath() . "\">View</a> "; //$Checkbox = "<input type='checkbox' name='Subtitle[]' ". $IsChecked ." value=\"".$Subtitle->getPath()."\">"; $Checkbox = "<input type='checkbox' name='Subtitle[]' " . $IsChecked . " value=\"" . $Video->getID() . ":" . $Subtitle->getID() . ":" . $Subtitle->getFilename() . "\">"; } if ($Subtitle->getPath() !== false) { if (exists($Subtitle->getPath()) === false) { USMLog("debug", "[" . __FILE__ . " Line:" . __LINE__ . "] Unable to find '" . $Subtitle->getPath() . "' on disk."); $Exists = "Not found on disk. Please update Plex library."; $Checkbox = ""; $View = ""; $AddClass = "Removed"; } } if (!$Subtitle->getHideSubtitle()) { echo "<div class='VideoSubtitle hovering " . $AddClass . "'>"; echo "<table class='Max' cellspacing=0 cellpadding=0><tr><td class='small'>" . $Checkbox . "</td><td class='small'>" . $Subtitle->getSource() . "</td><td class='small'>" . $Language . "</td><td>" . $Subtitle->getFilename() . "</td><td class='small'>" . $View . "</td></tr>"; if ($AddClass !== false) { echo "<tr><td></td><td></td><td></td><td>Message: " . $Active . $Exists . "</td></tr>"; } echo "</table></div>"; } }
/** * Function for fetching the xmls. * This function checks to see that the result is correct. */ function FetchXML($url) { global $Server, $Debug; $ErrorOccured = false; $xmlResult = ""; $xmlResult = simplexml_load_file($Server . $url); if (!$xmlResult) { USMLog("error", "[" . __FILE__ . " Line:" . __LINE__ . "] Failed to fetch xml from path: '" . $Server . $url . "'"); $ErrorOccured = true; } if ($Debug) { USMLog("debug", "[" . __FILE__ . " Line:" . __LINE__ . "] Received request to fetch xml from: '" . $Server . $url . "'", debug_backtrace()); } if (!$ErrorOccured) { if ($Debug) { USMLog("debug", "[" . __FILE__ . " Line:" . __LINE__ . "] Contents in xmlResult: \n" . var_export($xmlResult, true) . "\n"); } USMLog("debug", "[" . __FILE__ . " Line:" . __LINE__ . "] Successfully received XML from '" . $Server . $url . "'"); return $xmlResult; } else { return false; } }