Exemplo n.º 1
0
def signupPost():
    author = request.get_cookie("logged-in", secret=config.kargs['secretKey'])
    config.kargs['author'] = author
    user = userdb.createTable()

    username = request.forms.getunicode('fusername')
    password = request.forms.getunicode('fpassword')
    rights = request.forms.getunicode('frights')
    email = request.forms.getunicode('femail')
    profile = request.forms.getunicode('fprofile')
    gender = request.forms.getunicode('fgender')

    if not user:
        userdb.insert(str(uuid.uuid4().int), username, password, "Admin",
                      email, profile, gender)
    else:
        if ((author != "Guest") and userdb.checkAdmin(author)):
            if 'postId' in config.kargs:
                id = config.kargs['postId']
                userdb.update(username, password, rights, email, profile,
                              gender, id)
                del config.kargs['postId']
            else:
                id = str(uuid.uuid4().int)
                userdb.insert(id, username, password, rights, email, profile,
                              gender)

            redirect('/user/' + str(id))

    redirect('/login')
Exemplo n.º 2
0
def edit():
    author = request.get_cookie("logged-in", secret=config.kargs['secretKey'])
    if ((author != "Guest") and userdb.checkAdmin(author)):
        config.kargs['blogTitle'] = "ទំព័រ​កែ​តំរូវ"
        config.kargs['posts'] = postdb.select(
            config.kargs['dashboardPostLimit'])
        config.kargs['thumbs'] = lib.getPostThumbs(config.kargs['posts'])
        config.kargs['post'] = settingdb.select()
        config.kargs['page'] = 1
        return template('dashboard/setting', data=config.kargs)

    redirect('/login')
Exemplo n.º 3
0
def posting():
    author = request.get_cookie("logged-in", secret=config.kargs['secretKey'])
    if ((author != "Guest") and userdb.checkAdmin(author)):
        blogTitle = request.forms.getunicode('fblog-title')
        secretKey = request.forms.getunicode('fsecret-key')
        dpostLimit = request.forms.getunicode('fdpost-limit')
        fpostLimit = request.forms.getunicode('ffpost-limit')
        hpostLimit = request.forms.getunicode('fhpost-limit')
        apostLimit = request.forms.getunicode('fapost-limit')
        blogDescription = request.forms.getunicode('fblog-description')

        settingdb.update(blogTitle, secretKey, dpostLimit, fpostLimit,
                         hpostLimit, apostLimit, blogDescription)

    redirect('/login')
Exemplo n.º 4
0
def edit(id):
    author = request.get_cookie("logged-in", secret=config.kargs['secretKey'])
    if ((author != "Guest") and userdb.checkAdmin(author)):
        config.reset(settingdb.select())
        config.kargs['blogTitle'] = "ទំព័រ​កែ​តំរូវ"
        config.kargs['posts'] = userdb.select(
            config.kargs['dashboardPostLimit'])
        config.kargs['thumbs'] = lib.getPostThumbs(config.kargs['posts'],
                                                   type="user")
        config.kargs['post'] = userdb.select(1, id)
        config.kargs['edit'] = True
        config.kargs['postId'] = id
        config.kargs['page'] = 1
        return template('dashboard/signup', data=config.kargs)

    redirect('/signup')
Exemplo n.º 5
0
def delete(id):
    author = request.get_cookie("logged-in", secret=config.kargs['secretKey'])
    if ((author != "Guest") and userdb.checkAdmin(author)):
        userdb.delete(id)

    redirect('/signup')