Ticket #622: mythweb_deletion.diff

File mythweb_deletion.diff, 4.9 KB (added by stuart@…, 18 years ago)

Patch changing mythweb deletion to use chanid & starttime instead of filename

  • themes/Default/recorded_programs.php

     
    4747    foreach ($All_Shows as $show) {
    4848?>
    4949    file = new Object();
     50    file.chanid   = '<?php echo addslashes($show->chanid) ?>';
     51    file.starttime = '<?php echo addslashes($show->starttime) ?>';
    5052    file.title    = '<?php echo addslashes($show->title) ?>';
    5153    file.subtitle = '<?php echo addslashes($show->subtitle) ?>';
    5254    file.group    = '<?php echo addslashes(urlencode($show->group)) ?>';
     
    6466        if (confirm("<?php echo t('Are you sure you want to delete the following show?') ?>\n\n     "+file.title+": "+file.subtitle)) {
    6567        // Do the actual deletion
    6668            if (programs_shown == 1)
    67                 location.href = 'recorded_programs.php?delete=yes&file='+file.filename;
     69                location.href = 'recorded_programs.php?delete=yes&chanid='+file.chanid+'&starttime='+file.starttime;
    6870            else
    69                 submit_url('recorded_programs.php?ajax&delete=yes&file='+file.filename, http_success, http_failure, id, file);
     71                submit_url('recorded_programs.php?ajax&delete=yes&chanid='+file.chanid+'&starttime='+file.starttime, http_success, http_failure, id, file);
    7072        // Debug statements - uncomment to verify that the right file is being deleted
    7173            //alert('row number ' + id + ' belonged to section ' + section + ' which now has ' + rowcount[section] + ' elements');
    7274            //alert('just deleted an episode of "' + title + '" which now has ' + episode_count + ' episodes left');
     
    279281<?php   } else { ?>
    280282    <td width="5%" rowspan="<?php echo $_SESSION['recorded_descunder'] ? 2 : 1 ?>" class="command command_border_l command_border_t command_border_b command_border_r" align="center">
    281283        <a id="delete_<?php echo $row ?>"
    282             href="recorded_programs.php?delete=yes&file=<?php echo urlencode($show->filename) ?>"
     284            href="recorded_programs.php?delete=yes&chanid=<?php echo urlencode($show->chanid) ?>&starttime=<?php echo urlencode($show->starttime) ?>"
    283285            js_href="javascript:confirm_delete(<?php echo $row ?>, false)";
    284286            title="<?php echo htmlentities(t('Delete $1', preg_replace('/: $/', '', $show->title.': '.$show->subtitle))) ?>"
    285287            ><?php echo t('Delete') ?></a>
     
    304306        </td>
    305307    <td width="5%" class="command command_border_l command_border_t command_border_b command_border_r" align="center">
    306308        <a id="delete_rerecord_<?php echo $row ?>"
    307             href="recorded_programs.php?delete=yes&file=<?php echo urlencode($show->filename) ?>&forget_old"
     309            href="recorded_programs.php?delete=yes&chanid=<?php echo urlencode($show->chanid) ?>&starttime=<?php echo urlencode($show->starttime) ?>&forget_old"
    308310            js_href="javascript:confirm_delete(<?php echo $row ?>, true)";
    309311            title="<?php echo htmlentities(t('Delete and rerecord $1', preg_replace('/: $/', '', $show->title.': '.$show->subtitle))) ?>"
    310312            ><?php echo t('Delete + Rerecord') ?></a></td>
  • recorded_programs.php

     
    2121// Delete a program?
    2222    isset($_GET['forget_old']) or $_GET['forget_old'] = $_POST['forget_old'];
    2323    isset($_GET['delete'])     or $_GET['delete']     = $_POST['delete'];
    24     isset($_GET['file'])       or $_GET['file']       = $_POST['file'];
    25     if ($_GET['delete'] && preg_match('/\\d+_\\d+/', $_GET['file'])) {
     24    isset($_GET['chanid'])     or $_GET['chanid']     = $_POST['chanid'];
     25    isset($_GET['starttime'])  or $_GET['starttime']  = $_POST['starttime'];
     26    if ($_GET['delete']) {
    2627    // Keep a previous-row counter to return to after deleting
    2728        $prev_row = -2;
    2829    // We need to scan through the available recordings to get at the additional information required by the DELETE_RECORDING query
     
    3132            if (($_SESSION['recorded_title'] == $row[0]) || ($_SESSION['recorded_title'] == ''))
    3233                $prev_row++;
    3334        // This row isn't the one we're looking for
    34             if ($row[8] != $_GET['file'])
     35            if (($row[4] != $_GET['chanid']) or ($row[11] != $_GET['starttime']))
    3536                continue;
    3637        // Forget all knowledge of old recordings
    3738            if (isset($_GET['forget_old'])) {
    38                 preg_match('/\/(\d+)_(\d+)_\d+\.nuv$/', $_GET['file'], $matches);
     39                // What does this following line do? Commented it out as it wouldn't work anyway (matches nuv files only)
     40                // preg_match('/\/(\d+)_(\d+)_\d+\.nuv$/', $_GET['file'], $matches);
    3941                $show = new Program($row);
    4042                $show->rec_forget_old();
    4143            }