Пример #1
0
def carbon_copy(carbon,uname):
    mo = [n for n in reversed(api.lst('carbon/%s' % carbon))]
    if carbon.startswith('_'):
        title = 'Сообщения от пользователя %s' % uname
    else:
        title = 'Сообщения для пользователя %s' % uname
    return template('echoarea.html',mo=mo,title=title,u=u(),desc='Карбонки',ea='',pge=0)
Пример #2
0
def index_list(echo, year):
    allstart()
    ea = '%s.%s' % (echo, year)
    if not flt.echo_flt(ea): return ea
    cfg = api.load_echo(True)
    local.r.update(page_title=ea, echolist=cfg[1:], ea=ea)
    return template('iitpl/echoarea.html', r=local.r, j=api.get_echoarea_f(ea))
Пример #3
0
def auth_user_bykey():
    ud = udata(request.forms.kvitok.encode('utf-8'))
    if request.forms.kvitok:
        if ud.check():
            response.set_cookie('kvitok', ud.kvitok, path='/', max_age=7776000)
            return template('''<html><head>
                    <meta http-equiv="refresh" content="3; {{redir}}" />
                    </head><body><p>Пользователь: <b>{{ud.uname}}</b></p>
                    <p>Адрес: <b>{{ud.uaddr}}</b></p>
                    <p>Авторизация принята. Осуществляется переход по адресу: <a href="{{redir}}">{{redir}}</a></p></body></html>''', 
                    ud=ud, redir=request.forms.redir.encode('utf-8').decode('base64') or '/')
        else:
            return template('{{ud.uname}}<br>{{ud.uaddr}}<br><br>Ключ не принят, сожалеем. Обратитесь к производителю.',ud=ud)
    else:
        response.set_cookie('kvitok', '', path='/', max_age=7776000)
        return template('<html><head><meta http-equiv="refresh" content="3; {{redir}}" /></head><body><p>Авторизация cнята. Осуществляется переход по адресу: <a href="{{redir}}">{{redir}}</a></p></body></html>', ud=ud, redir=request.forms.redir.encode('utf-8').decode('base64') or '/')
Пример #4
0
def js_page(pge):
    response.content_type = 'application/javascript; charset=utf-8'
    if pge == 'lenta.js':
        mo = [api.get_msg(n.split()[0]) for n in reversed(api.lst('m.accepted'))]
        if request.query.lim:
            mo = mo[:int(request.query.lim)]
    return template('js.tpl',mo=mo,rq=request.query)
Пример #5
0
def blog_list(ea=''):
    if not ea:
        ea = api.echolist()[0]
    blogs = api.lst('et/%s' % ea)
    comms = mydict({n:len(api.lst('topic/%s' % n))-6 for n in blogs})
    pge = request.query.page or '1'
    return template ('blog-list.html',ea=ea,blogs=blogs,comms=comms,pge=int(pge)-1)
Пример #6
0
def adm_in():
    if request.method == 'POST':
        response.set_cookie('admikey',
                            request.forms.admikey.encode('utf-8'),
                            path='/',
                            max_age=7776000)
        return template('<a href="/user/me?ea={{ea}}">admikey set</a>',
                        ea=request.forms.ea)
    else:
        if ak():
            return template(
                '<form method="post"><input type="hidden" name="ea" value="{{ea}}"><input type="submit" value="Снять полномочия администратора"> или <a href="/user/me?ea={{ea}}">нет</a></form>',
                ea=request.query.ea)
        else:
            return template(
                '<form method="post"><input type="hidden" name="ea" value="{{ea}}"><input type="text" name="admikey" placeholder="admikey"><input type="submit" value="Ok"> | <a href="/user/me?ea={{ea}}">Отмена</a></form>',
                ea=request.query.ea)
