├── data └── file │ └── readme.md ├── app ├── log │ └── readme.md ├── view │ ├── mail_template │ │ └── register.html │ ├── home │ │ ├── 404.php │ │ ├── server_error.php │ │ ├── share_error.php │ │ └── index.php │ ├── share │ │ ├── picture-text.php │ │ ├── url.php │ │ ├── text.php │ │ ├── multi-text.php │ │ ├── file.php │ │ ├── picture.php │ │ ├── code.php │ │ └── markdown.php │ ├── common │ │ ├── footer.php │ │ ├── my_footer.php │ │ ├── header.php │ │ └── my_header.php │ ├── member │ │ ├── list.php │ │ └── home.php │ ├── profile │ │ ├── access_token.php │ │ ├── edit_name.php │ │ ├── edit_password.php │ │ └── edit_avatar.php │ ├── my │ │ ├── login.php │ │ ├── password_reset.php │ │ ├── login_form.php │ │ ├── password_reset_input.php │ │ └── register.php │ └── add │ │ ├── text.php │ │ ├── multi-text.php │ │ ├── url.php │ │ ├── code.php │ │ ├── markdown.php │ │ ├── file.php │ │ └── picture.php ├── page.error │ └── Home.php ├── page │ └── Api │ │ ├── Tool.php │ │ └── Member.php ├── lib │ ├── Hook.php │ ├── Share │ │ ├── ShareText.php │ │ ├── ShareMarkdown.php │ │ ├── ShareUrl.php │ │ ├── SharePicture.php │ │ ├── ShareParse.php │ │ ├── SharePictureText.php │ │ ├── ShareFile.php │ │ └── ShareMultiText.php │ ├── Markdown │ │ └── LICENSE.txt │ ├── Member │ │ ├── DaoGoogle.php │ │ ├── DaoShare.php │ │ └── Dao.php │ ├── ShareBaseInfo.php │ ├── ShareList.php │ ├── Page.php │ └── MailTemplate.php ├── page.my │ ├── MyList.php │ ├── Profile.php │ ├── OAuth2.php │ └── Home.php └── helper │ └── ref_class.php ├── LICENSE.md ├── web ├── favicon.ico ├── asset │ ├── style │ │ ├── images │ │ │ ├── logo.png │ │ │ └── sign-in-with-google.png │ │ └── main.js │ ├── bootstrap │ │ └── 3.3.1 │ │ │ ├── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ └── glyphicons-halflings-regular.woff │ │ │ └── js │ │ │ └── npm.js │ └── plugins │ │ ├── syntaxhighlighter │ │ ├── scripts │ │ │ ├── shBrushPlain.js │ │ │ ├── shBrushDiff.js │ │ │ ├── shAutoloader.js │ │ │ ├── shBrushJScript.js │ │ │ ├── shLegacy.js │ │ │ ├── shBrushErlang.js │ │ │ ├── shBrushScala.js │ │ │ ├── shBrushXml.js │ │ │ ├── shBrushJava.js │ │ │ ├── shBrushRuby.js │ │ │ ├── shBrushJavaFX.js │ │ │ ├── shBrushVb.js │ │ │ ├── shBrushDelphi.js │ │ │ ├── shBrushAS3.js │ │ │ ├── shBrushPython.js │ │ │ ├── shBrushCSharp.js │ │ │ ├── shBrushBash.js │ │ │ ├── shBrushGroovy.js │ │ │ ├── shBrushSql.js │ │ │ ├── shBrushPerl.js │ │ │ ├── shBrushPowerShell.js │ │ │ ├── shBrushPhp.js │ │ │ └── shBrushCpp.js │ │ ├── src │ │ │ ├── shAutoloader.js │ │ │ └── shLegacy.js │ │ └── styles │ │ │ ├── shThemeMDUltra.css │ │ │ ├── shThemeEmacs.css │ │ │ ├── shThemeRDark.css │ │ │ ├── shThemeMidnight.css │ │ │ ├── shThemeDefault.css │ │ │ ├── shThemeFadeToGrey.css │ │ │ ├── shThemeDjango.css │ │ │ └── shThemeEclipse.css │ │ └── markdown │ │ └── bootstrap-markdown.min.css ├── .htaccess └── index.php ├── .gitmodules ├── nginx.conf ├── .gitignore ├── README.md ├── config ├── oauth2-simple.php └── all-simple.php └── sys └── config.php /data/file/readme.md: -------------------------------------------------------------------------------- 1 | 上传的文件存放在此目录 -------------------------------------------------------------------------------- /app/log/readme.md: -------------------------------------------------------------------------------- 1 | ### 日志记录文件夹,以日期归档 -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | 代码仅供个人任意参考和使用 2 | 3 | 完整程序不允许公开在互联网发布,且不允许用于商业用途 -------------------------------------------------------------------------------- /web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loveyu/ShadowShare/master/web/favicon.ico -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "sys/core"] 2 | path = sys/core 3 | url = git@github.com:loveyu/php-framework-module.git 4 | -------------------------------------------------------------------------------- /web/asset/style/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loveyu/ShadowShare/master/web/asset/style/images/logo.png -------------------------------------------------------------------------------- /nginx.conf: -------------------------------------------------------------------------------- 1 | location / { 2 | if (!-f $request_filename){ 3 | rewrite (.*) /index.php; 4 | } 5 | } 6 | error_page 404 /index.php; 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # 移除部分系统目录 2 | .git/* 3 | .idea/* 4 | app/cache/ 5 | app/log/*.log 6 | test/ 7 | data/file/*/ 8 | config/oauth2.php 9 | config/all.php -------------------------------------------------------------------------------- /web/asset/style/images/sign-in-with-google.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loveyu/ShadowShare/master/web/asset/style/images/sign-in-with-google.png -------------------------------------------------------------------------------- /web/.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | RewriteBase / 3 | 4 | #不存在的文件直接重定向 5 | RewriteCond %{REQUEST_FILENAME} !-f 6 | RewriteRule ^(.*)$ /index.php [L] 7 | 8 | -------------------------------------------------------------------------------- /web/asset/bootstrap/3.3.1/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loveyu/ShadowShare/master/web/asset/bootstrap/3.3.1/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /web/asset/bootstrap/3.3.1/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loveyu/ShadowShare/master/web/asset/bootstrap/3.3.1/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /web/asset/bootstrap/3.3.1/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loveyu/ShadowShare/master/web/asset/bootstrap/3.3.1/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 阅后即隐 2 | 一个简单多功能一次性分享网站 3 | 4 | 完整网站:[https://shadow.loveyu.info](https://shadow.loveyu.info) 5 | 6 | 自定义域名配置:调整sys/config.php 中的域名定义即可 7 | 8 | 信息反馈:[https://www.loveyu.org/4107.html](https://www.loveyu.org/4107.html) -------------------------------------------------------------------------------- /app/view/mail_template/register.html: -------------------------------------------------------------------------------- 1 | {site_title} 用户注册验证码 2 | 3 |
4 |

你的验证码为 : {code}

5 | 6 |

如有疑问,访问:{site_title}

7 |
-------------------------------------------------------------------------------- /app/view/home/404.php: -------------------------------------------------------------------------------- 1 | get_header(); 6 | ?> 7 |

未找到,啥都没有哦,回首页

8 | get_footer(); -------------------------------------------------------------------------------- /app/view/home/server_error.php: -------------------------------------------------------------------------------- 1 | get_header("服务器错误"); ?> 8 |
9 |

10 |
11 | get_footer(); -------------------------------------------------------------------------------- /app/view/home/share_error.php: -------------------------------------------------------------------------------- 1 | get_header("分享获取失败"); ?> 8 |
9 |

10 |
11 | get_footer(); -------------------------------------------------------------------------------- /app/view/share/picture-text.php: -------------------------------------------------------------------------------- 1 | get_header("图文分享"); 7 | ?> 8 |
9 |

图文分享:

10 | getHtml() ?> 11 |
12 | get_footer(); -------------------------------------------------------------------------------- /app/view/share/url.php: -------------------------------------------------------------------------------- 1 | get_header("网址分享"); 7 | ?> 8 |
9 |

网址分享:

10 |

getUrl()?>

11 |
12 | get_footer(); -------------------------------------------------------------------------------- /app/view/share/text.php: -------------------------------------------------------------------------------- 1 | get_header("文本分享"); 7 | ?> 8 |
9 |

文本分享:

10 | 11 |

", htmlspecialchars($__share->getPrimaryData())) ?>

12 |
13 | get_footer(); -------------------------------------------------------------------------------- /app/page.error/Home.php: -------------------------------------------------------------------------------- 1 | __view("home/404.php"); 21 | } 22 | } -------------------------------------------------------------------------------- /web/index.php: -------------------------------------------------------------------------------- 1 | getTimer()->setBeginTime($time); //修正启动时间 5 | unset($time); //删除时间变量 6 | 7 | cfg()->load('../config/all.php'); //加载其他配置文件 8 | lib()->load('Hook')->add('Hook', new \ULib\Hook())->add(); //加载自定义类 9 | u()->home(array( 10 | 'Home', 11 | 'main' 12 | ), array( 13 | 'Home', 14 | 'not_found' 15 | )); //开始加载默认页面 -------------------------------------------------------------------------------- /app/view/common/footer.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/view/common/my_footer.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/view/share/multi-text.php: -------------------------------------------------------------------------------- 1 | get_header("动态文本分享"); 7 | ?> 8 |
9 |

文本分享:

10 | 11 |

", htmlspecialchars($__share->getPrimaryData())) ?>

12 |
13 |

当前IP : getNowIp()?>

14 | get_footer(); -------------------------------------------------------------------------------- /app/view/share/file.php: -------------------------------------------------------------------------------- 1 | get_header("文件分享"); 7 | ?> 8 |
9 |

文件分享:

10 |

文件名:getFileName()?>

11 |

文件大小:getFileReadSize()?>

12 |

下载地址:getUname())?>?m=bin

13 |
14 | get_footer(); -------------------------------------------------------------------------------- /web/asset/bootstrap/3.3.1/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /app/view/share/picture.php: -------------------------------------------------------------------------------- 1 | get_header("图片分享"); 7 | ?> 8 |
9 |

图片分享:

10 |

名称:getFileName()?>

11 |

大小:getFileReadSize()?>

12 |

分辨率:getWidth()?>xgetHeight()?>

13 |
14 | 15 |
16 |
17 | get_footer(); -------------------------------------------------------------------------------- /app/view/home/index.php: -------------------------------------------------------------------------------- 1 | get_header(); 6 | ?> 7 |
8 | '网址', 11 | 'text' => '文本', 12 | 'file' => '文件', 13 | 'code' => '代码', 14 | 'markdown' => 'Markdown', 15 | 'picture' => '图片', 16 | 'picture-text' => '图文', 17 | 'multi-text' => '多行文本' 18 | ] as $name => $value): 19 | ?> 20 |
21 | 22 |
23 | 26 |
27 | get_footer(); -------------------------------------------------------------------------------- /app/view/share/code.php: -------------------------------------------------------------------------------- 1 | get_header([ 7 | 'title' => '代码分享', 8 | 'js' => [ 9 | 'plugins/syntaxhighlighter/scripts/shCore.js', 10 | 'plugins/syntaxhighlighter/scripts/shBrush'.$__share->getLangValue($__share->getLang()).'.js' 11 | ], 12 | 'css' => 'plugins/syntaxhighlighter/styles/shCoreDefault.css' 13 | ]); 14 | ?> 15 |
16 |

代码分享:

