资源简介
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个文件信息
相关资源
- ThinkPHP5多小区物业管理系统源码系统
- element+thinkphp5+vue
- thinkphp5仿网易音乐的网
- ThinkPhp5.0电商源码前端,后端
- 微信公众平台开发:从零基础到Thin
- 微信公众平台开发:从零基础到Thin
- thinkphp5 + ajax 使用formdata提交数据包括
- ThinkPHP5.0 小程序商城构建全栈应用
- Thinkphp5.0 redirect 和 ajax 冲突的 解决方
- thinkPHP5.0 pdo_dblib扩展
- ThinkPHP5留言板
- thinkphp5开发app接口视频讲解
- 掌握ThinkPHP5.0数据库和模型-离线版官
- 淘宝客api在thinkphp5可以直接用
- thinkphp5漏洞验证
- Thinkphp5+Bootstrap响应式后台源码
- 钉钉开发服务器端API注册业务事件回
- ThinkPhp5从入门到精通项目实战开发a
- thinkphp5.1完美集成gatewayworker
- thinkphp5登陆密码修改demo
- 使用ThinkPHP5.1编写的论坛程序
- ThinkPHP5快速入门手册.pdf
- thinkphp5 后台家小程序整套商城源码
- WMS仓库管理系统thinkphp5.0开发
- ThinkPHP5快速入门手册PDF完全版
- thinkphp5完整版增删改查案例
- ThinkPHP5基础视频教程+商城项目实战
- thinkphp5.1后台管理系统
- thinkphp5+bootstrap整合支付宝和微信支付
- thinkphp5集成微信扫码支付VS支付宝扫码
评论
共有 条评论