Пример #7
0
def carbon_area(di, un, ea=''):
    if di in ('from', 'to'):
        uh = hsh(un) if di == 'to' else '_' + hsh(un)
        comm = rss.lastcomm(ea, 20, uh)
        return template('reg/lastcomm.html',
                        uname=un,
                        comms=comm,
                        u=u(),
                        admikey=ak(),
                        ea=ea)
    elif di == 'news':
        topic = api.lst('et/%s' % ea) if ea else api.lst('topic.list')
        um = set(api.lst('carbon/_' + hsh(un)))
        return template('reg/lastnews.html',
                        uname=un,
                        news=[x for x in topic if x in um][-15:],
                        u=u(),
                        ea=ea)
Пример #8
0
def index_list(ea, repto):
    allstart()
    cfg = api.load_echo()
    local.r.NODE = cfg[0][1]
    if repto and repto != '-':
        local.r.repto = repto
        local.r.rmsg = api.get_msg(repto)
    if not flt.echo_flt(ea): return ea
    local.r.page_title = u'message to ' + ea
    return template('iitpl/mform.html', r=local.r, ea=ea)
Пример #9
0
def reply_form(ea, topicid, repto):
    if repto and repto != '-':
        prev = api.get_msg(repto)
    else:
        prev = mydict()
    return template('frmnews.html',
                    u=u(),
                    prev=prev,
                    typ='blog',
                    ea=ea,
                    topicid=topicid,
                    repto=repto)
Пример #10
0
def blog_tag(tag):
    blogs = api.lst('tags/%s' % hsh(tag))
    comms = mydict({n: len(api.lst('topic/%s' % n)) - 6 for n in blogs})
    msgs = mydict({n: api.get_msg(n) for n in blogs})
    return template('blog-list.html',
                    blogs=blogs,
                    msgs=msgs,
                    comms=comms,
                    tag=tag,
                    ea='',
                    pge=-1,
                    u=u())
Пример #11
0
def _msg(o, ml):
    allstart()
    if o == 'msg':
        mo = api.get_msg(ml) + {'msgid': ml}
        local.r.page_title = mo.subj + ' @ ' + mo.echoarea
        lst = [mo]
    elif o == 'lst':
        lst = [api.get_msg(n) + {'msgid': n} for n in ml.split('/')]
        local.r.page_title = u'Список сообщений'
    return template('iitpl/msg.html',
                    lst=[mo] if o != 'lst' else lst,
                    r=local.r)
Пример #12
0
def user_login():
    up = request.forms.upass1.strip().encode('utf-8')
    out = reg.mk_reg(request.forms)
    if up.startswith(':') and up.endswith(':'):
        ud = udata(up)
    else:
        if not out.startswith(':'):
            return out
        ud = udata(out)
    response.set_cookie('kvitok',
                        ud.kvitok.encode('utf-8'),
                        path='/',
                        max_age=7776000)
    return template('reg/user.html', u=ud, ea=request.forms.ea, admikey=ak())
Пример #13
0
def default_blog():
    print conf.f
    if conf.f:
        redirect('/blog/%s' % conf.EA)
    else:
        if request.method == 'POST':
            out = lenin.create_account(request.forms)
            if out:
                return out
            else:
                conf.reload_cfg()
                return u'<a href="/">блог создан</a>'
        else:
            return template('reg/wizard.tpl', conf=conf)
Пример #14
0
def admin_del():
    if request.forms.admikey:
        if ak():
            if request.forms.msgid:
                lenin.del_all(request.forms.msgid.encode('utf-8'))
                return '<a href="/">ok</a>'
    else:
        return template(
            '''<form method="post"><input type="hidden" name="admikey" value="{{admikey}}"><p><input type="checkbox" name="msgid" value="{{rq.msgid}}" checked="on"> удалить</p>
<!--                <p><input type="checkbox" name="delall" value="{{rq.addr}} {{rq.msgid}}"> удалить все сообщения пользователя {{rq.who}} ({{rq.addr}}</p>
                <p><input type="checkbox" name="ban" value="1"> ... и заблокировать написание им сообщений</p>
                <p><input type="checkbox" name="dl" value="1"> заблеклистить указанные сообщение (нужно только при обмене, чтобы не получить их снова)</p> -->
                <p><input type="submit" value="Ok"></p></form>''',
            rq=request.query,
            admikey=request.cookies.admikey)