17 |
getPrimaryData()) ?>
18 | 19 |
20 | get_footer(); -------------------------------------------------------------------------------- /app/page/Api/Tool.php: -------------------------------------------------------------------------------- 1 | __req->post('data'); 22 | if($data === NULL){ 23 | $this->_set_status(false, 4001, "数据提交异常"); 24 | return; 25 | } 26 | $this->__lib->load('Markdown/Parsedown', 'Xss/XssHtml'); 27 | $parse = new Parsedown(); 28 | $xss = new XssHtml($parse->text($data)); 29 | $this->_set_status(true, 0); 30 | $this->_set_data($xss->getHtml()); 31 | } 32 | } -------------------------------------------------------------------------------- /config/oauth2-simple.php: -------------------------------------------------------------------------------- 1 | [ 9 | 'google' => [ 10 | "auth_uri" => "https://accounts.google.com/o/oauth2/auth", 11 | "client_secret" => "xx xx xx xx xx", 12 | "token_uri" => "https://accounts.google.com/o/oauth2/token", 13 | "client_email" => "xx xx xx xx xx@developer.gserviceaccount.com", 14 | "redirect_uris" => ["xx xx xx xx xx"], 15 | "client_x509_cert_url" => "https://www.googleapis.com/robot/v1/metadata/x509/xx xx xx xx xx@developer.gserviceaccount.com", 16 | "client_id" => "xx xx xx xx xx.apps.googleusercontent.com", 17 | "auth_provider_x509_cert_url" => "https://www.googleapis.com/oauth2/v1/certs", 18 | "javascript_origins" => ["xx xx xx xx xx"] 19 | ] 20 | ] 21 | ]; -------------------------------------------------------------------------------- /web/asset/style/main.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by loveyu on 2015/3/14. 3 | */ 4 | var MainObj = { 5 | loginStatus: function ($) { 6 | $.ajax({ 7 | url: URL_MAP.api + "Member/loginInfo", 8 | dataType: "json", 9 | xhrFields: { 10 | withCredentials: true 11 | }, 12 | success: function (result) { 13 | if (result.status) { 14 | //已登陆 15 | $("#Header .login_status").html("\"avatar\" " + result.data.name + "" + " | " + 17 | "退出"); 18 | } else { 19 | //未登陆 20 | } 21 | } 22 | }); 23 | } 24 | }; 25 | jQuery(function ($) { 26 | if (typeof IS_LOGIN == "undefined" || !IS_LOGIN)MainObj.loginStatus($); 27 | }); -------------------------------------------------------------------------------- /app/view/member/list.php: -------------------------------------------------------------------------------- 1 | get_header("我的 {$__name} 分享"); 11 | ?> 12 |

我的分享

13 | 26 | get_footer(); -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushPlain.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | }; 25 | 26 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 27 | Brush.aliases = ['text', 'plain']; 28 | 29 | SyntaxHighlighter.brushes.Plain = Brush; 30 | 31 | // CommonJS 32 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 33 | })(); 34 | -------------------------------------------------------------------------------- /app/lib/Hook.php: -------------------------------------------------------------------------------- 1 | hook = hook(); 18 | } 19 | 20 | public function add(){ 21 | $this->router(); 22 | l_h('system.php', 'ref_class.php'); 23 | lib()->load('Page', 'RestApi'); 24 | } 25 | 26 | private function router(){ 27 | c_lib()->load('router'); 28 | $router = new Router(); 29 | $this->hook->add('UriInfo_process', [ 30 | $router, 31 | 'result' 32 | ]); 33 | switch($_SERVER['HTTP_HOST']){ 34 | case _HOST_ROOT_: 35 | $router->add_preg("|^([0-9A-Za-z]{4,})$|", 'Home/share/[1]'); 36 | $router->add_preg("|^add/([a-z-]{3,})$|", 'Home/add/[1]'); 37 | break; 38 | case _HOST_MY_: 39 | $router->add_preg("|^list/([a-z-]{3,})$|", 'MyList/select/[1]'); 40 | break; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /app/view/profile/access_token.php: -------------------------------------------------------------------------------- 1 | get_header("我的授权访问参数"); 10 | ?> 11 |

我的授权访问参数

12 | 13 |
14 |
15 |
16 |
Access Token
17 | 18 |
19 |
20 |
21 |
22 |
创建时间
23 | "> 24 |
25 |
26 |
27 | 28 | 29 |
30 |
31 | get_footer(); -------------------------------------------------------------------------------- /app/view/profile/edit_name.php: -------------------------------------------------------------------------------- 1 | get_header("修改名称"); 11 | ?> 12 |

修改用户昵称

13 |
14 | 15 |

成功更新

16 | 17 |

18 | 19 |
20 | 21 | 22 |
23 |
名称
24 | 25 |
26 | 27 |
28 |
29 | 30 |
31 |
32 | get_footer(); -------------------------------------------------------------------------------- /app/view/share/markdown.php: -------------------------------------------------------------------------------- 1 | get_header("Markdown分享"); 7 | ?> 8 |
9 |

Markdown分享:

10 | 11 |
12 | 13 | 14 | 18 | 19 | 20 |
21 |
22 |
getPrimaryData()) ?>
23 |
24 |
getHtml() ?>
25 |
26 |
27 |
28 | get_footer(); -------------------------------------------------------------------------------- /app/view/my/login.php: -------------------------------------------------------------------------------- 1 | get_header('用户登录'); 9 | ?> 10 |
11 | 12 |

用户登录

13 | 14 |
15 |

16 | 17 | " alt="sign-in-with-google"/> 18 | 19 |

20 | 21 |

22 | 没有谷歌账号或无法登录? 23 | 24 | 25 | 27 | 28 | 29 |

30 | 31 |
32 |
33 | 34 | get_footer(); -------------------------------------------------------------------------------- /app/lib/Share/ShareText.php: -------------------------------------------------------------------------------- 1 | share_type = self::TYPE_TEXT; 22 | parent::__construct(); 23 | } 24 | 25 | /** 26 | * 设置对应要分享的内容 27 | * @param mixed $data 28 | * @return bool 设置的状态 29 | */ 30 | public function setData($data){ 31 | return class_db()->d_share_text_insert($this->base_data['s_id'], $data); 32 | } 33 | 34 | /** 35 | * 初始化拓展基本信息 36 | * @throws \Exception 37 | * @return void 38 | */ 39 | public function initExtData(){ 40 | $ex_data = class_db()->d_share_text_get($this->base_data['s_id']); 41 | if(!isset($ex_data['s_id'])){ 42 | throw new \Exception("数据获取异常"); 43 | } 44 | $this->text = $ex_data['st_text']; 45 | } 46 | 47 | /** 48 | * 返回主要的信息 49 | * @return mixed 50 | */ 51 | public function getPrimaryData(){ 52 | return $this->text; 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /app/view/add/text.php: -------------------------------------------------------------------------------- 1 | get_header("分享一段文本"); 6 | ?> 7 |
8 |

写下你想要分享的内容

9 | 10 |
11 |
12 | 13 | 14 |
15 | 16 |
17 | 18 | 19 | 32 |
33 | get_footer(); -------------------------------------------------------------------------------- /app/view/my/password_reset.php: -------------------------------------------------------------------------------- 1 | get_header("密码重置"); 10 | ?> 11 |

密码重置

12 |
13 |
14 |
15 | 16 |

17 | 18 |
19 | 20 | 21 |
22 |
23 | 24 |
25 |
26 | 27 |
28 | 29 |
30 |
31 | 32 |
33 |
34 | get_footer(); -------------------------------------------------------------------------------- /app/page.my/MyList.php: -------------------------------------------------------------------------------- 1 | header_view_file = "common/my_header.php"; 19 | $this->footer_view_file = "common/my_footer.php"; 20 | parent::__construct(); 21 | $this->member = class_member(); 22 | } 23 | 24 | public function select($type = NULL){ 25 | if(!$this->member->getLoginStatus()){ 26 | redirect([ 27 | 'Home', 28 | 'login' 29 | ], 'refresh', 302, false); 30 | return; 31 | } 32 | $this->__lib->load('ShareList'); 33 | $sl = new ShareList($this->member->getUid()); 34 | $type = $sl->checkTypeName($type, $name); 35 | if($type === NULL){ 36 | //检查失败 37 | $this->__load_404(); 38 | return; 39 | } 40 | $data = $sl->select($type); 41 | if(empty($data)){ 42 | $this->__load_404(); 43 | } else{ 44 | $this->__view("member/list.php", [ 45 | 'data' => $data, 46 | 'name' => $name 47 | ]); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /app/lib/Markdown/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Emanuil Rusev, erusev.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /app/view/add/multi-text.php: -------------------------------------------------------------------------------- 1 | get_header("多行文本分享"); 6 | ?> 7 |
8 |

你要分享的内容

9 | 10 |
11 |
12 | 13 | 14 |
15 | 16 |
17 | 18 | 19 | 32 |
33 | get_footer(); -------------------------------------------------------------------------------- /app/view/add/url.php: -------------------------------------------------------------------------------- 1 | get_header("创建一个网址分享"); 6 | ?> 7 |
8 |

分享你的网址

9 | 10 |
11 |
12 | 13 | 14 |
15 |
#
16 | 17 |
18 |
19 | 20 | 21 |
22 | 23 | 33 |
34 | get_footer(); -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushDiff.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | this.regexList = [ 25 | { regex: /^\+\+\+.*$/gm, css: 'color2' }, 26 | { regex: /^\-\-\-.*$/gm, css: 'color2' }, 27 | { regex: /^\s.*$/gm, css: 'color1' }, 28 | { regex: /^@@.*@@$/gm, css: 'variable' }, 29 | { regex: /^\+[^\+]{1}.*$/gm, css: 'string' }, 30 | { regex: /^\-[^\-]{1}.*$/gm, css: 'comments' } 31 | ]; 32 | }; 33 | 34 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 35 | Brush.aliases = ['diff', 'patch']; 36 | 37 | SyntaxHighlighter.brushes.Diff = Brush; 38 | 39 | // CommonJS 40 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 41 | })(); 42 | -------------------------------------------------------------------------------- /app/view/member/home.php: -------------------------------------------------------------------------------- 1 | get_header("我的分享中心"); 10 | ?> 11 |
12 | $value_map): ?> 13 |
14 | 15 | 16 | 17 | 18 |
19 | 20 |
21 | 修改名称* 22 |
23 |
24 | 编辑头像* 25 |
26 |
27 | 修改密码* 28 |
29 |
30 | Access Token* 31 |
32 |
33 | get_footer(); -------------------------------------------------------------------------------- /app/view/profile/edit_password.php: -------------------------------------------------------------------------------- 1 | get_header("修改密码"); 10 | ?> 11 |

修改用户密码

12 |
13 | 14 |

成功更新

15 | 16 |

17 | 18 |
19 | 20 | 21 |
22 |
旧密码
23 | 24 |
25 |
26 |
27 | 28 | 29 |
30 |
新密码
31 | 32 |
33 |
34 |
35 | 36 |
37 |
38 |

提示 : 如果使用第三方登录,如果需要使用密码,请使用密码找回功能。

39 |
40 |
41 | get_footer(); -------------------------------------------------------------------------------- /app/view/common/header.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | <?php echo $this->getTitle() ?> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 25 |
26 | 32 | -------------------------------------------------------------------------------- /app/lib/Member/DaoGoogle.php: -------------------------------------------------------------------------------- 1 | driver = class_db()->getDriver(); 21 | } 22 | 23 | /** 24 | * 返回数据库驱动 25 | * @return Sql 26 | */ 27 | public function getDriver(){ 28 | return $this->driver; 29 | } 30 | 31 | /** 32 | * 返回数据库的错误信息 33 | * @return array 34 | */ 35 | public function get_error(){ 36 | return $this->driver->error(); 37 | } 38 | 39 | 40 | /** 41 | * 通过google唯一UID查询当前的用户,并取得ID值 42 | * @param string $mg_uid 43 | * @return array|bool 44 | */ 45 | public function getInfoByUid($mg_uid){ 46 | return $this->driver->get("member_google", "*", ['mg_uid' => $mg_uid]); 47 | } 48 | 49 | /** 50 | * 通过用户ID查询信息 51 | * @param string $m_id 52 | * @return array|bool 53 | */ 54 | public function getInfoByMid($m_id){ 55 | return $this->driver->get("member_google", "*", ['m_id' => $m_id]); 56 | } 57 | 58 | /** 59 | * 插入数据到Google用户表 60 | * @param int $m_id 61 | * @param string $mg_uid 62 | * @param string $mg_app_uid 63 | * @param string $mg_avatar 64 | * @return bool 65 | */ 66 | public function insertData($m_id, $mg_uid, $mg_app_uid, $mg_avatar){ 67 | return $this->driver->insert("member_google", compact('m_id', 'mg_uid', 'mg_app_uid', 'mg_avatar')) !== -1; 68 | } 69 | } -------------------------------------------------------------------------------- /config/all-simple.php: -------------------------------------------------------------------------------- 1 | [ 4 | 'database_type' => 'mysql', 5 | 'server' => 'localhost', 6 | 'username' => 'root', 7 | 'password' => '123456', 8 | 'charset' => 'utf8', 9 | 'database_name' => 'changda', 10 | 'option' => [ //PDO选项 11 | PDO::ATTR_CASE => PDO::CASE_NATURAL, 12 | PDO::ATTR_TIMEOUT => 5 13 | ] 14 | ], 15 | 'register' => [ 16 | 'status' => 'open', 17 | 'login_form' => 'open' 18 | ], 19 | 'url_map_host' => [//用于前端的地址分配 20 | 'root' => '', 21 | //主域名,如changda.club,不设置取一个顶级域名 22 | 'home' => '%ROOT%', 23 | //当前首页的域名 24 | 'api' => '%ROOT%/Api', 25 | //API的域名地址 26 | 'my' => 'my.%ROOT%' 27 | //用户中心的域名 28 | ], 29 | 'cdn_list' => [ 30 | 'bootstrap' => '//dn-loveyu-libs.qbox.me/bootstrap/3.3.4', 31 | 'jquery' => '//dn-loveyu-libs.qbox.me/jquery/1.11.2', 32 | 'gravatar' => [ 33 | 'https' => 'https://secure.gravatar.com/avatar', 34 | 'http' => 'http://1.gravatar.com/avatar' 35 | ], 36 | ], 37 | 'mail_template' => _ViewPath_ . '/mail_template', 38 | //邮件模板视图 39 | 'mail' => [ 40 | //邮件配置设置,参考PHPMailer 41 | 'Mailer' => 'smtp', 42 | 'Host' => 'smtp.exmail.qq.com', 43 | 'SMTPAuth' => true, 44 | 'Username' => 'share@xxx.xxx', 45 | 'Password' => 'xxx', 46 | 'From' => 'share@xxx.xxx', 47 | 'FromName' => 'share', 48 | 'Sender' => 'share@xxx.xxx', 49 | 'XMailer' => 'Loveyu Mailer', 50 | 'CharSet' => 'utf-8', 51 | "Encoding" => 'base64', 52 | ], 53 | ]; -------------------------------------------------------------------------------- /app/lib/Share/ShareMarkdown.php: -------------------------------------------------------------------------------- 1 | share_type = self::TYPE_MARKDOWN; 23 | parent::__construct(); 24 | } 25 | 26 | /** 27 | * 设置对应要分享的内容 28 | * @param mixed $data 29 | * @return bool 设置的状态 30 | */ 31 | public function setData($data){ 32 | return class_db()->d_share_markdown_insert($this->base_data['s_id'], $data); 33 | } 34 | 35 | /** 36 | * 初始化拓展基本信息 37 | * @throws \Exception 38 | * @return void 39 | */ 40 | public function initExtData(){ 41 | $ex_data = class_db()->d_share_markdown_get($this->base_data['s_id']); 42 | if(!isset($ex_data['s_id'])){ 43 | throw new \Exception("数据获取异常"); 44 | } 45 | $this->markdown = $ex_data['sm_content']; 46 | } 47 | 48 | /** 49 | * 返回主要的信息 50 | * @return mixed 51 | */ 52 | public function getPrimaryData(){ 53 | return $this->markdown; 54 | } 55 | 56 | /** 57 | * 获取HTML数据 58 | * @return string 59 | * @throws \Exception 60 | */ 61 | public function getHtml(){ 62 | lib()->load('Markdown/Parsedown', 'Xss/XssHtml'); 63 | $parse = new Parsedown(); 64 | $xss = new XssHtml($parse->text(htmlspecialchars($this->markdown))); 65 | return $xss->getHtml(); 66 | } 67 | } -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shAutoloader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(2(){1 h=5;h.I=2(){2 n(c,a){4(1 d=0;dshare_type = self::TYPE_URL; 20 | parent::__construct(); 21 | } 22 | 23 | /** 24 | * 设置对应要分享的内容 25 | * @param mixed $data 26 | * @return bool 设置的状态 27 | */ 28 | public function setData($data){ 29 | return class_db()->d_share_url_insert($this->base_data['s_id'], $data); 30 | } 31 | 32 | /** 33 | * 返回主要的信息 34 | * @return mixed 35 | */ 36 | public function getPrimaryData(){ 37 | return $this->url; 38 | } 39 | 40 | 41 | /** 42 | * 初始化拓展基本信息 43 | * @throws \Exception 44 | * @return void 45 | */ 46 | public function initExtData(){ 47 | $ex_data = class_db()->d_share_url_get($this->base_data['s_id']); 48 | if(!isset($ex_data['s_id'])){ 49 | throw new \Exception("数据获取异常"); 50 | } 51 | $this->title = $ex_data['su_title']; 52 | $this->description = $ex_data['su_description']; 53 | $this->url = $ex_data['su_url']; 54 | } 55 | 56 | /** 57 | * @return string|null 58 | */ 59 | public function getTitle(){ 60 | return $this->title; 61 | } 62 | 63 | /** 64 | * @return string|null 65 | */ 66 | public function getDescription(){ 67 | return $this->description; 68 | } 69 | 70 | /** 71 | * @return string 72 | */ 73 | public function getUrl(){ 74 | return $this->url; 75 | } 76 | 77 | } -------------------------------------------------------------------------------- /app/lib/Share/SharePicture.php: -------------------------------------------------------------------------------- 1 | upload_config = [ 32 | 'max_size' => 1024 * 1024 * 5, 33 | 'image_info' => true 34 | ]; 35 | } 36 | 37 | /** 38 | * 设置分享的数据 39 | * @param mixed $data 40 | * @return bool 41 | */ 42 | public function setData($data){ 43 | if(!parent::setData($data)){ 44 | return false; 45 | } 46 | return class_db()->d_share_picture_insert($this->base_data['s_id'], $this->info['image']['width'], $this->info['image']['height']); 47 | } 48 | 49 | /** 50 | * 初始化数据 51 | * @throws \Exception 52 | */ 53 | public function initExtData(){ 54 | parent::initExtData(); 55 | $wh = class_db()->d_share_picture_get($this->base_data['s_id']); 56 | if(!isset($wh['s_id'])){ 57 | throw new \Exception("数据获取异常,图片信息丢失"); 58 | } 59 | $this->width = $wh['sp_width']; 60 | $this->height = $wh['sp_height']; 61 | } 62 | 63 | /** 64 | * @return int 65 | */ 66 | public function getWidth(){ 67 | return $this->width; 68 | } 69 | 70 | /** 71 | * @return int 72 | */ 73 | public function getHeight(){ 74 | return $this->height; 75 | } 76 | 77 | } -------------------------------------------------------------------------------- /app/view/add/code.php: -------------------------------------------------------------------------------- 1 | get_header([ 6 | 'title' => '分享你的代码', 7 | "js" => "js/jquery.form.js", 8 | ]); 9 | ?> 10 | 54 | get_footer(); -------------------------------------------------------------------------------- /app/view/my/login_form.php: -------------------------------------------------------------------------------- 1 | get_header("用户登录"); 10 | ?> 11 |

用户登录

12 | 13 |
14 |
15 |
16 | 17 |

18 | 19 |
20 | 21 | 22 |
23 |
24 | 26 |
27 |
28 |
29 | 30 | 31 |
32 |
33 | 34 |
35 |
36 |
37 | 38 |  ">忘记密码? 39 | 40 |  ">需要注册? 41 | 42 |
43 |
44 | 45 |
46 |
47 | get_footer(); -------------------------------------------------------------------------------- /app/view/common/my_header.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | <?php echo $this->getTitle() ?> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 25 |
26 | 44 | -------------------------------------------------------------------------------- /app/lib/Member/DaoShare.php: -------------------------------------------------------------------------------- 1 | driver = class_db()->getDriver(); 20 | } 21 | 22 | /** 23 | * 返回数据库驱动 24 | * @return Sql 25 | */ 26 | public function getDriver(){ 27 | return $this->driver; 28 | } 29 | 30 | /** 31 | * 返回数据库的错误信息 32 | * @return array 33 | */ 34 | public function get_error(){ 35 | return $this->driver->error(); 36 | } 37 | 38 | /** 39 | * 查询某一用户的统计数据 40 | * @param int $m_id 41 | * @return array 42 | */ 43 | public function count_share_by_id($m_id){ 44 | $m_id = intval($m_id); 45 | $sql = "SELECT 46 | `s_type`, 47 | COUNT(`s_mid`) AS `count` 48 | FROM 49 | `share` 50 | WHERE 51 | `s_mid` = {$m_id} AND `s_status` in (0, 1) AND `s_deny` = 0 52 | GROUP BY 53 | `s_type` 54 | ORDER BY 55 | `count` DESC;"; 56 | $stmt = $this->driver->query($sql); 57 | $rt = $stmt->fetchAll(\PDO::FETCH_ASSOC); 58 | $stmt->closeCursor(); 59 | return $rt; 60 | } 61 | 62 | /** 63 | * 查询用户的某一类分享数据 64 | * @param int $m_id 65 | * @param int|array $s_type 66 | * @param null $limit 67 | * @return array|bool 68 | */ 69 | public function select($m_id, $s_type, $limit = NULL){ 70 | $m_id = intval($m_id); 71 | $s_type = is_array($s_type) ? array_unique(array_map('intval', $s_type)) : intval($s_type); 72 | $where = [ 73 | 'AND' => [ 74 | 's_mid' => $m_id, 75 | 's_type' => $s_type, 76 | 's_status' => [ 77 | 0, 78 | 1 79 | ], 80 | 's_deny' => 0 81 | ], 82 | 'ORDER'=>'s_id DESC' 83 | ]; 84 | if(!empty($limit)){ 85 | $where['LIMIT'] = $limit; 86 | } 87 | return $this->driver->select("share", "*", $where); 88 | } 89 | 90 | } -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushJScript.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'break case catch continue ' + 25 | 'default delete do else false ' + 26 | 'for function if in instanceof ' + 27 | 'new null return super switch ' + 28 | 'this throw true try typeof var while with' 29 | ; 30 | 31 | var r = SyntaxHighlighter.regexLib; 32 | 33 | this.regexList = [ 34 | { regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings 35 | { regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings 36 | { regex: r.singleLineCComments, css: 'comments' }, // one line comments 37 | { regex: r.multiLineCComments, css: 'comments' }, // multiline comments 38 | { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 39 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords 40 | ]; 41 | 42 | this.forHtmlScript(r.scriptScriptTags); 43 | }; 44 | 45 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 46 | Brush.aliases = ['js', 'jscript', 'javascript']; 47 | 48 | SyntaxHighlighter.brushes.JScript = Brush; 49 | 50 | // CommonJS 51 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 52 | })(); 53 | -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shLegacy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3 u={8:{}};u.8={A:4(c,k,l,m,n,o){4 d(a,b){2 a!=1?a:b}4 f(a){2 a!=1?a.E():1}c=c.I(":");3 g=c[0],e={};t={"r":K};M=1;5=8.5;9(3 j R c)e[c[j]]="r";k=f(d(k,5.C));l=f(d(l,5.D));m=f(d(m,5.s));o=f(d(o,5.Q));n=f(d(n,5["x-y"]));2{P:g,C:d(t[e.O],k),D:d(t[e.N],l),s:d({"r":r}[e.s],m),"x-y":d(4(a,b){9(3 h=T S("^"+b+"\\\\[(?\\\\w+)\\\\]$","U"),i=1,p=0;pget_header([ 6 | "title" => "创建Markdown分享", 7 | "js" => "plugins/markdown/bootstrap-markdown.js", 8 | "css" => "plugins/markdown/bootstrap-markdown.min.css" 9 | ]); 10 | ?> 11 |
12 | 13 | 14 |
15 | 18 | 60 | get_footer(); -------------------------------------------------------------------------------- /app/view/my/password_reset_input.php: -------------------------------------------------------------------------------- 1 | get_header("密码重置"); 11 | ?> 12 |
13 | 14 |
15 |

密码重置成功,前往登录

16 |
17 | 18 |
19 |
20 |

输入新密码与验证码

21 | 22 |

23 | 24 |
25 | 26 | 27 |
28 |
邮箱
29 | 31 |
32 |
33 |
34 | 35 | 36 |
37 |
验证码
38 | 39 |
40 |
41 |
42 | 43 | 44 |
45 |
新密码
46 | 47 |
48 |
49 | 50 |
51 | 52 |
53 |
54 | 55 |
56 | 57 |
58 | get_footer(); -------------------------------------------------------------------------------- /app/page/Api/Member.php: -------------------------------------------------------------------------------- 1 | _origin()); 19 | header("Access-Control-Allow-Credentials: true"); 20 | } 21 | 22 | /** 23 | * 查询当前用户的登录信息 24 | */ 25 | public function loginInfo(){ 26 | if(!$this->_run_check()){ 27 | return; 28 | } 29 | $member = class_member(); 30 | if(!$member->getLoginStatus()){ 31 | $this->_set_status(false, 5001, '当前用户未登陆'); 32 | } else{ 33 | $this->_set_status(true, 0); 34 | $this->_set_data([ 35 | 'id' => $member->getUid(), 36 | 'name' => $member->getName(), 37 | 'avatar' => $member->getAvatar(25) 38 | ]); 39 | } 40 | } 41 | 42 | /** 43 | * 检测一个邮箱的地址是否被注册 44 | * 未被注册返回TRUE 45 | */ 46 | public function emailRegisterCheck(){ 47 | if(!$this->_run_check()){ 48 | return; 49 | } 50 | $email = $this->__req->req('email'); 51 | if(!filter_var($email, FILTER_VALIDATE_EMAIL)){ 52 | $this->_set_status(false, 5011, "邮箱地址不合法"); 53 | return; 54 | } 55 | lib()->load('Member/Dao'); 56 | $dao = new Dao(); 57 | if($dao->has_email($email)){ 58 | $this->_set_status(false, 5012, "邮箱已被注册"); 59 | return; 60 | } 61 | $this->_set_status(true, 0, '邮箱有效,未被注册'); 62 | } 63 | 64 | /** 65 | * 发送邮箱注册验证码 66 | */ 67 | public function sendEmailRegisterCode(){ 68 | if(!$this->_run_check()){ 69 | return; 70 | } 71 | $email = trim(strtolower($this->__req->req('email'))); 72 | if(!filter_var($email, FILTER_VALIDATE_EMAIL)){ 73 | $this->_set_status(false, 5011, "邮箱地址不合法"); 74 | return; 75 | } 76 | if(!class_member()->SendRegisterCode($email)){ 77 | $this->_set_status(false, 5012, class_member()->getError()); 78 | } else{ 79 | $this->_set_status(true, 0, "验证码已发送"); 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushScala.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Yegor Jbanov and David Bernard. 25 | 26 | var keywords = 'val sealed case def true trait implicit forSome import match object null finally super ' + 27 | 'override try lazy for var catch throw type extends class while with new final yield abstract ' + 28 | 'else do if return protected private this package false'; 29 | 30 | var keyops = '[_:=><%#@]+'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 35 | { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // multi-line strings 36 | { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double-quoted string 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /0x[a-f0-9]+|\d+(\.\d+)?/gi, css: 'value' }, // numbers 39 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 40 | { regex: new RegExp(keyops, 'gm'), css: 'keyword' } // scala keyword 41 | ]; 42 | } 43 | 44 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 45 | Brush.aliases = ['scala']; 46 | 47 | SyntaxHighlighter.brushes.Scala = Brush; 48 | 49 | // CommonJS 50 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 51 | })(); 52 | -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushXml.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | function process(match, regexInfo) 25 | { 26 | var constructor = SyntaxHighlighter.Match, 27 | code = match[0], 28 | tag = new XRegExp('(<|<)[\\s\\/\\?]*(?[:\\w-\\.]+)', 'xg').exec(code), 29 | result = [] 30 | ; 31 | 32 | if (match.attributes != null) 33 | { 34 | var attributes, 35 | regex = new XRegExp('(? [\\w:\\-\\.]+)' + 36 | '\\s*=\\s*' + 37 | '(? ".*?"|\'.*?\'|\\w+)', 38 | 'xg'); 39 | 40 | while ((attributes = regex.exec(code)) != null) 41 | { 42 | result.push(new constructor(attributes.name, match.index + attributes.index, 'color1')); 43 | result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string')); 44 | } 45 | } 46 | 47 | if (tag != null) 48 | result.push( 49 | new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword') 50 | ); 51 | 52 | return result; 53 | } 54 | 55 | this.regexList = [ 56 | { regex: new XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, // 57 | { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // 58 | { regex: new XRegExp('(<|<)[\\s\\/\\?]*(\\w+)(?.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process } 59 | ]; 60 | }; 61 | 62 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 63 | Brush.aliases = ['xml', 'xhtml', 'xslt', 'html']; 64 | 65 | SyntaxHighlighter.brushes.Xml = Brush; 66 | 67 | // CommonJS 68 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 69 | })(); 70 | -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /app/view/profile/edit_avatar.php: -------------------------------------------------------------------------------- 1 | parseAvatarParam(); 11 | $google = $member->getAvatarByGoogle(); 12 | $this->get_header("自定义头像"); 13 | ?> 14 |

自定义你的头像

15 |
16 | 17 |

成功更新

18 | 19 |

20 | 21 | 22 |
23 |
27 | 28 |
29 |
33 |
34 | 38 |
39 |
40 | 46 | 47 |

48 | id="InputValue">

51 |
52 |
53 | 54 |
55 |
56 | get_footer(); -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushRuby.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Erik Peterson. 25 | 26 | var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif ' + 27 | 'END end ensure false for if in module new next nil not or raise redo rescue retry return ' + 28 | 'self super then throw true undef unless until when while yield'; 29 | 30 | var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload ' + 31 | 'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ' + 32 | 'ThreadGroup Thread Time TrueClass'; 33 | 34 | this.regexList = [ 35 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 38 | { regex: /\b[A-Z0-9_]+\b/g, css: 'constants' }, // constants 39 | { regex: /:[a-z][A-Za-z0-9_]*/g, css: 'color2' }, // symbols 40 | { regex: /(\$|@@|@)\w+/g, css: 'variable bold' }, // $global, @instance, and @@class variables 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 42 | { regex: new RegExp(this.getKeywords(builtins), 'gm'), css: 'color1' } // builtins 43 | ]; 44 | 45 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 46 | }; 47 | 48 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 49 | Brush.aliases = ['ruby', 'rails', 'ror', 'rb']; 50 | 51 | SyntaxHighlighter.brushes.Ruby = Brush; 52 | 53 | // CommonJS 54 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 55 | })(); 56 | -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushJavaFX.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Patrick Webster 25 | // http://patrickwebster.blogspot.com/2009/04/javafx-brush-for-syntaxhighlighter.html 26 | var datatypes = 'Boolean Byte Character Double Duration ' 27 | + 'Float Integer Long Number Short String Void' 28 | ; 29 | 30 | var keywords = 'abstract after and as assert at before bind bound break catch class ' 31 | + 'continue def delete else exclusive extends false finally first for from ' 32 | + 'function if import in indexof init insert instanceof into inverse last ' 33 | + 'lazy mixin mod nativearray new not null on or override package postinit ' 34 | + 'protected public public-init public-read replace return reverse sizeof ' 35 | + 'step super then this throw true try tween typeof var where while with ' 36 | + 'attribute let private readonly static trigger' 37 | ; 38 | 39 | this.regexList = [ 40 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, 41 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, 42 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, 43 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, 44 | { regex: /(-?\.?)(\b(\d*\.?\d+|\d+\.?\d*)(e[+-]?\d+)?|0x[a-f\d]+)\b\.?/gi, css: 'color2' }, // numbers 45 | { regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'variable' }, // datatypes 46 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } 47 | ]; 48 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 49 | }; 50 | 51 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 52 | Brush.aliases = ['jfx', 'javafx']; 53 | 54 | SyntaxHighlighter.brushes.JavaFX = Brush; 55 | 56 | // CommonJS 57 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 58 | })(); 59 | -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushVb.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto ' + 25 | 'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate ' + 26 | 'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType ' + 27 | 'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each ' + 28 | 'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend ' + 29 | 'Function Get GetType GoSub GoTo Handles If Implements Imports In ' + 30 | 'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module ' + 31 | 'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing ' + 32 | 'NotInheritable NotOverridable Object On Option Optional Or OrElse ' + 33 | 'Overloads Overridable Overrides ParamArray Preserve Private Property ' + 34 | 'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume ' + 35 | 'Return Select Set Shadows Shared Short Single Static Step Stop String ' + 36 | 'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until ' + 37 | 'Variant When While With WithEvents WriteOnly Xor'; 38 | 39 | this.regexList = [ 40 | { regex: /'.*$/gm, css: 'comments' }, // one line comments 41 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 42 | { regex: /^\s*#.*$/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 43 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // vb keyword 44 | ]; 45 | 46 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 47 | }; 48 | 49 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 50 | Brush.aliases = ['vb', 'vbnet']; 51 | 52 | SyntaxHighlighter.brushes.Vb = Brush; 53 | 54 | // CommonJS 55 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 56 | })(); 57 | -------------------------------------------------------------------------------- /app/page.my/Profile.php: -------------------------------------------------------------------------------- 1 | header_view_file = "common/my_header.php"; 17 | $this->footer_view_file = "common/my_footer.php"; 18 | parent::__construct(); 19 | } 20 | 21 | public function edit(){ 22 | $member = class_member(); 23 | if(!$member->getLoginStatus()){ 24 | redirect('Home/login', 'refresh', 302, false); 25 | } 26 | $name = $this->__req->post('name'); 27 | $error = ""; 28 | if(!empty($name)){ 29 | if(!$member->setName($name)){ 30 | $error = $member->getError(); 31 | } else{ 32 | $error = NULL; 33 | } 34 | } 35 | $this->__view("profile/edit_name.php", [ 36 | 'name' => $member->getName(), 37 | 'error' => $error 38 | ]); 39 | } 40 | 41 | public function avatar(){ 42 | $member = class_member(); 43 | if(!$member->getLoginStatus()){ 44 | redirect('Home/login', 'refresh', 302, false); 45 | } 46 | $error = ""; 47 | $type = $this->__req->post('type'); 48 | if(!empty($type)){ 49 | if(!$member->setAvatar($type, $this->__req->post('value'))){ 50 | $error = $member->getError(); 51 | } else{ 52 | $error = NULL; 53 | } 54 | } 55 | $this->__view("profile/edit_avatar.php", ['error' => $error]); 56 | } 57 | 58 | public function password(){ 59 | $member = class_member(); 60 | if(!$member->getLoginStatus()){ 61 | redirect('Home/login', 'refresh', 302, false); 62 | } 63 | $password = trim((string)$this->__req->post('new')); 64 | $old = trim((string)$this->__req->post('old')); 65 | $error = ""; 66 | if(!empty($password)){ 67 | if(empty($password) || empty($old)){ 68 | $error = "不允许空密码"; 69 | } elseif($password == $old){ 70 | $error = "新旧密码不能一致"; 71 | } else{ 72 | if(!$member->setPassword(_md5($old), _md5($password))){ 73 | $error = $member->getError(); 74 | } else{ 75 | $error = NULL; 76 | } 77 | } 78 | } 79 | $this->__view("profile/edit_password.php", [ 80 | 'error' => $error 81 | ]); 82 | } 83 | 84 | public function access_token(){ 85 | if(!class_member()->getLoginStatus()){ 86 | redirect('Home/login', 'refresh', 302, false); 87 | } 88 | $reset = $this->__req->post('reset'); 89 | if($reset === "true"){ 90 | $access_token = class_member()->resetAccessToken(); 91 | } else{ 92 | $access_token = class_member()->getAccessToken(); 93 | } 94 | $this->__view("profile/access_token.php", compact('access_token')); 95 | } 96 | } -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushDelphi.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' + 25 | 'case char class comp const constructor currency destructor div do double ' + 26 | 'downto else end except exports extended false file finalization finally ' + 27 | 'for function goto if implementation in inherited int64 initialization ' + 28 | 'integer interface is label library longint longword mod nil not object ' + 29 | 'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' + 30 | 'pint64 pointer private procedure program property pshortstring pstring ' + 31 | 'pvariant pwidechar pwidestring protected public published raise real real48 ' + 32 | 'record repeat set shl shortint shortstring shr single smallint string then ' + 33 | 'threadvar to true try type unit until uses val var varirnt while widechar ' + 34 | 'widestring with word write writeln xor'; 35 | 36 | this.regexList = [ 37 | { regex: /\(\*[\s\S]*?\*\)/gm, css: 'comments' }, // multiline comments (* *) 38 | { regex: /{(?!\$)[\s\S]*?}/gm, css: 'comments' }, // multiline comments { } 39 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line 40 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 41 | { regex: /\{\$[a-zA-Z]+ .+\}/g, css: 'color1' }, // compiler Directives and Region tags 42 | { regex: /\b[\d\.]+\b/g, css: 'value' }, // numbers 12345 43 | { regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // numbers $F5D3 44 | { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword 45 | ]; 46 | }; 47 | 48 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 49 | Brush.aliases = ['delphi', 'pascal', 'pas']; 50 | 51 | SyntaxHighlighter.brushes.Delphi = Brush; 52 | 53 | // CommonJS 54 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 55 | })(); 56 | -------------------------------------------------------------------------------- /web/asset/plugins/markdown/bootstrap-markdown.min.css: -------------------------------------------------------------------------------- 1 | .md-editor{display:block;border:1px solid #ddd}.md-editor .md-footer,.md-editor>.md-header{display:block;padding:6px 4px;background:#f5f5f5}.md-editor>.md-header{margin:0}.md-editor>.md-preview{background:#fff;border-top:1px dashed #ddd;border-bottom:1px dashed #ddd;min-height:10px;overflow:auto}.md-editor>textarea{font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:14px;outline:0;margin:0;display:block;padding:0;width:100%;border:0;border-top:1px dashed #ddd;border-bottom:1px dashed #ddd;border-radius:0;box-shadow:none;background:#eee}.md-editor>textarea:focus{box-shadow:none;background:#fff}.md-editor.active{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.md-editor .md-controls{float:right;padding:3px}.md-editor .md-controls .md-control{right:5px;color:#bebebe;padding:3px 3px 3px 10px}.md-editor .md-controls .md-control:hover{color:#333}.md-editor.md-fullscreen-mode{width:100%;height:100%;position:fixed;top:0;left:0;z-index:99999;padding:60px 30px 15px;background:#fff!important;border:0!important}.md-editor.md-fullscreen-mode .md-footer{display:none}.md-editor.md-fullscreen-mode .md-input,.md-editor.md-fullscreen-mode .md-preview{margin:0 auto!important;height:100%!important;font-size:20px!important;padding:20px!important;color:#999;line-height:1.6em!important;resize:none!important;box-shadow:none!important;background:#fff!important;border:0!important}.md-editor.md-fullscreen-mode .md-preview{color:#333;overflow:auto}.md-editor.md-fullscreen-mode .md-input:focus,.md-editor.md-fullscreen-mode .md-input:hover{color:#333;background:#fff!important}.md-editor.md-fullscreen-mode .md-header{background:0 0;text-align:center;position:fixed;width:100%;top:20px}.md-editor.md-fullscreen-mode .btn-group{float:none}.md-editor.md-fullscreen-mode .btn{border:0;background:0 0;color:#b3b3b3}.md-editor.md-fullscreen-mode .btn.active,.md-editor.md-fullscreen-mode .btn:active,.md-editor.md-fullscreen-mode .btn:focus,.md-editor.md-fullscreen-mode .btn:hover{box-shadow:none;color:#333}.md-editor.md-fullscreen-mode .md-fullscreen-controls{position:absolute;top:20px;right:20px;text-align:right;z-index:1002;display:block}.md-editor.md-fullscreen-mode .md-fullscreen-controls a{color:#b3b3b3;clear:right;margin:10px;width:30px;height:30px;text-align:center}.md-editor.md-fullscreen-mode .md-fullscreen-controls a:hover{color:#333;text-decoration:none}.md-editor.md-fullscreen-mode .md-editor{height:100%!important;position:relative}.md-editor .md-fullscreen-controls{display:none}.md-nooverflow{overflow:hidden;position:fixed;width:100%} -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushAS3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Created by Peter Atoria @ http://iAtoria.com 25 | 26 | var inits = 'class interface function package'; 27 | 28 | var keywords = '-Infinity ...rest Array as AS3 Boolean break case catch const continue Date decodeURI ' + 29 | 'decodeURIComponent default delete do dynamic each else encodeURI encodeURIComponent escape ' + 30 | 'extends false final finally flash_proxy for get if implements import in include Infinity ' + 31 | 'instanceof int internal is isFinite isNaN isXMLName label namespace NaN native new null ' + 32 | 'Null Number Object object_proxy override parseFloat parseInt private protected public ' + 33 | 'return set static String super switch this throw true try typeof uint undefined unescape ' + 34 | 'use void while with' 35 | ; 36 | 37 | this.regexList = [ 38 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 39 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 40 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 41 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 42 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 43 | { regex: new RegExp(this.getKeywords(inits), 'gm'), css: 'color3' }, // initializations 44 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 45 | { regex: new RegExp('var', 'gm'), css: 'variable' }, // variable 46 | { regex: new RegExp('trace', 'gm'), css: 'color1' } // trace 47 | ]; 48 | 49 | this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags); 50 | }; 51 | 52 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 53 | Brush.aliases = ['actionscript3', 'as3']; 54 | 55 | SyntaxHighlighter.brushes.AS3 = Brush; 56 | 57 | // CommonJS 58 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 59 | })(); 60 | -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushPython.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Gheorghe Milas and Ahmad Sherif 25 | 26 | var keywords = 'and assert break class continue def del elif else ' + 27 | 'except exec finally for from global if import in is ' + 28 | 'lambda not or pass print raise return try yield while'; 29 | 30 | var funcs = '__import__ abs all any apply basestring bin bool buffer callable ' + 31 | 'chr classmethod cmp coerce compile complex delattr dict dir ' + 32 | 'divmod enumerate eval execfile file filter float format frozenset ' + 33 | 'getattr globals hasattr hash help hex id input int intern ' + 34 | 'isinstance issubclass iter len list locals long map max min next ' + 35 | 'object oct open ord pow print property range raw_input reduce ' + 36 | 'reload repr reversed round set setattr slice sorted staticmethod ' + 37 | 'str sum super tuple type type unichr unicode vars xrange zip'; 38 | 39 | var special = 'None True False self cls class_'; 40 | 41 | this.regexList = [ 42 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, 43 | { regex: /^\s*@\w+/gm, css: 'decorator' }, 44 | { regex: /(['\"]{3})([^\1])*?\1/gm, css: 'comments' }, 45 | { regex: /"(?!")(?:\.|\\\"|[^\""\n])*"/gm, css: 'string' }, 46 | { regex: /'(?!')(?:\.|(\\\')|[^\''\n])*'/gm, css: 'string' }, 47 | { regex: /\+|\-|\*|\/|\%|=|==/gm, css: 'keyword' }, 48 | { regex: /\b\d+\.?\w*/g, css: 'value' }, 49 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, 50 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, 51 | { regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' } 52 | ]; 53 | 54 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 55 | }; 56 | 57 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 58 | Brush.aliases = ['py', 'python']; 59 | 60 | SyntaxHighlighter.brushes.Python = Brush; 61 | 62 | // CommonJS 63 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 64 | })(); 65 | -------------------------------------------------------------------------------- /app/lib/Share/ShareParse.php: -------------------------------------------------------------------------------- 1 | baseInfo($id, $uname); 56 | if(!isset($info['s_id'])){ 57 | return false; 58 | } 59 | switch($info['s_type']){ 60 | case self::TYPE_URL: 61 | $share = class_share("Url"); 62 | break; 63 | case self::TYPE_TEXT: 64 | $share = class_share("Text"); 65 | break; 66 | case self::TYPE_MULTI_TEXT: 67 | $share = class_share("MultiText"); 68 | break; 69 | case self::TYPE_CODE: 70 | $share = class_share("Code"); 71 | break; 72 | case self::TYPE_FILE: 73 | $share = class_share("File"); 74 | break; 75 | case self::TYPE_MARKDOWN: 76 | $share = class_share("Markdown"); 77 | break; 78 | case self::TYPE_PICTURE: 79 | $share = class_share("Picture", "File"); 80 | break; 81 | case self::TYPE_PICTURE_TEXT: 82 | $share = class_share("PictureText", "File"); 83 | break; 84 | default: 85 | return false; 86 | } 87 | $share->setBaseData($info); 88 | $share->initExtData(); 89 | return $share; 90 | } 91 | 92 | private function baseInfo($s_id, $uname){ 93 | $info = class_db()->d_share_get($s_id); 94 | if(isset($info['s_id']) && $info['s_uname'] == $uname){ 95 | return $info; 96 | } 97 | return false; 98 | } 99 | 100 | /** 101 | * 初始化拓展基本信息 102 | * @return void 103 | */ 104 | public function initExtData(){ 105 | } 106 | 107 | /** 108 | * 返回主要的信息 109 | * @return mixed 110 | */ 111 | public function getPrimaryData(){ 112 | return NULL; 113 | } 114 | 115 | 116 | public function getAllId(){ 117 | //DEBUG 方法 118 | $list = class_db()->getDriver()->select("share", [ 119 | "s_uname", 120 | "s_time_share", 121 | "s_type" 122 | ]); 123 | return $list; 124 | } 125 | } -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushCSharp.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract as base bool break byte case catch char checked class const ' + 25 | 'continue decimal default delegate do double else enum event explicit ' + 26 | 'extern false finally fixed float for foreach get goto if implicit in int ' + 27 | 'interface internal is lock long namespace new null object operator out ' + 28 | 'override params private protected public readonly ref return sbyte sealed set ' + 29 | 'short sizeof stackalloc static string struct switch this throw true try ' + 30 | 'typeof uint ulong unchecked unsafe ushort using virtual void while'; 31 | 32 | function fixComments(match, regexInfo) 33 | { 34 | var css = (match[0].indexOf("///") == 0) 35 | ? 'color1' 36 | : 'comments' 37 | ; 38 | 39 | return [new SyntaxHighlighter.Match(match[0], match.index, css)]; 40 | } 41 | 42 | this.regexList = [ 43 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, func : fixComments }, // one line comments 44 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 45 | { regex: /@"(?:[^"]|"")*"/g, css: 'string' }, // @-quoted strings 46 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 47 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 48 | { regex: /^\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 49 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // c# keyword 50 | { regex: /\bpartial(?=\s+(?:class|interface|struct)\b)/g, css: 'keyword' }, // contextual keyword: 'partial' 51 | { regex: /\byield(?=\s+(?:return|break)\b)/g, css: 'keyword' } // contextual keyword: 'yield' 52 | ]; 53 | 54 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 55 | }; 56 | 57 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 58 | Brush.aliases = ['c#', 'c-sharp', 'csharp']; 59 | 60 | SyntaxHighlighter.brushes.CSharp = Brush; 61 | 62 | // CommonJS 63 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 64 | })(); 65 | 66 | -------------------------------------------------------------------------------- /app/helper/ref_class.php: -------------------------------------------------------------------------------- 1 | using('UDB'); 19 | if($db === false){ 20 | $lib->load('DB'); 21 | $db = new \ULib\DB(); 22 | $lib->add("UDB", $db); 23 | } 24 | return $db; 25 | } 26 | 27 | /** 28 | * 返回一个分享的类 29 | * @param string $type {Url|File|Text|Markdown} 30 | * @param array|string $require 依赖额其他类 31 | * @return \ULib\Share 32 | */ 33 | function class_share($type, $require = NULL){ 34 | static $map = []; 35 | if(isset($map[$type])){ 36 | return $map[$type]; 37 | } 38 | $lib = lib(); 39 | if(!class_exists('ULib\Share')){ 40 | $lib->load('Share'); 41 | } 42 | $map[$type] = $lib->using('UShare' . $type); 43 | if($map[$type] === false){ 44 | if(is_string($require)){ 45 | $lib->load('Share/Share' . $require); 46 | } elseif(is_array($require)){ 47 | foreach($require as $v){ 48 | $lib->load('Share/Share' . $v); 49 | } 50 | } 51 | $lib->load('Share/Share' . $type); 52 | $class_name = 'ULib\Share\Share' . $type; 53 | $map[$type] = new $class_name(); 54 | $lib->add("UShare" . $type, $map[$type]); 55 | } 56 | return $map[$type]; 57 | } 58 | 59 | /** 60 | * 获取用户类 61 | * @return \ULib\Member 62 | */ 63 | function class_member(){ 64 | static $member = NULL; 65 | if($member !== NULL){ 66 | return $member; 67 | } 68 | $lib = lib(); 69 | $member = $lib->using('UMember'); 70 | if($member === false){ 71 | $lib->load('Member'); 72 | $member = new \ULib\Member(); 73 | $lib->add("UMember", $member); 74 | } 75 | return $member; 76 | } 77 | 78 | /** 79 | * 获取Session对象 80 | * @return \CLib\Session 81 | */ 82 | function class_session(){ 83 | static $session = NULL; 84 | if($session !== NULL){ 85 | return $session; 86 | } 87 | $lib = c_lib(); 88 | $session = $lib->using('CSession'); 89 | if($session === false){ 90 | $lib->load('session'); 91 | 92 | $session = new \CLib\Session('Local', [ 93 | 'domain' => get_top_domain(2), 94 | 'path' => '/' 95 | ]); 96 | $lib->add("CSession", $session); 97 | } 98 | return $session; 99 | } 100 | 101 | /** 102 | * 获取Cookie对象 103 | * @return \CLib\Cookie 104 | */ 105 | function class_cookie(){ 106 | static $cookie = NULL; 107 | if($cookie !== NULL){ 108 | return $cookie; 109 | } 110 | $lib = c_lib(); 111 | $cookie = $lib->using('CCookie'); 112 | if($cookie === false){ 113 | $lib->load('cookie'); 114 | $cookie = new \CLib\Cookie(cfg()->get('cookie', 'enable'), cfg()->get('cookie', 'key')); 115 | $lib->add("CCookie", $cookie); 116 | } 117 | return $cookie; 118 | } -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushBash.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'if fi then elif else for do done until while break continue case function return in eq ne ge le'; 25 | var commands = 'alias apropos awk basename bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot' + 26 | 'cksum clear cmp comm command cp cron crontab csplit cut date dc dd ddrescue declare df ' + 27 | 'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' + 28 | 'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' + 29 | 'free fsck ftp gawk getopts grep groups gzip hash head history hostname id ifconfig ' + 30 | 'import install join kill less let ln local locate logname logout look lpc lpr lprint ' + 31 | 'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' + 32 | 'mv netstat nice nl nohup nslookup open op passwd paste pathchk ping popd pr printcap ' + 33 | 'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' + 34 | 'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' + 35 | 'sleep sort source split ssh strace su sudo sum symlink sync tail tar tee test time ' + 36 | 'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' + 37 | 'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' + 38 | 'vi watch wc whereis which who whoami Wget xargs yes' 39 | ; 40 | 41 | this.regexList = [ 42 | { regex: /^#!.*$/gm, css: 'preprocessor bold' }, 43 | { regex: /\/[\w-\/]+/gm, css: 'plain' }, 44 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments 45 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 46 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 47 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 48 | { regex: new RegExp(this.getKeywords(commands), 'gm'), css: 'functions' } // commands 49 | ]; 50 | } 51 | 52 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 53 | Brush.aliases = ['bash', 'shell']; 54 | 55 | SyntaxHighlighter.brushes.Bash = Brush; 56 | 57 | // CommonJS 58 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 59 | })(); 60 | -------------------------------------------------------------------------------- /sys/config.php: -------------------------------------------------------------------------------- 1 | driver = class_db()->getDriver(); 24 | } 25 | 26 | /** 27 | * 返回数据库驱动 28 | * @return Sql 29 | */ 30 | public function getDriver(){ 31 | return $this->driver; 32 | } 33 | 34 | /** 35 | * 返回数据库的错误信息 36 | * @return array 37 | */ 38 | public function get_error(){ 39 | return $this->driver->error(); 40 | } 41 | 42 | 43 | /** 44 | * 返回用户注册ID 45 | * @param string $m_name 46 | * @param string $m_email 47 | * @param string $m_avatar 48 | * @param string $m_salt 49 | * @param string $m_password 50 | * @param string $m_login_token 51 | * @param int $m_login_expire 52 | * @return int 53 | */ 54 | public function insert($m_name, $m_email, $m_avatar, $m_salt = "", $m_password = "", $m_login_token = "", $m_login_expire = 0){ 55 | return $this->driver->insert("member", compact('m_name', 'm_salt', 'm_avatar', 'm_email', 'm_password', 'm_login_token', 'm_login_expire')); 56 | } 57 | 58 | 59 | /** 60 | * 获取最近的一条记录 61 | * @param int $m_id 62 | * @return array|bool 63 | */ 64 | public function get_base_info($m_id){ 65 | return $this->driver->get("member", '*', ['m_id' => $m_id]); 66 | } 67 | 68 | /** 69 | * 获取最近的一条记录 70 | * @param int $access_token 71 | * @return array|bool 72 | */ 73 | public function get_base_info_by_access_token($access_token){ 74 | return $this->driver->get("member", '*', ['m_access_token' => $access_token]); 75 | } 76 | 77 | /** 78 | * 获取最近的一条记录 79 | * @param int $email 80 | * @return array|bool 81 | */ 82 | public function get_base_info_by_email($email){ 83 | return $this->driver->get("member", '*', ['m_email' => $email]); 84 | } 85 | 86 | /** 87 | * 通过Email更新数据 88 | * @param $email 89 | * @param $data 90 | * @return int 91 | */ 92 | public function update_by_email($email, $data){ 93 | return $this->driver->update("member", $data, ['m_email' => $email]); 94 | } 95 | 96 | /** 97 | * 通过ID更新数据 98 | * @param int $id 99 | * @param array $data 100 | * @return int 101 | */ 102 | public function update_by_id($id, $data){ 103 | return $this->driver->update("member", $data, ['m_id' => intval($id)]); 104 | } 105 | 106 | /** 107 | * 更新用户Token 108 | * @param int $m_id 109 | * @param string $m_login_token 110 | * @param int $m_login_expire 111 | * @return bool 112 | */ 113 | public function update_token($m_id, $m_login_token, $m_login_expire){ 114 | return $this->driver->update("member", compact('m_login_token', 'm_login_expire'), compact('m_id')) === 1; 115 | } 116 | 117 | /** 118 | * 判断某个邮箱是否已经注册 119 | * @param string $email 120 | * @return bool 121 | */ 122 | public function has_email($email){ 123 | return $this->driver->has("member", ['m_email' => $email]); 124 | } 125 | } -------------------------------------------------------------------------------- /app/page.my/OAuth2.php: -------------------------------------------------------------------------------- 1 | load(_RootPath_ . "/config/oauth2.php"); 20 | if(isset($cfg['OAuth2'])){ 21 | $this->oauth_config = $cfg['OAuth2']; 22 | } else{ 23 | $this->oauth_config = false; 24 | } 25 | } 26 | 27 | public function google_login(){ 28 | if(!isset($this->oauth_config['google'])){ 29 | $this->error("谷歌登录未启用"); 30 | return; 31 | } 32 | $state = md5(rand() . NOW_TIME); 33 | class_session()->set("oauth2_google_state", $state); 34 | $cfg = $this->oauth_config['google']; 35 | redirect($cfg['auth_uri'] . "?" . http_build_query([ 36 | 'client_id' => $cfg['client_id'], 37 | 'response_type' => 'code', 38 | 'scope' => 'profile email', 39 | 'redirect_uri' => $cfg['redirect_uris'][0], 40 | 'state' => $state 41 | ]), 'refresh', 302, false); 42 | } 43 | 44 | public function google_callback(){ 45 | if(!isset($this->oauth_config['google'])){ 46 | $this->error("谷歌登录未启用"); 47 | return; 48 | } 49 | $state = $this->__req->get('state'); 50 | $code = $this->__req->get('code'); 51 | if(empty($state) || empty($code)){ 52 | $this->error("服务器未返回任何可用数据"); 53 | return; 54 | } 55 | if(class_session()->get('oauth2_google_state') !== $state){ 56 | $this->error("服务器返回的验证数据无效"); 57 | return; 58 | } 59 | $this->__lib->load('OAuth2/Google'); 60 | $google = new Google($this->oauth_config['google']); 61 | if(!$google->readData($code)){ 62 | //无法从远程服务器读取数据,意味着失败 63 | $this->error($google->getError()); 64 | return; 65 | } 66 | if($google->isMember()){ 67 | //获取登录用户ID进行登录 68 | class_member()->oauth2login($google->getMemberId(), "google"); 69 | redirect(get_url(), "refresh", 302, false);//重新跳转到用户首页 70 | return; 71 | } 72 | if(!$google->getEmailVerified()){ 73 | //也就是在用户登录过程中已注册的账户不验证其是否注册 74 | $this->error("该用户邮箱未经过验证禁止登录"); 75 | return; 76 | } 77 | 78 | //开始注册 79 | $name = $google->getName(); 80 | if(empty($name)){ 81 | //无法获取用户的名称 82 | $this->error($google->getError()); 83 | return; 84 | } 85 | 86 | $member = class_member(); 87 | //将数据注册到用户表 88 | $m_id = $member->register($name, $google->getEmail(), $member->createAvatarStore($google->getAvatar(), "google")); 89 | 90 | if(!$m_id){ 91 | //如果无法创建用户数据 92 | $this->error($member->getError()); 93 | } else{ 94 | //插入用户数据到Google数据表 95 | if(!$google->insertMember($m_id)){ 96 | $this->error($google->getError()); 97 | } else{ 98 | //成功注册数据 99 | $member->oauth2login($m_id, "google"); 100 | redirect(get_url(), "refresh", 302, false);//重新跳转到用户首页 101 | } 102 | } 103 | } 104 | 105 | /** 106 | * 调用错误输出 107 | * @param string $msg 108 | */ 109 | private function error($msg){ 110 | header("Content-Type: text/html; charset=utf-8"); 111 | $this->__view("home/server_error.php", ['msg' => $msg]); 112 | } 113 | 114 | 115 | } -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushGroovy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Andres Almiray 25 | // http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter 26 | 27 | var keywords = 'as assert break case catch class continue def default do else extends finally ' + 28 | 'if in implements import instanceof interface new package property return switch ' + 29 | 'throw throws try while public protected private static'; 30 | var types = 'void boolean byte char short int long float double'; 31 | var constants = 'null'; 32 | var methods = 'allProperties count get size '+ 33 | 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' + 34 | 'findIndexOf grep inject max min reverseEach sort ' + 35 | 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' + 36 | 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' + 37 | 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' + 38 | 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' + 39 | 'transformChar transformLine withOutputStream withPrintWriter withStream ' + 40 | 'withStreams withWriter withWriterAppend write writeLine '+ 41 | 'dump inspect invokeMethod print println step times upto use waitForOrKill '+ 42 | 'getText'; 43 | 44 | this.regexList = [ 45 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 46 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 47 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 48 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 49 | { regex: /""".*"""/g, css: 'string' }, // GStrings 50 | { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'value' }, // numbers 51 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword 52 | { regex: new RegExp(this.getKeywords(types), 'gm'), css: 'color1' }, // goovy/java type 53 | { regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' }, // constants 54 | { regex: new RegExp(this.getKeywords(methods), 'gm'), css: 'functions' } // methods 55 | ]; 56 | 57 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 58 | } 59 | 60 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 61 | Brush.aliases = ['groovy']; 62 | 63 | SyntaxHighlighter.brushes.Groovy = Brush; 64 | 65 | // CommonJS 66 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 67 | })(); 68 | -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushSql.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var funcs = 'abs avg case cast coalesce convert count current_timestamp ' + 25 | 'current_user day isnull left lower month nullif replace right ' + 26 | 'session_user space substring sum system_user upper user year'; 27 | 28 | var keywords = 'absolute action add after alter as asc at authorization begin bigint ' + 29 | 'binary bit by cascade char character check checkpoint close collate ' + 30 | 'column commit committed connect connection constraint contains continue ' + 31 | 'create cube current current_date current_time cursor database date ' + 32 | 'deallocate dec decimal declare default delete desc distinct double drop ' + 33 | 'dynamic else end end-exec escape except exec execute false fetch first ' + 34 | 'float for force foreign forward free from full function global goto grant ' + 35 | 'group grouping having hour ignore index inner insensitive insert instead ' + 36 | 'int integer intersect into is isolation key last level load local max min ' + 37 | 'minute modify move name national nchar next no numeric of off on only ' + 38 | 'open option order out output partial password precision prepare primary ' + 39 | 'prior privileges procedure public read real references relative repeatable ' + 40 | 'restrict return returns revoke rollback rollup rows rule schema scroll ' + 41 | 'second section select sequence serializable set size smallint static ' + 42 | 'statistics table temp temporary then time timestamp to top transaction ' + 43 | 'translation trigger true truncate uncommitted union unique update values ' + 44 | 'varchar varying view when where with work'; 45 | 46 | var operators = 'all and any between cross in join like not null or outer some'; 47 | 48 | this.regexList = [ 49 | { regex: /--(.*)$/gm, css: 'comments' }, // one line and multiline comments 50 | { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings 51 | { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // single quoted strings 52 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'color2' }, // functions 53 | { regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such 54 | { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword 55 | ]; 56 | }; 57 | 58 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 59 | Brush.aliases = ['sql']; 60 | 61 | SyntaxHighlighter.brushes.Sql = Brush; 62 | 63 | // CommonJS 64 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 65 | })(); 66 | 67 | -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/src/shAutoloader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | (function() { 18 | 19 | var sh = SyntaxHighlighter; 20 | 21 | /** 22 | * Provides functionality to dynamically load only the brushes that a needed to render the current page. 23 | * 24 | * There are two syntaxes that autoload understands. For example: 25 | * 26 | * SyntaxHighlighter.autoloader( 27 | * [ 'applescript', 'Scripts/shBrushAppleScript.js' ], 28 | * [ 'actionscript3', 'as3', 'Scripts/shBrushAS3.js' ] 29 | * ); 30 | * 31 | * or a more easily comprehendable one: 32 | * 33 | * SyntaxHighlighter.autoloader( 34 | * 'applescript Scripts/shBrushAppleScript.js', 35 | * 'actionscript3 as3 Scripts/shBrushAS3.js' 36 | * ); 37 | */ 38 | sh.autoloader = function() 39 | { 40 | var list = arguments, 41 | elements = sh.findElements(), 42 | brushes = {}, 43 | scripts = {}, 44 | all = SyntaxHighlighter.all, 45 | allCalled = false, 46 | allParams = null, 47 | i 48 | ; 49 | 50 | SyntaxHighlighter.all = function(params) 51 | { 52 | allParams = params; 53 | allCalled = true; 54 | }; 55 | 56 | function addBrush(aliases, url) 57 | { 58 | for (var i = 0; i < aliases.length; i++) 59 | brushes[aliases[i]] = url; 60 | }; 61 | 62 | function getAliases(item) 63 | { 64 | return item.pop 65 | ? item 66 | : item.split(/\s+/) 67 | ; 68 | } 69 | 70 | // create table of aliases and script urls 71 | for (i = 0; i < list.length; i++) 72 | { 73 | var aliases = getAliases(list[i]), 74 | url = aliases.pop() 75 | ; 76 | 77 | addBrush(aliases, url); 78 | } 79 | 80 | // dynamically add 97 |
98 | get_footer(); -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/styles/shThemeEclipse.css: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | .syntaxhighlighter { 18 | background-color: white !important; 19 | } 20 | .syntaxhighlighter .line.alt1 { 21 | background-color: white !important; 22 | } 23 | .syntaxhighlighter .line.alt2 { 24 | background-color: white !important; 25 | } 26 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { 27 | background-color: #c3defe !important; 28 | } 29 | .syntaxhighlighter .line.highlighted.number { 30 | color: white !important; 31 | } 32 | .syntaxhighlighter table caption { 33 | color: black !important; 34 | } 35 | .syntaxhighlighter .gutter { 36 | color: #787878 !important; 37 | } 38 | .syntaxhighlighter .gutter .line { 39 | border-right: 3px solid #d4d0c8 !important; 40 | } 41 | .syntaxhighlighter .gutter .line.highlighted { 42 | background-color: #d4d0c8 !important; 43 | color: white !important; 44 | } 45 | .syntaxhighlighter.printing .line .content { 46 | border: none !important; 47 | } 48 | .syntaxhighlighter.collapsed { 49 | overflow: visible !important; 50 | } 51 | .syntaxhighlighter.collapsed .toolbar { 52 | color: #3f5fbf !important; 53 | background: white !important; 54 | border: 1px solid #d4d0c8 !important; 55 | } 56 | .syntaxhighlighter.collapsed .toolbar a { 57 | color: #3f5fbf !important; 58 | } 59 | .syntaxhighlighter.collapsed .toolbar a:hover { 60 | color: #aa7700 !important; 61 | } 62 | .syntaxhighlighter .toolbar { 63 | color: #a0a0a0 !important; 64 | background: #d4d0c8 !important; 65 | border: none !important; 66 | } 67 | .syntaxhighlighter .toolbar a { 68 | color: #a0a0a0 !important; 69 | } 70 | .syntaxhighlighter .toolbar a:hover { 71 | color: red !important; 72 | } 73 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a { 74 | color: black !important; 75 | } 76 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a { 77 | color: #3f5fbf !important; 78 | } 79 | .syntaxhighlighter .string, .syntaxhighlighter .string a { 80 | color: #2a00ff !important; 81 | } 82 | .syntaxhighlighter .keyword { 83 | color: #7f0055 !important; 84 | } 85 | .syntaxhighlighter .preprocessor { 86 | color: #646464 !important; 87 | } 88 | .syntaxhighlighter .variable { 89 | color: #aa7700 !important; 90 | } 91 | .syntaxhighlighter .value { 92 | color: #009900 !important; 93 | } 94 | .syntaxhighlighter .functions { 95 | color: #ff1493 !important; 96 | } 97 | .syntaxhighlighter .constants { 98 | color: #0066cc !important; 99 | } 100 | .syntaxhighlighter .script { 101 | font-weight: bold !important; 102 | color: #7f0055 !important; 103 | background-color: none !important; 104 | } 105 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { 106 | color: gray !important; 107 | } 108 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { 109 | color: #ff1493 !important; 110 | } 111 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { 112 | color: red !important; 113 | } 114 | 115 | .syntaxhighlighter .keyword { 116 | font-weight: bold !important; 117 | } 118 | .syntaxhighlighter .xml .keyword { 119 | color: #3f7f7f !important; 120 | font-weight: normal !important; 121 | } 122 | .syntaxhighlighter .xml .color1, .syntaxhighlighter .xml .color1 a { 123 | color: #7f007f !important; 124 | } 125 | .syntaxhighlighter .xml .string { 126 | font-style: italic !important; 127 | color: #2a00ff !important; 128 | } 129 | -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/scripts/shBrushPowerShell.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributes by B.v.Zanten, Getronics 25 | // http://confluence.atlassian.com/display/CONFEXT/New+Code+Macro 26 | 27 | var keywords = 'Add-Content Add-History Add-Member Add-PSSnapin Clear(-Content)? Clear-Item ' + 28 | 'Clear-ItemProperty Clear-Variable Compare-Object ConvertFrom-SecureString Convert-Path ' + 29 | 'ConvertTo-Html ConvertTo-SecureString Copy(-Item)? Copy-ItemProperty Export-Alias ' + 30 | 'Export-Clixml Export-Console Export-Csv ForEach(-Object)? Format-Custom Format-List ' + 31 | 'Format-Table Format-Wide Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command ' + 32 | 'Get-Content Get-Credential Get-Culture Get-Date Get-EventLog Get-ExecutionPolicy ' + 33 | 'Get-Help Get-History Get-Host Get-Item Get-ItemProperty Get-Location Get-Member ' + 34 | 'Get-PfxCertificate Get-Process Get-PSDrive Get-PSProvider Get-PSSnapin Get-Service ' + 35 | 'Get-TraceSource Get-UICulture Get-Unique Get-Variable Get-WmiObject Group-Object ' + 36 | 'Import-Alias Import-Clixml Import-Csv Invoke-Expression Invoke-History Invoke-Item ' + 37 | 'Join-Path Measure-Command Measure-Object Move(-Item)? Move-ItemProperty New-Alias ' + 38 | 'New-Item New-ItemProperty New-Object New-PSDrive New-Service New-TimeSpan ' + 39 | 'New-Variable Out-Default Out-File Out-Host Out-Null Out-Printer Out-String Pop-Location ' + 40 | 'Push-Location Read-Host Remove-Item Remove-ItemProperty Remove-PSDrive Remove-PSSnapin ' + 41 | 'Remove-Variable Rename-Item Rename-ItemProperty Resolve-Path Restart-Service Resume-Service ' + 42 | 'Select-Object Select-String Set-Acl Set-Alias Set-AuthenticodeSignature Set-Content ' + 43 | 'Set-Date Set-ExecutionPolicy Set-Item Set-ItemProperty Set-Location Set-PSDebug ' + 44 | 'Set-Service Set-TraceSource Set(-Variable)? Sort-Object Split-Path Start-Service ' + 45 | 'Start-Sleep Start-Transcript Stop-Process Stop-Service Stop-Transcript Suspend-Service ' + 46 | 'Tee-Object Test-Path Trace-Command Update-FormatData Update-TypeData Where(-Object)? ' + 47 | 'Write-Debug Write-Error Write(-Host)? Write-Output Write-Progress Write-Verbose Write-Warning'; 48 | var alias = 'ac asnp clc cli clp clv cpi cpp cvpa diff epal epcsv fc fl ' + 49 | 'ft fw gal gc gci gcm gdr ghy gi gl gm gp gps group gsv ' + 50 | 'gsnp gu gv gwmi iex ihy ii ipal ipcsv mi mp nal ndr ni nv oh rdr ' + 51 | 'ri rni rnp rp rsnp rv rvpa sal sasv sc select si sl sleep sort sp ' + 52 | 'spps spsv sv tee cat cd cp h history kill lp ls ' + 53 | 'mount mv popd ps pushd pwd r rm rmdir echo cls chdir del dir ' + 54 | 'erase rd ren type % \\?'; 55 | 56 | this.regexList = [ 57 | { regex: /#.*$/gm, css: 'comments' }, // one line comments 58 | { regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // variables $Computer1 59 | { regex: /\-[a-zA-Z]+\b/g, css: 'keyword' }, // Operators -not -and -eq 60 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 61 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 62 | { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' }, 63 | { regex: new RegExp(this.getKeywords(alias), 'gmi'), css: 'keyword' } 64 | ]; 65 | }; 66 | 67 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 68 | Brush.aliases = ['powershell', 'ps']; 69 | 70 | SyntaxHighlighter.brushes.PowerShell = Brush; 71 | 72 | // CommonJS 73 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 74 | })(); 75 | -------------------------------------------------------------------------------- /app/view/my/register.php: -------------------------------------------------------------------------------- 1 | get_header("用户注册"); 10 | ?> 11 |
12 |
13 |
14 | 注册 15 |
16 | 17 |

18 | 19 |
20 |
21 | 22 | 23 |
24 |
邮箱
25 | 26 |
27 |
28 |
29 | 30 | 31 |
32 |
名称
33 | 34 |
35 |
36 |
37 | 38 | 39 |
40 |
密码
41 | 42 |
43 |
44 |
45 | 46 | 47 |
48 |
验证码
49 | 50 | 51 |
52 |
53 |
54 |
55 | 56 |
57 |
58 |
59 |
60 | 124 | 125 | get_footer(); -------------------------------------------------------------------------------- /web/asset/plugins/syntaxhighlighter/src/shLegacy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | var dp = { 18 | SyntaxHighlighter : {} 19 | }; 20 | 21 | dp.SyntaxHighlighter = { 22 | parseParams: function( 23 | input, 24 | showGutter, 25 | showControls, 26 | collapseAll, 27 | firstLine, 28 | showColumns 29 | ) 30 | { 31 | function getValue(list, name) 32 | { 33 | var regex = new XRegExp('^' + name + '\\[(?\\w+)\\]$', 'gi'), 34 | match = null 35 | ; 36 | 37 | for (var i = 0; i < list.length; i++) 38 | if ((match = regex.exec(list[i])) != null) 39 | return match.value; 40 | 41 | return null; 42 | }; 43 | 44 | function defaultValue(value, def) 45 | { 46 | return value != null ? value : def; 47 | }; 48 | 49 | function asString(value) 50 | { 51 | return value != null ? value.toString() : null; 52 | }; 53 | 54 | var parts = input.split(':'), 55 | brushName = parts[0], 56 | options = {}, 57 | straight = { 'true' : true } 58 | reverse = { 'true' : false }, 59 | result = null, 60 | defaults = SyntaxHighlighter.defaults 61 | ; 62 | 63 | for (var i in parts) 64 | options[parts[i]] = 'true'; 65 | 66 | showGutter = asString(defaultValue(showGutter, defaults.gutter)); 67 | showControls = asString(defaultValue(showControls, defaults.toolbar)); 68 | collapseAll = asString(defaultValue(collapseAll, defaults.collapse)); 69 | showColumns = asString(defaultValue(showColumns, defaults.ruler)); 70 | firstLine = asString(defaultValue(firstLine, defaults['first-line'])); 71 | 72 | return { 73 | brush : brushName, 74 | gutter : defaultValue(reverse[options.nogutter], showGutter), 75 | toolbar : defaultValue(reverse[options.nocontrols], showControls), 76 | collapse : defaultValue(straight[options.collapse], collapseAll), 77 | // ruler : defaultValue(straight[options.showcolumns], showColumns), 78 | 'first-line' : defaultValue(getValue(parts, 'firstline'), firstLine) 79 | }; 80 | }, 81 | 82 | HighlightAll: function( 83 | name, 84 | showGutter /* optional */, 85 | showControls /* optional */, 86 | collapseAll /* optional */, 87 | firstLine /* optional */, 88 | showColumns /* optional */ 89 | ) 90 | { 91 | function findValue() 92 | { 93 | var a = arguments; 94 | 95 | for (var i = 0; i < a.length; i++) 96 | { 97 | if (a[i] === null) 98 | continue; 99 | 100 | if (typeof(a[i]) == 'string' && a[i] != '') 101 | return a[i] + ''; 102 | 103 | if (typeof(a[i]) == 'object' && a[i].value != '') 104 | return a[i].value + ''; 105 | } 106 | 107 | return null; 108 | }; 109 | 110 | function findTagsByName(list, name, tagName) 111 | { 112 | var tags = document.getElementsByTagName(tagName); 113 | 114 | for (var i = 0; i < tags.length; i++) 115 | if (tags[i].getAttribute('name') == name) 116 | list.push(tags[i]); 117 | } 118 | 119 | var elements = [], 120 | highlighter = null, 121 | registered = {}, 122 | propertyName = 'innerHTML' 123 | ; 124 | 125 | // for some reason IE doesn't find
 by name, however it does see them just fine by tag name... 
126 | 		findTagsByName(elements, name, 'pre');
127 | 		findTagsByName(elements, name, 'textarea');
128 | 
129 | 		if (elements.length === 0)
130 | 			return;
131 | 		
132 | 		for (var i = 0; i < elements.length; i++)
133 | 		{
134 | 			var element = elements[i],
135 | 				params = findValue(
136 | 					element.attributes['class'], element.className, 
137 | 					element.attributes['language'], element.language
138 | 					),
139 | 				language = ''
140 | 				;
141 | 			
142 | 			if (params === null) 
143 | 				continue;
144 | 
145 | 			params = dp.SyntaxHighlighter.parseParams(
146 | 				params,
147 | 				showGutter, 
148 | 				showControls, 
149 | 				collapseAll, 
150 | 				firstLine, 
151 | 				showColumns
152 | 				);
153 | 
154 | 			SyntaxHighlighter.highlight(params, element);
155 | 		}
156 | 	}
157 | };
158 | 


--------------------------------------------------------------------------------
/app/lib/Share/ShareFile.php:
--------------------------------------------------------------------------------
  1 | share_type = $share_type;
 37 | 		parent::__construct();
 38 | 	}
 39 | 
 40 | 	/**
 41 | 	 * 设置对应要分享的内容
 42 | 	 * @param mixed $data
 43 | 	 * @return bool 设置的状态
 44 | 	 */
 45 | 	public function setData($data){
 46 | 		c_lib()->load('upload');
 47 | 		$upload = new Upload(array_merge([
 48 | 			'root_path' => _DATA_FILE_,
 49 | 			'max_size' => 1024 * 1024,
 50 | 			'sub_status' => true,
 51 | 			'make_hash' => true,
 52 | 			'save_ext' => 'dt',
 53 | 			'replace' => 'true',
 54 | 			'sub_path' => [
 55 | 				function ($info){
 56 | 					return implode("/", str_split(substr($info['md5'], 0, 4), 2));
 57 | 				},
 58 | 				'__FILE_INFO__'
 59 | 			],
 60 | 			'name_callback' => [
 61 | 				function ($info){
 62 | 					return $info['md5'] . "_" . $info['sha1'];
 63 | 				},
 64 | 				'__FILE_INFO__'
 65 | 			]
 66 | 		], $this->upload_config), 'Local', ['server_root_path' => _RootPath_]);
 67 | 		try{
 68 | 			$info = $upload->uploadOne($data);
 69 | 			$type = mime_get($info['ext']);
 70 | 			if($type != $info['type'] && !empty($type) && (empty($info['type']) || $info['type'] == "application/octet-stream")){
 71 | 				$info['type'] = $type;
 72 | 			}
 73 | 			$this->info = $info;//用于子类处理数据
 74 | 			return class_db()->d_share_file_insert($this->base_data['s_id'], $info['md5'], $info['sha1'], $info['name'], $info['type'], $info['size'], $info['save_name'], $info['save_path']);
 75 | 		} catch(\Exception $ex){
 76 | 			Log::write($ex->getMessage());
 77 | 			return false;
 78 | 		}
 79 | 	}
 80 | 
 81 | 	/**
 82 | 	 * 初始化拓展基本信息
 83 | 	 * @throws \Exception
 84 | 	 * @return void
 85 | 	 */
 86 | 	public function initExtData(){
 87 | 		$this->info = class_db()->d_share_file_get($this->base_data['s_id']);
 88 | 		if(!isset($this->info['s_id'])){
 89 | 			throw new \Exception("数据获取异常");
 90 | 		}
 91 | 	}
 92 | 
 93 | 	/**
 94 | 	 * 返回主要的信息
 95 | 	 * @return mixed
 96 | 	 */
 97 | 	public function getPrimaryData(){
 98 | 		return $this->info;
 99 | 	}
100 | 
101 | 	/**
102 | 	 * 开始下载当前文件
103 | 	 */
104 | 	public function downloadFile(){
105 | 		$name = _RootPath_ . _DATA_FILE_ . "/" . $this->info['sf_save_path'] . $this->info['sf_save_name'];
106 | 		if(!file_exists($name)){
107 | 			return "服务器文件丢失";
108 | 		}
109 | 		if(!is_readable($name)){
110 | 			return "服务器文件读取失败";
111 | 		}
112 | 		if(empty($this->info['sf_type'])){
113 | 			header("Content-Disposition: attachment; filename=" . $this->info['sf_name']);
114 | 		} else{
115 | 			header("Content-Disposition: inline; filename=" . $this->info['sf_name']);
116 | 		}
117 | 		header("Content-Type: " . (empty($this->info['sf_type']) ? "application/force-download" : $this->info['sf_type']) . ";");
118 | 		header("Content-Length: " . $this->info['sf_size']);
119 | 		flush();
120 | 		$fp = fopen($name, "r");
121 | 		while(!feof($fp)){
122 | 			echo fread($fp, 65536);
123 | 			flush();
124 | 		}
125 | 		fclose($fp);
126 | 		return true;
127 | 	}
128 | 
129 | 	/**
130 | 	 * 返回Base64编码的链接
131 | 	 * @return false|string
132 | 	 */
133 | 	public function getBase64Encode(){
134 | 		$name = _RootPath_ . _DATA_FILE_ . "/" . $this->info['sf_save_path'] . $this->info['sf_save_name'];
135 | 		if(!file_exists($name) || !is_readable($name)){
136 | 			return false;
137 | 		}
138 | 		$data = base64_encode(file_get_contents($name));
139 | 		return "data:" . (empty($this->info['sf_type']) ? "application/force-download" : $this->info['sf_type']) . ";base64," . $data;
140 | 	}
141 | 
142 | 	/**
143 | 	 * 返回文件名
144 | 	 * @return string
145 | 	 */
146 | 	public function getFileName(){
147 | 		return $this->info['sf_name'];
148 | 	}
149 | 
150 | 	/**
151 | 	 * 返回文件大小
152 | 	 * @return int
153 | 	 */
154 | 	public function getFileSize(){
155 | 		return $this->info['sf_size'];
156 | 	}
157 | 
158 | 	/**
159 | 	 * 返回一个可读的文件大小
160 | 	 * @return string
161 | 	 */
162 | 	public function getFileReadSize(){
163 | 		return file_h_size($this->info['sf_size']);
164 | 	}
165 | }


--------------------------------------------------------------------------------
/app/lib/Share/ShareMultiText.php:
--------------------------------------------------------------------------------
  1 | share_type = self::TYPE_MULTI_TEXT;
 42 | 		parent::__construct();
 43 | 	}
 44 | 
 45 | 
 46 | 	/**
 47 | 	 * 设置当前的分享字符串集
 48 | 	 * @param string $text
 49 | 	 * @return bool
 50 | 	 */
 51 | 	public function setText($text){
 52 | 		$list = explode("\n", $text);
 53 | 		$text_list = [];
 54 | 		foreach($list as $v){
 55 | 			$v = trim((string)$v);
 56 | 			if($v === ""){
 57 | 				continue;
 58 | 			}
 59 | 			$text_list[] = $v;
 60 | 		}
 61 | 		if(empty($text_list)){
 62 | 			return false;
 63 | 		}
 64 | 		$this->text = $text_list;
 65 | 		return true;
 66 | 	}
 67 | 
 68 | 	/**
 69 | 	 * 重写创建类,添加更多信息
 70 | 	 * @param int  $mid
 71 | 	 * @param null $more
 72 | 	 * @return bool
 73 | 	 */
 74 | 	public function create($mid, $more = NULL){
 75 | 		$c = count($this->text);
 76 | 		if($c < 1){
 77 | 			return false;
 78 | 		}
 79 | 		//多一次是为防止数据查看完后无法继续查看的问题,该数据为特殊数据
 80 | 		return parent::create($mid, ['s_share_max' => $c+1]);
 81 | 	}
 82 | 
 83 | 	/**
 84 | 	 * 重新检查数据
 85 | 	 * @return int
 86 | 	 */
 87 | 	public function activeCheck(){
 88 | 		$rt = parent::activeCheck();
 89 | 		if($rt != self::ACTIVE_NORMAL){
 90 | 			return $rt;
 91 | 		}
 92 | 		c_lib()->load('ip');
 93 | 		$this->now_ip = Ip::getInstance()->realip();
 94 | 		$this->last_visit_data = class_db()->d_share_multi_text_map_get_last($this->base_data['s_id'], $this->now_ip);
 95 | 		if(isset($this->last_visit_data['smtm_ip'])){
 96 | 			//纯在最后访问数据,为重复访问
 97 | 			if($this->expire == 0 || $this->last_visit_data['smtm_time'] + $this->expire > NOW_TIME){
 98 | 				//未超时
 99 | 				$this->index = $this->last_visit_data['smt_index'];//当前访问序列变为原始序列
100 | 				return self::ACTIVE_NORMAL;
101 | 			}
102 | 		}
103 | 
104 | 		if($this->index >= $this->max_count || !isset($this->text[$this->index])){
105 | 			$this->active_error_msg = "当前分享已无效,数据分享完毕";
106 | 			return self::ACTIVE_LIMIT;
107 | 		}
108 | 
109 | 		//添加新记录
110 | 		$this->new_index = $this->index + 1;
111 | 
112 | 		return self::ACTIVE_NORMAL;
113 | 	}
114 | 
115 | 	/**
116 | 	 * 重写激活设置操作
117 | 	 */
118 | 	public function activeSet(){
119 | 		if($this->base_object->getMid() === 0 || $this->base_object->getMid() !== class_member()->getUid()){
120 | 			//开始设置访问数据
121 | 			if(is_int($this->new_index) && $this->new_index >= 0){
122 | 				//判断新的索引是否变化
123 | 				parent::activeSet();//原纪录访问
124 | 				$db = class_db();
125 | 				$db->d_share_multi_text_update($this->base_data['s_id'], ['smt_index[+]' => 1]);
126 | 				$db->d_share_multi_text_map_insert($this->base_data['s_id'], $this->now_ip, NOW_TIME, $this->index, 1);
127 | 			} else{
128 | 				//更新计数器
129 | 				class_db()->d_share_multi_text_map_update_count($this->last_visit_data['s_id'], $this->last_visit_data['smtm_ip'], $this->last_visit_data['smtm_time']);
130 | 			}
131 | 		}
132 | 	}
133 | 
134 | 
135 | 	/**
136 | 	 * 设置对应要分享的内容
137 | 	 * @param mixed $data
138 | 	 * @return bool 设置的状态
139 | 	 */
140 | 	public function setData($data){
141 | 		/**
142 | 		 * 设置一天的超时
143 | 		 */
144 | 		return class_db()->d_share_multi_text_insert($this->base_data['s_id'], implode("\n", $this->text), count($this->text), 24 * 3600);
145 | 	}
146 | 
147 | 	/**
148 | 	 * 初始化拓展基本信息
149 | 	 * @throws \Exception
150 | 	 * @return void
151 | 	 */
152 | 	public function initExtData(){
153 | 		$ex_data = class_db()->d_share_multi_text_get($this->base_data['s_id']);
154 | 		if(!isset($ex_data['s_id'])){
155 | 			throw new \Exception("数据获取异常");
156 | 		}
157 | 		$this->text = explode("\n", $ex_data['smt_text']);
158 | 		$this->index = $ex_data['smt_index'];
159 | 		$this->max_count = $ex_data['smt_max'];
160 | 		$this->expire = $ex_data['smt_expire'];
161 | 	}
162 | 
163 | 	/**
164 | 	 * 返回主要的信息
165 | 	 * @return mixed
166 | 	 */
167 | 	public function getPrimaryData(){
168 | 		if(!isset($this->text[$this->index])){
169 | 			false;
170 | 		}
171 | 		return $this->text[$this->index];
172 | 	}
173 | 
174 | 	/**
175 | 	 * @return string
176 | 	 */
177 | 	public function getNowIp(){
178 | 		return $this->now_ip;
179 | 	}
180 | 
181 | }


--------------------------------------------------------------------------------
/app/view/add/picture.php:
--------------------------------------------------------------------------------
  1 | get_header("分享一张图片");
  6 | ?>
  7 | 	
118 | get_footer();


--------------------------------------------------------------------------------
/app/lib/Page.php:
--------------------------------------------------------------------------------
  1 | __core->getHook();
 27 | 		$hook->add('header_hook', "ULib\\Page::__out_header");
 28 | 		$hook->add('footer_hook', "ULib\\Page::__out_footer");
 29 | 	}
 30 | 
 31 | 	/**
 32 | 	 * 加载头文件
 33 | 	 * @param mixed $info 包含的信息,默认为字符串标签
 34 | 	 */
 35 | 	public function get_header($info = NULL){
 36 | 		if(is_string($info)){
 37 | 			$this->setTitle($info);
 38 | 		} else if(is_array($info)){
 39 | 			if(isset($info['title'])){
 40 | 				if(is_array($info['title'])){
 41 | 					call_user_func_array([
 42 | 						$this,
 43 | 						'setTitle'
 44 | 					], $info['title']);
 45 | 				} else{
 46 | 					$this->setTitle($info['title']);
 47 | 				}
 48 | 			}
 49 | 			if(isset($info['js'])){
 50 | 				$this->_set_header($info['js'], 'js');
 51 | 			}
 52 | 			if(isset($info['css'])){
 53 | 				$this->_set_header($info['css'], 'css');
 54 | 			}
 55 | 			if(isset($info['data'])){
 56 | 				$this->_set_header($info['data'], 'data');
 57 | 			}
 58 | 		}
 59 | 		$this->__view($this->header_view_file);
 60 | 	}
 61 | 
 62 | 	protected function _set_header($data, $type = 'data'){
 63 | 		if(is_array($data)){
 64 | 			foreach($data as $v){
 65 | 				self::$_header[] = [
 66 | 					'data' => $v,
 67 | 					'type' => $type
 68 | 				];
 69 | 			}
 70 | 		} else{
 71 | 			self::$_header[] = compact('data', 'type');
 72 | 		}
 73 | 	}
 74 | 
 75 | 	protected function _set_footer($data, $type = 'data'){
 76 | 		if(is_array($data)){
 77 | 			foreach($data as $v){
 78 | 				self::$_footer[] = [
 79 | 					'data' => $v,
 80 | 					'type' => $type
 81 | 				];
 82 | 			}
 83 | 		} else{
 84 | 			self::$_footer[] = compact('data', 'type');
 85 | 		}
 86 | 	}
 87 | 
 88 | 	public static function __out_header(){
 89 | 		foreach(self::$_header as $v){
 90 | 			switch($v['type']){
 91 | 				case 'data':
 92 | 					echo $v['data'];
 93 | 					break;
 94 | 				case "js":
 95 | 					echo html_js(['src' => get_asset($v['data'])]), "\n";
 96 | 					break;
 97 | 				case "css":
 98 | 					echo html_css(['href' => get_asset($v['data'])]), "\n";
 99 | 					break;
100 | 			}
101 | 		}
102 | 	}
103 | 
104 | 	public static function __out_footer(){
105 | 		foreach(self::$_footer as $v){
106 | 			switch($v['type']){
107 | 				case 'data':
108 | 					echo $v['data'];
109 | 					break;
110 | 				case "js":
111 | 					echo html_js(['src' => get_asset($v['data'])]), "\n";
112 | 					break;
113 | 				case "css":
114 | 					echo html_css(['href' => get_asset($v['data'])]), "\n";
115 | 					break;
116 | 			}
117 | 		}
118 | 	}
119 | 
120 | 	public function get_footer($info = NULL){
121 | 		if(isset($info['js'])){
122 | 			$this->_set_footer($info['js'], 'js');
123 | 		}
124 | 		if(isset($info['css'])){
125 | 			$this->_set_footer($info['css'], 'css');
126 | 		}
127 | 		if(isset($info['data'])){
128 | 			$this->_set_footer($info['data'], 'data');
129 | 		}
130 | 		$this->__view($this->footer_view_file);
131 | 	}
132 | 
133 | 	/**
134 | 	 * 设置标题
135 | 	 * @param $title string
136 | 	 * @param $_     string 多级标题
137 | 	 */
138 | 	public function setTitle($title, $_ = NULL){
139 | 		$this->title = implode(" - ", func_get_args());
140 | 	}
141 | 
142 | 	public function getTitle(){
143 | 		if(empty($this->title)){
144 | 			return site_title() . " - " . site_desc();
145 | 		} else{
146 | 			return $this->title . " | " . site_title();
147 | 		}
148 | 	}
149 | 
150 | 	public function get_bootstrap($file, $version = '3.3.1', $cache_code = ''){
151 | 		$cdn = cfg()->get('cdn_list', 'bootstrap');
152 | 		if(!empty($cdn)){
153 | 			return $cdn . "/" . $file;
154 | 		}
155 | 		return $this->get_asset("bootstrap/{$version}/{$file}", $cache_code);
156 | 	}
157 | 
158 | 	/**
159 | 	 * 优先通过CDN读取,否则通过本地读取
160 | 	 * @param string $cdn_file
161 | 	 * @param string $cdn_name
162 | 	 * @param string $local_replace
163 | 	 * @param string $cache_code
164 | 	 * @return string
165 | 	 */
166 | 	public function get_cdn($cdn_file, $cdn_name, $local_replace = '', $cache_code = ''){
167 | 		$cdn_list = cfg()->get('cdn_list');
168 | 		if(!isset($cdn_list[$cdn_name])){
169 | 			return $this->get_asset($local_replace, $cache_code);
170 | 		}
171 | 		return $cdn_list[$cdn_name] . "/" . $cdn_file;
172 | 	}
173 | 
174 | 	/**
175 | 	 * 读取资源文件
176 | 	 * @param  string $file
177 | 	 * @param string  $cache_code
178 | 	 * @return string
179 | 	 */
180 | 	public function get_asset($file, $cache_code = ''){
181 | 		return get_asset($file, $cache_code);
182 | 	}
183 | 
184 | 	public static function __un_register(){
185 | 		return get_class_methods("ULib\\Page");
186 | 	}
187 | 
188 | }


--------------------------------------------------------------------------------
/app/lib/MailTemplate.php:
--------------------------------------------------------------------------------
  1 | get('mail_template') . "/" . trim((string)$path);
 59 | 		if(is_file($path) && is_readable($path)){
 60 | 			$this->content = $this->get_template($path);
 61 | 		} else{
 62 | 			throw(new \Exception(_("Template is not exists.")));
 63 | 		}
 64 | 	}
 65 | 
 66 | 	/**
 67 | 	 * @param $path
 68 | 	 * @return mixed
 69 | 	 */
 70 | 	private function get_template($path){
 71 | 		$content = file_get_contents($path);
 72 | 		$matches = $this->getParamList($content);
 73 | 		$system_array = $this->getSystemParams();
 74 | 		for($i = 0; $i < count($matches[1]); $i++){
 75 | 			if(isset($system_array[$matches[1][$i]])){
 76 | 				$matches[1][$i] = $system_array[$matches[1][$i]];
 77 | 			} else{
 78 | 				$matches[1][$i] = $matches[0][$i];
 79 | 			}
 80 | 		}
 81 | 		return str_replace($matches[0], $matches[1], $content);
 82 | 	}
 83 | 
 84 | 	/**
 85 | 	 * @param array $user_info
 86 | 	 */
 87 | 	public function setUserInfo($user_info){
 88 | 		foreach($user_info as $k => $v){
 89 | 			$this->replace["user_" . $k] = $v;
 90 | 		}
 91 | 	}
 92 | 
 93 | 	/**
 94 | 	 * 设置对应的变量列表
 95 | 	 * @param $array
 96 | 	 */
 97 | 	public function setValues($array){
 98 | 		$matches = $this->getParamList($this->content);
 99 | 		$array = array_merge($this->replace, $array);
100 | 		for($i = 0; $i < count($matches[1]); $i++){
101 | 			if(isset($array[$matches[1][$i]])){
102 | 				$matches[1][$i] = $array[$matches[1][$i]];
103 | 			}
104 | 		}
105 | 		$this->content = str_replace($matches[0], $matches[1], $this->content);
106 | 		$this->getTitle();
107 | 		$this->getText();
108 | 		$this->content = preg_replace("/^[\\s]+\\n?/", "", $this->content);
109 | 		$this->is_set_values = true;
110 | 	}
111 | 
112 | 	/**
113 | 	 * 获取网站系统参数
114 | 	 * @return array
115 | 	 */
116 | 	private function getSystemParams(){
117 | 		return [
118 | 			'site_url' => get_url_map('home'),
119 | 			'site_title' => site_title(),
120 | 			'site_desc' => site_desc(),
121 | 			'site_time' => date("Y-m-d H:i:s"),
122 | 		];
123 | 	}
124 | 
125 | 	/**
126 | 	 * 返回模板中对应的变量
127 | 	 * @param string $content 模板内容
128 | 	 * @return array
129 | 	 */
130 | 	private function getParamList($content){
131 | 		preg_match_all("/{([0-9a-zA-Z_]+)}/", $content, $matches);
132 | 		return $matches;
133 | 	}
134 | 
135 | 
136 | 	/**
137 | 	 * 获取内容
138 | 	 * @return string
139 | 	 */
140 | 	public function getContent(){
141 | 		return $this->content;
142 | 	}
143 | 
144 | 	/**
145 | 	 * 取得邮件标题
146 | 	 * @return string
147 | 	 */
148 | 	public function getTitle(){
149 | 		if($this->title !== NULL){
150 | 			return $this->title;
151 | 		}
152 | 		preg_match_all("/([\\s\\S]+?)<\\/title>/", $this->content, $matches);
153 | 		if(isset($matches[1])){
154 | 			$this->title = strip_tags(implode(", ", $matches[1]));
155 | 		}
156 | 		$this->content = preg_replace("/<title>([\\s\\S]+?)<\\/title>/", "", $this->content);
157 | 		return $this->title;
158 | 	}
159 | 
160 | 	/**
161 | 	 * 取得邮件描述文字
162 | 	 */
163 | 	private function getText(){
164 | 		preg_match_all("/<!--T([\\s\\S]+?)-->/", $this->content, $matches);
165 | 		if(isset($matches[1])){
166 | 			$matches = array_map("trim", $matches[1]);
167 | 			$this->text = trim(strip_tags(implode("\r\n", $matches)));
168 | 		}
169 | 		$this->content = preg_replace("/<!--T([\\s\\S]+?)-->/", "", $this->content);
170 | 	}
171 | 
172 | 	/**
173 | 	 * 邮件发送
174 | 	 * @param string      $name
175 | 	 * @param string      $email
176 | 	 * @param string|null $title
177 | 	 * @param string|null $textContent
178 | 	 * @param bool        $queue
179 | 	 * @throws \Exception
180 | 	 */
181 | 	public function mailSend($name, $email, $title = NULL, $textContent = NULL, $queue = true){
182 | 		if(!hook()->apply("MailTemplate_mailSend", true)){
183 | 			//是否取消所有邮件发送记录
184 | 			Log::write(_("Mail send is cancel.") . print_r(func_get_args(), true), Log::NOTICE);
185 | 			return;
186 | 		}
187 | 		if(!$this->is_set_values){
188 | 			$this->setValues([]);
189 | 		}
190 | 		ob_start();
191 | 		try{
192 | 			c_lib()->load('mail');
193 | 			$mail = new Mail();
194 | 			if($title === NULL){
195 | 				$title = $this->title;
196 | 			}
197 | 			$mail->Subject = $title;
198 | 			$mail->addAddress($email, $name);
199 | 			$mail->msgHTML($this->content);
200 | 			if($textContent === NULL){
201 | 				$mail->AltBody = $this->text;
202 | 			} else{
203 | 				$mail->AltBody = $textContent;
204 | 			}
205 | 			$mail->send();
206 | 			ob_clean();
207 | 		} catch(\Exception $ex){
208 | 			ob_clean();
209 | 			throw new \Exception(_("Mail Send Error.") . debug(" :" . $ex->getMessage()));
210 | 		}
211 | 	}
212 | }


