Exemplo n.º 1
0
def show_msgid(msgs):
    msgs = msgs.replace('/', ':')
    lrq = app_rq('msgs/%s' % msgs)
    lst = mydict()
    for n in lrq:
        lst[n.mid] = mydict(n._data)
    return template('tpl/msg.html', msgs=msgs, lst=lst, u=get_u())
Exemplo n.º 2
0
def show_echoarea(ea, opts=''):
    if not '.' in ea:
        ea += '.11'
    opts = opts.split(',') + ['', '', '']
    lim, page, rev = '/lim/100', '', ''
    pg = 1
    if opts[0]:
        page = '/page/%s' % opts[0]
        pg = int(opts[0])
    if opts[1]:
        lim = '/lim/%s' % opts[1]
    if opts[2] == 'rev':
        rev = '/rev/1'
    cnt = app_rq('echolist/none/addecho/%s/cnt/1' % ea)[0][1]
    msgs = app_rq('echo/%s%s%s%s' % (ea, lim, page, rev))
    if opts[2] == 'intrev':
        msgdict = []
        for n in msgs:
            msgdict.append(mydict(n._data))
        msgs = msgdict[::-1]
    return template('tpl/echoarea.html',
                    msgs=msgs,
                    ea=ea,
                    opts=opts,
                    u=get_u(),
                    cnt=cnt,
                    page=pg)
Exemplo n.º 3
0
def show_lite(ea, mid=''):
    if mid:
        rmsg = app_rq('msgs/%s/fmt/noempty' % mid)
    else:
        rmsg = mydict()
    msgs = app_rq('echo/%s/lim/30' % ea)
    return template('tpl/lite.html', msgs=msgs, ea=ea, u=get_u(), rmsg=rmsg)
Exemplo n.º 4
0
def uweb(umod, rq, kuk):
    if umod == 'reguser':
        return mydict(html=bottle.template('userbb/reg.html', acc=rq.acc))
    elif umod == 'adduser':
        save_user(rq.uname, rq.upass)
        return mydict(redir='/user/me')
    elif umod == 'login':
        newhash = mkhash(rq.uname, rq.upass)
        return mydict(cookie={'uhash': newhash}, redir=rq.redir or '/user/me')
    elif umod == 'logout':
        return mydict(cookie={'uhash': ''}, redir='/user/me')
    elif umod == 'me':
        u = check_auth(rq.uhash or kuk.uhash)
        if u:
            return mydict(html=bottle.template('userbb/profile.html', u=u))
        else:
            return mydict(html=bottle.template('userbb/login.html', rq=rq))
Exemplo n.º 5
0
def ecfg_index(ss=0):
    uu = get_u()
    if not uu or not uu.root:
        return 'no access'
    try:
        txt = open('subs%s.lst' % ss).read()
    except:
        txt = ''
    return template(
        '<form method="POST"><input type="hidden" name="uhash" value="{{uu.uhash}}" /><input type="text" name="txt" value="{{txt}}" style="width:100%" /><input type="submit" value="Save" /> {{txt}} </form>',
        txt=txt,
        uu=uu)
Exemplo n.º 6
0
def show_carbon(carbon):
    lrq = dbj.msg.select().order_by(
        dbj.msg.accepted.desc()).where(dbj.msg.msgto == carbon).limit(50)
    cbid, lst = [], mydict()
    for n in lrq:
        lst[n.mid] = mydict(n._data)
        cbid.append(n.mid)
    return template('tpl/msg.html',
                    msgs=':'.join(cbid),
                    lst=lst,
                    deftitle=carbon,
                    u=get_u())
