Example #1
0
    exit(-1);
}
$editpostparamid = 0;
if (isset($_REQUEST['editpostparam'])) {
    $editpostparamid = $_REQUEST['id'];
}
$wantstart = false;
$connected = false;
$supportpostparam = $PostProcessConfigTemplate != '' && $PostProcessConfigFile != '';
$phpvars = null;
if (isset($_REQUEST['start']) && $ServerStartCommand != '') {
    $wantstart = true;
}
if (!$wantstart) {
    $phpvars = GetInfo($groupmode);
    $connected = !IsConnectError($phpvars);
}
function add_category_combo($category, $id, $paused)
{
    global $Categories;
    if ($category == '' && count($Categories) == 0) {
        return;
    }
    $catfound = false;
    echo '<select class="' . ($paused ? 'pausedcategorycombo' : 'categorycombo') . '" onchange="javascript:updatestatus(\'status.php?action=groupsetcategory&edittext=\' + this.options[this.selectedIndex].text + \'&offset=-1&id=' . $id . '\')">';
    foreach ($Categories as $cat) {
        if ($cat == $category) {
            echo "<option selected='selected'>{$cat}</option>";
            $catfound = true;
        } else {
            echo "<option>{$cat}</option>";
Example #2
0
function GetInfo($listgroups)
{
    global $LogLines, $RpcApi;
    $rarr = GetMultiRequest(array(array('version', null), array('status', null), array($listgroups ? 'listgroups' : 'listfiles', array(0, 0)), array('postqueue', $LogLines), array('log', array(0, $LogLines)), array('history', null)));
    if (IsConnectError($rarr)) {
        return $rarr;
    }
    $r = array();
    $r['version'] = $RpcApi == 'xml-rpc-ext' ? $rarr[0][0] : $rarr[0];
    $r['status'] = $RpcApi == 'xml-rpc-ext' ? $rarr[1][0] : $rarr[1];
    $r['postqueue'] = $rarr[3];
    $r['log'] = $rarr[4];
    $r['history'] = $rarr[5];
    if ($listgroups) {
        $r['groups'] = $rarr[2];
        // find active group
        // definition: active group is the top group with unpaused items
        $r['queuedgroups'] = array();
        foreach ($r['groups'] as $group) {
            $grouppaused = $group['PausedSizeLo'] != 0 && $group['RemainingSizeLo'] == $group['PausedSizeLo'];
            if (!$grouppaused && !$r['status']['ServerStandBy'] && !isset($r['activegroup'])) {
                $r['activegroup'] = $group;
            } else {
                // do not add group with all paused items, if it is currently in post-processor-queue
                $postgroup = False;
                foreach ($r['postqueue'] as $postitem) {
                    if ($postitem['NZBFilename'] == $group['NZBFilename']) {
                        $postgroup = True;
                    }
                }
                if (!$postgroup) {
                    $r['queuedgroups'][] = $group;
                }
            }
        }
    } else {
        $r['files'] = $rarr[2];
    }
    return $r;
}