--------------------------------------------------------------------------------
/app/page.my/Home.php:
--------------------------------------------------------------------------------
  1 | <?php
  2 | /**
  3 |  * User: loveyu
  4 |  * Date: 2015/2/18
  5 |  * Time: 9:53
  6 |  */
  7 | 
  8 | namespace UView;
  9 | 
 10 | 
 11 | use ULib\Page;
 12 | use ULib\ShareList;
 13 | 
 14 | class Home extends Page{
 15 | 
 16 | 	function __construct(){
 17 | 		$this->header_view_file = "common/my_header.php";
 18 | 		$this->footer_view_file = "common/my_footer.php";
 19 | 		parent::__construct();
 20 | 	}
 21 | 
 22 | 	function avatar_rand(){
 23 | 		$this->__view("my/rand_avatar.php");
 24 | 	}
 25 | 
 26 | 	public function main(){
 27 | 		$member = class_member();
 28 | 		if($member->getLoginStatus()){
 29 | 			lib()->load('ShareList');
 30 | 			$share_list = new ShareList($member->getUid());
 31 | 			$this->__view("member/home.php", [
 32 | 				'name' => $member->getName(),
 33 | 				'email' => $member->getEmail(),
 34 | 				'avatar' => $member->getAvatar(),
 35 | 				'count' => $share_list->analyse()
 36 | 			]);
 37 | 		} else{
 38 | 			redirect([
 39 | 				'Home',
 40 | 				'login'
 41 | 			], 'refresh', 302, false);
 42 | 		}
 43 | 	}
 44 | 
 45 | 	public function logout(){
 46 | 		class_member()->logout();
 47 | 		redirect([
 48 | 			'Home',
 49 | 			'login'
 50 | 		], 'refresh', 302, false);
 51 | 		header("Content-Type: text/plain; charset=utf-8");
 52 | 		echo "你已经退出登录。";
 53 | 	}
 54 | 
 55 | 	public function login_form($post = NULL){
 56 | 		if(!allow_form_login()){
 57 | 			$this->__load_404();
 58 | 			return;
 59 | 		}
 60 | 		$member = class_member();
 61 | 		if($member->getLoginStatus()){
 62 | 			$this->__view("home/server_error.php", ['msg' => '当前用户已登录,还登录个啥子。']);
 63 | 			return;
 64 | 		}
 65 | 		$error = "";
 66 | 		if($post == "post" && $this->__req->is_post()){
 67 | 			//注册
 68 | 			//跳转
 69 | 			$email = strtolower(trim((string)$this->__req->post('email')));
 70 | 			$password = trim((string)$this->__req->post('password'));
 71 | 			if(empty($email) || empty($password)){
 72 | 				$error = "有空值,请检查";
 73 | 			} else{
 74 | 				if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
 75 | 					$error = "邮箱格式有误,请检查";
 76 | 				} else{
 77 | 					if($member->formLogin($email, _md5($password))){
 78 | 						redirect(get_url(), "refresh", 302, false);//重新跳转到用户首页
 79 | 						return;
 80 | 					} else{
 81 | 						$error = $member->getError();
 82 | 					}
 83 | 				}
 84 | 			}
 85 | 		}
 86 | 		$this->__view("my/login_form.php", ['error' => $error]);
 87 | 	}
 88 | 
 89 | 	public function register($post = NULL){
 90 | 		if(!allow_register()){
 91 | 			$this->__load_404();
 92 | 			return;
 93 | 		}
 94 | 		$member = class_member();
 95 | 		if($member->getLoginStatus()){
 96 | 			$this->__view("home/server_error.php", ['msg' => '当前用户已登录,还注册个啥子。']);
 97 | 			return;
 98 | 		}
 99 | 		$error = "";
100 | 		if($post == "post" && $this->__req->is_post()){
101 | 			//注册
102 | 			//跳转
103 | 			$name = trim((string)$this->__req->post('name'));
104 | 			$email = strtolower(trim((string)$this->__req->post('email')));
105 | 			$password = trim((string)$this->__req->post('password'));
106 | 			if(empty($name) || empty($email) || empty($password)){
107 | 				$error = "有空值,请检查";
108 | 			} else{
109 | 				if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
110 | 					$error = "邮箱格式有误,请检查";
111 | 				} else{
112 | 					if(($id = $member->registerByPassword($name, $email, _md5($password), trim((string)$this->__req->post('captcha')))) > 0){
113 | 						$member->oauth2login($id, "register");
114 | 						redirect(get_url(), "refresh", 302, false);//重新跳转到用户首页
115 | 						return;
116 | 					} else{
117 | 						$error = $member->getError();
118 | 					}
119 | 				}
120 | 			}
121 | 		}
122 | 		$this->__view("my/register.php", ['error' => $error]);
123 | 	}
124 | 
125 | 	public function password_reset(){
126 | 		$member = class_member();
127 | 		if($member->getLoginStatus()){
128 | 			$this->__view("home/server_error.php", ['msg' => '当前用户已登录,还需要找回密码么?']);
129 | 			return;
130 | 		}
131 | 		$email = strtolower($this->__req->post('email'));
132 | 		$status = "";
133 | 		if(!empty($email)){
134 | 			if($member->PwdResetCodeSend($email)){
135 | 				redirect([
136 | 					'Home',
137 | 					'password_reset_input',
138 | 					$email
139 | 				], 'refresh', 302, false);
140 | 				return;
141 | 			} else{
142 | 				$status = $member->getError();
143 | 			}
144 | 		}
145 | 		$this->__view("my/password_reset.php", ['status' => $status]);
146 | 	}
147 | 
148 | 	public function password_reset_input($email = NULL){
149 | 		$member = class_member();
150 | 		if($member->getLoginStatus()){
151 | 			$this->__view("home/server_error.php", ['msg' => '当前用户已登录,还需要找回密码么?']);
152 | 			return;
153 | 		}
154 | 		$error = '';
155 | 		if($this->__req->is_post()){
156 | 			$code = $this->__req->post('code');
157 | 			$password = $this->__req->post('password');
158 | 			if(empty($code) || empty($password)){
159 | 				$error = "存在空值";
160 | 			} else{
161 | 				if(class_member()->PwdReset($email, $code, _md5($password))){
162 | 					$error = "ok";
163 | 				} else{
164 | 					$error = class_member()->getError();
165 | 				}
166 | 			}
167 | 		}
168 | 		$this->__view("my/password_reset_input.php", compact('email', 'error'));
169 | 	}
170 | 
171 | 	public function login(){
172 | 		$member = class_member();
173 | 		if($member->getLoginStatus()){
174 | 			$this->__view("home/server_error.php", ['msg' => '当前用户已登录,还需要找回密码么?']);
175 | 			return;
176 | 		}
177 | 		if(func_num_args() > 0){
178 | 			$this->__load_404();
179 | 			return;
180 | 		}
181 | 		$this->__view("my/login.php");
182 | 	}
183 | 
184 | 	public function not_found(){
185 | 		send_http_status(404);
186 | 		$this->__view("home/404.php");
187 | 	}
188 | }


