Пример #1
0
def publicObject(toObject, defs, action=None, get=None):
    if 'request_token' in session and 'login' in session:
        request_token = request.cookies.get('request_token')
        if session['request_token'] != request_token:
            if session['login'] != False:
                session['login'] = False
                cache.set('dologin', True)
                return redirect('/login')

    if not get: get = get_input()
    if action: get.action = action

    if hasattr(get, 'path'):
        get.path = get.path.replace('//', '/').replace('\\', '/')
        if get.path.find('->') != -1:
            get.path = get.path.split('->')[0].strip()
    not_acts = [
        'GetTaskSpeed', 'GetNetWork', 'check_pay_status',
        'get_re_order_status', 'get_order_stat'
    ]
    for key in defs:
        if key == get.action:
            fun = 'toObject.' + key + '(get)'
            if not key in not_acts: public.write_request_log()
            if hasattr(get, 'html') or hasattr(get, 's_module'):
                return eval(fun)
            else:
                return public.GetJson(eval(fun)), json_header

    return public.ReturnJson(False, 'ARGS_ERR'), json_header
Пример #2
0
def publicObject(toObject,defs,action=None,get = None):
    if 'request_token' in session and 'login' in session:
        if not check_csrf(): return public.ReturnJson(False,'Csrf-Token error.'),json_header

    if not get: get = get_input()
    if action: get.action = action

    if hasattr(get,'path'):
            get.path = get.path.replace('//','/').replace('\\','/');
            if get.path.find('..') != -1: return public.ReturnJson(False,public.GetMsg("UNSAFE_PATH")),json_header
            if get.path.find('->') != -1:
                get.path = get.path.split('->')[0].strip();
    not_acts = ['GetTaskSpeed','GetNetWork','check_pay_status','get_re_order_status','get_order_stat']
    for key in defs:
        if key == get.action:
            fun = 'toObject.'+key+'(get)'
            if not key in not_acts: public.write_request_log()
            if hasattr(get,'html') or hasattr(get,'s_module'):
                return eval(fun)
            else:
                return public.GetJson(eval(fun)),json_header

    return public.ReturnJson(False,'ARGS_ERR'),json_header
Пример #3
0
def request_end(reques = None):
    not_acts = ['GetTaskSpeed','GetNetWork','check_pay_status','get_re_order_status','get_order_stat']
    key = request.args.get('action')
    if not key in not_acts and request.full_path.find('/static/') == -1: public.write_request_log()