• 大小: 11.3MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-06-26
  • 语言: PHP
  • 标签: thinkphp5  hui  

资源简介

tpadmin 是一个基于 ThinkPHP5.0 正式版和 Hui.admin v2.5 的管理后台,简化管理后台的开发流程,简化代码的编写,提高代码复用率,同时集成完整的权限管理和其他管理后台中常用的功能

资源截图

代码片段和文件信息

# -*- coding: utf-8 -*-
#
# jQuery File Upload Plugin GAE Python Example
# https://github.com/blueimp/jQuery-File-Upload
#
# Copyright 2011 Sebastian Tschan
# https://blueimp.net
#
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT
#

from google.appengine.api import memcache images
import json
import os
import re
import urllib
import webapp2

DEBUG=os.environ.get(‘SERVER_SOFTWARE‘ ‘‘).startswith(‘Dev‘)
WEBSITE = ‘https://blueimp.github.io/jQuery-File-Upload/‘
MIN_FILE_SIZE = 1  # bytes
# Max file size is memcache limit (1MB) minus key size minus overhead:
MAX_FILE_SIZE = 999000  # bytes
IMAGE_TYPES = re.compile(‘image/(gif|p?jpeg|(x-)?png)‘)
ACCEPT_FILE_TYPES = IMAGE_TYPES
THUMB_MAX_WIDTH = 80
THUMB_MAX_HEIGHT = 80
THUMB_SUFFIX = ‘.‘+str(THUMB_MAX_WIDTH)+‘x‘+str(THUMB_MAX_HEIGHT)+‘.png‘
EXPIRATION_TIME = 300  # seconds
# If set to None only allow redirects to the referer protocol+host.
# Set to a regexp for custom pattern matching against the redirect value:
REDIRECT_ALLOW_TARGET = None

class CORSHandler(webapp2.RequestHandler):
    def cors(self):
        headers = self.response.headers
        headers[‘Access-Control-Allow-Origin‘] = ‘*‘
        headers[‘Access-Control-Allow-Methods‘] =\
            ‘OPTIONS HEAD GET POST DELETE‘
        headers[‘Access-Control-Allow-Headers‘] =\
            ‘Content-Type Content-Range Content-Disposition‘

    def initialize(self request response):
        super(CORSHandler self).initialize(request response)
        self.cors()

    def json_stringify(self obj):
        return json.dumps(obj separators=(‘‘ ‘:‘))

    def options(self *args **kwargs):
        pass

class UploadHandler(CORSHandler):
    def validate(self file):
        if file[‘size‘] < MIN_FILE_SIZE:
            file[‘error‘] = ‘File is too small‘
        elif file[‘size‘] > MAX_FILE_SIZE:
            file[‘error‘] = ‘File is too big‘
        elif not ACCEPT_FILE_TYPES.match(file[‘type‘]):
            file[‘error‘] = ‘Filetype not allowed‘
        else:
            return True
        return False

    def validate_redirect(self redirect):
        if redirect:
            if REDIRECT_ALLOW_TARGET:
                return REDIRECT_ALLOW_TARGET.match(redirect)
            referer = self.request.headers[‘referer‘]
            if referer:
                from urlparse import urlparse
                parts = urlparse(referer)
                redirect_allow_target = ‘^‘ + re.escape(
                    parts.scheme + ‘://‘ + parts.netloc + ‘/‘
                )
            return re.match(redirect_allow_target redirect)
        return False

    def get_file_size(self file):
        file.seek(0 2)  # Seek to the end of the file
        size = file.tell()  # Get the position of EOF
        file.seek(0)  # Reset the file position to the beginning
        return size

    def write_blob(self data info):
        key = urllib.quote(info[‘type‘].encode(‘utf-8‘) ‘‘) +\
            ‘/‘ + str(hash(data)) +\

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-03-08 07:13  tpAdmin-master\
     文件          84  2017-03-08 07:13  tpAdmin-master\.gitattributes
     文件           5  2017-03-08 07:13  tpAdmin-master\.gitignore
     文件       11357  2017-03-08 07:13  tpAdmin-master\LICENSE
     文件        2660  2017-03-08 07:13  tpAdmin-master\README.md
     目录           0  2017-03-08 07:13  tpAdmin-master\application\
     文件           0  2017-03-08 07:13  tpAdmin-master\application\.gitignore
     文件          13  2017-03-08 07:13  tpAdmin-master\application\.htaccess
     目录           0  2017-03-08 07:13  tpAdmin-master\application\admin\
     文件           0  2017-03-08 07:13  tpAdmin-master\application\admin\.gitignore
     文件       13303  2017-03-08 07:13  tpAdmin-master\application\admin\Controller.php
     文件       13777  2017-03-08 07:13  tpAdmin-master\application\admin\common.php
     文件        1225  2017-03-08 07:13  tpAdmin-master\application\admin\config.php
     目录           0  2017-03-08 07:13  tpAdmin-master\application\admin\controller\
     文件           9  2017-03-08 07:13  tpAdmin-master\application\admin\controller\.gitignore
     文件        1406  2017-03-08 07:13  tpAdmin-master\application\admin\controller\AdminGroup.php
     文件       10487  2017-03-08 07:13  tpAdmin-master\application\admin\controller\AdminNode.php
     文件         997  2017-03-08 07:13  tpAdmin-master\application\admin\controller\AdminNodeLoad.php
     文件        3457  2017-03-08 07:13  tpAdmin-master\application\admin\controller\AdminRole.php
     文件        2570  2017-03-08 07:13  tpAdmin-master\application\admin\controller\AdminUser.php
     文件        4641  2017-03-08 07:13  tpAdmin-master\application\admin\controller\Demo.php
     文件        2411  2017-03-08 07:13  tpAdmin-master\application\admin\controller\Generate.php
     文件        2636  2017-03-08 07:13  tpAdmin-master\application\admin\controller\Index.php
     文件        1693  2017-03-08 07:13  tpAdmin-master\application\admin\controller\LoginLog.php
     文件        1390  2017-03-08 07:13  tpAdmin-master\application\admin\controller\NodeMap.php
     文件        6733  2017-03-08 07:13  tpAdmin-master\application\admin\controller\Pub.php
     文件        8049  2017-03-08 07:13  tpAdmin-master\application\admin\controller\Ueditor.php
     文件        2057  2017-03-08 07:13  tpAdmin-master\application\admin\controller\Upload.php
     文件        5294  2017-03-08 07:13  tpAdmin-master\application\admin\controller\WebLog.php
     目录           0  2017-03-08 07:13  tpAdmin-master\application\admin\controller\one\
     目录           0  2017-03-08 07:13  tpAdmin-master\application\admin\controller\one\two\
............此处省略3179个文件信息

评论

共有 条评论