--------------------------------------------------------------------------------
/web/asset/plugins/syntaxhighlighter/scripts/shBrushPhp.js:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * SyntaxHighlighter
 3 |  * http://alexgorbatchev.com/SyntaxHighlighter
 4 |  *
 5 |  * SyntaxHighlighter is donationware. If you are using it, please donate.
 6 |  * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
 7 |  *
 8 |  * @version
 9 |  * 3.0.83 (July 02 2010)
10 |  * 
11 |  * @copyright
12 |  * Copyright (C) 2004-2010 Alex Gorbatchev.
13 |  *
14 |  * @license
15 |  * Dual licensed under the MIT and GPL licenses.
16 |  */
17 | ;(function()
18 | {
19 | 	// CommonJS
20 | 	typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
21 | 
22 | 	function Brush()
23 | 	{
24 | 		var funcs	=	'abs acos acosh addcslashes addslashes ' +
25 | 						'array_change_key_case array_chunk array_combine array_count_values array_diff '+
26 | 						'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+
27 | 						'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+
28 | 						'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+
29 | 						'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+
30 | 						'array_push array_rand array_reduce array_reverse array_search array_shift '+
31 | 						'array_slice array_splice array_sum array_udiff array_udiff_assoc '+
32 | 						'array_udiff_uassoc array_uintersect array_uintersect_assoc '+
33 | 						'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+
34 | 						'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+
35 | 						'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+
36 | 						'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+
37 | 						'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+
38 | 						'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+
39 | 						'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+
40 | 						'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+
41 | 						'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+
42 | 						'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+
43 | 						'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+
44 | 						'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+
45 | 						'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+
46 | 						'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+
47 | 						'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+
48 | 						'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+
49 | 						'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+
50 | 						'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+
51 | 						'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+
52 | 						'parse_ini_file parse_str parse_url passthru pathinfo print readlink realpath rewind rewinddir rmdir '+
53 | 						'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+
54 | 						'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+
55 | 						'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+
56 | 						'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+
57 | 						'strtoupper strtr strval substr substr_compare';
58 | 
59 | 		var keywords =	'abstract and array as break case catch cfunction class clone const continue declare default die do ' +
60 | 						'else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach ' +
61 | 						'function include include_once global goto if implements interface instanceof namespace new ' +
62 | 						'old_function or private protected public return require require_once static switch ' +
63 | 						'throw try use var while xor ';
64 | 		
65 | 		var constants	= '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__';
66 | 
67 | 		this.regexList = [
68 | 			{ regex: SyntaxHighlighter.regexLib.singleLineCComments,	css: 'comments' },			// one line comments
69 | 			{ regex: SyntaxHighlighter.regexLib.multiLineCComments,		css: 'comments' },			// multiline comments
70 | 			{ regex: SyntaxHighlighter.regexLib.doubleQuotedString,		css: 'string' },			// double quoted strings
71 | 			{ regex: SyntaxHighlighter.regexLib.singleQuotedString,		css: 'string' },			// single quoted strings
72 | 			{ regex: /\$\w+/g,											css: 'variable' },			// variables
73 | 			{ regex: new RegExp(this.getKeywords(funcs), 'gmi'),		css: 'functions' },			// common functions
74 | 			{ regex: new RegExp(this.getKeywords(constants), 'gmi'),	css: 'constants' },			// constants
75 | 			{ regex: new RegExp(this.getKeywords(keywords), 'gm'),		css: 'keyword' }			// keyword
76 | 			];
77 | 
78 | 		this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
79 | 	};
80 | 
81 | 	Brush.prototype	= new SyntaxHighlighter.Highlighter();
82 | 	Brush.aliases	= ['php'];
83 | 
84 | 	SyntaxHighlighter.brushes.Php = Brush;
85 | 
86 | 	// CommonJS
87 | 	typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
88 | })();
89 | 


