Beispiel #1
0
def login(request):
    if request.method == 'GET':
        reDict = {'nav': getNav(request)}
        response = render_to_response('accounts/login.html', reDict)
        ref = get_referer_view(request)
        response.set_cookie('ref', smart_str(ref))
        return response
    else:
        _usr = request.POST.get('usr', '')
        _pwd = request.POST.get('pwd', '')
        userInfoList = UserInfo.objects.filter(username=_usr)
        if userInfoList.count() == 0:
            reDict = {'nav': getNav(request), 'notexists': True}
            return render_to_response('accounts/login.html', reDict)
        else:
            if userInfoList[0].password == pwd2hash(_pwd):
                referer = getRef(request)
                _kwargs = {'siteid': getSiteid(request)} if u'freebtc123:evaluate' == referer else {}
                response = HttpResponseRedirect(reverse(referer, kwargs=_kwargs))
                delCookie(request, response, 'ref')
                response.set_cookie('usr', smart_str(_usr))
                return response
            else:
                reDict = {'nav': getNav(request), 'notexists': False, 'pwderror': True}
                return render_to_response('accounts/login.html', reDict)
Beispiel #2
0
def getEvaluateDict(request, siteid):
    site = Site.objects.get(id=siteid)
    siteDict = model_to_dict(site)
    siteDict = siteDictAdd(request, siteid, siteDict)
    eva = Evaluate.objects.filter(site__id=siteid).order_by('-evaDateTime')
    proof = Proof.objects.filter(site__id=siteid).order_by('-proofDateTime')
    reDict = {'nav': getNav(request), 'siteid': siteid, 'site': siteDict, 'eva': eva, 'proof': proof, 'usr': getUsr(request), 'wallet': getWallet(request)}
    return reDict
Beispiel #3
0
def scores(request, p=1):
    _p = int(p)
    _from = (_p - 1) * 100
    _to = _p * 100
    _maxp = (Scores.objects.using('baiduchengjiu').all().count() + 100 - 1) / 100
    prev, next, showlist = getpnsl(_p, _maxp)
    scores = Scores.objects.using('baiduchengjiu').filter().order_by('-score')[_from: _to]
    reDict = {'nav': getNav(request), 'scores': addRank(scores, _from + 1), 'prev': prev, 'cur': _p, 'next': next, 'showlist': showlist}
    return render_to_response('baiduchengjiu/scores.html', reDict)
Beispiel #4
0
def getEvaluateDict(request, siteid):
    site = Site.objects.get(id=siteid)
    siteDict = model_to_dict(site)
    siteDict['like'] = getLikeFlag(request, siteid, True)
    siteDict['unlike'] = getLikeFlag(request, siteid, False)
    siteDict['fav'] = getFavFlag(request, siteid)
    eva = Evaluate.objects.filter(site__id=siteid).order_by('-evaDateTime')
    proof = Proof.objects.filter(site__id=siteid).order_by('-proofDateTime')
    reDict = {'nav': getNav(request), 'siteid': siteid, 'site': siteDict, 'eva': eva, 'proof': proof}
    return reDict
Beispiel #5
0
def cjadmin(request):
    reDict = {'nav': getNav(request)}
    if request.method == 'GET':
        pass
    else:
        _uid = request.POST.get('usr', '')
        if 1 == Scores.objects.using('baiduchengjiu').filter(uid=_uid).count():
            reDict['exists'] = True
        else:
            _add.delay(_uid)
    return render_to_response('baiduchengjiu/cjadmin.html', reDict)
Beispiel #6
0
def submitsite(request):
    _name = request.POST.get('name', '')
    _description = request.POST.get('description', '')
    _url = request.POST.get('url', '')
    if _url == '':
        print 'error'
    else:
        csySet = Classify.objects.get(nav__navName='submitsite')
        Site.objects.create(siteName=_name, siteDescription=_description, siteUrl=_url, classify_id=csySet.id)
    reDict = {'nav': getNav(request), 'csysite': getCsySite(request, 'submitsite', 1), 'usr': getUsr(request)}
    return render_to_response('freebtc123/submitsite.html', reDict)
Beispiel #7
0
def signup(request):
    if request.method == 'GET':
        reDict = {'nav': getNav(request)}
        response = render_to_response('accounts/signup.html', reDict)
        ref = get_referer_view(request)
        response.set_cookie('ref', smart_str(ref))
        return response
    else:
        _usr = request.POST.get('usr', '')
        _pwd = request.POST.get('pwd', '')
        _email = request.POST.get('email', '')
        _wallet = request.POST.get('wallet', '')
        if UserInfo.objects.filter(username=_usr).count() != 0:
            reDict = {'nav': getNav(request), 'exists': True}
            return render_to_response('accounts/signup.html', reDict)
        else:
            w = Wallet.objects.create(walletUrl=_wallet)
            u = UserInfo.objects.create(username=_usr, password=pwd2hash(_pwd), email=_email, wallet=w)
            response = HttpResponseRedirect(reverse(getRef(request)))
            delCookie(request, response, 'ref')
            response.set_cookie('usr', smart_str(_usr))
            return response
