Changeset 170

Show
Ignore:
Timestamp:
01/12/08 19:27:57 (12 months ago)
Author:
drarok
Message:

Closed ticket #21, implemented David Kubicek's patch with a few alterations.

Location:
hellaworld/trunk
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • hellaworld/trunk/CHANGELOG

    r165 r170  
    111.10 
    22 
     3* Applied David Kubicek's patch for HTTP-uploading of NZBs, see 
     4  http://trac.cheezyblog.net/ticket/21 for details. (drarok) 
     5 
     6* Fixed a bug where descending sort wouldn't work (chris) 
     7 
    38* Fixed a bug where queue items with an ETA over 24 but less than 48 
    4   hours long weren't showing the days in the ETA 
    5  
    6 * Updated the bookmarklet to support Newzbin v2 and Newzxxx 
     9  hours long weren't showing the days in the ETA (chris) 
     10 
     11* Updated the bookmarklet to support Newzbin v2 and Newzxxx (chris) 
    712 
    8131.9 
  • hellaworld/trunk/classes/HellaController.php

    r158 r170  
    244244 
    245245                                        //add the argument to the argument array as an XML-RPC value 
    246                                         $atmp[] = new xmlrpcval($argument, 'int'); 
     246                                        $type = (is_numeric($arguments) ? 'int' : 'string'); 
     247                                        $atmp[] = new xmlrpcval($argument, $type); 
    247248                                } 
    248249 
     
    254255 
    255256                                // convert it to a one item array contianing an XML-RPC value 
    256                                 $arguments = array(new xmlrpcval($arguments, 'int')); 
     257                                $type = (is_numeric($arguments) ? 'int' : 'string'); 
     258                                $arguments = array(new xmlrpcval($arguments, $type)); 
    257259                        } 
    258260 
  • hellaworld/trunk/completed.xml

    r93 r170  
    11<?xml version="1.0" encoding="utf-8"?> 
    22<queue> 
    3 </queue> 
     3<item><type>ERROR</type><archiveName>Apocalyptica Sheet Music Flood - 2007-12-30 (15 Books)</archiveName><destDir>/Volumes/LaCie/usenet/Books/Apocalyptica Sheet Music Flood - 2007-12-30 (15 Books)</destDir><elapsedTime>1s</elapsedTime><finishedTime>1200164124</finishedTime><parMessage>A problem occurred: FatalError: Unable to par repair: archive requires 77 more recovery blocks for repair</parMessage></item><item><type>SUCCESS</type><archiveName>The Colbert Report - 2008-01-10 - Muhammad Yunus</archiveName><destDir>/Volumes/LaCie/usenet/The Colbert Report - 2008-01-10 - Muhammad Yunus</destDir><elapsedTime>18s</elapsedTime><finishedTime>1200164254</finishedTime><parMessage/></item><item><type>SUCCESS</type><archiveName>The Colbert Report - 2008-01-09 - Matt Taibbi, Gov. Mike Huckabee</archiveName><destDir>/Volumes/LaCie/usenet/The Colbert Report - 2008-01-09 - Matt Taibbi, Gov. Mike Huckabee</destDir><elapsedTime>27s</elapsedTime><finishedTime>1200164664</finishedTime><parMessage></parMessage></item></queue> 
  • hellaworld/trunk/index.php

    r169 r170  
    275275                } 
    276276 
     277                if (array_key_exists('nzbupload', $_FILES)) { 
     278                        $nzbfile = trim($_FILES['nzbupload']['tmp_name']); 
     279                        chmod($nzbfile, 0644); 
     280                        $nzbname = trim($_FILES['nzbupload']['name']); 
     281                        if (preg_match('/\.nzb$/i', $nzbname)) { 
     282                                $newfile = dirname($nzbfile)."/".$nzbname; 
     283                                move_uploaded_file($nzbfile, $newfile); 
     284                                $c->enqueue($newfile); 
     285                                unlink($newfile); 
     286                        } else { 
     287                                throw new Exception("Invalid NZB upload!"); 
     288                        } 
     289                        header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . $self); 
     290                } 
     291 
    277292                if (array_key_exists('bookmarklet', $_GET)) { 
    278293                        if (preg_match('/((https?):\/\/)?(([A-Z0-9][A-Z0-9_-]*)((\.[A-Z0-9][A-Z0-9_-]*)+)?)(:(\d+))?(\/([^ ]*)?| |$)/i', $_GET['bookmarklet']) < 1) { 
  • hellaworld/trunk/js/hellaworld.php

    r157 r170  
    8181                var info = "<h2><?php echo _('Currently Downloading'); ?></h2>"; 
    8282                if (json.downloading != null) { 
    83                         info += "<div>" + json.downloading + "</div>"; 
     83                        info += '<div class="nzbname">' + json.downloading + '</div>'; 
    8484                        info += '<div class="queuestats"><img alt="progress bar" src="progress.php?percentage=' + json.completed + '"/> <?php printf(_('%s%% complete'), "' + json.completed + '"); ?></div>'; 
    8585                        info += '<div class="queuestats"><?php printf(_('%sMB of %sMB remaining'), "' + json.remaining + '", "' + json.size + '"); ?></div>'; 
     
    133133                                for (i = 0; i < json.finished.length; i++) { 
    134134                                        finished += '<li class="queuebox ' + json.finished[i].type + '">'; 
    135                                         finished += '<div class="queuetitle">' + json.finished[i].archiveName + '</div>'; 
     135                                        if (json.finished[i].url != '') { 
     136                                                finished += '<div><a class="queuetitle" href="' + json.finished[i].url + '">' + json.finished[i].archiveName + '</a></div>'; 
     137                                        } else { 
     138                                                finished += '<div class="queuetitle">' + json.finished[i].archiveName + '</div>'; 
     139                                        } 
    136140                                        finished += '<ul class="queuecontrols"><li class="control"><a href="index.php?removefinished=' + json.finished[i].index + '"><?php echo _('Remove'); ?></a></li></ul>'; 
    137141                                        finished += '<div class="queuestats"><?php printf(_('Finished on: %s Processing Time: %s'), "' + json.finished[i].finishedTime + '", "' + json.finished[i].elapsedTime"); ?>; 
  • hellaworld/trunk/style/main.css

    r152 r170  
    6262} 
    6363 
    64 #modules div { 
     64#nzbinput { 
    6565        background: #eaeaea; 
    6666        padding: 3px; 
     
    6868        border-top: 0px; 
    6969        margin-bottom: 10px; 
    70         min-height: 36px; 
    71         height: 36px; 
     70        min-height: 30px; 
     71        height: 73px; 
     72} 
     73 
     74#downrate { 
     75        background: #eaeaea; 
     76        padding: 3px; 
     77        border: 1px solid #000; 
     78        border-top: 0px; 
     79        margin-bottom: 10px; 
     80        min-height: 30px; 
     81        height: 30px; 
     82} 
     83 
     84#modules div input { 
     85        left: 0px; 
    7286} 
    7387 
     
    150164        border: 1px solid #000; 
    151165        margin-bottom: 10px; 
     166} 
     167 
     168.queuebox.first { 
     169        margin-left: 310px; 
    152170} 
    153171 
     
    193211.queuetitle { 
    194212        font-weight: bold; 
     213        color: black; 
     214} 
     215 
     216.queuetitle:visited { 
     217        font-weight: bold; 
     218        color: black; 
    195219} 
    196220 
  • hellaworld/trunk/templates/default.php

    r165 r170  
    4747                <link rel="stylesheet" type="text/css" href="style/thickbox.css" /> 
    4848                <link rel="stylesheet" type="text/css" href="style/tabs.css" /> 
     49                <link rel="icon" href="images/trac.ico" type="image/x-icon" /> 
     50                <link rel="shortcut icon" href="images/trac.ico" type="image/x-icon" /> 
    4951                <!--[if lte IE 7]> 
    5052                <link rel="stylesheet" href="style/tabs-ie.css" type="text/css" /> 
     
    6769                        <div id="modules"> 
    6870                                <h2><?php echo _('Add NZB Via Newzbin ID Or URL'); ?></h2> 
    69                                 <div> 
     71                                <div id="nzbinput"> 
    7072                                        <form method="get" action="<?php echo $self; ?>"> 
    7173                                                <fieldset> 
     74                                                        <label for="nzbdownload"><?php echo _('Article ID or URL:'); ?><br /> <input type="text" name="nzbdownload" id="nzbdownload" /></label> 
    7275                                                        <input type="submit" value="Go" style="float:right;" /> 
    73                                                         <label for="nzbdownload"><?php echo _('Article ID or URL:'); ?> <input type="text" name="nzbdownload" id="nzbdownload" /></label> 
    7476                                                </fieldset> 
    7577                                        </form> 
     78                                        <form method="post" enctype="multipart/form-data" action="<?php echo $self; ?>"> 
     79                                                <fieldset> 
     80                                                        <label for="nzbupload" ><?php echo _('Upload NZB:'); ?><br/> <input size=27 type="file" name="nzbupload" id="nzbupload" /></label> 
     81                                                        <input type="submit" value="Go" style="float:right;" /> 
     82                                                </fieldset> 
     83                                        </form> 
    7684                                </div> 
    7785                                <h2><?php echo _('Set Rate Limit'); ?></h2> 
    78                                 <div> 
     86                                <div id="downrate" > 
    7987                                        <form method="get" action="<?php echo $self; ?>"> 
    8088                                                <fieldset> 
     
    101109<h2><?php echo _('Currently Downloading'); ?></h2> 
    102110<?php if ($c->downloadCount > 0): foreach($c->downloads as $download): ?> 
    103 <div><?php echo htmlspecialchars($download['nzbName']); ?></div> 
     111<div class="nzbname"><?php echo htmlspecialchars($download['nzbName']); ?></div> 
    104112<div class="queuestats"><img src="progress.php?percentage=<?php echo $c->completed; ?>" alt="progress bar" /> <?php printf(_('%s%% complete'), $c->completed); ?></div> 
    105113<div class="queuestats"><?php printf(_('%sMB of %sMB remaining'), $c->remaining, $download['total_mb']); ?></div> 
     
    154162<div id="log"><?php foreach ($c->log as $line): echo $line . "<br />"; endforeach; ?></div> 
    155163</div> 
    156 <?php if (isset($config['showfinished']) && $config['showfinished']): $finishedcount = count($x->item); ?> 
     164<?php if (isset($config['showfinished']) && $config['showfinished']): $finishedcount = count($x->item); 
     165        $baseurl = (!strstr($config['basepath'], '://') ? $protocol . '://' . htmlentities($_SERVER['HTTP_HOST']) : '').$config['basepath'].'/'; 
     166?> 
    157167<div id="fragment-2"> 
    158168<div id="finishedbox"> 
     
    169179                        <li class="queuebox" style="text-align: center; font-weight: bold;"><?php echo _('No Finished Items'); ?></li> 
    170180                <?php else: ?> 
    171                         <?php $i = 0; foreach($x->item as $item): $i++; ?> 
     181                        <?php $i = 0; foreach($x->item as $item): 
     182                                $i++; $durl = ''; 
     183                                if (!strncmp($config['destpath'], (string)$item->destDir, strlen($config['destpath'])) && is_dir((string)$item->destDir)): 
     184                                        $durl = $baseurl.substr((string)$item->destDir, strlen($config['destpath'])+1); 
     185                                endif 
     186                        ?> 
    172187                        <li class="queuebox <?php echo (((string)$item->type == 'SUCCESS') ? 'good' : 'bad'); ?>"> 
    173                                 <div class="queuetitle"> 
    174                                         <?php echo (string)$item->archiveName; ?> 
     188                                <div> 
     189                                        <?php if ($config['showlinks'] && !empty($durl)): ?> 
     190                                        <div><a class="queuetitle" href="<?php echo $durl; ?>"><?php echo (string)$item->archiveName; ?></a></div> 
     191                                        <?php else: ?> 
     192                                        <div class="queuetitle"><?php echo (string)$item->archiveName; ?></div> 
     193                                        <?php endif ?> 
    175194                                </div> 
    176195                                <ul class="queuecontrols"> 
  • hellaworld/trunk/templates/json.php

    r157 r170  
    7777        $hellainfo['showfinished'] = true; 
    7878        $hellainfo['finished'] = array(); 
     79        $baseurl = (!strstr($config['basepath'], '://') ? $protocol . '://' . htmlentities($_SERVER['HTTP_HOST']) : '').$config['basepath'].'/'; 
    7980        $i = 0; 
    8081        foreach($x->item as $item) { 
    8182                $tmp = array(); 
     83                $durl = ''; 
     84                if (!strncmp($config['destpath'], (string)$item->destDir, strlen($config['destpath']))) { 
     85                        $durl = $baseurl.substr((string)$item->destDir, strlen($config['destpath'])+1); 
     86                } 
    8287                $tmp['index'] = ++$i; 
    8388                $tmp['type'] = (((string)$item->type == 'SUCCESS') ? 'good' : 'bad' ); 
    8489                $tmp['archiveName'] = (string)$item->archiveName; 
    8590                $tmp['destDir'] = (string)$item->destDir; 
     91                $tmp['url'] = $durl; 
    8692                $tmp['elapsedTime'] = (string)$item->elapsedTime; 
    8793                $tmp['finishedTime'] = date('M dS - H:i:s', (int)$item->finishedTime);