Beispiel #1
0
def index_list(echo,year):
    allstart()
    ea = '%s.%s' % (echo,year)
    if not flt.echo_flt(ea): return ea
    elist = api.load_echo(True)
    local.r.update(page_title=ea,echolist=elist,ea=ea)
    return template('iitpl/echoarea.html',r=local.r,j=api.get_echoarea_f(ea))
Beispiel #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))
Beispiel #3
0
def msg_post(ea):
    allstart()
    fz = local.r.fz
    cfg = api.load_echo(False)
    ufor = request.forms.msgfrom.encode('utf-8')
    if not flt.echo_flt(ea): return ea
    if not fz.msg or not fz.subj: return 'empty msg or subj'
    uname, uaddr = points.check_hash(ufor)
    if uaddr:
        mo = sx.mydict()
        for _ in ('subj', 'msg', 'repto'):
            mo[_] = fz[_].decode('utf-8')
        mo['msgfrom'] = uname
        mo['msg'] = mo['msg'].replace('\r\n', '\n')
        mo['date'] = str(sx.gts())
        mo.update(addr='%s, %s' % (cfg[0][1], uaddr),
                  msgto=request.forms.msgto,
                  echoarea=ea)
        api.savemsg(mo)
    else:
        return 'no auth'
    if ufor != local.r.auth:
        response.set_cookie('auth', ufor, path='/', max_age=7776000)
        return (
            '<html><head><meta http-equiv="refresh" content="0; /%s" /></head><body></body></html>'
            % ea)
    else:
        redirect('/%s' % ea)
Beispiel #4
0
def msg_post(ea):
    allstart()
    fz = local.r.fz
    cfg = config(CONFIG)
    ufor = request.forms.msgfrom.encode('utf-8')
    if not flt.echo_flt(ea): return ea
    if not fz.msg or not fz.subj: return 'empty msg or subj'
    uname, uaddr = points.check_hash(ufor)
    if uaddr:
        mo = sx.mydict()
        for _ in ('subj', 'msg', 'repto'):
            mo[_] = fz[_].decode('utf-8')
        mo['msgfrom'] = uname
        mo['msg'] = mo['msg'].replace('\r\n', '\n')
        mo.update(addr='%s,%s' % (cfg['server']['address'], uaddr),
                  msgto=request.forms.msgto,
                  echoarea=ea)
        h = api.point_newmsg(mo)
        if not h: return 'bad message'
    else:
        return 'no auth'
    redir = fz.goback or '/%s' % ea
    if ufor != local.r.auth:
        response.set_cookie('auth', ufor, path='/', max_age=7776000)
        return (
            '<html><head><meta http-equiv="refresh" content="0; %s" /></head><body></body></html>'
            % redir)
    else:
        redirect(redir)
Beispiel #5
0
def index_list(ea,repto):
    allstart()
    cfg = config(CONFIG)
    local.r.NODE = cfg['server']['address']
    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)
Beispiel #6
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)
Beispiel #7
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)
Beispiel #8
0
def index_list(ea, repto):
    allstart()
    cfg = config(CONFIG)
    local.r.NODE = cfg['server']['address']
    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)
Beispiel #9
0
def gen_rss(ea,url,num):
    if not flt.echo_flt(ea): return ea
    msgs = [api.get_msg(n) + {'msgid': n} for n in reversed(api.get_echoarea_f(ea)[-num:])]
    items = [PyRSS2Gen.RSSItem(
        title=n.subj,description=sx.rend(n.msg),link='http://%s/%s#%s' % (url,ea,n.msgid),
        guid='http://%s/%s#%s' % (url,ea,n.msgid),
        pubDate=datetime.datetime.fromtimestamp(n.date)
    ) for n in msgs ]
    rssout = PyRSS2Gen.RSS2(title=ea,link='http://%s/%s' % (url,ea),description='Echoarea: %s' % ea,
    lastBuildDate=datetime.datetime.now(),items=items)
    return rssout.to_xml('utf-8')
Beispiel #10
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)
Beispiel #11
0
def msg_post(ea):
    allstart(); fz = local.r.fz
    cfg = config(CONFIG)
    ufor = request.forms.msgfrom.encode('utf-8')
    if not flt.echo_flt(ea): return ea
    if not fz.msg or not fz.subj: return 'empty msg or subj'
    uname, uaddr = points.check_hash(ufor)
    if uaddr:
        mo = sx.mydict()
        for _ in ('subj', 'msg', 'repto'):
            mo[_] = fz[_].decode('utf-8')
        mo['msgfrom'] = uname
        mo['msg']=mo['msg'].replace('\r\n','\n')
        mo.update(addr='%s,%s' % (cfg['server']['address'], uaddr),msgto=request.forms.msgto,echoarea=ea)
        h = api.point_newmsg(mo)
        if not h: return 'bad message'
    else:
        return 'no auth'
    redir = fz.goback or '/%s' % ea
    if ufor != local.r.auth:
        response.set_cookie('auth',ufor,path='/',max_age=7776000)
        return ('<html><head><meta http-equiv="refresh" content="0; %s" /></head><body></body></html>' % redir)
    else:
        redirect (redir)