Beispiel #8
0
def submitsite(request):
    verify_url = 'http://www.google.com/recaptcha/api/verify'

    _name = request.POST.get('name', '')
    _description = request.POST.get('description', '')
    _url = request.POST.get('url', '')

    robots = False
    if _url == '':
        pass
    else:
        _recaptcha_challenge_field = request.POST.get('recaptcha_challenge_field', '')
        _recaptcha_response_field = request.POST.get('recaptcha_response_field', '')
        data = {'privatekey': '6LfWhe0SAAAAAEkkiS0DD2w0u2xWA1gxpvFGt7YP', 'remoteip': getIP(request), 'challenge': _recaptcha_challenge_field, 'response': _recaptcha_response_field}
        re = requests.post(verify_url, data)

        if u'true' in re.text:
            csySet = Classify.objects.get(nav__navName='submitsite')
            Site.objects.create(siteName=_name, siteDescription=_description, siteUrl=_url, classify_id=csySet.id)
        else:
            robots = True

    reDict = {'nav': getNav(request), 'csysite': getCsySite(request, 'submitsite', 1), 'usr': getUsr(request), 'wallet': getWallet(request), 'robots': robots}
    return render_to_response('freebtc123/submitsite.html', reDict)
Beispiel #9
0
def btcreaper(request):
    reDict = {'nav': getNav(request), 'csysite': getCsySite(request, 'freebtc'), 'numsite': -1, 'num': 0, 'usr': getUsr(request)}
    return render_to_response('freebtc123/btcreaper.html', reDict)
Beispiel #10
0
def btcwiki(request):
    reDict = {'nav': getNav(request), 'csysite': getCsySite(request, 'btcwiki', 1), 'usr': getUsr(request)}
    return render_to_response('freebtc123/btcwiki.html', reDict)
Beispiel #11
0
def altcoin(request):
    reDict = {'nav': getNav(request), 'csysite': getCsySite(request, 'altcoin', 0), 'usr': getUsr(request)}
    return render_to_response('freebtc123/altcoin.html', reDict)
Beispiel #12
0
def freebtc(request):
    reDict = {'nav': getNav(request), 'csysite': getCsySite(request, 'freebtc', 0), 'usr': getUsr(request)}
    return render_to_response('freebtc123/freebtc.html', reDict)
Beispiel #13
0
def btcreaper(request, csyid=-1):
    reDict = {'nav': getNav(request), 'csyid': csyid, 'numsite': -1, 'num': 0, 'usr': getUsr(request)}
    reHtml = 'freebtc123/btcreaper.html' if -1 == csyid else 'freebtc123/csyreaper.html'
    return render_to_response(reHtml, reDict)
Beispiel #14
0
def next(request, num, csyid=-1):
    numsite, num = getNumSite(request, int(num)) if -1 == csyid else getCsyNumSite(request, int(num), int(csyid))
    reDict = {'nav': getNav(request), 'csyid': csyid, 'numsite': numsite, 'num': num, 'usr': getUsr(request)}
    reHtml = 'freebtc123/btcreaper.html' if -1 == csyid else 'freebtc123/csyreaper.html'
    return render_to_response(reHtml, reDict)
Beispiel #15
0
def about(request):
    reDict = {'nav': getNav(request), 'usr': getUsr(request)}
    return render_to_response('freebtc123/about.html', reDict)
Beispiel #16
0
def next(request, num):
    numsite, num = getNumSite(request, int(num))
    reDict = {'nav': getNav(request), 'numsite': numsite, 'num': num, 'usr': getUsr(request)}
    return render_to_response('freebtc123/btcreaper.html', reDict)
Beispiel #17
0
def dustbin(request):
    reDict = {'nav': getNav(request), 'dustbin': getDustBin(request)}
    return render_to_response('freebtc123/dustbin.html', reDict)
Beispiel #18
0
def newtobtc(request):
    reDict = {'nav': getNav(request), 'usr': getUsr(request), 'wallet': getWallet(request)}
    return render_to_response('freebtc123/newtobtc.html', reDict)
Beispiel #19
0
def fav(request):
    reDict = {'nav': getNav(request), 'favsite': getFavSite(request), 'lastest': getLastestSite(request), 'hottest': gethottestSite(request), 'usr': getUsr(request)}
    return render_to_response('freebtc123/fav.html', reDict)
Beispiel #20
0
def btcforum(request):
    reDict = {'nav': getNav(request), 'csysite': getCsySite(request, 'btcforum', 0), 'usr': getUsr(request), 'wallet': getWallet(request)}
    return render_to_response('freebtc123/btcforum.html', reDict)