示例#1
0
function update_favorite()
{
    global $test_run;
    if (!isset($_GET['button'])) {
        return;
    }
    switch ($_GET['button']) {
        case 'Add':
        case 'Update':
            $response = add_favorite();
            $test_run = TRUE;
            break;
        case 'Delete':
            del_favorite();
            break;
    }
    write_config_file();
    return $response;
}
示例#2
0
	</div>
</div>
<?php 
    if (is_moderator($username)) {
        ?>
<a class="btn btn-info btn-block" href="artists.php?action=addartist">Add New Artist</a>

<?php 
    }
} else {
    if ($_GET['action'] == "addfavorite") {
        if (!isset($_GET['id'])) {
            die("Need to specify id for details action");
        }
        $artist_id = intval($_GET['id']);
        add_favorite($_SESSION['username'], $artist_id);
        echo "Artist Added to Favorites!";
        header('Location: artists.php?action=details&id=' . $artist_id, true);
    } else {
        if ($_GET['action'] == "removefavorite") {
            if (!isset($_GET['id'])) {
                die("Must specify id for this action");
            }
            $artist_id = intval($_GET['id']);
            remove_favorite($_SESSION['username'], $artist_id);
            echo "Artist Removed from Favorites!";
            header('Location: artists.php?action=details&id=' . $artist_id, true);
        } else {
            if ($_GET['action'] == "details") {
                if (!isset($_GET['id'])) {
                    die("Need to specify id for details action");
            if (!isset($_GET["episode"])) {
                set_error_output("Favorite failed. Episode not selected. ", "search.php?epname=+");
            } else {
                if (!check_existance_by_id("episodes", "EpID", $_GET["episode"])) {
                    set_error_output("Episode does not exist.", "search.php?epname=+");
                } else {
                    if (!check_existance_by_id("users", "id", $_GET["user"])) {
                        set_error_output("User does not exist. ", "video.php?e=" . urlencode($_GET["episode"]));
                    } else {
                        if (already_favorite($_GET["user"], $_GET["episode"])) {
                            set_error_output("You have already favorited that", "video.php?e=" . urlencode($_GET["episode"]));
                        }
                    }
                }
            }
        }
    }
}
add_favorite($_GET["user"], $_GET["episode"]);
// now that we know it was added, we can now output the html to replace the other.
?>
<!--span data-user-id="<?php 
/*
	if (isset($_SESSION["user_id"])) {
		echo $_SESSION["user_id"];
	} else {
		echo "-1"; // we will say please log in if we get this
	}		*/
?>
"id="video_info_panel_favorite"--> Unfavorite:<i class="fi-like" id="video_info_panel_favorite_icon_clicked"></i>