Beispiel #1
0
function AddElementToWatchLists($db, $UserID, $ElementID, $WatchListsIDs)
{
    if ($Debug) {
        echo "I'm adding {$ElementID}\n<BR>";
    }
    $WatchListElement = new WatchListElement($db);
    while (list($key, $WatchListID) = each($WatchListsIDs)) {
        $result = $WatchListElement->Add($UserID, $WatchListID, $ElementID);
        if ($result == -1) {
            break;
        }
    }
    return $result;
}
Beispiel #2
0
        $wlid = $WatchLists->GetDefaultWatchListID($User->id);
        if ($Debug) {
            echo "GetDefaultWatchListID => \$wlid='{$wlid}'";
        }
    }
}
if (!freshports_IsInt($wlid)) {
    $msg = "\$wlid = '{$wlid}', which is not an integer as expected.";
    syslog(LOG_ERR, $msg . " User = '******' in " . __FILE__ . ':' . __LINE__);
    die($msg);
}
if ($submit) {
    pg_exec($db, "BEGIN");
    $categories = $_POST["categories"];
    if ($categories) {
        $WatchListElement = new WatchListElement($db);
        // make sure we are pointing at the start of the array.
        reset($categories);
        while (list($key, $value) = each($categories)) {
            $result = $WatchListElement->Add($User->id, $wlid, $value);
            #      ${"category_".$value} = 1;
            if ($result != 1) {
                syslog(LOG_ERR, $_SERVER["PHP_SELF"] . ": could not clear watch list '{$wlid}' owned by '{$User->id}' of element '{$value}' in " . __FILE__ . ':' . __LINE__);
                die("error clear list before saving");
            }
        }
    }
    pg_exec($db, "COMMIT");
    header("Location: filter-setup.php");
    /* Redirect browser */
    exit;