--------------------------------------------------------------------------------
/web/asset/plugins/syntaxhighlighter/scripts/shBrushCpp.js:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * SyntaxHighlighter
 3 |  * http://alexgorbatchev.com/SyntaxHighlighter
 4 |  *
 5 |  * SyntaxHighlighter is donationware. If you are using it, please donate.
 6 |  * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
 7 |  *
 8 |  * @version
 9 |  * 3.0.83 (July 02 2010)
10 |  * 
11 |  * @copyright
12 |  * Copyright (C) 2004-2010 Alex Gorbatchev.
13 |  *
14 |  * @license
15 |  * Dual licensed under the MIT and GPL licenses.
16 |  */
17 | ;(function()
18 | {
19 | 	// CommonJS
20 | 	typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
21 | 
22 | 	function Brush()
23 | 	{
24 | 		// Copyright 2006 Shin, YoungJin
25 | 	
26 | 		var datatypes =	'ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR ' +
27 | 						'DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH ' +
28 | 						'HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP ' +
29 | 						'HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY ' +
30 | 						'HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT ' +
31 | 						'HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE ' +
32 | 						'LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF ' +
33 | 						'LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR ' +
34 | 						'LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR ' +
35 | 						'PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT ' +
36 | 						'PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 ' +
37 | 						'POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR ' +
38 | 						'PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 ' +
39 | 						'PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT ' +
40 | 						'SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG ' +
41 | 						'ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM ' +
42 | 						'char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t ' +
43 | 						'clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS ' +
44 | 						'FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t ' +
45 | 						'__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t ' +
46 | 						'jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler ' +
47 | 						'sig_atomic_t size_t _stat __stat64 _stati64 terminate_function ' +
48 | 						'time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf ' +
49 | 						'va_list wchar_t wctrans_t wctype_t wint_t signed';
50 | 
51 | 		var keywords =	'break case catch class const __finally __exception __try ' +
52 | 						'const_cast continue private public protected __declspec ' +
53 | 						'default delete deprecated dllexport dllimport do dynamic_cast ' +
54 | 						'else enum explicit extern if for friend goto inline ' +
55 | 						'mutable naked namespace new noinline noreturn nothrow ' +
56 | 						'register reinterpret_cast return selectany ' +
57 | 						'sizeof static static_cast struct switch template this ' +
58 | 						'thread throw true false try typedef typeid typename union ' +
59 | 						'using uuid virtual void volatile whcar_t while';
60 | 					
61 | 		var functions =	'assert isalnum isalpha iscntrl isdigit isgraph islower isprint' +
62 | 						'ispunct isspace isupper isxdigit tolower toupper errno localeconv ' +
63 | 						'setlocale acos asin atan atan2 ceil cos cosh exp fabs floor fmod ' +
64 | 						'frexp ldexp log log10 modf pow sin sinh sqrt tan tanh jmp_buf ' +
65 | 						'longjmp setjmp raise signal sig_atomic_t va_arg va_end va_start ' +
66 | 						'clearerr fclose feof ferror fflush fgetc fgetpos fgets fopen ' +
67 | 						'fprintf fputc fputs fread freopen fscanf fseek fsetpos ftell ' +
68 | 						'fwrite getc getchar gets perror printf putc putchar puts remove ' +
69 | 						'rename rewind scanf setbuf setvbuf sprintf sscanf tmpfile tmpnam ' +
70 | 						'ungetc vfprintf vprintf vsprintf abort abs atexit atof atoi atol ' +
71 | 						'bsearch calloc div exit free getenv labs ldiv malloc mblen mbstowcs ' +
72 | 						'mbtowc qsort rand realloc srand strtod strtol strtoul system ' +
73 | 						'wcstombs wctomb memchr memcmp memcpy memmove memset strcat strchr ' +
74 | 						'strcmp strcoll strcpy strcspn strerror strlen strncat strncmp ' +
75 | 						'strncpy strpbrk strrchr strspn strstr strtok strxfrm asctime ' +
76 | 						'clock ctime difftime gmtime localtime mktime strftime time';
77 | 
78 | 		this.regexList = [
79 | 			{ regex: SyntaxHighlighter.regexLib.singleLineCComments,	css: 'comments' },			// one line comments
80 | 			{ regex: SyntaxHighlighter.regexLib.multiLineCComments,		css: 'comments' },			// multiline comments
81 | 			{ regex: SyntaxHighlighter.regexLib.doubleQuotedString,		css: 'string' },			// strings
82 | 			{ regex: SyntaxHighlighter.regexLib.singleQuotedString,		css: 'string' },			// strings
83 | 			{ regex: /^ *#.*/gm,										css: 'preprocessor' },
84 | 			{ regex: new RegExp(this.getKeywords(datatypes), 'gm'),		css: 'color1 bold' },
85 | 			{ regex: new RegExp(this.getKeywords(functions), 'gm'),		css: 'functions bold' },
86 | 			{ regex: new RegExp(this.getKeywords(keywords), 'gm'),		css: 'keyword bold' }
87 | 			];
88 | 	};
89 | 
90 | 	Brush.prototype	= new SyntaxHighlighter.Highlighter();
91 | 	Brush.aliases	= ['cpp', 'c'];
92 | 
93 | 	SyntaxHighlighter.brushes.Cpp = Brush;
94 | 
95 | 	// CommonJS
96 | 	typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
97 | })();
98 | 


--------------------------------------------------------------------------------