Example #1
0
def signup():
    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['page'] = 1

    return template('dashboard/signup', data=config.kargs)
Example #2
0
def search(place):
  config.reset(settingdb.select())
  query = request.forms.getunicode('fquery')
  config.kargs['posts'] = postdb.search(query)
  config.kargs['thumbs'] = lib.getPostThumbs(config.kargs['posts'])
  config.kargs['blogTitle'] = "ទំព័រ​ស្វែង​រក"

  if place == "backend":
    return template('dashboard/search', data=config.kargs)
  else:
    return template('search', data=config.kargs)
Example #3
0
def category(name):
  config.reset(settingdb.select())
  config.kargs['blogTitle'] = "ទំព័រ​ជំពូក"
  config.kargs['category'] = name
  config.kargs['posts'] = postdb.select(config.kargs['categoryPostLimit'], category=name)
  config.kargs['thumbs'] = lib.getPostThumbs(config.kargs['posts'])
  config.kargs['page'] = 1
  author = request.get_cookie("logged-in", secret=config.kargs['secretKey'])
  if author:
    config.kargs['showEdit'] = True

  return template('categories', data=config.kargs)
Example #4
0
def post(name):
    config.reset(settingdb.select())
    config.kargs['blogTitle'] = "ទំព័រសមាជិក"
    config.kargs['post'] = userdb.select(1, author=name)
    config.kargs['posts'] = userdb.select(config.kargs['authorPagePostLimit'])
    config.kargs['thumbs'] = lib.getPostThumbs(config.kargs['posts'], "user")
    config.kargs['page'] = 1
    author = request.get_cookie("logged-in", secret=config.kargs['secretKey'])
    if author:
        config.kargs['showEdit'] = True

    return template('user', data=config.kargs)
Example #5
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')
Example #6
0
def post(id):
    config.reset(settingdb.select())
    config.kargs['blogTitle'] = "ទំព័រ​ស្តាទិក"
    config.kargs['post'] = pagedb.select(1, id)
    config.kargs['posts'] = pagedb.select(config.kargs['frontPagePostLimit'])
    config.kargs['thumbs'] = lib.getPostThumbs(config.kargs['posts'])
    config.kargs['page'] = 1
    author = request.get_cookie("logged-in", secret=config.kargs['secretKey'])
    if author:
        config.kargs['showEdit'] = True

    return template('page', data=config.kargs)
Example #7
0
def post():
  config.reset(settingdb.select())
  config.kargs['blogTitle'] = "ទំព័រ​ជំពូក"
  config.kargs['posts'] = categorydb.select(config.kargs['dashboardPostLimit'])
  config.kargs['thumbs'] = lib.getPostThumbs(config.kargs['posts'])
  config.kargs['datetime'] = getTimeZone()
  config.kargs['page'] = 1
  author = request.get_cookie("logged-in", secret=config.kargs['secretKey'])
  if author:
    config.kargs['author'] = author
    config.kargs['showEdit'] = True

  return template('dashboard/category', data=config.kargs)
Example #8
0
def edit(id):
  author = request.get_cookie("logged-in", secret=config.kargs['secretKey'])
  if ((author != "Guest") and categorydb.check(author)):
    config.reset(settingdb.select())
    config.kargs['blogTitle'] = "ទំព័រ​កែ​តំរូវ"
    config.kargs['posts'] = categorydb.select(config.kargs['dashboardPostLimit'])
    config.kargs['thumbs'] = lib.getPostThumbs(config.kargs['posts'])
    config.kargs['post'] = categorydb.select(1, id)
    config.kargs['edit'] = True
    config.kargs['postId'] = id
    config.kargs['page'] = 1
    return template('dashboard/category', data=config.kargs)
  
  redirect('/category')
Example #9
0
def login():
    user = userdb.createTable()
    username = request.get_cookie("logged-in",
                                  secret=config.kargs['secretKey'])
    if not user:
        return template('dashboard/signup', data=config.kargs)
    elif username:
        config.reset(settingdb.select())
        config.kargs['author'] = username
        config.kargs['blogTitle'] = "ទំព័រ​គ្រប់គ្រង"
        config.kargs['datetime'] = getTimeZone()
        config.kargs['posts'] = postdb.select(
            config.kargs['dashboardPostLimit'])
        config.kargs['categories'] = categorydb.select(amount="all")
        config.kargs['thumbs'] = lib.getPostThumbs(config.kargs['posts'])
        config.kargs['page'] = 1
        return template('dashboard/home', data=config.kargs)
    else:
        return template('login', data=config.kargs)
Example #10
0
def main():
  config.reset(settingdb.select())
  config.kargs['posts'] = postdb.select(config.kargs['homePagePostLimit'])
  config.kargs['thumbs'] = lib.getPostThumbs(config.kargs['posts'])
  config.kargs['page'] = 1
  return template('home', data=config.kargs)
Example #11
0
#config.py
from models import settingdb

setting = settingdb.createTable()

kargs = {}
kargs['message'] = ''
kargs['page'] = 1

def reset(setting):
  kargs['blogTitle'] = setting[0]
  kargs['secretKey'] = setting[1]
  kargs['dashboardPostLimit'] = setting[2]
  kargs['frontPagePostLimit'] = setting[3]
  kargs['homePagePostLimit'] = setting[4]
  kargs['authorPagePostLimit'] = setting[5]
  kargs['categoryPostLimit'] = setting[6]

if not setting:
  settingdb.insert('គេហទំព័រ​ខ្មែរអង្គរ', 'h4!#au%8tb_9@oe+c0te=g=u%cfxb8t8fy%7+(gx2+51!t*b+s', 5, 8, 12, 16, 20)
  setting = settingdb.select()
  
reset(setting)