function validate_event_creation($ticker, $code)
{
    validate_ticker_passcode($ticker, $code);
    if (check_ticker_finished($ticker)) {
        throw new Exception();
    }
    if (!check_ticker_running($ticker)) {
        throw new Exception();
    }
}
Example #2
0
/**
 * Removes an event from a liveticker.
 * @param int id The liveticker's id.
 * @param int event_id The id of the event to remove.
 * @param string code The passcode for the liveticker.
 * @return bool Whether the event was sucessfully removed.
 */
function remove_ticker_event($id, $event_id, $code)
{
    global $con;
    try {
        validate_ticker_passcode($id, $code);
    } catch (Exception $e) {
        return false;
    }
    $sql = "DELETE FROM events WHERE id=? AND ticker=?";
    $stmt = $con->prepare($sql);
    $stmt->bindParam(1, $event_id);
    $stmt->bindParam(2, $id);
    $stmt->execute();
    return true;
}