예제 #1
0
파일: views.py 프로젝트: Qbitus/pinecast
def player(req, episode_id):
    ep = get_object_or_404(PodcastEpisode, id=episode_id)
    resp = render(req, 'player.html', {'episode': ep})

    # If the user is not a demo user, allow the player to be used outside the app.
    if UserSettings.user_meets_plan(ep.podcast.owner, plans.FEATURE_MIN_PLAYER):
        resp.xframe_options_exempt = True
    return resp
예제 #2
0
def player(req, episode_id):
    ep = get_object_or_404(PodcastEpisode, id=episode_id)
    resp = render(req, 'player.html', {'episode': ep})

    # If the user is not a demo user, allow the player to be used outside the app.
    if UserSettings.user_meets_plan(ep.podcast.owner,
                                    plans.FEATURE_MIN_PLAYER):
        resp.xframe_options_exempt = True
    return resp
예제 #3
0
파일: views.py 프로젝트: vctrshn/pinecast
def ep_comment_box(req, podcast_slug, episode_id):
    pod = get_object_or_404(Podcast, slug=podcast_slug)
    if not UserSettings.user_meets_plan(pod.owner,
                                        plans.FEATURE_MIN_COMMENT_BOX):
        raise Http404()
    ep = get_object_or_404(PodcastEpisode, podcast=pod, id=episode_id)
    if not req.POST:
        return _pmrender(req, 'feedback/comment_episode.html', {
            'podcast': pod,
            'episode': ep
        })

    try:
        if not _validate_recaptcha(req):
            raise Exception('Invalid ReCAPTCHA')

        ip = analyze.get_request_ip(req)
        f = Feedback(podcast=pod,
                     episode=ep,
                     sender=req.POST.get('email'),
                     message=req.POST.get('message'),
                     sender_ip=ip)
        f.save()
        send_notification_email(
            pod.owner, ugettext('[Pinecast] You got some feedback!'),
            'Go check the Feedback page of %s--an episode on %s--to see what was written.\n\n'
            'https://pinecast.com%s' %
            (ep.title, pod.name,
             reverse('podcast_episode',
                     podcast_slug=podcast_slug,
                     episode_id=str(ep.id)) + '#tab-feedback'))
        NotificationHook.trigger_notification(podcast=pod,
                                              trigger_type='feedback',
                                              data={
                                                  'episode':
                                                  ep,
                                                  'content':
                                                  req.POST.get('message'),
                                                  'sender':
                                                  req.POST.get('email')
                                              })
    except Exception:
        return _pmrender(req, 'feedback/comment_episode.html', {
            'podcast': pod,
            'episode': ep,
            'error': True,
            'default': req.POST
        })

    return _pmrender(req, 'feedback/thanks.html', {'podcast': pod})
예제 #4
0
파일: views.py 프로젝트: Qbitus/pinecast
def ep_comment_box(req, podcast_slug, episode_id):
    pod = get_object_or_404(Podcast, slug=podcast_slug)
    if not UserSettings.user_meets_plan(pod.owner, plans.FEATURE_MIN_COMMENT_BOX):
        raise Http404()
    ep = get_object_or_404(PodcastEpisode, podcast=pod, id=episode_id)
    if not req.POST:
        return _pmrender(req, 'feedback/comment_episode.html', {'podcast': pod, 'episode': ep})

    try:
        if not _validate_recaptcha(req):
            raise Exception('Invalid ReCAPTCHA')

        ip = analyze.get_request_ip(req)
        f = Feedback(
            podcast=pod,
            episode=ep,
            sender=req.POST.get('email'),
            message=req.POST.get('message'),
            sender_ip=ip
        )
        f.save()
        analytics_log.write('feedback', {
            'podcast': unicode(pod.id),
            'episode': unicode(ep.id),
            'profile': {
                'email': req.POST.get('email'),
                'email_host': req.POST.get('email').split('@')[1],
                'ip': ip,
                'ua': req.META.get('HTTP_USER_AGENT'),
            },
        }, req=req)
        send_notification_email(
            pod.owner,
            ugettext('[Pinecast] You got some feedback!'),
            'Go check the Feedback page of %s--an episode on %s--to see what was written.\n\n'
            'https://pinecast.com%s' %
                (ep.title,
                 pod.name,
                 reverse('podcast_episode',
                         podcast_slug=podcast_slug,
                         episode_id=str(ep.id)) +
                    '#tab-feedback')
        )
    except Exception:
        return _pmrender(req, 'feedback/comment_episode.html',
                         {'podcast': pod, 'episode': ep, 'error': True, 'default': req.POST})

    return _pmrender(req, 'feedback/thanks.html', {'podcast': pod})
예제 #5
0
파일: views.py 프로젝트: Pinecast/pinecast
def podcast_comment_box(req, podcast_slug):
    pod = get_object_or_404(Podcast, slug=podcast_slug)
    if not UserSettings.user_meets_plan(pod.owner, plans.FEATURE_MIN_COMMENT_BOX):
        raise Http404()
    if not req.POST:
        return _pmrender(req, 'feedback/comment_podcast.html', {'podcast': pod})

    try:
        if not _validate_recaptcha(req):
            raise Exception('Invalid ReCAPTCHA')

        ip = analyze.get_request_ip(req)
        f = Feedback(
            podcast=pod,
            sender=req.POST.get('email'),
            message=req.POST.get('message'),
            sender_ip=ip
        )
        f.save()
        send_notification_email(
            pod.owner,
            ugettext('[Pinecast] You got some feedback!'),
            'Go check the Feedback page of your podcast, %s, to see what was written.\n\n'
            'https://pinecast.com%s' %
            (pod.name,
             reverse('podcast_dashboard', podcast_slug=podcast_slug) + '#tab-feedback')
        )

        NotificationHook.trigger_notification(
            podcast=pod,
            trigger_type='feedback',
            data={'content': req.POST.get('message'), 'sender': req.POST.get('email')})
    except Exception:
        return _pmrender(req, 'feedback/comment_podcast.html',
                         {'podcast': pod, 'error': True, 'default': req.POST})

    return _pmrender(req, 'feedback/thanks.html', {'podcast': pod})