Exemplo n.º 7
0
def uweb(umod, rq, kuk):
    if umod == 'reguser':
        return mydict(html=bottle.template('userbb/reg.html', acc=rq.acc))
    elif umod == 'adduser':
        newhash = save_user(rq.uname, rq.upass)
        return mydict(
            html=
            'login <b>%s</b>, password <b>%s</b><br>authstr: <b>%s</b><br><br><a href="/user/login">LOGIN</a>'
            % (rq.uname, rq.upass, newhash))
    elif umod == 'login':
        newhash = mkhash(rq.uname, rq.upass)
        return mydict(cookie={'uhash': newhash}, redir=rq.redir or '/user/me')
    elif umod == 'logout':
        return mydict(cookie={'uhash': ''}, redir='/user/me')
    elif umod == 'me':
        u = check_auth(rq.uhash or kuk.uhash)
        if u:
            return mydict(html=bottle.template('userbb/profile.html', u=u),
                          cookie={'uhash': u.uhash})
        else:
            return mydict(html=bottle.template('userbb/login.html', rq=rq))
Exemplo n.º 8
0
def show_topic(tid):
    msgs = []
    lrq = app_rq('topicid/%s/rev/1' % tid)
    lst = mydict()
    deftitle = ''
    for n in lrq:
        lst[n.mid] = mydict(n._data)
        msgs.append(n.mid)
        deftitle = n.title if not deftitle else deftitle
    return template('tpl/msg.html',
                    msgs=':'.join(msgs),
                    lst=lst,
                    u=get_u(),
                    deftitle=u'Topic: %s' % deftitle)
Exemplo n.º 9
0
def reply_to(ea, repto):
    u = get_u()
    if not u:
        redirect('/user/me?redir=/reply/%s/%s' % (ea, repto))
    rep = repto if repto != '-' else ''
    if rep:
        # fix msgs// !
        rmsg = app_rq('msgs/%s/fmt/noempty' % rep)
    else:
        rmsg = mydict()
    return template('tpl/mform.html',
                    rmsg=rmsg,
                    ea=ea,
                    repto=rep,
                    u=u,
                    zo=request.query.tn)
Exemplo n.º 10
0
def show_topic(tid):
    msgs, deftitle = topic.get_topic(tid, request.query.flag)
    try:
        ea = dbj.msg.get(dbj.msg.mid == msgs.split(':')[0]).echoarea
    except:
        ea = ''
    lrq = app_rq('msgs/%s' % msgs)
    lst = mydict()
    for n in lrq:
        lst[n.mid] = mydict(n._data)
    return template('tpl/msg.html',
                    msgs=msgs,
                    lst=lst,
                    u=get_u(),
                    deftitle=u'Topic: %s' % deftitle,
                    ea=ea,
                    tn=deftitle)
Exemplo n.º 11
0
def show_rq():
    rq = request.query
    cur = []
    if rq:
        cur = dbj.msg().select()
        if rq.dfrom:
            cur = cur.where(dbj.msg.date >= wh.ts_get(rq.dfrom + ' 00:00:00'))
        if rq.dto:
            cur = cur.where(dbj.msg.date <= wh.ts_get(rq.dto + ' 23:59:59'))
        if rq.msgfrom:
            cur = cur.where(dbj.msg.msgfrom == rq.msgfrom)
        if rq.msgto:
            cur = cur.where(dbj.msg.msgto == rq.msgto)
        if rq.ea:
            cur = cur.where(dbj.msg.echoarea << rq.ea.split())
        cur = cur.limit(400)
    return template('tpl/query.html',
                    lst=cur,
                    cnt=cur.count() if cur else 0,
                    rq=rq)
Exemplo n.º 12
0
def show_lite(ea, opts=''):
    msgs = app_rq('echo/%s/lim/30' % ea)
    return template('tpl/lite.html', msgs=msgs, ea=ea, u=get_u())
Exemplo n.º 13
0
def show_authors():
    query = dbj.msg.select(dbj.msg.msgfrom,
                           fn.COUNT(dbj.msg.msgfrom).alias('cnt')).group_by(
                               dbj.msg.msgfrom).order_by(
                                   fn.COUNT(dbj.msg.msgfrom).desc())
    return template('tpl/authors.html', query=query)
Exemplo n.º 14
0
def bb_index():
    return template('tpl/index.html', u=get_u())
Exemplo n.º 15
0
def info_html():
    return template('data/info.html')
Exemplo n.º 16
0
def lite_list(authstr=None):
    if authstr:
        response.set_cookie('uhash', authstr, path='/', max_age=7776000)
    return template('tpl/litelist.html', elist=app_rq('echolist/public'))