Пример #15
0
def start_page():
    allstart()
    cfg = api.load_echo(True)
    if local.r.kuk.myel:
        myel = [e for e in local.r.kuk.myel.splitlines() if flt.echo_flt(e)]
    else:
        myel = []
    if not myel:
        myel = cfg[1:]
    else:
        myel = api.separate_myel(myel, cfg[1:])
        #print myel
    lst = [(e, api.get_echoarea_f(e)) for e, c, d in myel]
    local.r.page_title = u'ii : всё для хорошего общения'
    return template('iitpl/index.html', r=local.r, lst=lst)
Пример #16
0
def forum_list(ea=''):
    if not ea:
        ea = api.echolist()[0]
    pge = request.query.page or '1'
    return template('forum-list.html',out=api.forum_list(ea),ea=ea,u=u(),pge=int(pge)-1)
Пример #17
0
def topic_list(topicid):
    topic = api.lst('topic/%s' % topicid)
    msgs = mydict({n:api.get_msg(n) for n in topic[5:]})
    return template('forum-topic.html',topicid=topicid,topic=topic,msgs=msgs,u=u())
Пример #18
0
def last_comm(ea=''):
    return template('lcomm.html',
                    ea=ea,
                    comms=rss.lastcomm(ea, 30),
                    u=u(),
                    admikey=ak())
Пример #19
0
def user_info():
    return template('user.html',u=u())
Пример #20
0
def start_page():
    mo = [x.split()[0] for x in reversed(api.lst('m.accepted'))]
    return template('start.html',out=api.forums_list(),mo=mo,u=u())
Пример #21
0
def user_info():
    ud = u()
    if request.query.logout:
        response.set_cookie('kvitok', '', path='/', max_age=7776000)
        ud = udata('')
    return template('reg/user.html', u=ud, ea=request.query.ea, admikey=ak())
Пример #22
0
def lenta_list():
    mo = [n.split()[0] for n in reversed(api.lst('m.accepted'))]
    return template('echoarea.html',mo=mo,title='Лента сообщений',u=u(),ea='',desc='все сообщения всех эх',pge=0)
Пример #23
0
def msg_list(ml_):
    ml = ml_.strip('/').split('/')
    mo = [n.split()[0] for n in ml]
    return template('echoarea.html',mo=mo,desc='',u=u(),ea='',title='Сообщения' if len(ml) > 1 else ml[0],pge=-1)
Пример #24
0
def user_info():
    return template('reg/frmuadd.html', u=u(), ea=request.query.ea)
Пример #25
0
def echo_list(ea):
    mo = [n for n in reversed(api.lst('e/%s' % ea))]
    pge = request.query.page or '1'
    return template('echoarea.html',mo=mo,title=ea,ea=ea,u=u(),desc=api.echo_desc(ea),pge=int(pge)-1)
Пример #26
0
def blog_select():
    return template('select-blog.html',
                    u=u(),
                    ea='',
                    out=[(n, len(api.lst('e/%s' % n)), api.echo_desc(n)
                          or 'no desc') for n in api.echolist()])
Пример #27
0
def show_custom_page(page):
    allstart()
    return template('iitpl/%s.pge' % page, r=local.r)
Пример #28
0
def print_topic(topicid):
    topic = api.lst('topic/%s' % topicid)
    return template('print.html', jd=api.get_msg(topic[5]), u=u())
Пример #29
0
def blog_topic(topicid):
    topic = api.lst('topic/%s' % topicid)
    mo = [api.get_msg(n) for n in topic[5:]]
    return template ('blog-topic.html',mo=mo)
Пример #30
0
def gen_all(ea,num=30):
    comms = api.get_ea(ea)
    return template('rss/rss.tpl',msgs=msglst(comms,num),title=ea,link='%s/blog/%s' % (conf.URL,ea),desc='%s: %s' % (ea,api.echo_desc(ea)))