'Submit form.'

@validate(url=VRequired('url', None), title=VRequired('title', None), text=VRequired('text', None), selftext=VRequired('selftext', None))
def GET_submit(self, url, title, text, selftext):

    resubmit = request.GET.get('resubmit')
    url = sanitize_url(url)
    if (url and (not resubmit)):
        def keep_fn(item):
            would_keep = item.keep_item(item)
            return (would_keep and (getattr(item, 'promoted', None) is None))
        listing = hot_links_by_url_listing(url, sr=c.site, num=100, skip=True, keep_fn=keep_fn)
        links = listing.things
        if (links and (len(links) == 1)):
            existing_submission_url = links[0].already_submitted_link(url, title)
            return self.redirect(existing_submission_url)
        elif links:
            resubmit_url = Link.resubmit_link(url, title)
            sr_resubmit_url = add_sr(resubmit_url)
            infotext = (strings.multiple_submitted % sr_resubmit_url)
            res = BoringPage(_('seen    it'), content=listing, infotext=infotext).render()
            return res
    if (not c.user_is_loggedin):
        raise UserRequiredException
    if (not (c.default_sr or c.site.can_submit(c.user))):
        abort(403, 'forbidden')
    target = (c.site if (not isinstance(c.site, FakeSubreddit)) else None)
    VNotInTimeout().run(action_name='pageview', details_text='submit', target=target)
    captcha = (Captcha() if c.user.needs_captcha() else None)
    extra_subreddits = []
    if isinstance(c.site, MultiReddit):
        extra_subreddits.append(((_('%s    subreddits') % c.site.name), c.site.srs))
    newlink = NewLink(url=(url or ''), title=(title or ''), text=(text or ''), selftext=(selftext or ''), captcha=captcha, resubmit=resubmit, default_sr=(c.site if (not c.default_sr) else None), extra_subreddits=extra_subreddits, show_link=(c.default_sr or c.site.can_submit_link(c.user)), show_self=((c.default_sr or c.site.can_submit_text(c.user)) and (not request.GET.get('no_self'))))
    return FormPage(_('submit'), show_sidebar=True, page_classes=['submit-page'], content=newlink).render()
