Browse Source

清空

pull/35/head
xiaoz 5 years ago
parent
commit
069ae524ad
  1. 4
      .gitignore
  2. 1
      .htaccess
  3. 21
      LICENSE
  4. 99
      README.md
  5. 38
      about.php
  6. 8
      admin/about.php
  7. 27
      admin/delete.php
  8. 60
      admin/index.php
  9. 39
      admin/login.php
  10. 7
      admin/logout.php
  11. 26
      admin/operation.php
  12. 126
      admin/picadmin.php
  13. 186
      admin/senioradmin.php
  14. 97
      admin/smadmin.php
  15. 65
      admin/urlup.php
  16. 34
      check.php
  17. 38
      config-simple.php
  18. 2
      db/.htaccess
  19. BIN
      db/imgurl-simple.db3
  20. 96
      dispose.php
  21. BIN
      favicon.ico
  22. 81
      found.php
  23. BIN
      functions/Arial Monospaced.ttf
  24. 27
      functions/Controller.php
  25. 120
      functions/api.php
  26. 1545
      functions/class/Medoo.php
  27. 387
      functions/class/class.admin.php
  28. 173
      functions/class/class.install.php
  29. 90
      functions/class/class.pic.php
  30. 0
      functions/class/class.sm.php
  31. 5061
      functions/class/class.upload.php
  32. 189
      functions/class/class.user.php
  33. 86
      functions/class/lang/class.upload.zh_CN.gb-2312.php
  34. 85
      functions/class/lang/class.upload.zh_CN.php
  35. 87
      functions/class/lang/class.upload.zh_TW.php
  36. 98
      functions/cvupload.php
  37. 59
      functions/sm.php
  38. 96
      functions/tinypng/Tinify.php
  39. 160
      functions/tinypng/Tinify/Client.php
  40. 36
      functions/tinypng/Tinify/Exception.php
  41. 36
      functions/tinypng/Tinify/Result.php
  42. 23
      functions/tinypng/Tinify/ResultMeta.php
  43. 69
      functions/tinypng/Tinify/Source.php
  44. 3550
      functions/tinypng/data/cacert.pem
  45. 37
      functions/unknown.php
  46. 102
      functions/upload.php
  47. 7
      functions/urlup.php
  48. 1
      functions/version.txt
  49. 127
      index.php
  50. 41
      install.php
  51. 203
      miniup.html
  52. 6
      robots.txt
  53. 68
      sm.php
  54. 1
      static/404.svg
  55. 8
      static/clipBoard.min.js
  56. 112
      static/ctrv-upload.js
  57. 501
      static/embed.js
  58. 93
      static/imgurl.js
  59. 228
      static/index.js
  60. 4
      static/jquery.min.js
  61. 2
      static/layui/css/layui.css
  62. 2
      static/layui/css/layui.mobile.css
  63. 2
      static/layui/css/modules/code.css
  64. 2
      static/layui/css/modules/laydate/default/laydate.css
  65. BIN
      static/layui/css/modules/layer/default/icon-ext.png
  66. BIN
      static/layui/css/modules/layer/default/icon.png
  67. 2
      static/layui/css/modules/layer/default/layer.css
  68. BIN
      static/layui/css/modules/layer/default/loading-0.gif
  69. BIN
      static/layui/css/modules/layer/default/loading-1.gif
  70. BIN
      static/layui/css/modules/layer/default/loading-2.gif
  71. BIN
      static/layui/font/iconfont.eot
  72. 483
      static/layui/font/iconfont.svg
  73. BIN
      static/layui/font/iconfont.ttf
  74. BIN
      static/layui/font/iconfont.woff
  75. BIN
      static/layui/images/face/0.gif
  76. BIN
      static/layui/images/face/1.gif
  77. BIN
      static/layui/images/face/10.gif
  78. BIN
      static/layui/images/face/11.gif
  79. BIN
      static/layui/images/face/12.gif
  80. BIN
      static/layui/images/face/13.gif
  81. BIN
      static/layui/images/face/14.gif
  82. BIN
      static/layui/images/face/15.gif
  83. BIN
      static/layui/images/face/16.gif
  84. BIN
      static/layui/images/face/17.gif
  85. BIN
      static/layui/images/face/18.gif
  86. BIN
      static/layui/images/face/19.gif
  87. BIN
      static/layui/images/face/2.gif
  88. BIN
      static/layui/images/face/20.gif
  89. BIN
      static/layui/images/face/21.gif
  90. BIN
      static/layui/images/face/22.gif
  91. BIN
      static/layui/images/face/23.gif
  92. BIN
      static/layui/images/face/24.gif
  93. BIN
      static/layui/images/face/25.gif
  94. BIN
      static/layui/images/face/26.gif
  95. BIN
      static/layui/images/face/27.gif
  96. BIN
      static/layui/images/face/28.gif
  97. BIN
      static/layui/images/face/29.gif
  98. BIN
      static/layui/images/face/3.gif
  99. BIN
      static/layui/images/face/30.gif
  100. BIN
      static/layui/images/face/31.gif
  101. Some files were not shown because too many files have changed in this diff Show More

4
.gitignore vendored

@ -1,4 +0,0 @@ @@ -1,4 +0,0 @@
temp/
upload/
1808/
db/

1
.htaccess

@ -1 +0,0 @@ @@ -1 +0,0 @@
ErrorDocument 404 /static/404.svg

21
LICENSE

@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
MIT License
Copyright (c) 2017 J3n5en
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

99
README.md

@ -1,99 +0,0 @@ @@ -1,99 +0,0 @@
# ImgURL
ImgURL是一款简单、纯粹的图床程序,使用PHP + SQLite 3开发,不需要复杂的配置,开箱即用。
### 环境要求
* PHP >= 5.6
* 需要exif函数支持
* SQLite 3
### 安装
* 访问:<a href = "https://github.com/helloxz/imgurl/archive/master.zip" target = "_blank" rel = "nofollow">master.zip</a>下载最新版ImgURL程序,放到您的站点根目录并解压。
* 访问 `http(s)://domain.com/install.php` 根据提示完成安装。
* **更多设置请参考帮助文档:[https://doc.xiaoz.me/#/imgurl/](https://doc.xiaoz.me/#/imgurl/) (必看)**
### 开发计划
- [x] 图片上传与预览
- [x] 一键生成链接
- [x] 浏览与删除图片
- [x] 限制访客上传数量
- [x] 图片压缩
- [x] 图片鉴黄
- [x] API上传
- [x] 油猴脚本上传
- [ ] 图片水印
### 更新日志
#### v1.4 - 2018.11.06
* 新增安装向导
* 修复一处上传BUG
#### v1.3 - 2018.09.11
* 新增粘贴上传(Ctrl + V)
* 期待已久的API上传
* 后台新增按时间筛选图片
* 优化“探索发现”,之前为随机显示12张,现在显示本月所有图片(流加载)
* 优化后台“看图模式”
* 修复一些BGU,优化CSS
* 增加ImgURL脚本,可在任意网页上传图片,参考:[https://www.xiaoz.me/archives/11038](https://www.xiaoz.me/archives/11038)
#### v1.2 - 2018.08.11
* 增加URL批量上传
* 去掉一些不必要的菜单
* 优化CSS样式
* 优化图片查看器
* 修复一些BUG
#### v1.1 - 2018.05.04
* 可上传至SM.MS图床
* 优化IP获取,及其它细节优化
* 修复一些BUG
### 安全设置
* 配置完毕后测试功能没问题,请删除根目录的`check.php`
* Apache默认已经通过`.htaccess`文件来屏蔽数据库下载
* Nginx用户请在server段内添加如下配置,并重启Nginx
```nginx
location ~* \.(db3)$ {
deny all;
}
location ~* ^/(temp|upload)/.*.(php|php5)$ {
return 444;
}
```
### Demo
* [http://test.imgurl.org/](http://test.imgurl.org/) ,账号:`xiaoz`,密码:`xiaoz.me`
![](https://imgurl.org/upload/1804/3ccc55eeb47965c3.png)
### 获取捐赠版
ImgURL普通版和捐赠版功能上没有任何区别,不过您可以请xiaoz喝一杯咖啡或吃一顿午餐即可获得捐赠版。描下方二维码获取,并在付款说明填写您的网址。
![](https://imgurl.org/upload/1712/cb349aa4a1b95997.png)
#### 捐赠版说明
* 可提供首次安装及调试
* 可去除底部版权
#### 捐赠列表
* 2018-05-02 lackk.com 捐赠30元
* 2018-05-04 zip30.com 捐赠30元
* 2018-05-06 sopoy.com 捐赠30元
* 2018-05-06 tuchuang.app 捐赠60元
* 2018-05-15 coolsong.com 捐赠30元
### 鸣谢
ImgURL的诞生离不开以下开源项目。
* LayUI: [https://github.com/sentsin/layui](https://github.com/sentsin/layui)
* class.upload.php: [https://github.com/verot/class.upload.php](https://github.com/verot/class.upload.php)
* clipBoard.js: [https://github.com/baixuexiyang/clipBoard.js](https://github.com/baixuexiyang/clipBoard.js)
### 联系我
* Blog:[https://www.xiaoz.me/](https://www.xiaoz.me/)
* QQ:337003006
* 社区支持:[https://ttt.sh/](https://ttt.sh/category/6/)

38
about.php

@ -1,38 +0,0 @@ @@ -1,38 +0,0 @@
<?php
$title = "ImgURL - 简单、纯粹的图床程序。";
include_once("./tpl/user/header.php");
?>
<div class="layui-container">
<div class="layui-row">
<div class="layui-col-lg10 layui-col-md-offset1" id = "about">
<h1>ImgURL</h1>
<p>ImgURL是一款简洁、纯粹的图床程序,使用PHP + Sqlite开发,开箱即用。</p>
<h3>功能与特色</h3>
<ul>
<li>拽拖上传图片、实时预览</li>
<li>一键生成链接,一键复制</li>
<li>基本图片管理</li>
<li>TinyPNG图片压缩</li>
<li>图片智能鉴黄</li>
</ul>
<h3>使用说明</h3>
<ul>
<li>图片最大上传限制为2M</li>
<li>游客每天限制上传5张图片</li>
<li>图片定期清理,重要图片建议自行下载ImgURL部署</li>
<li>勿上传暴力、色情、反动图片,否则后果自负</li>
<li>如果您使用ImgURL代表同意以上协议</li>
</ul>
<h3>联系我</h3>
<ul>
<li>Blog:<a href = "https://www.xiaoz.me/" target = "_blank">https://www.xiaoz.me/</a></li>
<li>QQ:337003006</li>
</ul>
</div>
</div>
</div>
<?php
include_once("./tpl/user/footer.php");
?>

8
admin/about.php

@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
<?php
include_once("../config.php");
$year = date('Y',time());
$version = file_get_contents(APP."functions/version.txt");
echo "当前版本:".$version."<br />";
?>

27
admin/delete.php

@ -1,27 +0,0 @@ @@ -1,27 +0,0 @@
<?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
include_once("../functions/class/class.admin.php");
//获取图片ID
$id = $_GET['id'];
$id = (int) $id;
//获取类型
$type = $_GET['type'];
if((!isset($id) || ($id == ''))) {
echo 'ID错误';
exit;
}
// 判断类型
switch ($type) {
case 'sm':
$pic->deletesm($id);
break;
default:
//删除图片
$pic->delete($id);
break;
}
?>

60
admin/index.php

@ -1,60 +0,0 @@ @@ -1,60 +0,0 @@
<?php
$title = "后台管理 - ImgURL";
include_once("../functions/class/class.admin.php");
// 载入头部
include_once("../tpl/admin/header.php");
//获取统计数据
$data = $pic->data();
?>
<div class="layui-container" style = "margin-top:2em;">
<div class="layui-row">
<div class="layui-col-lg3">
<!-- 载入左侧导航栏 -->
<?php include_once("../tpl/admin/left.php"); ?>
</div>
<!-- 后台内容部分 -->
<div class="layui-col-lg9">
<h1 style = "margin-bottom:0.8em;color:#515151">数据统计:</h1>
<!-- 后台数据统计 -->
<div id="tongji" class="layui-row layui-col-space18">
<div class="layui-col-lg4">
<div class="item">
<p></p><h2>累计上传</h2><p></p>
<p><?php echo $data['all']; ?></p>
</div>
</div>
<div class="layui-col-lg4">
<div class="item">
<p></p><h2><i class="fa fa-street-view fa-fw"></i> 本月上传</h2><p></p>
<p><?php echo $data['month']; ?></p>
</div>
</div>
<div class="layui-col-lg4">
<div class="item">
<p></p><h2><i class="fa fa-exclamation-triangle fa-fw"></i> 当日上传</h2><p></p>
<p><?php echo $data['day']; ?></p>
</div>
</div>
<div class="layui-col-lg4">
<div class="item">
<a href="./senioradmin.php?type=dubious&page=1">
<p></p><h2><i class="fa fa-exclamation-triangle fa-fw"></i> 可疑图片</h2><p></p>
<p><?php echo $data['level']; ?></p>
</a>
</div>
</div>
</div>
<!-- 后台数据统计END -->
</div>
<!-- 后台内容部分END -->
</div>
</div>
<?php
// 载入页脚
// 载入头部
include_once("../tpl/admin/footer.php");
?>

39
admin/login.php

@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
<?php
$title = "登录 - ImgURL";
// 简单的判断用户是否登录
if(isset($_COOKIE['user'])) {
header('Location:index.php');
}
?>
<?php
// 载入头部
include_once("../tpl/admin/header.php");
?>
<!-- 内容部分 -->
<div id="container">
<div class="layui-container">
<div class="layui-row">
<div class="layui-col-lg4 layui-col-md-offset4">
<!-- 登录表单 -->
<div class="login">
<div class="layui-form-item">
<input id = "user" type="text" name="title" required lay-verify="required" placeholder="用户名" autocomplete="off" class="layui-input">
</div>
<div class="layui-form-item">
<input id = "password" type="password" name="password" required lay-verify="required" placeholder="密码" autocomplete="off" class="layui-input">
</div>
<div class="layui-form-item">
<button class="layui-btn" lay-submit lay-filter="formDemo" onclick = "login()">登录</button>
</div>
</div>
<!-- 登录表单END -->
</div>
</div>
</div>
</div>
<!-- 内容部分end -->
<?php
// 载入页脚
// 载入头部
include_once("../tpl/admin/footer.php");
?>

7
admin/logout.php

@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
<?php
//清除COOKIE
setcookie("user", '', time()-3600,"/");
setcookie("password", '', time()-3600,"/");
echo "<script>window.location.href = './login.php'</script>";
?>

26
admin/operation.php

@ -1,26 +0,0 @@ @@ -1,26 +0,0 @@
<?php
include_once("../functions/class/class.admin.php");
//获取操作类型
$type = $_GET['type'];
//获取图片ID
$id = $_GET['id'];
$id = (int) $id;
if((!isset($id) || ($id == ''))) {
echo 'ID错误';
exit;
}
//判断需要操作的类型
switch ($type) {
case 'cdubious':
//取消图片可疑状态
$pic->cdubious($id);
break;
default:
# code...
break;
}
?>

126
admin/picadmin.php

@ -1,126 +0,0 @@ @@ -1,126 +0,0 @@
<?php
$title = "后台管理 - ImgURL";
include_once("../functions/class/class.admin.php");
// 载入头部
include_once("../tpl/admin/header.php");
// 获取类型
$type = $_GET['type'];
//获取时间
@$date = $_GET['date'];
//如果时间不为空
if($date != ''){
$thedate = explode("|",$date);
$starttime = $thedate[0];
$endtime = $thedate[1];
//翻页选项
$thepage = '&date='.$date;
}
else{
$starttime = '';
//获取当前日期
$endtime = date("Y-m-d",time());
//翻页选项
$thepage = '';
}
//获取页数
$page = $_GET['page'];
//查询图片
$imgs = $pic->newquery($type,$date);
$up = (int)$page - 1;
if($up <= 0){
$up = 1;
}
$down = (int)$page +1;
?>
<div class="layui-container" style = "margin-top:2em;">
<div class="layui-row layui-col-space20">
<div class="layui-col-lg3">
<!-- 载入左侧导航栏 -->
<?php include_once("../tpl/admin/left.php"); ?>
</div>
<!-- 后台内容部分 -->
<div id = "adminpic">
<div class="layui-col-lg9 layui-col-space10" style="margin-bottom:6em;">
<!--时间筛选-->
<div id="date">
<table class="layui-table" lay-skin="nob">
<tbody>
<tr>
<td>按时间筛选:</td>
<td><input type="text" class="layui-input" id="starttime" value = "<?php echo $starttime; ?>"></td>
<td> - </td>
<td><input type="text" class="layui-input" id="endtime" value = "<?php echo $endtime; ?>"></td>
<td><button lay-submit class="layui-btn" onclick = "screen('picadmin.php')">筛选</button></td>
</tr>
</tbody>
</table>
</div>
<!--时间筛选END-->
<?php foreach ($imgs as $img) {
$imgurl = $config['domain'].$img['path'];
$id = $img['id'];
?>
<div id = "imgid<?php echo $id; ?>" class="layui-col-lg4 picadmin" onmouseover = "show_imgcon(<?php echo $id; ?>)" onmouseout = "hide_imgcon(<?php echo $id; ?>)">
<!-- <a id = "imgid<?php echo $id; ?>" href="javascript:;" onclick = "adminshow('<?php echo $imgurl ?>',<?php echo $id; ?>)"></a> -->
<img lay-src="<?php echo $imgurl; ?>" layer-src="<?php echo $imgurl; ?>" alt="图片ID: <?php echo $id; ?>" src = "../static/loading32.gif">
<!-- 删除按钮 -->
<div class = "imgcon" id = "imgcon<?php echo $id; ?>">
<a href="javascript:;" title = "图片链接" class="layui-btn layui-btn-xs layui-btn-normal" onclick = "adminshow('<?php echo $imgurl ?>',<?php echo $id; ?>)"><i class="layui-icon">&#xe64c;</i></a>
<a href="javascript:;" title = "删除这张图片" class="layui-btn layui-btn-xs layui-btn-danger" onclick="deleteimg(<?php echo $id; ?>)"><i class="layui-icon">&#xe640;</i></a>
</div>
<!-- 删除按钮END -->
</div>
<?php } ?>
</div>
<!-- 翻页按钮 -->
<!-- 翻页按钮END -->
<!-- 后台内容部分END -->
</div>
</div>
<!--图片查看-->
<div id="adminshow">
<div style = "margin-top:2em;"><center><img src="" alt=""></center></div>
<div id = "copy">
<center>
<table class="layui-table" lay-skin="nob">
<colgroup>
<col width="80">
<col width="520">
<col>
</colgroup>
<tbody>
<tr>
<td>URL</td>
<td><input type="text" class="layui-input" id="url" data-cip-id="url"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="newcopy('url')">复制</a></td>
</tr>
<tr>
<td>HTML</td>
<td><input type="text" class="layui-input" id="html" data-cip-id="html"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="newcopy('html')">复制</a></td>
</tr>
<tr>
<td>MarkDown</td>
<td><input type="text" class="layui-input" id="markdown" data-cip-id="markdown"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="newcopy('markdown')">复制</a></td>
</tr>
<tr>
<td>BBcode</td>
<td><input type="text" class="layui-input" id="bbcode" data-cip-id="bbcode"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="newcopy('bbcode')">复制</a></td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
<!--图片查看-->
<?php
// 载入页脚
// 载入头部
include_once("../tpl/admin/footer.php");
?>

186
admin/senioradmin.php

@ -1,186 +0,0 @@ @@ -1,186 +0,0 @@
<?php
$title = "后台管理 - ImgURL";
include_once("../functions/class/class.admin.php");
// 载入头部
include_once("../tpl/admin/header.php");
// 获取类型
$type = $_GET['type'];
//获取页数
$page = $_GET['page'];
//获取时间
@$date = $_GET['date'];
//如果时间不为空
if($date != ''){
$thedate = explode("|",$date);
$starttime = $thedate[0];
$endtime = $thedate[1];
//翻页选项
$thepage = '&date='.$date;
}
else{
$starttime = '';
//获取当前日期
$endtime = date("Y-m-d",time());
//翻页选项
$thepage = '';
}
//查询图片
$imgs = $pic->querypic($type,$page,$date);
$up = (int)$page - 1;
if($up <= 0){
$up = 1;
}
$down = (int)$page +1;
?>
<div class="layui-container" style = "margin-top:2em;">
<div class="layui-row layui-col-space20">
<div class="layui-col-lg3">
<!-- 载入左侧导航栏 -->
<?php include_once("../tpl/admin/left.php"); ?>
</div>
<!-- 后台内容部分 -->
<div id = "adminpic">
<div class="layui-col-lg9">
<!--时间筛选-->
<div id="date">
<table class="layui-table" lay-skin="nob">
<tbody>
<tr>
<td>按时间筛选:</td>
<td><input type="text" class="layui-input" id="starttime" value = "<?php echo $starttime; ?>"></td>
<td> - </td>
<td><input type="text" class="layui-input" id="endtime" value = "<?php echo $endtime; ?>"></td>
<td><button lay-submit class="layui-btn" onclick = "screen('senioradmin.php')">筛选</button></td>
</tr>
</tbody>
</table>
</div>
<!--时间筛选END-->
<!-- 表格 -->
<table class="layui-table">
<colgroup>
<col width="30">
<col width="280">
<col width="120">
<col width="120">
<col width="120">
<col>
</colgroup>
<thead>
<tr>
<th>ID</th>
<th>图片路径(点击可查看)</th>
<th>IP</th>
<th>日期</th>
<th>是否压缩</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($imgs as $img) {
$imgurl = $config['domain'].$img['path'];
$id = $img['id'];
$size = filesize('../'.$img['path']); //文件大小计算
$size = round($size / 1024)."kb";
if($img['compress'] == 0) {
$compress = array(
"css" => "layui-btn layui-btn-xs layui-btn-danger",
"content" => "否"
);
}
else{
$compress = array(
"css" => "layui-btn layui-btn-xs layui-btn-normal",
"content" => "是"
);
}
?>
<tr id = "imgid<?php echo $id; ?>">
<td><a href="javascript:;" onclick = "copyurl('<?php echo $imgurl; ?>')"><?php echo $id; ?></a></td>
<td>
<a id = "imgid<?php echo $id; ?>" href="javascript:;" onclick = "adminshow('<?php echo $imgurl ?>',<?php echo $id; ?>)" onmouseover = "viewimg('<?php echo $id; ?>','<?php echo $imgurl; ?>')" onmouseout = "hideimg('<?php echo $id; ?>')">
<?php echo $img['path']; ?>
</a>
<div id="viewimg<?php echo $id; ?>" class = "viewimg">
<img src="" alt="">
</div>
</td>
<td><a href="javascript:;" onclick = "ipquery('<?php echo $img['ip']; ?>')"><?php echo $img['ip']; ?></a></td>
<td><?php echo $img['date']; ?></td>
<td>
<a href="javascript::" class = "<?php echo $compress['css']; ?>"><?php echo $compress['content']; ?></a>
<a href="javascript:;" class = "layui-btn layui-btn-xs layui-btn-disabled"><?php echo $size; ?></a>
</td>
<td>
<?php if($type == 'dubious'){ ?>
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-normal" onclick = "cdubious(<?php echo $id; ?>)">非可疑</a>
<?php }else{ ?>
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-normal" onclick = "compress(<?php echo $id; ?>)">压缩</a>
<?php } ?>
<!-- <a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-normal" onclick = "copyurl('<?php echo $imgurl; ?>')">复制</a> -->
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-danger" onclick = "deleteimg(<?php echo $id; ?>)">删除</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<!-- 表格END -->
</div>
<!-- 翻页按钮 -->
<div class="layui-col-lg9 layui-col-md-offset3">
<div class="page">
<a href="?type=<?php echo $type; ?>&page=<?php echo $up.$thepage; ?>" class="layui-btn">上一页</a>
<a href="?type=<?php echo $type; ?>&page=<?php echo $down.$thepage; ?>" class="layui-btn">下一页</a>
</div>
</div>
<!-- 翻页按钮END -->
<!-- 后台内容部分END -->
</div>
</div>
<!--图片查看-->
<div id="adminshow">
<div style = "margin-top:2em;"><center><img src="" alt=""></center></div>
<div id = "copy">
<center>
<table class="layui-table" lay-skin="nob">
<colgroup>
<col width="80">
<col width="520">
<col>
</colgroup>
<tbody>
<tr>
<td>URL</td>
<td><input type="text" class="layui-input" id="url" data-cip-id="url"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="newcopy('url')">复制</a></td>
</tr>
<tr>
<td>HTML</td>
<td><input type="text" class="layui-input" id="html" data-cip-id="html"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="newcopy('html')">复制</a></td>
</tr>
<tr>
<td>MarkDown</td>
<td><input type="text" class="layui-input" id="markdown" data-cip-id="markdown"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="newcopy('markdown')">复制</a></td>
</tr>
<tr>
<td>BBcode</td>
<td><input type="text" class="layui-input" id="bbcode" data-cip-id="bbcode"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="newcopy('bbcode')">复制</a></td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
<!--图片查看-->
<?php
// 载入页脚
include_once("../tpl/admin/footer.php");
?>

97
admin/smadmin.php

@ -1,97 +0,0 @@ @@ -1,97 +0,0 @@
<?php
$title = "后台管理 - ImgURL";
include_once("../functions/class/class.admin.php");
// 载入头部
include_once("../tpl/admin/header.php");
// 获取类型
$type = $_GET['type'];
//获取页数
$page = $_GET['page'];
//查询sm.ms图片
$imgs = $pic->querysm($page);
//var_dump($imgs);
$up = (int)$page - 1;
if($up <= 0){
$up = 1;
}
$down = (int)$page +1;
?>
<div class="layui-container" style = "margin-top:2em;">
<div class="layui-row layui-col-space20">
<div class="layui-col-lg3">
<!-- 载入左侧导航栏 -->
<?php include_once("../tpl/admin/left.php"); ?>
</div>
<!-- 后台内容部分 -->
<div id = "adminpic">
<div class="layui-col-lg9">
<?php if($type == 'preview') { ?>
<!-- 预览图片 -->
<div class="layui-col-lg9 layui-col-space10">
<?php foreach ($imgs as $img) {
?>
<div class="layui-col-lg4 picadmin">
<img lay-src="<?php echo $img['url']; ?>" layer-src="<?php echo $img['url']; ?>" alt="ID: <?php echo $img['id']; ?>" src = "../static/loading32.gif" />
</div>
<?php } ?>
</div>
<?php }else{ ?>
<!-- 预览图片END -->
<!-- 表格 -->
<table class="layui-table">
<colgroup>
<col width="60">
<col width="380">
<col width="150">
<col width="120">
<col>
</colgroup>
<thead>
<tr>
<th>ID</th>
<th>图片路径(点击可查看)</th>
<th>IP</th>
<th>日期</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($imgs as $img) {
?>
<tr id = "imgid<?php echo $img['id']; ?>">
<td><?php echo $img['id']; ?></td>
<td><a id = "imgid<?php echo $img['id']; ?>" href="javascript:;" onclick = "smshow('<?php echo $img['url'] ?>',<?php echo $img['id']; ?>)"><?php echo $img['url']; ?></a></td>
<td><a href="javascript:;" onclick = "ipquery('<?php echo $img['ip']; ?>')"><?php echo $img['ip']; ?></a></td>
<td><?php echo $img['date']; ?></td>
<td>
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-normal" onclick = "copyurl('<?php echo $img['url']; ?>')">复制</a>
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-danger" onclick = "deletesm(<?php echo $img['id']; ?>)">删除</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<!-- 表格END -->
</div>
<!-- 翻页按钮 -->
<div class="layui-col-lg9 layui-col-md-offset3">
<div class="page">
<a href="?type=<?php echo $type; ?>&page=<?php echo $up; ?>" class="layui-btn">上一页</a>
<a href="?type=<?php echo $type; ?>&page=<?php echo $down; ?>" class="layui-btn">下一页</a>
</div>
</div>
<!-- 翻页按钮END -->
<!-- 后台内容部分END -->
</div>
</div>
<?php
// 载入页脚
// 载入头部
include_once("../tpl/admin/footer.php");
?>

65
admin/urlup.php

@ -1,65 +0,0 @@ @@ -1,65 +0,0 @@
<?php
$title = "URL批量上传 - ImgURL";
include_once("../functions/class/class.admin.php");
// 载入头部
include_once("../tpl/admin/header.php");
// 获取类型
$type = $_GET['type'];
//获取页数
$page = $_GET['page'];
//查询sm.ms图片
$imgs = $pic->querysm($page);
//var_dump($imgs);
$up = (int)$page - 1;
if($up <= 0){
$up = 1;
}
$down = (int)$page +1;
?>
<div class="layui-container" style = "margin-top:2em;">
<div class="layui-row layui-col-space20">
<div class="layui-col-lg3">
<!-- 载入左侧导航栏 -->
<?php include_once("../tpl/admin/left.php"); ?>
</div>
<!-- 后台内容部分 -->
<div id = "adminpic">
<div class="layui-col-lg9">
<?php if($type == 'preview') { ?>
<!-- 预览图片 -->
<div class="layui-col-lg9 layui-col-space10">
<?php foreach ($imgs as $img) {
?>
<div class="layui-col-lg4 picadmin">
<img lay-src="<?php echo $img['url']; ?>" layer-src="<?php echo $img['url']; ?>" alt="ID: <?php echo $img['id']; ?>" />
</div>
<?php } ?>
</div>
<?php }else{ ?>
<!-- 预览图片END -->
<!-- 表格 -->
<table class="layui-table">
<div class="msg" style = "margin-top:0;"><i class="layui-icon"></i> 请输入图片地址,一行一个,一次不超过10个</div>
<div class="urltext">
<textarea rows="10" id = "arrurl" name="desc" placeholder="请输入图片地址,一行一个" class="layui-textarea"></textarea>
</div>
<div style = "margin-top:1em;">
<a href="javascript:;" class="layui-btn" onclick = "urlup()">开始上传</a>
</div>
</table>
<?php } ?>
<!-- 表格END -->
</div>
<!-- 后台内容部分END -->
</div>
</div>
<?php
// 载入页脚
// 载入头部
include_once("../tpl/admin/footer.php");
?>

34
check.php

@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
<?php
echo "<h1>请将以下信息填写到配置文件config.php</h1>";
//获取当前端口
$port = $_SERVER["SERVER_PORT"];
//对端口进行判断
switch ( $port )
{
case 80:
$protocol = "http://";
$port = '';
break;
case 443:
$protocol = "https://";
$port = '';
break;
default:
$protocol = "http://";
$port = ":".$port;
break;
}
//获取项目绝对路径
$thedir = __DIR__;
$thedir = str_replace("\\","/",$thedir).'/';
echo "项目绝对路径:".$thedir."<br />";
//或如URI
$uri = $_SERVER["REQUEST_URI"];
$uri = str_replace("check.php","",$uri);
//组合为完整的URL
$domain = $protocol.$_SERVER['SERVER_NAME'].$port.$uri;
echo "当前域名为:".$domain;
echo "<h1>配置完成后测试网站功能正常,请删除此文件。</h1>";
?>

38
config-simple.php

@ -1,38 +0,0 @@ @@ -1,38 +0,0 @@
<?php
//项目绝对路径
define("APP","homedir");
//载入数据库类
include_once(APP."functions/class/Medoo.php");
$config = array(
"domain" => "https://imgurl.org/", //站点地址
"user" => "imguser", //管理员账号
"password" => "imgpass", //管理员密码
"limit" => 5, //游客上传数量限制
"watermark" => "imgurl.org", //图片文字水印
"userdir" => "temp", //游客上传目录,一般不用做修改
"admindir" => "upload", //管理员上传目录,一般不用做修改
"datadir" => APP."db/imgurl.db3" //数据库路径,一般不用做修改
);
// TinyPNG压缩图片
$tinypng = array(
"option" => false,
"key" => array(
"xxx", //TinyPNG API KEY,支持填写多行key
"xxx" //如果只有一个key,请删除此行
)
);
//ModerateContent 图片鉴黄,请参考帮助文档:https://doc.xiaoz.me/docs/imgurl/imgurl-jh
$ModerateContent = array(
"option" => false,
"key" => "xxx"
);
//初始化Medoo
use Medoo\Medoo;
$database = new medoo([
'database_type' => 'sqlite',
'database_file' => $config['datadir']
]);
?>

2
db/.htaccess

@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
order allow,deny
deny from all

BIN
db/imgurl-simple.db3

Binary file not shown.

96
dispose.php

@ -1,96 +0,0 @@ @@ -1,96 +0,0 @@
<?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
//载入配置文件
include_once("./config.php");
//载入TinyPNG
require_once("functions/tinypng/Tinify/Exception.php");
require_once("functions/tinypng/Tinify/ResultMeta.php");
require_once("functions/tinypng/Tinify/Result.php");
require_once("functions/tinypng/Tinify/Source.php");
require_once("functions/tinypng/Tinify/Client.php");
require_once("functions/tinypng/Tinify.php");
//初始化值
$dispose['compress'] = 0;
$dispose['level'] = 0;
//获取ID
$id = $_GET['id'];
$id = (int)$id;
//获取tinypng key
$tinykey = array_rand($tinypng['key']); //取出数组键值
$tinykey = $tinypng['key'][$tinykey];
//获取ModerateContent key
$mckey = $ModerateContent['key'];
//如果ID不存在或为空
if((!isset($id)) || ($id == '')) {
echo 'ID错误!';
exit;
}
//查询对应信息
$info = $database->get("imginfo",[
"id",
"path",
"compress",
"level"
],[
"id" => $id
]);
//组合为完整的URL地址
$imgurl = $config['domain'].$info['path'];
//获取压缩状态
$compress = $info['compress'];
//获取图片等级
$level = $info['level'];
//获取文件后缀名
$suffix = substr(strrchr($info['path'], '.'), 1);
//后缀变为小写
$suffix = strtolower($suffix);
if(($suffix == 'png') || ($suffix == 'jpg') || ($suffix == 'jpeg')) {
$iscompress = 1;
}
//对图片进行压缩
if(($tinypng['option'] == true) && ($iscompress == 1) && ($compress == 0)) {
//初始化
\Tinify\setKey($tinykey);
$source = \Tinify\fromUrl($imgurl);
//覆盖原有图片
$source->toFile($info['path']);
//更新数据库
$database->update("imginfo",[
"compress" => 1
],[
"id" => $id
]);
$dispose['compress'] = 1;
}
//对图片进行鉴黄
if(($ModerateContent['option'] == true) && (($level == 0) || ($level == null))) {
$apiurl = "https://www.moderatecontent.com/api/v2?key=".$mckey."&url=".$imgurl;
$curl = curl_init($apiurl);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36");
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
$html = curl_exec($curl);
curl_close($curl);
//更新数据库
$html = json_decode($html);
$level = $html->rating_index;
$database->update("imginfo",["level" => $level],["id" => $id]);
$dispose['level'] = $level;
}
//返回json数据
$dispose['code'] = 1;
$dispose = json_encode($dispose);
echo $dispose;
?>

BIN
favicon.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

81
found.php

@ -1,81 +0,0 @@ @@ -1,81 +0,0 @@
<?php
$title = "探索发现 - ImgURL";
include_once("./tpl/user/header.php");
// 载入类
include_once("config.php");
//获取当前时间
$thetime = date('Y-m',time());
//初始化
$domain = $config['domain'];
$userdir = $config['userdir'];
//$sql = "SELECT `id`,`path` FROM `imginfo` WHERE (`dir` = '$userdir' AND `level` < 3 AND `date` LIKE '$thetime%') ORDER BY random() LIMIT 12";
$sql = "SELECT `id`,`path` FROM `imginfo` WHERE (`dir` = '$userdir' AND `level` < 3 AND `date` LIKE '$thetime%') ORDER BY `id` DESC";
$datas = $database->query($sql)->fetchAll();
?>
<div class="layui-container" style = "margin-bottom:6em;">
<div class="layui-row" >
<div class="msg"><i class="layui-icon">&#xe645;</i> 此页面显示本月上传图片,如果不显示说明本月暂未上传图片。</div>
<div id = "found-img" class = "layui-col-space20">
<?php foreach ($datas as $img) {
$imgurl = $domain.$img['path'];
$imgid = $img['id'];
?>
<div id = "imgid<?php echo $imgid; ?>" class="layui-col-lg4" style = "height:220px;border:1px solid #ECECEC;margin-top:1em;" onmouseover = "show_imgcon(<?php echo $imgid; ?>)" onmouseout = "hide_imgcon(<?php echo $imgid; ?>)">
<!-- <a href="javascript:;" onclick = "userpreview('<?php echo $imgurl ?>',<?php echo $imgid; ?>)"></a> -->
<img lay-src="<?php echo $imgurl ?>" layer-src="<?php echo $imgurl ?>" src = "./static/loading32.gif">
<!-- 图片按钮 -->
<div class = "imgcon" id = "imgcon<?php echo $imgid; ?>">
<a href="javascript:;" title = "图片链接" class="layui-btn layui-btn-xs layui-btn-normal" onclick = "adminshow('<?php echo $imgurl ?>',<?php echo $imgid; ?>)"><i class="layui-icon">&#xe64c;</i></a>
</div>
<!-- 图片按钮END -->
</div>
<?php } ?>
</div>
</div>
</div>
<!--图片查看-->
<div id="adminshow">
<div style = "margin-top:2em;"><center><img src="" alt=""></center></div>
<div id = "copy">
<center>
<table class="layui-table" lay-skin="nob">
<colgroup>
<col width="80">
<col width="520">
<col>
</colgroup>
<tbody>
<tr>
<td>URL</td>
<td><input type="text" class="layui-input" id="url" data-cip-id="url"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="newcopy('url')">复制</a></td>
</tr>
<tr>
<td>HTML</td>
<td><input type="text" class="layui-input" id="html" data-cip-id="html"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="newcopy('html')">复制</a></td>
</tr>
<tr>
<td>MarkDown</td>
<td><input type="text" class="layui-input" id="markdown" data-cip-id="markdown"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="newcopy('markdown')">复制</a></td>
</tr>
<tr>
<td>BBcode</td>
<td><input type="text" class="layui-input" id="bbcode" data-cip-id="bbcode"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="newcopy('bbcode')">复制</a></td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
<!--图片查看-->
<?php
include_once("./tpl/user/footer.php");
?>

BIN
functions/Arial Monospaced.ttf

Binary file not shown.

27
functions/Controller.php

@ -1,27 +0,0 @@ @@ -1,27 +0,0 @@
<?php
// 控制器
// 载入类
include_once("class/class.user.php");
$type = $_GET['type'];
switch ($type) {
case 'login':
// 用户登录时输入的信息
$user = array(
"user" => $_POST['user'],
"password" => $_POST['password']
);
// 配置文件里面的用户信息
$admin = array(
"user" => $config['user'],
"password" => $config['password']
);
$basis->login($user,$admin);
break;
case 'check':
$basis->check($config);
break;
default:
# code...
break;
}
?>

120
functions/api.php

@ -1,120 +0,0 @@ @@ -1,120 +0,0 @@
<?php
/*
name:ImgURL上传API
version:v1.0
author:xiaoz.me
update:2018-09-11
*/
header('Access-Control-Allow-Origin:*');
//载入配置文件
include_once("./class/class.user.php");
@$type = $_GET['type'];
$type = strip_tags($type);
//如果没有post文件
if(!$_FILES['file']){
$basis->re_error('未选择文件!');
}
//检查用户是否登录
$status = $basis->check($config);
//检查用户是否登陆来判断上传目录
if($status == 'islogin') {
//设置上传路径
$updir = $config['admindir'];
}
else{
$updir = $config['userdir'];
//限制用户上传数量
$basis->limitnum();
}
//获取上传者信息
$ip = $basis->getip();
$ua = $_SERVER['HTTP_USER_AGENT'];
$date = date('Y-m-d',time());
//载入上传类
include('./class/class.upload.php');
//上传方法
$handle = new upload($_FILES['file']);
if ($handle->uploaded) {
$handle->file_new_name_body = 'image_resized';
//允许上传大小2m
$handle->file_max_size = '2097152';
//允许的MIME类型,仅运行上传图片
$handle->allowed = array('image/*');
// 当前月份
$current_time = date('ym',time());
//上传路径:目录 + 时间
$handle->process('../'.$updir.'/'.$current_time."/");
if ($handle->processed) {
//获取站点域名
$domain = $config['domain'];
//生成文件hash
$fhash = hash_file("md5",$handle->file_dst_pathname,FALSE);
$fhash = substr($fhash,8,16);
//新的文件名(../temp/1804/\d64c8036c0605175.jpg)
$new_img = $handle->file_dst_path.$fhash.'.'.$handle->file_dst_name_ext;
//图片URL地址
$imgurl = $domain.$updir.'/'.$current_time.'/'.$fhash.'.'.$handle->file_dst_name_ext;
//图片路径(temp/1804/d64c8036c0605175.jpg)
$imgdir = $updir.'/'.$current_time.'/'.$fhash.'.'.$handle->file_dst_name_ext;
//判断文件是否已经存在
if(!is_file($new_img)) {
//对文件更名
rename($handle->file_dst_pathname,$new_img);
}
else{
//删除原始文件
unlink($handle->file_dst_pathname);
}
//检查某张图片是否已经上传过,如果已经上传了,直接返回数据并终止操作
$basis->isupload($imgdir);
//没有上传过的图片,继续写入数据库
$last_user_id = $database->insert("imginfo", [
"path" => $imgdir,
"ip" => $ip,
"ua" => $ua,
"date" => $date,
"dir" => $updir,
"compress" => 0,
"level" => 0
]);
//返回最后的ID
$account_id = $database->id();
//上传成功,返回json数据
$redata = array(
"code" => 1,
"id" => $account_id,
"url" => $imgurl,
"width" => $handle->image_dst_x,
"height" => $handle->image_dst_y
);
//直接返回图片URL
if($type == 'url'){
echo $imgurl;
}
else{
//返回json
echo $redata = json_encode($redata);
}
$handle->clean();
//继续请求鉴黄接口
$basis->curlZip($account_id,$config['domain']);
} else {
//上传出现错误,返回报错信息
$redata = array(
"code" => 0,
"msg" => $handle->error
);
echo json_encode($redata);
}
}
?>

1545
functions/class/Medoo.php

File diff suppressed because it is too large Load Diff

387
functions/class/class.admin.php

@ -1,387 +0,0 @@ @@ -1,387 +0,0 @@
<?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
// 载入配置文件
include_once("../config.php");
class Admin{
var $config;
var $database;
function __construct($config,$database) {
$this->config = $config;
$this->database = $database;
$user1 = $config['user'].md5("imgurl".$config['password']);
// echo $user1;
//COOKIES里面的信息
$user2 = $_COOKIE['user'].$_COOKIE['password'];
//如果两者信息相符,说明已登录
if($user1 != $user2) {
echo '权限不足,请先登录!';
//清理cookie
setcookie("user", '', time()-3600,"/");
setcookie("password", '', time()-3600,"/");
header('Location:login.php');
exit;
}
}
//查询图片
function querypic($type,$page,$date = null){
//对时间进行拆分
if($date != null){
$date = explode("|",$date);
$starttime = $date[0];
$endttime = $date[1];
}
$config = $this->config;
$database = $this->database;
//分页计算
$start = ($page - 1) * 12;
//$end = $page * 12;
if(($page == '') || (!isset($page))) {
$page = 1;
}
//要查询的条数
$num = 12;
//判断类型
switch ($type) {
case 'user':
// echo 'dsd';
$datas = $database->select("imginfo", "*", [
"dir" => $config['userdir'],
"ORDER" => ["id" => "DESC"],
"LIMIT" => [$start,$num]
]);
// var_dump( $database->log() );
// exit;
return $datas;
break;
case 'admin':
$datas = $database->select("imginfo", "*", [
"dir" => $config['admindir'],
"ORDER" => ["id" => "DESC"],
"LIMIT" => [$start,$num]
]);
return $datas;
break;
case 'dubious':
$datas = $database->select("imginfo", "*", [
"level" => 3,
"ORDER" => ["id" => "DESC"],
"LIMIT" => [$start,$num]
]);
return $datas;
break;
case 'unidentification':
$datas = $database->select("imginfo", "*", [
"level" => null,
"ORDER" => ["id" => "DESC"],
"LIMIT" => [$start,$num]
]);
return $datas;
break;
default:
$sql = "SELECT * FROM imginfo WHERE date(date) BETWEEN '$starttime' AND '$endttime' ORDER BY `id` DESC LIMIT $num OFFSET $start";
$datas = $database->query($sql);
return $datas;
break;
}
}
//新版查询图片
function newquery($type,$date = null){
//echo $type;
//exit;
//获取当前时间
$thetime = date('Y-m',time());
//对时间进行拆分
if($date != null){
$date = explode("|",$date);
$starttime = $date[0];
$endttime = $date[1];
}
$config = $this->config;
$database = $this->database;
//判断类型
switch ($type) {
case 'user':
// echo 'dsd';
$datas = $database->select("imginfo", "*", [
"dir" => $config['userdir'],
"date[~]" => $thetime,
"ORDER" => ["id" => "DESC"]
]);
// var_dump( $database->log() );
// exit;
return $datas;
break;
case 'admin':
$datas = $database->select("imginfo", "*", [
"dir" => $config['admindir'],
"date[~]" => $thetime,
"ORDER" => ["id" => "DESC"]
]);
return $datas;
break;
default:
$sql = "SELECT * FROM imginfo WHERE date(date) BETWEEN '$starttime' AND '$endttime' ORDER BY `id` DESC";
$datas = $database->query($sql);
//var_dump($database->log());
return $datas;
break;
}
}
//删除一张图片
function delete($id){
$config = $this->config;
$database = $this->database;
//先查询数据库获取图片路径
$path = $database->get("imginfo","path",[
"id" => $id
]);
//完整的图片路径
$imgpath = APP.$path;
//如果图片删除成功,将再次删除数据库
//删除图片
unlink($imgpath);
//删除数据库
$del = $database->delete("imginfo", [
"AND" => [
"id" => $id
]
]);
echo 'ok';
}
//统计数据
function data() {
//获取当前月份
$themonth = date('Y-m',time());
//获取当天时间
$theday = date('Y-m-d',time());
//统计本月上传图片数量
$month = $this->database->count("imginfo",[
"date[~]" => $themonth
]);
$day = $this->database->count("imginfo",[
"date" => $theday
]);
//统计可疑图片
$level = $this->database->count("imginfo",[
"level" => 3
]);
//统计全部图片
$all = $this->database->count("imginfo");
//返回数据
$redata = array(
"month" => $month,
"day" => $day,
"level" => $level,
"all" => $all
);
return $redata;
}
//取消图片可疑状态
function cdubious($id){
$database = $this->database;
$database->update("imginfo",[
"level" => 1
],[
"id" => $id
]);
echo 'ok';
}
//对某张图片进行压缩,未开发完成
function compress($id,$tinypng){
$database = $this->database;
$config = $this->config;
if($tinypng['option'] != true){
$compress['code'] = 0;
$compress['msg'] = "未开启图片压缩功能!";
}
else{
$getdata = $database->get("imginfo","*",[
"id" => $id
]);
}
}
//查询SM.MS图片
//查询图片
function querysm($page){
$config = $this->config;
$database = $this->database;
//分页计算
$start = ($page - 1) * 12;
//$end = $page * 12;
if(($page == '') || (!isset($page))) {
$page = 1;
}
//要查询的条数
$num = 12;
//判断类型
$datas = $database->select("sm", "*", [
"ORDER" => ["id" => "DESC"],
"LIMIT" => [$start,$num]
]);
return $datas;
}
//删除SM.MS图片
function deletesm($id){
$config = $this->config;
$database = $this->database;
//先查询数据库
$query = $database->get("sm","*",[
"id" => $id
]);
$delete = $database->delete("sm", [
"AND" => [
"id" => $id
]
]);
//请求接口删除图片
$curl = curl_init($query['delete']);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36");
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
#设置超时时间,最小为1s(可选)
curl_setopt($curl , CURLOPT_TIMEOUT, 2);
$html = curl_exec($curl);
curl_close($curl);
echo 'ok';
}
//通过URL批量上传图片
function urlup($arr){
$config = $this->config;
//$arr参数为一个数组
$arr = explode("\n",$arr);
//计算URL个数
$urlnum = count($arr);
//不能超过10个
if($urlnum > 10){
$rejson = array(
"code" => 0,
"msg" => "URL链接不能超过10个!"
);
echo json_encode($rejson);
exit;
}
//遍历URL并下载图片
foreach( $arr as $url )
{
//去掉空格
$url = trim($url);
//判断是否是URL
if(!filter_var($url, FILTER_VALIDATE_URL)){
$rejson = array(
"code" => 0,
"msg" => $url."不是有效的地址,程序终止!"
);
echo json_encode($rejson);
exit;
}
//获取图片后缀
$suffix = explode(".",$url);
$suffix = end($suffix);
$suffix = strtolower($suffix);
//如果是图片后缀,使用curl进行抓取
if(($suffix == 'jpg') || ($suffix == 'jpeg') || ($suffix == 'png') || ($suffix == 'bmp') || ($suffix == 'gif')) {
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)");
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
#设置超时时间,最小为1s(可选)
curl_setopt($curl , CURLOPT_TIMEOUT, 10);
$html = curl_exec($curl);
curl_close($curl);
//判断目录是否存在
$dir = APP.$config['admindir'].'/'.date('ym',time());
if(!is_dir($dir)){
mkdir($dir);
}
//生成文件名
$filenme = $dir.date('Y-m-d H:i:s',time()).$suffix;
$filenme = substr(md5($url.$filenme), 8, 16).'.'.$suffix;
$full = $dir.'/'.$filenme;
//写入文件
$myfile = fopen($full, "w") or die("Unable to open file!");
fwrite($myfile, $html);
fclose($myfile);
$datas = array(
"path" => $config['admindir'].'/'.date('ym',time()).'/'.$filenme,
"dir" => $config['admindir']
);
//写入数据库
$insert = $this->indb($datas);
}
else{
$rejson = array(
"code" => 0,
"msg" => "包含无效的图片地址,程序终止!"
);
echo json_encode($rejson);
exit;
}
}
$rejson = array(
"code" => 1,
"msg" => "成功上传".$urlnum."张图片!"
);
echo json_encode($rejson);
exit;
}
//图片写入数据库
function indb($datas){
$database = $this->database;
$date = date('Y-m-d',time());
$insert = $database->insert("imginfo",[
"path" => $datas['path'],
"ip" => "127.0.0.1",
"ua" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36",
"date" => $date,
"dir" => $datas['dir'],
"compress" => 0,
"level" => 0
]);
return $insert;
}
}
$pic = new Admin($config,$database);
?>

173
functions/class/class.install.php

@ -1,173 +0,0 @@ @@ -1,173 +0,0 @@
<?php
class Install{
public $homedir;
public $domain;
//构造函数
public function __construct(){
//获取项目绝对路径
$thedir = __DIR__;
$homedir = str_replace("\\","/",$thedir);
$homedir = str_replace("functions/class","",$homedir);
$this->homedir = $homedir;
//获取当前域名
//获取当前端口
$port = $_SERVER["SERVER_PORT"];
//对端口进行判断
switch ( $port )
{
case 80:
$protocol = "http://";
$port = '';
break;
case 443:
$protocol = "https://";
$port = '';
break;
default:
$protocol = "http://";
$port = ":".$port;
break;
}
$uri = $_SERVER["REQUEST_URI"];
$uri = str_replace("check.php","",$uri);
//组合为完整的URL
$domain = $protocol.$_SERVER['SERVER_NAME'].$port.$uri;
$domain = str_replace("install.php?setup=2","",$domain);
$this->domain = $domain;
}
//检查环境是否符合条件
public function check(){
$homedir = $this->homedir;
//echo $homedir.'db';
//检查根目录是否可写,结果写入到一个数组
//echo $thedir;
$checkarr['home'] = is_writable($homedir);
if($checkarr['home']){
$statusarr['home'] = '通过';
}
else{
$statusarr['home'] = '<span style = "color:red;">目录不可写!</span>';
}
$checkarr['db'] = is_writable($homedir.'db');
if($checkarr['db']){
$statusarr['db'] = '通过';
}
else{
$statusarr['db'] = '<span style = "color:red;">目录不可写!</span>';
}
//检测组建是否支持
$ext = get_loaded_extensions();
if(array_search('pdo_sqlite',$ext)){
$statusarr['pdo'] = '支持';
}
else{
$statusarr['pdo'] = '<span style = "color:red;">不支持!</span>';
}
//return $checkarr;
return $statusarr;
}
//获取站点信息
public function info(){
$homedir = $this->homedir;
$info = array(
"homedir" => $this->homedir,
"domain" => $this->domain
);
return $info;
}
//验证函数
protected function verify($data,$type){
switch ($type) {
//检查用户名
case 'user':
$pattern = '/^[a-zA-Z0-9]+$/';
if($data == ''){
echo '请填写用户名!';
exit;
}
if(!preg_match($pattern,$data)){
echo '用户名格式有误!';
exit;
}
break;
case 'pass':
$pattern = '/^[a-zA-Z0-9!@#$%^&*.]+$/';
if(!preg_match($pattern,$data)){
echo '密码格式有误!';
exit;
}
break;
case 'pass2':
$pass1 = $data['pass1'];
$pass2 = $data['pass2'];
if($pass1 != $pass2){
echo '两次密码不一致!';
exit;
}
break;
case 'domain':
$domain = $data['domain'];
if(!filter_var($domain, FILTER_VALIDATE_URL)){
echo '域名格式有误!(需要包含https://)';
exit;
}
break;
default:
# code...
break;
}
}
//安装
public function setup($data){
$homedir = $this->homedir;
$dbpath = $this->homedir.'db/';
$user = $data['user'];
$pass1 = $data['pass1'];
$pass2 = $data['pass2'];
$this->verify($user,'user');
$this->verify($pass1,'pass');
$this->verify($data,'pass2');
$this->verify($data,'domain');
//复制一份数据库
copy($dbpath."imgurl-simple.db3",$dbpath."imgurl.db3");
//复制一份配置文件
if(copy($homedir."config-simple.php",$homedir."config.php")){
$configdir = $homedir."config.php";
$myfile = fopen($homedir."config.php", "r") or die("Unable to open file!");
$content = fread($myfile,filesize($configdir));
//执行替换
$content = str_replace("imguser",$user,$content);
$content = str_replace("imgpass",$pass2,$content);
$content = str_replace("homedir",$data['homedir'],$content);
$content = str_replace("https://imgurl.org/",$data['domain'],$content);
//var_dump($content);
//写入文件
$myfile = fopen($homedir."config.php", "w+") or die("Unable to open file!");
fwrite($myfile, $content);
//关闭
fclose($myfile);
//更名安装文件
rename($homedir."install.php",$homedir."install.php.bak");
}
}
}
?>

90
functions/class/class.pic.php

@ -1,90 +0,0 @@ @@ -1,90 +0,0 @@
<?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
/*
图像处理类
*/
include_once("../../config.php");
//载入TinyPNG
require_once(APP."functions/tinypng/Tinify/Exception.php");
require_once(APP."functions/tinypng/Tinify/ResultMeta.php");
require_once(APP."functions/tinypng/Tinify/Result.php");
require_once(APP."functions/tinypng/Tinify/Source.php");
require_once(APP."functions/tinypng/Tinify/Client.php");
require_once(APP."functions/tinypng/Tinify.php");
//初始化值
$dispose['compress'] = 0;
$dispose['level'] = 0;
//获取ID
$id = $_GET['id'];
$id = (int)$id;
//获取tinypng key
$tinykey = array_rand($tinypng['key']); //取出数组键值
$tinykey = $tinypng['key'][$tinykey];
$iscompress = 0;
//如果ID不存在或为空
if((!isset($id)) || ($id == '')) {
echo 'ID错误!';
exit;
}
//如果没有启用压缩
if($tinypng['option'] != true){
echo '未启用压缩功能!';
exit;
}
//查询对应信息
$info = $database->get("imginfo",[
"id",
"path",
"compress",
"level"
],[
"id" => $id
]);
//组合为完整的URL地址
$imgurl = $config['domain'].$info['path'];
//获取压缩状态
$compress = $info['compress'];
//获取图片等级
$level = $info['level'];
//获取文件后缀名
$suffix = substr(strrchr($info['path'], '.'), 1);
//后缀改为小写
$suffix = strtolower($suffix);
if(($suffix == 'png') || ($suffix == 'jpg') || ($suffix == 'jpeg')) {
$iscompress = 1;
}
if($iscompress == 0){
echo '该后缀不支持压缩!';
exit;
}
if($compress == 1){
echo '该图片已经压缩!';
exit;
}
//对图片进行压缩
if(($tinypng['option'] == true) && ($iscompress == 1) && ($compress == 0)) {
//初始化
\Tinify\setKey($tinykey);
$source = \Tinify\fromUrl($imgurl);
//覆盖原有图片
$source->toFile(APP.$info['path']);
//更新数据库
$database->update("imginfo",[
"compress" => 1
],[
"id" => $id
]);
$dispose['compress'] = 1;
echo '压缩成功!';
}
?>

0
functions/class/class.sm.php

5061
functions/class/class.upload.php

File diff suppressed because it is too large Load Diff

189
functions/class/class.user.php

@ -1,189 +0,0 @@ @@ -1,189 +0,0 @@
<?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
// 载入配置文件
include_once("../config.php");
class User{
var $config;
var $database;
//构造函数
public function __construct($config,$database){
$this->config = $config;
$this->database = $database;
}
// 用户登录,两个参数,一个是用户输入,一个是配置文件里面的用户信息
function login($user,$admin){
// 用户输入的信息进行md5加密和对比
$pw1 = md5($user['user'].$user['password']);
$pw2 = md5($admin['user'].$admin['password']);
// 判断用户名密码是否正确
if($pw1 != $pw2){
echo '用户名或密码不正确!';
setcookie("user", '', time()-3600,"/");
setcookie("password", '', time()-3600,"/");
exit;
}
else{
$password = md5("imgurl".$admin['password']);
//生成cookie
setcookie("user", $user['user'], time()+3600 * 24 * 30,"/");
setcookie("password", $password, time()+3600 * 24 * 30,"/");
echo "<script>window.location.href = './index.php'</script>";
exit;
}
}
//判断用户状态
function check($userinfo){
//配置文件里面的用户信息
$user1 = $userinfo['user'].md5("imgurl".$userinfo['password']);
// echo $user1;
//COOKIES里面的信息
$user2 = $_COOKIE['user'].$_COOKIE['password'];
//如果两者信息相符,说明已登录
if($user1 == $user2) {
return'islogin';
exit;
}
else{
return 'nologin';
setcookie("user", '', time()-3600,"/");
setcookie("password", '', time()-3600,"/");
exit;
}
}
//检查某张图片是否已经上传
function isupload($path){
$num = $this->database->count("imginfo",["path" => $path]);
//如果图片已经上传过,直接返回图片信息
if($num >=1) {
$info = $this->database->get("imginfo","*",["path" => $path]);
$imgurl = $this->config['domain'].$path;
//返回json数据
$redata = array(
"code" => 1,
"id" => $info['id'],
"url" => $imgurl,
"width" => 0,
"height" => 0
);
echo $redata = json_encode($redata);
exit;
}
}
//限制访客上传数量
function limitnum(){
//获取访客IP
$ip = $_SERVER['REMOTE_ADDR'];
//获取当前时间
$date = date('Y-m-d',time());
//获取配置文件限额
$limit = $this->config['limit'];
//获取用户上传目录
$dir = $this->config['userdir'];
//查询数据库统计数量
$database = $this->database;
$num = $database->count("imginfo",[
"date" => $date,
"ip" => $ip,
"dir" => $dir
]);
if($num >= $limit) {
$redata = array(
"code" => 0,
"msg" => "上传达到限制!"
);
echo $redata = json_encode($redata);
exit;
}
}
//获取访客真实IP
function getip(){
if (getenv('HTTP_CLIENT_IP')) {
$ip = getenv('HTTP_CLIENT_IP');
}
elseif (getenv('HTTP_X_FORWARDED_FOR')) {
$ip = getenv('HTTP_X_FORWARDED_FOR');
}
elseif (getenv('HTTP_X_FORWARDED')) {
$ip = getenv('HTTP_X_FORWARDED');
}
elseif (getenv('HTTP_FORWARDED_FOR')) {
$ip = getenv('HTTP_FORWARDED_FOR');
}
elseif (getenv('HTTP_FORWARDED')) {
$ip = getenv('HTTP_FORWARDED');
}
else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
//判断文件MIME类型
function mime($path){
$mime = mime_content_type($path);
switch ( $mime )
{
case 'image/gif':
case 'image/png':
case 'image/jpeg':
case 'image/bmp':
return true;
break;
default:
return false;
break;
}
}
//返回错误json
function re_error($msg){
$arr = array(
"code" => 0,
"msg" => $msg
);
$rejson = json_encode($arr);
echo $rejson;
exit;
}
//请求tipng和鉴黄接口
function curlZip($id,$domain){
//组合为完整的接口
$apiurl = $domain.'dispose.php?id='.$id;
//请求接口
$curl = curl_init($apiurl);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36");
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
#设置超时时间,最小为1s(可选)
curl_setopt($curl , CURLOPT_TIMEOUT, 2);
@curl_exec($curl);
curl_close($curl);
//var_dump($html);
}
//查询未识别图片
function unknown(){
$thedate = date('Y-m-d',time());
$sql = "SELECT * FROM `imginfo` WHERE (level IS NULL OR level = 0) AND date = '$thedate'";
$database = $this->database;
//$datas = $database->select("imginfo","*");
$datas = $database->query($sql)->fetchAll();
return $datas;
}
}
//自动初始化完成一些基础操作
$basis = new User($config,$database);
?>

86
functions/class/lang/class.upload.zh_CN.gb-2312.php

@ -1,86 +0,0 @@ @@ -1,86 +0,0 @@
<?php
// +------------------------------------------------------------------------+
// | class.upload.zh_CN.php |
// +------------------------------------------------------------------------+
// | Copyright (c) caoshiwei 2008. All rights reserved. |
// | Version 0.25 |
// | Last modified 09/29/2008 |
// | Email caoshiwei@gmail.com |
// | Web http://www.hfut.edu.cn |
// +------------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License version 2 as |
// | published by the Free Software Foundation. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the |
// | Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
// | Boston, MA 02111-1307 USA |
// | |
// | Please give credit on sites that use class.upload and submit changes |
// | of the script so other people can use them as well. |
// | This script is free to use, don't abuse. |
// +------------------------------------------------------------------------+
/**
* Class upload Chinese translation
*
* @version 0.25
* @codepage gb-2312
* @author Shiwei Cao (caoshiwei@gmail.com)
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @copyright Shiwei Cao
* @package cmf
* @subpackage external
*/
$translation = array();
$translation['file_error'] = '<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԡ<EFBFBD>';
$translation['local_file_missing'] = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڡ<EFBFBD>';
$translation['local_file_not_readable'] = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɶ<EFBFBD><EFBFBD>';
$translation['uploaded_too_big_ini'] = '<EFBFBD>ļ<EFBFBD><EFBFBD>ϼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD>ϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>php.ini<EFBFBD><EFBFBD>upload_max_filesize<EFBFBD><EFBFBD><EFBFBD>õĴ<EFBFBD>С)<EFBFBD><EFBFBD>';
$translation['uploaded_too_big_html'] = '<EFBFBD>ļ<EFBFBD><EFBFBD>ϼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD>ϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HTML <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õĴ<EFBFBD>С)<EFBFBD><EFBFBD>';
$translation['uploaded_partial'] = '<EFBFBD>ļ<EFBFBD><EFBFBD>ϼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD>ϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ʧ)<EFBFBD><EFBFBD>';
$translation['uploaded_missing'] = '<EFBFBD>ļ<EFBFBD><EFBFBD>ϼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD>ϴ<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ʧ)<EFBFBD><EFBFBD>';
$translation['uploaded_unknown'] = '<EFBFBD>ļ<EFBFBD><EFBFBD>ϼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֪<EFBFBD><EFBFBD><EFBFBD><EFBFBD>).';
$translation['try_again'] = '<EFBFBD>ļ<EFBFBD><EFBFBD>ϼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԡ<EFBFBD>';
$translation['file_too_big'] = '<EFBFBD>ļ<EFBFBD>̫<EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
$translation['no_mime'] = 'δ֪<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD>';
$translation['incorrect_file'] = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>';
$translation['image_too_wide'] = 'ͼƬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̫<EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
$translation['image_too_narrow'] = 'ͼƬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̫С<EFBFBD><EFBFBD>';
$translation['image_too_high'] = 'ͼƬ<EFBFBD>߶<EFBFBD>̫<EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
$translation['image_too_short'] = 'ͼƬ<EFBFBD>߶<EFBFBD>̫С<EFBFBD><EFBFBD>';
$translation['ratio_too_high'] = 'ͼƬ<EFBFBD><EFBFBD>/<EFBFBD>߱<EFBFBD><EFBFBD><EFBFBD>̫<EFBFBD><EFBFBD>(ͼƬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̫<EFBFBD><EFBFBD>)<EFBFBD><EFBFBD>';
$translation['ratio_too_low'] = 'ͼƬ<EFBFBD><EFBFBD>/<EFBFBD>߱<EFBFBD><EFBFBD><EFBFBD>̫<EFBFBD><EFBFBD>(ͼƬ<EFBFBD>߶<EFBFBD>̫<EFBFBD><EFBFBD>).';
$translation['too_many_pixels'] = 'ͼƬλ<EFBFBD><EFBFBD>̫<EFBFBD>ߡ<EFBFBD>';
$translation['not_enough_pixels'] = 'ͼƬλ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
$translation['file_not_uploaded'] = '<EFBFBD>ļ<EFBFBD>δ<EFBFBD>ϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>';
$translation['already_exists'] = '%s <EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
$translation['temp_file_missing'] = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>ʱ)Դ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>';
$translation['source_missing'] = '<EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>';
$translation['destination_dir'] = 'Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>Ŀ¼<EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>';
$translation['destination_dir_missing'] = 'Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>Ŀ¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>';
$translation['destination_path_not_dir'] = 'Ŀ¼·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>Ŀ¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>';
$translation['destination_dir_write'] = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>Ŀ¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>д<EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>';
$translation['destination_path_write'] = 'Ŀ¼·<EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>';
$translation['temp_file'] = '<EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>';
$translation['source_not_readable'] = 'Դ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>';
$translation['no_create_support'] = '%s <EFBFBD><EFBFBD>֧<EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD>';
$translation['create_error'] = '<EFBFBD><EFBFBD>Դ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s ͼƬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><EFBFBD><EFBFBD>';
$translation['source_invalid'] = '<EFBFBD>޷<EFBFBD><EFBFBD><EFBFBD>ȡԭʼͼƬ<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD>ͼƬ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>';
$translation['gd_missing'] = 'GD <EFBFBD><EFBFBD><EFBFBD>񲻿<EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>á<EFBFBD>';
$translation['watermark_no_create_support'] = '%s <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD>ȡˮӡ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>';
$translation['watermark_create_error'] = '%s <EFBFBD><EFBFBD>֧<EFBFBD>ֶ<EFBFBD>, <EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD>ˮӡ<EFBFBD><EFBFBD>';
$translation['watermark_invalid'] = 'δ֪<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ʽ, <EFBFBD>޷<EFBFBD><EFBFBD><EFBFBD>ȡˮӡ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>';
$translation['file_create'] = '%s <EFBFBD><EFBFBD>֧<EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
$translation['no_conversion_type'] = 'δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
$translation['copy_failed'] = '<EFBFBD>ڷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> copy() <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>.';
$translation['reading_failed'] = '<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><EFBFBD><EFBFBD>';
?>

85
functions/class/lang/class.upload.zh_CN.php

@ -1,85 +0,0 @@ @@ -1,85 +0,0 @@
<?php
// +------------------------------------------------------------------------+
// | class.upload.zh_CN.php |
// +------------------------------------------------------------------------+
// | Copyright (c) caoshiwei 2008. All rights reserved. |
// | Version 0.25 |
// | Last modified 09/29/2008 |
// | Email caoshiwei@gmail.com |
// | Web http://www.hfut.edu.cn |
// +------------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License version 2 as |
// | published by the Free Software Foundation. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the |
// | Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
// | Boston, MA 02111-1307 USA |
// | |
// | Please give credit on sites that use class.upload and submit changes |
// | of the script so other people can use them as well. |
// | This script is free to use, don't abuse. |
// +------------------------------------------------------------------------+
/**
* Class upload Chinese translation
*
* @version 0.25
* @author Shiwei Cao (caoshiwei@gmail.com)
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @copyright Shiwei Cao
* @package cmf
* @subpackage external
*/
$translation = array();
$translation['file_error'] = '文件错误,请重试。';
$translation['local_file_missing'] = '本地文件不存在。';
$translation['local_file_not_readable'] = '本地文件不可读。';
$translation['uploaded_too_big_ini'] = '文件上件出错 (上传的文件大小超过了php.ini中upload_max_filesize设置的大小)。';
$translation['uploaded_too_big_html'] = '文件上件出错 (上传的文件大小超过了HTML 表单设置的大小)。';
$translation['uploaded_partial'] = '文件上件出错 (上传的文件部分丢失)。';
$translation['uploaded_missing'] = '文件上件出错 (上传文件丢失)。';
$translation['uploaded_unknown'] = '文件上件出错 (未知错误).';
$translation['try_again'] = '文件上件出错。 请重试。';
$translation['file_too_big'] = '文件太大。';
$translation['no_mime'] = '未知文件类型。';
$translation['incorrect_file'] = '不正确的文件格式。';
$translation['image_too_wide'] = '图片宽度太大。';
$translation['image_too_narrow'] = '图片宽度太小。';
$translation['image_too_high'] = '图片高度太大。';
$translation['image_too_short'] = '图片高度太小。';
$translation['ratio_too_high'] = '图片宽/高比率太高(图片宽度太大)。';
$translation['ratio_too_low'] = '图片宽/高比率太低(图片高度太大).';
$translation['too_many_pixels'] = '图片位数太高。';
$translation['not_enough_pixels'] = '图片位数不够';
$translation['file_not_uploaded'] = '文件未上传,不能进行处理。';
$translation['already_exists'] = '%s 已经存在,请更换文件名。';
$translation['temp_file_missing'] = '处理的(临时)源文件不正确,不能进行处理。';
$translation['source_missing'] = '已上传的文件丢失,不能进行处理。';
$translation['destination_dir'] = '目标文件目录不能被创建,不能进行处理。';
$translation['destination_dir_missing'] = '目标文件目录不存在,不能进行处理。';
$translation['destination_path_not_dir'] = '目录路径不是一个有效的目录,不能进行处理。';
$translation['destination_dir_write'] = '不能让目标文件目录设置为可写的,不能进行处理。';
$translation['destination_path_write'] = '目录路径是不可以写的,不能进行处理。';
$translation['temp_file'] = '不能创建临时文件,不能进行处理。';
$translation['source_not_readable'] = '源文件不可以读,不能进行处理。';
$translation['no_create_support'] = '%s 不支持创建';
$translation['create_error'] = '从源文件创建 %s 图片过程中出错。';
$translation['source_invalid'] = '无法读取原始图片,确认是不是正确的图片文件?';
$translation['gd_missing'] = 'GD 好像不可以使用。';
$translation['watermark_no_create_support'] = '%s 创建不支持, 不能读取水印文件。';
$translation['watermark_create_error'] = '%s 不支持读, 不能创建水印。';
$translation['watermark_invalid'] = '未知文件格式, 无法读取水印文件。';
$translation['file_create'] = '%s 不支持创建。';
$translation['no_conversion_type'] = '未定义转换类型';
$translation['copy_failed'] = '在服务器上复制文件时出错。 copy() 操作失败.';
$translation['reading_failed'] = '读取过程中出错。';
?>

87
functions/class/lang/class.upload.zh_TW.php

@ -1,87 +0,0 @@ @@ -1,87 +0,0 @@
<?php
// +------------------------------------------------------------------------+
// | class.upload.zh_TW.php |
// +------------------------------------------------------------------------+
// | Copyright (c) Yang Chih-Wen 2009. All rights reserved. |
// | Version 0.28 |
// | Last modified 15/08/2009 |
// | Email chihwen.yang@gmail.com |
// | Web http://www.doubleservice.com/ |
// +------------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License version 2 as |
// | published by the Free Software Foundation. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the |
// | Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
// | Boston, MA 02111-1307 USA |
// | |
// | Please give credit on sites that use class.upload and submit changes |
// | of the script so other people can use them as well. |
// | This script is free to use, don't abuse. |
// +------------------------------------------------------------------------+
/**
* Class upload Traditional Chinese translation
*
* @version 0.28
* @author Yang Chih-Wen (chihwen.yang@gmail.com)
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @copyright Yang Chih-Wen
* @package cmf
* @subpackage external
*/
$translation = array();
$translation['file_error'] = '檔案錯誤,請重試。';
$translation['local_file_missing'] = '本地端的檔案不存在。';
$translation['local_file_not_readable'] = '本地端的檔案不可讀取。';
$translation['uploaded_too_big_ini'] = '檔案上傳出錯 (上傳的檔案超過了 php.ini 中 upload_max_filesize 指定的大小)。';
$translation['uploaded_too_big_html'] = '檔案上傳出錯 (上傳的檔案超過了 HTML 表單中 MAX_FILE_SIZE 指定的大小)。';
$translation['uploaded_partial'] = '檔案上傳出錯 (只有部份的檔案被上傳)。';
$translation['uploaded_missing'] = '檔案上傳出錯 (沒有檔案被上傳)。';
$translation['uploaded_no_tmp_dir'] = '檔案上傳出錯 (找不到暫存目錄)。';
$translation['uploaded_cant_write'] = '檔案上傳出錯 (檔案寫入失敗)。';
$translation['uploaded_err_extension'] = '檔案上傳出錯 (檔案上傳被 extension 中斷)。';
$translation['uploaded_unknown'] = '檔案上傳出錯 (未知的錯誤)。';
$translation['try_again'] = '檔案上傳出錯,請重試。';
$translation['file_too_big'] = '檔案太大了。';
$translation['no_mime'] = '未知的 MIME Type 檔案類型。';
$translation['incorrect_file'] = '不正確的 MIME Type 檔案類型。';
$translation['image_too_wide'] = '圖片寬度太大。';
$translation['image_too_narrow'] = '圖片寬度太小。';
$translation['image_too_high'] = '圖片高度太大。';
$translation['image_too_short'] = '圖片高度太小。';
$translation['ratio_too_high'] = '圖片寬高比率太大 (圖片寬度太大)。';
$translation['ratio_too_low'] = '圖片寬高比率太小 (圖片高度太大)。';
$translation['too_many_pixels'] = '圖片像素太多。';
$translation['not_enough_pixels'] = '圖片像素太少。';
$translation['file_not_uploaded'] = '檔案未上傳,無法繼續進行處理。';
$translation['already_exists'] = '%s 已經存在,請更改檔名。';
$translation['temp_file_missing'] = '暫存的原始檔案不正確,無法繼續進行處理。';
$translation['source_missing'] = '已上傳的原始檔案不正確,無法繼續進行處理。';
$translation['destination_dir'] = '無法創建目標目錄,無法繼續進行處理。';
$translation['destination_dir_missing'] = '目標目錄不存在,無法繼續進行處理。';
$translation['destination_path_not_dir'] = '目標路徑不是一個有效的目錄,無法繼續進行處理。';
$translation['destination_dir_write'] = '目標目錄不能設定為可寫入,無法繼續進行處理。';
$translation['destination_path_write'] = '目錄路徑不可寫入,無法繼續進行處理。';
$translation['temp_file'] = '不能創建暫存檔案,無法繼續進行處理。';
$translation['source_not_readable'] = '原始檔案不可讀取,無法繼續進行處理。';
$translation['no_create_support'] = '不支援 %s 創建功能。';
$translation['create_error'] = '從原始檔案創建 %s 圖片過程中出錯。';
$translation['source_invalid'] = '無法讀取原始圖片,請確認是否為正確的圖片檔?';
$translation['gd_missing'] = '無法使用 GD 函式庫。';
$translation['watermark_no_create_support'] = '不支援 %s 創建功能,無法讀取浮水印。';
$translation['watermark_create_error'] = '不支援 %s 讀取功能,無法創建浮水印。';
$translation['watermark_invalid'] = '未知的圖片格式,無法讀取浮水印。';
$translation['file_create'] = '不支援 %s 創建功能。';
$translation['no_conversion_type'] = '未定義的轉換類型。';
$translation['copy_failed'] = '在伺服端複製檔案時出錯,copy() 操作失敗。';
$translation['reading_failed'] = '讀檔過程中出錯。';
?>

98
functions/cvupload.php

@ -1,98 +0,0 @@ @@ -1,98 +0,0 @@
<?php
//载入配置文件
include_once("./class/class.user.php");
//检查用户是否登录
$status = $basis->check($config);
//检查用户是否登陆来判断上传目录
if($status == 'islogin') {
//设置上传路径
$updir = $config['admindir'];
}
else{
$updir = $config['userdir'];
//限制用户上传数量
$basis->limitnum();
}
//获取上传者信息
$ip = $basis->getip();
$ua = $_SERVER['HTTP_USER_AGENT'];
$date = date('Y-m-d',time());
//根据IP、ua、时间生成一个唯一的md5值
$picname = md5($ip.$ua.date('Y-m-d H:i:s',time()));
//截取16个字符
$picname = substr($picname,8,16).'.png';
//本月图片路径
$monthdir = APP.$updir.'/'.date('ym',time());
$onepath = $updir.'/'.date('ym',time()).'/'.$picname;
//路径不存在,则创建路径
if(!file_exists($monthdir)){
mkdir($monthdir,0777);
}
//图片完整存储路径
$picpath = APP.$onepath;
//echo $picpath;
//替换一下,以免windows出现问题
$picpath = str_replace("\\","/",$picpath);
//echo $picpath;
//接接收ase64图片
$picfile = $_POST['content'];
$picfile = base64_decode($picfile);
//echo $picfile;
//存储图片
file_put_contents($picpath, $picfile);
//获取文件mime类型
//如果不是图片文件,终止执行
if(!$basis->mime($picpath)){
unlink($picpath);
$arr = array(
"code" => 0,
"msg" => '不允许的文件类型'
);
$json = json_encode($arr);
echo $json;
exit;
}
//继续执行并写入数据库
$last_user_id = $database->insert("imginfo", [
"path" => $onepath,
"ip" => $ip,
"ua" => $ua,
"date" => $date,
"dir" => $updir,
"compress" => 0,
"level" => 0
]);
//var_dump($database->log());
//返回最后的ID
$account_id = $database->id();
//写入数据库成功,返回json数据
if($last_user_id){
$url = $config['domain'].$onepath;
rejson(1,$url,$account_id);
}
//echo $picpath;
//var_dump($picfile);
?>
<?php
//返回json数据
function rejson($code,$url,$id = 0){
$arr = array(
"code" => $code,
"url" => $url,
"id" => $id
);
$json = json_encode($arr);
echo $json;
}
?>

59
functions/sm.php

@ -1,59 +0,0 @@ @@ -1,59 +0,0 @@
<?php
//载入类
include_once("./class/class.user.php");
//获取sm.ms API返回数据
$data = $_POST['data'];
//获取访客IP
$sm['ip'] = $basis->getip();
//获取访客UA
$sm['ua'] = $_SERVER['HTTP_USER_AGENT'];
//获取当前时间
$sm['date'] = date('Y-m-d',time());
//获取图片URL
$sm['url'] = $data['url'];
//获取删除链接
$sm['delete'] = $data['delete'];
//进行基本的判断
if((!isset($data)) || ($data == '') || (!is_array($data))) {
echo '获取数据失败!';
exit;
}
//再次判断地址是否合法
if(!filter_var($sm['url'], FILTER_VALIDATE_URL)) {
echo '不是合法的地址!';
exit;
}
if(!filter_var($sm['delete'], FILTER_VALIDATE_URL)) {
echo '不是合法的地址!';
exit;
}
//写入数据库
$last_user_id = $database->insert("sm", [
"ip" => $sm['ip'],
"ua" => $sm['ua'],
"date" => $sm['date'],
"url" => $sm['url'],
"delete"=> $sm['delete']
]);
//返回ID
$smid = $database->id();
if($last_user_id) {
$redata = array(
"code" => 1,
"id" => $smid,
"msg" => "写入成功!"
);
echo json_encode($redata);
exit;
}
else{
$redata = array(
"code" => 0,
"id" => $smid,
"msg" => "该图片可能已经上传过!"
);
echo json_encode($redata);
}
?>

96
functions/tinypng/Tinify.php

@ -1,96 +0,0 @@ @@ -1,96 +0,0 @@
<?php
namespace Tinify;
const VERSION = "1.5.2";
class Tinify {
private static $key = NULL;
private static $appIdentifier = NULL;
private static $proxy = NULL;
private static $compressionCount = NULL;
private static $client = NULL;
public static function setKey($key) {
self::$key = $key;
self::$client = NULL;
}
public static function setAppIdentifier($appIdentifier) {
self::$appIdentifier = $appIdentifier;
self::$client = NULL;
}
public static function setProxy($proxy) {
self::$proxy = $proxy;
self::$client = NULL;
}
public static function getCompressionCount() {
return self::$compressionCount;
}
public static function setCompressionCount($compressionCount) {
self::$compressionCount = $compressionCount;
}
public static function getClient() {
if (!self::$key) {
throw new AccountException("Provide an API key with Tinify\setKey(...)");
}
if (!self::$client) {
self::$client = new Client(self::$key, self::$appIdentifier, self::$proxy);
}
return self::$client;
}
public static function setClient($client) {
self::$client = $client;
}
}
function setKey($key) {
return Tinify::setKey($key);
}
function setAppIdentifier($appIdentifier) {
return Tinify::setAppIdentifier($appIdentifier);
}
function setProxy($proxy) {
return Tinify::setProxy($proxy);
}
function getCompressionCount() {
return Tinify::getCompressionCount();
}
function compressionCount() {
return Tinify::getCompressionCount();
}
function fromFile($path) {
return Source::fromFile($path);
}
function fromBuffer($string) {
return Source::fromBuffer($string);
}
function fromUrl($string) {
return Source::fromUrl($string);
}
function validate() {
try {
Tinify::getClient()->request("post", "/shrink");
} catch (AccountException $err) {
if ($err->status == 429) return true;
throw $err;
} catch (ClientException $err) {
return true;
}
}

160
functions/tinypng/Tinify/Client.php

@ -1,160 +0,0 @@ @@ -1,160 +0,0 @@
<?php
namespace Tinify;
class Client {
const API_ENDPOINT = "https://api.tinify.com";
const RETRY_COUNT = 1;
const RETRY_DELAY = 500;
private $options;
public static function userAgent() {
$curl = curl_version();
return "Tinify/" . VERSION . " PHP/" . PHP_VERSION . " curl/" . $curl["version"];
}
private static function caBundle() {
return __DIR__ . "/../data/cacert.pem";
}
function __construct($key, $app_identifier = NULL, $proxy = NULL) {
$curl = curl_version();
if (!($curl["features"] & CURL_VERSION_SSL)) {
throw new ClientException("Your curl version does not support secure connections");
}
if ($curl["version_number"] < 0x071201) {
$version = $curl["version"];
throw new ClientException("Your curl version ${version} is outdated; please upgrade to 7.18.1 or higher");
}
$this->options = array(
CURLOPT_BINARYTRANSFER => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_USERPWD => "api:" . $key,
CURLOPT_CAINFO => self::caBundle(),
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_USERAGENT => join(" ", array_filter(array(self::userAgent(), $app_identifier))),
);
if ($proxy) {
$parts = parse_url($proxy);
if (isset($parts["host"])) {
$this->options[CURLOPT_PROXYTYPE] = CURLPROXY_HTTP;
$this->options[CURLOPT_PROXY] = $parts["host"];
} else {
throw new ConnectionException("Invalid proxy");
}
if (isset($parts["port"])) {
$this->options[CURLOPT_PROXYPORT] = $parts["port"];
}
$creds = "";
if (isset($parts["user"])) $creds .= $parts["user"];
if (isset($parts["pass"])) $creds .= ":" . $parts["pass"];
if ($creds) {
$this->options[CURLOPT_PROXYAUTH] = CURLAUTH_ANY;
$this->options[CURLOPT_PROXYUSERPWD] = $creds;
}
}
}
function request($method, $url, $body = NULL) {
$header = array();
if (is_array($body)) {
if (!empty($body)) {
$body = json_encode($body);
array_push($header, "Content-Type: application/json");
} else {
$body = NULL;
}
}
for ($retries = self::RETRY_COUNT; $retries >= 0; $retries--) {
if ($retries < self::RETRY_COUNT) {
usleep(self::RETRY_DELAY * 1000);
}
$request = curl_init();
if ($request === false || $request === null) {
throw new ConnectionException(
"Error while connecting: curl extension is not functional or disabled."
);
}
curl_setopt_array($request, $this->options);
$url = strtolower(substr($url, 0, 6)) == "https:" ? $url : self::API_ENDPOINT . $url;
curl_setopt($request, CURLOPT_URL, $url);
curl_setopt($request, CURLOPT_CUSTOMREQUEST, strtoupper($method));
if (count($header) > 0) {
curl_setopt($request, CURLOPT_HTTPHEADER, $header);
}
if ($body) {
curl_setopt($request, CURLOPT_POSTFIELDS, $body);
}
$response = curl_exec($request);
if (is_string($response)) {
$status = curl_getinfo($request, CURLINFO_HTTP_CODE);
$headerSize = curl_getinfo($request, CURLINFO_HEADER_SIZE);
curl_close($request);
$headers = self::parseHeaders(substr($response, 0, $headerSize));
$body = substr($response, $headerSize);
if (isset($headers["compression-count"])) {
Tinify::setCompressionCount(intval($headers["compression-count"]));
}
if ($status >= 200 && $status <= 299) {
return (object) array("body" => $body, "headers" => $headers);
}
$details = json_decode($body);
if (!$details) {
$message = sprintf("Error while parsing response: %s (#%d)",
PHP_VERSION_ID >= 50500 ? json_last_error_msg() : "Error",
json_last_error());
$details = (object) array(
"message" => $message,
"error" => "ParseError"
);
}
if ($retries > 0 && $status >= 500) continue;
throw Exception::create($details->message, $details->error, $status);
} else {
$message = sprintf("%s (#%d)", curl_error($request), curl_errno($request));
curl_close($request);
if ($retries > 0) continue;
throw new ConnectionException("Error while connecting: " . $message);
}
}
}
protected static function parseHeaders($headers) {
if (!is_array($headers)) {
$headers = explode("\r\n", $headers);
}
$res = array();
foreach ($headers as $header) {
if (empty($header)) continue;
$split = explode(":", $header, 2);
if (count($split) === 2) {
$res[strtolower($split[0])] = trim($split[1]);
}
}
return $res;
}
}

36
functions/tinypng/Tinify/Exception.php

@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
<?php
namespace Tinify;
class Exception extends \Exception {
public $status;
public static function create($message, $type, $status) {
if ($status == 401 || $status == 429) {
$klass = "Tinify\AccountException";
} else if($status >= 400 && $status <= 499) {
$klass = "Tinify\ClientException";
} else if($status >= 500 && $status <= 599) {
$klass = "Tinify\ServerException";
} else {
$klass = "Tinify\Exception";
}
if (empty($message)) $message = "No message was provided";
return new $klass($message, $type, $status);
}
function __construct($message, $type = NULL, $status = NULL) {
$this->status = $status;
if ($status) {
parent::__construct($message . " (HTTP " . $status . "/" . $type . ")");
} else {
parent::__construct($message);
}
}
}
class AccountException extends Exception {}
class ClientException extends Exception {}
class ServerException extends Exception {}
class ConnectionException extends Exception {}

36
functions/tinypng/Tinify/Result.php

@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
<?php
namespace Tinify;
class Result extends ResultMeta {
protected $data;
public function __construct($meta, $data) {
$this->meta = $meta;
$this->data = $data;
}
public function data() {
return $this->data;
}
public function toBuffer() {
return $this->data;
}
public function toFile($path) {
return file_put_contents($path, $this->toBuffer());
}
public function size() {
return intval($this->meta["content-length"]);
}
public function mediaType() {
return $this->meta["content-type"];
}
public function contentType() {
return $this->mediaType();
}
}

23
functions/tinypng/Tinify/ResultMeta.php

@ -1,23 +0,0 @@ @@ -1,23 +0,0 @@
<?php
namespace Tinify;
class ResultMeta {
protected $meta;
public function __construct($meta) {
$this->meta = $meta;
}
public function width() {
return intval($this->meta["image-width"]);
}
public function height() {
return intval($this->meta["image-height"]);
}
public function location() {
return isset($this->meta["location"]) ? $this->meta["location"] : null;
}
}

69
functions/tinypng/Tinify/Source.php

@ -1,69 +0,0 @@ @@ -1,69 +0,0 @@
<?php
namespace Tinify;
class Source {
private $url, $commands;
public static function fromFile($path) {
return self::fromBuffer(file_get_contents($path));
}
public static function fromBuffer($string) {
$response = Tinify::getClient()->request("post", "/shrink", $string);
return new self($response->headers["location"]);
}
public static function fromUrl($url) {
$body = array("source" => array("url" => $url));
$response = Tinify::getClient()->request("post", "/shrink", $body);
return new self($response->headers["location"]);
}
public function __construct($url, $commands = array()) {
$this->url = $url;
$this->commands = $commands;
}
public function preserve() {
$options = $this->flatten(func_get_args());
$commands = array_merge($this->commands, array("preserve" => $options));
return new self($this->url, $commands);
}
public function resize($options) {
$commands = array_merge($this->commands, array("resize" => $options));
return new self($this->url, $commands);
}
public function store($options) {
$response = Tinify::getClient()->request("post", $this->url,
array_merge($this->commands, array("store" => $options)));
return new Result($response->headers, $response->body);
}
public function result() {
$response = Tinify::getClient()->request("get", $this->url, $this->commands);
return new Result($response->headers, $response->body);
}
public function toFile($path) {
return $this->result()->toFile($path);
}
public function toBuffer() {
return $this->result()->toBuffer();
}
private static function flatten($options) {
$flattened = array();
foreach ($options as $option) {
if (is_array($option)) {
$flattened = array_merge($flattened, $option);
} else {
array_push($flattened, $option);
}
}
return $flattened;
}
}

3550
functions/tinypng/data/cacert.pem

File diff suppressed because it is too large Load Diff

37
functions/unknown.php

@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
<?php
//此页面需要配置定时任务(crontab)完成
include_once("./class/class.user.php");
//获取密码
@$pass = $_GET['pass'];
if($pass != $config['password']){
echo '密码错误!';
exit;
}
$datas = $basis->unknown();
//遍历数据
foreach( $datas as $key => $value )
{
$url = $config['domain'].'dispose.php?id='.$value['id'];
//echo $url;
//请求鉴黄接口
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36");
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
#设置超时时间,最小为1s(可选)
curl_setopt($curl , CURLOPT_TIMEOUT, 3);
$html = curl_exec($curl);
curl_close($curl);
}
echo '处理完成!';
?>

102
functions/upload.php

@ -1,102 +0,0 @@ @@ -1,102 +0,0 @@
<?php
//载入配置文件
include_once("./class/class.user.php");
//阻止用户直接访问
//if( !strstr($_SERVER['HTTP_REFERER'],$config['domain']) )
//{
// $basis->re_error('非法请求!');
//}
//检查用户是否登录
$status = $basis->check($config);
//检查用户是否登陆来判断上传目录
if($status == 'islogin') {
//设置上传路径
$updir = $config['admindir'];
}
else{
$updir = $config['userdir'];
//限制用户上传数量
$basis->limitnum();
}
//获取上传者信息
$ip = $basis->getip();
$ua = $_SERVER['HTTP_USER_AGENT'];
$date = date('Y-m-d',time());
//载入上传类
include('./class/class.upload.php');
//上传方法
$handle = new upload($_FILES['file']);
if ($handle->uploaded) {
$handle->file_new_name_body = 'image_resized';
//允许上传大小2m
$handle->file_max_size = '2097152';
//允许的MIME类型,仅运行上传图片
$handle->allowed = array('image/*');
// 当前月份
$current_time = date('ym',time());
//上传路径:目录 + 时间
$handle->process('../'.$updir.'/'.$current_time."/");
if ($handle->processed) {
//获取站点域名
$domain = $config['domain'];
//生成文件hash
$fhash = hash_file("md5",$handle->file_dst_pathname,FALSE);
$fhash = substr($fhash,8,16);
//新的文件名(../temp/1804/\d64c8036c0605175.jpg)
$new_img = $handle->file_dst_path.$fhash.'.'.$handle->file_dst_name_ext;
//图片URL地址
$imgurl = $domain.$updir.'/'.$current_time.'/'.$fhash.'.'.$handle->file_dst_name_ext;
//图片路径(temp/1804/d64c8036c0605175.jpg)
$imgdir = $updir.'/'.$current_time.'/'.$fhash.'.'.$handle->file_dst_name_ext;
//判断文件是否已经存在
if(!is_file($new_img)) {
//对文件更名
rename($handle->file_dst_pathname,$new_img);
}
else{
//删除原始文件
unlink($handle->file_dst_pathname);
}
//检查某张图片是否已经上传过,如果已经上传了,直接返回数据并终止操作
$basis->isupload($imgdir);
//没有上传过的图片,继续写入数据库
$last_user_id = $database->insert("imginfo", [
"path" => $imgdir,
"ip" => $ip,
"ua" => $ua,
"date" => $date,
"dir" => $updir,
"compress" => 0,
"level" => 0
]);
//返回最后的ID
$account_id = $database->id();
//上传成功,返回json数据
$redata = array(
"code" => 1,
"id" => $account_id,
"url" => $imgurl,
"width" => $handle->image_dst_x,
"height" => $handle->image_dst_y
);
echo $redata = json_encode($redata);
$handle->clean();
} else {
//上传出现错误,返回报错信息
$redata = array(
"code" => 0,
"msg" => $handle->error
);
echo json_encode($redata);
}
}
?>

7
functions/urlup.php

@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
<?php
include_once("class/class.admin.php");
@$arr = $_POST['arr'];
$pic->urlup($arr);
?>

1
functions/version.txt

@ -1 +0,0 @@ @@ -1 +0,0 @@
v1.41(20181119)

127
index.php

@ -1,127 +0,0 @@ @@ -1,127 +0,0 @@
<?php
$title = "ImgURL - 简单、纯粹的图床程序。";
include_once("./tpl/user/header.php");
//判断程序是否已安装
$homedir = __DIR__;
$homedir = str_replace("\\","/",$homedir);
//$homedir = str_replace("tpl/user","",$homedir);
$lockfile = $homedir.'/config.php';
if(!file_exists($lockfile)){
header("location:./install.php?setup=1");
}
?>
<div class="layui-container">
<div class="layui-row">
<div class="layui-col-lg12 layui-col-xs12">
<div class="msg"><i class="layui-icon">&#xe645;</i> 注意:您上传的图片将会公开显示,勿上传隐私图片。游客限制每天10张,最大支持2M</div>
<!-- 上传图片表单 -->
<div class="layui-upload-drag" id="upimg">
<i class="layui-icon">&#xe67c;</i>
<p>将图片拖拽到此处,支持Ctrl + V粘贴上传</p>
</div>
<!-- 上传图片表单END -->
</div>
</div>
<div style = "clear:both;"></div>
<!-- 图片上传成功 -->
<div class="layui-row" id = "upok">
<div>
<div id="showpic" class = "layui-col-lg5"><a href="" target = "_blank"><img src="./static/loading32.gif"></a></div>
<div id="piclink" class = "layui-col-lg6 layui-col-md-offset1">
<table class="layui-table" lay-skin="nob">
<colgroup>
<col width="80">
<col width="400">
<col>
</colgroup>
<tbody>
<tr>
<td>URL</td>
<td><input type="text" class="layui-input" id = "url"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('url')">复制</a></td>
</tr>
<tr>
<td>HTML</td>
<td><input type="text" class="layui-input" id = "html"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('html')">复制</a></td>
</tr>
<tr>
<td>MarkDown</td>
<td><input type="text" class="layui-input" id = "markdown"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('markdown')">复制</a></td>
</tr>
<tr>
<td>BBcode</td>
<td><input type="text" class="layui-input" id = "bbcode"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('bbcode')">复制</a></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- 图片上传成功END -->
</div>
<!--Ctrl + V粘贴上传-->
<script>
var load1 = document.querySelector("#upimg");
// 实例化即可
new ctrlVUtil({
uploadUrl: "functions/cvupload.php",
targetElement: load1,
isCompleteImg:false,
data:{
name:"alanzhang",
},
success:function(data){
//转为对象
var res = data;
//上传成功
if(res.code == 1){
layer.closeAll('loading');
$("#showpic a").attr('href',res.url);
$("#showpic img").attr('src',res.url);
$("#url").val(res.url);
$("#html").val("<img src = '" + res.url + "' />");
$("#markdown").val("![](" + res.url + ")");
$("#bbcode").val("[img]" + res.url + "[/img]");
$("#upok").show();
//请求接口处理图片
$.get("./dispose.php?id="+res.id,function(data,status){
var obj = eval('(' + data + ')');
if(obj.level == 3){
layer.open({
title: '温馨提示'
,content: '请勿上传违规图片!'
});
}
if(obj.level == null){
$.get("./dispose.php?id="+res.id,function(data,status){
var obj = eval('(' + data + ')');
if(obj.level == 3){
layer.open({
title: '温馨提示'
,content: '请勿上传违规图片!'
});
}
});
}
});
}
else{
layer.msg(res.msg);
}
},
error: function(error){
layer.closeAll('loading');
layer.msg('上传失败!');
}
});
</script>
<!--粘贴上传END-->
<?php
include_once("./tpl/user/footer.php");
?>

41
install.php

@ -1,41 +0,0 @@ @@ -1,41 +0,0 @@
<?php
//载入类
//echo __DIR__."/functions/class/class.install.php";
include_once(__DIR__."/functions/class/class.install.php");
@$setup = (int)$_GET['setup'];
$install = new Install;
$statusarr = $install->check();
$info = $install->info();
switch ($setup) {
case 1:
//载入模板
include_once("./tpl/user/header.php");
include_once("./tpl/user/install1.php");
include_once("./tpl/user/footer.php");
break;
case 2:
include_once("./tpl/user/header.php");
include_once("./tpl/user/install2.php");
include_once("./tpl/user/footer.php");
break;
case 3:
//获取用户名
@$data['user'] = $_POST['user'];
//获取用户密码
@$data['pass1'] = $_POST['pass1'];
@$data['pass2'] = $_POST['pass2'];
@$data['domain'] = $_POST['domain'];
@$data['homedir'] = $_POST['homedir'];
$install->setup($data);
include_once("./tpl/user/header.php");
include_once("./tpl/user/install3.php");
include_once("./tpl/user/footer.php");
break;
default:
header("location:./install.php?setup=1");
break;
}
?>

203
miniup.html

@ -1,203 +0,0 @@ @@ -1,203 +0,0 @@
<!DOCTYPE html>
<html lang="zh-cmn-Hans" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>ImgURL - 简单、纯粹的图床程序。</title>
<meta name="generator" content="EverEdit" />
<meta name="author" content="xiaoz.me" />
<meta name="keywords" content="ImgURL,免费图床,图床程序,小z图床,XZ Pic" />
<meta name="description" content="ImgURL是一个简单、纯粹的图床程序,让个人图床多一个选择。" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="Bookmark" href="favicon.ico" />
<link rel="stylesheet" href="./static/layui/css/layui.css">
<link rel="stylesheet" href="./static/style.css?v=1.2">
<script src = "https://libs.xiaoz.top/clipBoard.js/clipBoard.min.js"></script>
<style type="text/css" media="screen">
#imgbtn{
display: none;
}
</style>
</head>
<body>
<div class="layui-container">
<div class="layui-row">
<div class="layui-col-lg12 layui-col-xs12">
<div class="msg"><i class="layui-icon">&#xe645;</i> 注意:您上传的图片将会公开显示,勿上传隐私图片。此项目依赖于:<a href="https://imgurl.org/" target = "_blank">https://imgurl.org/</a></div>
<!--选项卡测试-->
<div class="layui-tab layui-tab-brief" lay-filter="uptab">
<ul class="layui-tab-title">
<li class="layui-this">ImgURL</li>
<li>SM.MS</li>
<li>关于</li>
</ul>
<div class="layui-tab-content">
<!--上传到ImgURL-->
<div class="layui-tab-item layui-show">
<!-- 上传图片表单 -->
<div class="layui-upload-drag" id="upimg">
<i class="layui-icon">&#xe67c;</i>
<p>将图片拖拽到此处,或将鼠标移动到这里支持Ctrl + V上传</p>
</div>
<!-- 上传图片表单END -->
</div>
<!--上传到sm.ms-->
<div class="layui-tab-item">
<div class = "smfile">
<a href="javascript:;" class="file">
<input type="file" name="smfile" id="sm">
<i class="layui-icon" style = "font-size:6em;">&#xe67c;</i>
</a>
</div>
</div>
<!--捐赠-->
<div class="layui-tab-item">
<h1>ImgURL</h1>
<p>ImgURL是一款简洁、纯粹的图床程序,使用PHP + Sqlite开发,开箱即用。</p>
<br /><h2>主要功能</h2><br />
<ul>
<li>拽拖上传图片、实时预览</li>
<li>一键生成链接,一键复制</li>
<li>图片管理</li>
<li>TinyPNG图片压缩</li>
<li>图片智能鉴黄</li>
</ul>
<br /><h2>使用说明</h2><br />
<ul>
<li>图片最大上传限制为2M</li>
<li>游客每天限制上传10张图片</li>
<li>勿上传暴力、色情、反动图片,否则后果自负</li>
<li>如果您使用ImgURL代表同意以上协议</li>
</ul>
<br /><h2>联系我</h2><br />
<ul>
<li>Blog:<a href = "https://www.xiaoz.me/" target = "_blank">https://www.xiaoz.me/</a></li>
<li>QQ:337003006</li>
</ul>
<br />
<p>扫描下方二维码请我喝一杯咖啡</p><br />
<p><img src="https://imgurl.org/upload/1712/cb349aa4a1b95997.png" alt=""></p>
</div>
<!--捐赠-->
</div>
</div>
<!--选项卡END-->
</div>
</div>
<div style = "clear:both;"></div>
<!-- 图片上传成功 -->
<div class="layui-row" id = "upok" style = "margin-top:1em;">
<div>
<div id="showpic" class = "layui-col-lg5"><a href="" target = "_blank"><img src=""></a></div>
<div id="piclink" class = "layui-col-lg6 layui-col-md-offset1">
<table class="layui-table" lay-skin="nob">
<colgroup>
<col width="80">
<col width="400">
<col>
</colgroup>
<tbody>
<tr>
<td>URL</td>
<td><input type="text" class="layui-input" id = "url"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('url')">复制</a></td>
</tr>
<tr>
<td>HTML</td>
<td><input type="text" class="layui-input" id = "html"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('html')">复制</a></td>
</tr>
<tr>
<td>MarkDown</td>
<td><input type="text" class="layui-input" id = "markdown"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('markdown')">复制</a></td>
</tr>
<tr>
<td>BBcode</td>
<td><input type="text" class="layui-input" id = "bbcode"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('bbcode')">复制</a></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- 图片上传成功END -->
</div>
<div style = "clear:both;"></div>
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src = "./static/ctrv-upload.js"></script>
<script src="./static/layui/layui.js"></script>
<script src="./static/embed.js?v=1.2"></script>
<script>
//隐藏按钮
//setTimeout('$("#imgbtn").remove()',100)
layui.use(['element','layer'],function(){
var element = layui.element;
var layer = layui.layer;
element.on('tab(uptab)', function(data){
//console.log(this); //当前Tab标题所在的原始DOM元素
//console.log(data.index); //得到当前Tab的所在下标
//console.log(data.elem); //得到当前的Tab大容器
});
});
var load1 = document.querySelector("body");
// 实例化即可
new ctrlVUtil({
uploadUrl: "functions/cvupload.php",
targetElement: load1,
isCompleteImg:false,
data:{
name:"alanzhang",
},
success:function(data){
//转为对象
var res = data;
//上传成功
if(res.code == 1){
layer.closeAll('loading');
$("#showpic a").attr('href',res.url);
$("#showpic img").attr('src',res.url);
$("#url").val(res.url);
$("#html").val("<img src = '" + res.url + "' />");
$("#markdown").val("![](" + res.url + ")");
$("#bbcode").val("[img]" + res.url + "[/img]");
$("#upok").show();
//请求接口处理图片
$.get("./dispose.php?id="+res.id,function(data,status){
var obj = eval('(' + data + ')');
if(obj.level == 3){
layer.open({
title: '温馨提示'
,content: '请勿上传违规图片!'
});
}
if(obj.level == null){
$.get("./dispose.php?id="+res.id,function(data,status){
var obj = eval('(' + data + ')');
if(obj.level == 3){
layer.open({
title: '温馨提示'
,content: '请勿上传违规图片!'
});
}
});
}
});
}
else{
layer.msg(res.msg);
}
},
error: function(error){
layer.closeAll('loading');
layer.msg('上传失败!');
}
});
</script>
</body>
</html>

6
robots.txt

@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
User-Agent: *
Disallow: /admin/
Disallow: /db/
Disallow: /functions/
Disallow: /static/
Disallow: /tpl/

68
sm.php

@ -1,68 +0,0 @@ @@ -1,68 +0,0 @@
<?php
$title = "ImgURL - 简单、纯粹的图床程序。";
include_once("./tpl/user/header.php");
?>
<div class="layui-container">
<div class="layui-row">
<div class="layui-col-lg12 layui-col-xs10">
<div class="msg"><i class="layui-icon">&#xe645;</i> 该功能可以将图片上传至SM.MS图床。</div>
<!-- 上传图片表单 -->
<div class = "smfile">
<a href="javascript:;" class="file">
<input type="file" name="smfile" id="sm">
<i class="layui-icon" style = "font-size:6em;">&#xe67c;</i>
</a>
</div>
<!-- 上传图片表单END -->
</div>
</div>
<div style = "clear:both;"></div>
<!-- 图片上传成功 -->
<div class="layui-row" id = "upok">
<div>
<div id="showpic" class = "layui-col-lg5"><a href="" target = "_blank"><img src=""></a></div>
<div id="piclink" class = "layui-col-lg6 layui-col-md-offset1">
<table class="layui-table" lay-skin="nob">
<colgroup>
<col width="80">
<col width="400">
<col>
</colgroup>
<tbody>
<tr>
<td>URL</td>
<td><input type="text" class="layui-input" id = "url"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('url')">复制</a></td>
</tr>
<tr>
<td>HTML</td>
<td><input type="text" class="layui-input" id = "html"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('html')">复制</a></td>
</tr>
<tr>
<td>MarkDown</td>
<td><input type="text" class="layui-input" id = "markdown"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('markdown')">复制</a></td>
</tr>
<tr>
<td>BBcode</td>
<td><input type="text" class="layui-input" id = "bbcode"></td>
<td><a href="javascript:;" class = "layui-btn layui-btn-sm" onclick = "copy('bbcode')">复制</a></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- 图片上传成功END -->
</div>
<?php
include_once("./tpl/user/footer.php");
?>
<script>
$(document).ready(function(){
$("#smfile input:text").attr("name",'smfile');
});
</script>

1
static/404.svg

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 9.5 KiB

8
static/clipBoard.min.js vendored

@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
/**
* clipboard.js
* width clipboard.js, you can copy cut and paste clipboard data
* the main methods ard execCommand for modern browser and clipboardData for ie
* @author ganzw@gmail.com
* @url https://github.com/baixuexiyang/clipBoard.js
*/
!function(t,e){"undefined"!=typeof module&&module.exports?module.exports=e():"function"==typeof define&&define.amd?define(e):this[t]=e()}("clipBoard",function(){"use strict";function t(t,e){this.options=e||{},this.tar=t[0]||t,this.options.copy&&this.copyd(),this.options.cut&&this.cut(),this.options.paste&&this.paste()}return t.prototype.copyd=function(t){if(this.options.beforeCopy&&this.options.beforeCopy(),t=t||this.tar.value||this.tar.innerText,this.options.copy&&(t=this.options.copy()),document.execCommand){var e=document.createElement("SPAN");if(e.textContent=t,document.body.appendChild(e),document.selection){var o=document.body.createTextRange();o.moveToElementText(e),o.select()}else if(window.getSelection){var o=document.createRange();o.selectNode(e),window.getSelection().removeAllRanges(),window.getSelection().addRange(o)}document.execCommand("copy"),e.remove?e.remove():e.removeNode(!0)}window.clipboardData&&window.clipboardData.setData("text",t),this.options.afterCopy&&this.options.afterCopy()},t.prototype.cut=function(){if("text"===this.tar.type||"textarea"===this.tar.type){if(this.options.beforeCut&&this.options.beforeCut(),document.execCommand){var t=this.tar;if(document.selection){var e=document.body.createTextRange();e.moveToElementText(t),e.select()}else window.getSelection&&t.select();document.execCommand("cut")}window.clipboardData&&(window.clipboardData.setData("text",this.tar.value),this.tar.value=""),this.options.afterCut&&this.options.afterCut()}},t.prototype.paste=function(){if("text"===this.tar.type||"textarea"===this.tar.type){if(this.options.beforePaste&&this.options.beforePaste(),document.execCommand){var t=this.tar;if(t.setSelectionRange)t.focus(),t.setSelectionRange(t.value.length,t.value.length);else if(t.createTextRange){var e=t.createTextRange();e.collapse(!0),e.moveEnd("character",t.value.length),e.moveStart("character",t.value.length),e.select()}document.execCommand("paste")}!document.execCommand&&window.clipboardData&&(this.tar.value+=window.clipboardData.getData("text")),this.options.afterPaste&&this.options.afterPaste()}},t});

112
static/ctrv-upload.js

@ -1,112 +0,0 @@ @@ -1,112 +0,0 @@
'use strict';
(function(root, factory){
if (typeof define === 'function' && define.amd) {
define([], factory);
} else if (typeof exports === 'object') {
module.exports = factory();
} else {
root.ctrlVUtil = factory();
}
}(this, function(){
function ctrlVUtil(option){
this.targetElement = null;
this.uploadInput = null;
this.uploadUrl = "http://www.oa.com/screenshot/create-file";
this.isCompleteImg = false;
var that = this;
that.mixinConfig(option);
that.targetElement.addEventListener("mouseover", function() {
that.uploadInput.focus();
});
that.targetElement.addEventListener("click", function() {
that.uploadInput.focus();
});
that.targetElement.addEventListener("mouseleave", function() {
that.uploadInput.blur();
});
that.uploadInput.addEventListener('paste', function(e) {
that.handlePaste(e);
});
}
ctrlVUtil.prototype.mixinConfig = function(option){
this.targetElement = option.targetElement || document.querySelector(".js-upload");
this.uploadInput = this.createInputTarget();
this.isCompleteImg = "isCompleteImg" in option ? option.isCompleteImg : this.isCompleteImg;
this.uploadUrl = option.uploadUrl || this.uploadUrl;
this.data = option.data;
this.success = option.success || function(data) {
console.log(data);
};
this.error = option.error || function(error) {
console.log(error);
};
};
ctrlVUtil.prototype.createInputTarget = function() {
var imgContinaer = document.createElement("div");
imgContinaer.style.cssText = "border:none;margin:0;padding:0;font-size: 0;height:1px;width:1px;opacity:0;position:fixed;z-index:-1;";
imgContinaer.contentEditable = true;
imgContinaer.class = "ui-ctrlv-uploadInput";
this.targetElement.parentNode.insertBefore(imgContinaer, this.targetElement);
return imgContinaer;
};
ctrlVUtil.prototype.handlePaste = function(e){
var that = this;
if (e && e.clipboardData && e.clipboardData.items) {
var item = e.clipboardData.items[0],
that = this;
if (item.type.indexOf('image') != -1) {
var blob = item.getAsFile();
var fileReader = new FileReader();
fileReader.readAsDataURL(blob);
fileReader.addEventListener('load', function(e) {
var file = e.target.result;
that.send(file);
}, false);
} else {
layer.msg('请粘贴image类型!');
}
} else {
setTimeout(function() {
var $img = that.uploadInput.querySelector("img");
if ($img) {
that.send($img.src);
} else {
layer.msg('当前浏览器不支持剪贴板操作!');
return;
}
}, 200);
}
};
ctrlVUtil.prototype.send = function(imgcontent) {
layer.load();
var that = this;
that.uploadInput.innerHTML = "";
var data = that.data || {};
data.content = this.isCompleteImg ? imgcontent : imgcontent.split(';')[1].split(',')[1];
var xhr = new XMLHttpRequest();
xhr.open("post",that.uploadUrl,true);
xhr.onreadystatechange = function(e) {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
var ret = JSON.parse(xhr.responseText);
that.success && that.success(ret);
} else {
that.error && that.error(e, xhr);
}
}
};
xhr.onerror = function(e) {
that.error && that.error(e, xhr);
};
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
var dataString = [];
for(var key in data){
dataString.push(key+"="+encodeURIComponent(data[key]));
}
xhr.send(dataString.join("&"));
};
ctrlVUtil.prototype.alertMsg = function(content){
alert(content);
}
return ctrlVUtil;
}));

501
static/embed.js

@ -1,501 +0,0 @@ @@ -1,501 +0,0 @@
//layui 根目录配置
layui.config({
base: '/static/layui/',
})
//载入layui组建
layui.use(['layer', 'form','element','upload','flow'], function(){
var form = layui.form;
var layer = layui.layer;
var element = layui.element;
var upload = layui.upload;
var flow = layui.flow;
//图片懒加载
flow.lazyimg({
elem:'#found-img img'
});
flow.lazyimg({
elem:'#adminpic img'
});
//图片查看器
layer.photos({
photos: '#adminpic'
,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
});
layer.photos({
photos: '#found-img'
,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
});
//首页拖拽上传
upload.render({
elem: '#upimg'
,url: 'functions/upload.php'
,size: 2048 //限制上传大小为2M
,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
layer.load(); //上传loading
}
,done: function(res){
//如果上传失败
if(res.code == 0){
layer.open({
title: '温馨提示'
,content: res.msg
});
layer.closeAll('loading');
}
else if(res.code == 1){
layer.closeAll('loading');
$("#showpic a").attr('href',res.url);
$("#showpic img").attr('src',res.url);
$("#url").val(res.url);
$("#html").val("<img src = '" + res.url + "' />");
$("#markdown").val("![](" + res.url + ")");
$("#bbcode").val("[img]" + res.url + "[/img]");
$("#upok").show();
//请求接口处理图片
$.get("./dispose.php?id="+res.id,function(data,status){
var obj = eval('(' + data + ')');
if(obj.level == 3){
layer.open({
title: '温馨提示'
,content: '请勿上传违规图片!'
});
}
if(obj.level == null){
$.get("./dispose.php?id="+res.id,function(data,status){
var obj = eval('(' + data + ')');
if(obj.level == 3){
layer.open({
title: '温馨提示'
,content: '请勿上传违规图片!'
});
}
});
}
});
}
}
});
//上传到sm.ms
upload.render({
elem: '#sm'
,url: 'https://sm.ms/api/upload'
,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
layer.load(); //上传loading
}
,done: function(res){
//如果上传失败
if(res.code == 'error'){
layer.open({
title: '温馨提示'
,content: res.msg
});
layer.closeAll('loading');
}
else if(res.code == 'success'){
layer.closeAll('loading');
$("#showpic a").attr('href',res.data.url);
$("#showpic img").attr('src',res.data.url);
$("#url").val(res.data.url);
$("#html").val("<img src = '" + res.data.url + "' />");
$("#markdown").val("![](" + res.data.url + ")");
$("#bbcode").val("[img]" + res.data.url + "[/img]");
$("#upok").show();
$.post("./functions/sm.php",{data:res.data},function(data,status){
});
}
}
});
//上传到sm.ms end
});
//复制链接
function copy(info){
var copy = new clipBoard(document.getElementById('piclink'), {
beforeCopy: function() {
info = $("#" + info).val();
},
copy: function() {
return info;
},
afterCopy: function() {
}
});
layui.use('layer', function(){
var layer = layui.layer;
layer.msg('复制成功!', {time: 2000})
});
}
//后台复制URL
function copyurl(url){
var copy = new clipBoard(document.getElementById('adminpic'), {
beforeCopy: function() {
},
copy: function() {
return url;
},
afterCopy: function() {
}
});
layui.use('layer', function(){
var layer = layui.layer;
layer.msg('链接已复制!', {time: 2000})
});
}
//复制链接
function newcopy(info){
var copy = new clipBoard(document.getElementById('url'), {
beforeCopy: function() {
info = $("#" + info).val();
},
copy: function() {
return info;
},
afterCopy: function() {
}
});
layui.use('layer', function(){
var layer = layui.layer;
layer.msg('复制成功!', {time: 2000})
});
}
//用户登录方法
function login(){
// 获取用户提交的信息
var user = $("#user").val();
var password = $("#password").val();
if((user == '') || (password == '')){
layer.msg('用户名或密码不能为空!');
return false;
}
$.post("../functions/Controller.php?type=login",{user:user,password:password},function(data,status){
layer.msg(data,{time:2000});
});
}
//用户前台预览图片
function userpreview(imgurl,id){
var showimg = "<center><img style = 'max-width:100%;max-height:100%;' src = '" + imgurl + "' /></center>";
layui.use('layer', function(){
var layer = layui.layer;
layer.open({
type: 1,
title:"图片预览",
area: ['80%', '80%'],
content: showimg
});
});
}
//后台管理员查看图片
function adminshow(imgurl,id){
$("#adminshow").show();
$("#url").val(imgurl);
$("#html").val("<img src = '" + imgurl + "' />");
$("#markdown").val("![](" + imgurl + ")");
$("#bbcode").val("[img]" + imgurl + "[/img]");
$("#copy").show();
$("#adminshow img").attr("src",imgurl);
layui.use('layer', function(){
var layer = layui.layer;
layer.open({
type: 1,
title:false,
area: '720px',
content: $("#adminshow"),
btn: ['删除'],
cancel: function(index, layero){
$("#adminshow img").attr("src","");
$("#copy").hide();
},
yes: function(index, layero){
layer.confirm('确认删除?', {icon: 3, title:'温馨提示!'}, function(index){
$.get("./delete.php?id="+id,function(data,status){
if(data == 'ok') {
$("#imgid"+id).remove();
$("#adminshow img").attr("src","");
$("#copy").hide();
}
else{
alert(data);
}
});
layer.closeAll();
});
}
});
});
}
//后台管理员查看SM.MS图片
function smshow(imgurl,id){
var showimg = "<center><img style = 'max-width:100%;max-height:100%;' src = '" + imgurl + "' /></center>";
layui.use('layer', function(){
var layer = layui.layer;
layer.open({
type: 1,
title:"图片预览",
area: ['80%', '80%'],
content: showimg,
btn: ['压缩', '删除'],
yes: function(index, layero){
layer.msg('SM.MS图片不支持压缩!', {time: 2000})
}
//删除按钮
,btn2: function(index, layero){
layer.confirm('确认删除?', {icon: 3, title:'温馨提示!'}, function(index){
$.get("./delete.php?type=sm&id="+id,function(data,status){
if(data == 'ok') {
$("#imgid"+id).remove();
}
else{
alert(data);
}
});
layer.close(index);
});
}
});
});
}
//删除某张图片
function deleteimg(id){
layer.confirm('确认删除?', {icon: 3, title:'温馨提示!'}, function(index){
$.get("./delete.php?id="+id,function(data,status){
if(data == 'ok') {
$("#imgid"+id).remove();
console.log("#imgid"+id);
}
else{
alert(data);
}
});
layer.close(index);
});
}
//删除SM.MS图片
function deletesm(id){
layer.confirm('确认删除?', {icon: 3, title:'温馨提示!'}, function(index){
$.get("./delete.php?type=sm&id="+id,function(data,status){
if(data == 'ok') {
$("#imgid"+id).remove();
}
else{
alert(data);
}
});
layer.close(index);
});
}
//取消图片可疑状态
function cdubious(id){
layer.confirm('确认取消图片可疑状态?', {icon: 3, title:'温馨提示!'}, function(index){
$.get("./operation.php?type=cdubious&id="+id,function(data,status){
if(data == 'ok') {
$("#imgid"+id).remove();
}
else{
alert(data);
}
});
layer.close(index);
});
}
//图片压缩功能
function compress(id){
//layer.msg('该功能还在开发中!', {time: 2000})
layer.open({
type:3
,content: '处理中...'
});
$.get("../functions/class/class.pic.php?id=" + id,function(data,status){
if(status == 'success'){
layer.closeAll('loading');
}
layer.open({
title: '温馨提示:',
time:2000
,content: data
});
});
}
//IP查询
function ipquery(ip){
$.get("https://api.ttt.sh/ip/qqwry/" + ip,function(data,status){
if(status == 'success') {
var info = JSON.parse(data);
layer.open({
title: 'IP查询结果:'
,content: info.address
,time:3000
});
}
});
}
//关于
function about(){
url = window.location.protocol + '//';
url = url + window.location.host + '/';
layer.open({
title: '关于',
type: 2,
area: ['240px', '100px'],
content: "./about.php"
});
}
//删除本页所有照片
function delall(){
layer.confirm('确认删除本页所有图片?', {icon: 3, title:'提示'}, function(index){
//do something
layer.close(index);
});
}
//预览图片
function previewimg(id,url){
var imgid = "img" + id;
var upid = id - 1;
var dnid = id + 1;
$("#show" + upid).hide();
$("#show" + dnid).hide();
$("#img" + id).attr('src',url);
$("#show" + id).show();
}
//隐藏图片
function hideimg(id){
var upid = id - 1;
var dnid = id + 1;
$("#show" + id).hide();
$("#show" + upid).hide();
$("#show" + dnid).hide();
}
//Ctrl + V上传图片
//$(document).keyup(function(){
// if(event.keyCode == 86){
// }
//});
//预览图片
function viewimg(id,imgurl){
id = "viewimg" + id;
$("#" + id + " img").attr('src',imgurl);
//显示图片
$("#" + id).show();
}
//隐藏图片
function hideimg(id){
id = "viewimg" + id;
$("#" + id).hide();
}
//URL上传
function urlup(){
layui.use('layer', function(){
var layer = layui.layer;
layer.open({
type:3
,content: '上传中,请等待...'
});
});
arr = $("#arrurl").val();
//如果地址为空
if(arr == ''){
layer.closeAll('loading');
layer.msg('地址不能为空!');
return false;
}
$.post("../functions/urlup.php",{arr:arr},function(data,status){
var re = eval('(' + data + ')');
if(re.code == 1){
//关闭加载层
layer.closeAll('loading');
layer.msg(re.msg);
}
else if(re.code == 0){
//关闭加载层
layer.closeAll('loading');
layer.msg(re.msg);
}
else{
layer.closeAll('loading');
layer.msg(re.msg);
}
});
}
//时间筛选
function screen(page){
var starttime = $("#starttime").val();
var endtime = $("#endtime").val();
if((starttime == '') || (endtime == '')){
layui.use('layer', function(){
var layer = layui.layer;
layer.msg('请选择时间!');
});
}
else{
window.location.href = page + "?page=1&date=" + starttime + '|' + endtime;
}
}
//显示图片操作按钮
function show_imgcon(id){
$("#imgcon" + id).show();
}
//隐藏图片操作按钮
function hide_imgcon(id){
$("#imgcon" + id).hide();
}
//新版删除图片
// function deleteimg(id){
// layer.confirm('确认删除?', {icon: 3, title:'温馨提示!'}, function(index){
// $.get("./delete.php?id="+id,function(data,status){
// if(data == 'ok') {
// $("#imgid"+id).remove();
// }
// else{
// alert(data);
// }
// });
// layer.close(index);
// });
// }

93
static/imgurl.js

@ -1,93 +0,0 @@ @@ -1,93 +0,0 @@
// ==UserScript==
// @name ImgURL上传脚本
// @namespace https://imgurl.org/
// @version 0.21
// @description ImgURL快捷上传工具
// @author xiaoz.me
// @match http://*/*
// @match https://*/*
// @license GPL
// @grant none
// ==/UserScript==
(function() {
'use strict';
//定义一个全局弹出层
window.layerstart = '<div id = "layer" style = "box-shadow: 1px 1px 2px #888888;border-radius:5px;top:0em;left:0;width:80%;height:720px;background-color:#FFFFFF;position:fixed;z-index:999;display:none;border:1px solid #d2d2d2">';
layerstart += '<div style="text-align:right;padding:0.8em;border-bottom:1px solid #d2d2d2;"><a href="javascript:;" onclick="closelayer()" style="color:#FFFFFF;background-color:#FF5722;width:80px;text-align:center;padding:0.5em;border-radius:2px;padding-left:1em;padding-right:1em;">关闭</a></div>';
window.layerend = '</div>';
//让层居中显示
window.layerCenter = function(){
var bwidth = window.screen.availWidth;
var bheight = window.screen.availHeight;
var layertop = (bheight - 720) / 2;
var layerleft = (bwidth - 1280) / 2;
if(layertop <= 70){
layertop = "1em";
}
else{
layertop = layertop + "px";
}
//改变css
//$("#layer").css({"top":layertop,"left":layerleft});
//原生js改变css
//alert(layertop);
document.getElementById("layer").style.top = layertop;
document.getElementById("layer").style.left = "10%";
}
//创建一个遮罩层
window.keepout = function(){
var fade = '<div id = "fade" style = "width:100%;height:100%;background:rgba(0, 0, 0, 0.5);position: fixed;left: 0;top: 0;z-index: 99;" onclick = "closelayer()"></div>';
//$("body").append(fade);
var div = document.createElement("div");
div.innerHTML = fade;
document.body.appendChild(div);
}
//关闭层
window.closelayer = function(){
//$("#layer").hide();
document.getElementById("layer").style.display = "none";
//showSidebar();
//$("#layer").remove();
var layer = document.getElementById("layer");
layer.parentNode.removeChild(layer);
//$("#fade").remove();
var fade = document.getElementById("fade");
fade.parentNode.removeChild(fade);
}
//创建一个显示按钮
function imgurl(){
//$("body").append('<div id = "imgbtn" style = "position:fixed;right:1em;bottom:1em;z-index:88;cursor:pointer;" onclick = "showImgurl()"><img src = "https://libs.xiaoz.top/material/image.png" width = "36px" height = "36px" /></div>');
//使用原生js添加按钮
var div = document.createElement("div");
div.innerHTML = '<div id = "imgbtn" style = "position:fixed;right:1em;bottom:1em;z-index:88;cursor:pointer;" onclick = "showImgurl()"><img src = "https://libs.xiaoz.top/material/image.png" width = "36px" height = "36px" /></div>';
document.body.appendChild(div);
}
//显示上传按钮
window.showImgurl = function(){
var up = layerstart;
up += '<iframe src = "https://imgurl.org/miniup.html" width="100%" height="660px" frameborder="0"></iframe>';
up += layerend;
//$("body").append(up);
var div = document.createElement("div");
div.innerHTML = up;
document.body.appendChild(div);
//$("#layer").show();
document.getElementById("layer").style.display = "block";
//显示遮罩
keepout();
//居中显示层
layerCenter();
}
imgurl();
})();

228
static/index.js

@ -1,228 +0,0 @@ @@ -1,228 +0,0 @@
/*!
*
* @author: diandian & alanzhang
* @date: 2016/8/19
* @overview: [截屏后按粘贴快捷键ctrl+v上传]
* @兼容性说明 IE11Firefoxchrome
*
*/
'use strict';
(function(root, factory){
if (typeof define === 'function' && define.amd) {
// AMD
define([], factory);
} else if (typeof exports === 'object') {
// Node, CommonJS-like
module.exports = factory();
} else {
// Browser globals (root is window)
root.ctrlVUtil = factory();
}
}(this, function(){
function ctrlVUtil(option){
// 鼠标在该元素上,使用ctrl+v键时上传
this.targetElement = null;
// 用于响应paste事件的元素,如果页面不传递,则创建该元素,并位于targetElement前面
this.uploadInput = null;
// 默认的上传地址
this.uploadUrl = "http://www.oa.com/screenshot/create-file";
// 对于读取的图片base64,前缀为data:image/jpg;base64,base64content
// isCompleteImg为false则去掉前缀直接上传内容部分,为true则上传完整的base64字符串
this.isCompleteImg = false;
var that = this;
// 合并参数
that.mixinConfig(option);
// 鼠标移入和点击时上传,移出时失焦
that.targetElement.addEventListener("mouseover", function() {
that.uploadInput.focus();
});
that.targetElement.addEventListener("click", function() {
that.uploadInput.focus();
});
// 移除鼠标则input失去交掉
that.targetElement.addEventListener("mouseleave", function() {
that.uploadInput.blur();
});
// 监听paste的事件
that.uploadInput.addEventListener('paste', function(e) {
that.handlePaste(e);
});
}
/**
* [mixinConfig 整合参数]
* @param {[type]} option [description]
* @return {[type]} [description]
*/
ctrlVUtil.prototype.mixinConfig = function(option){
this.targetElement = option.targetElement || document.querySelector(".js-upload");
this.uploadInput = this.createInputTarget();
this.isCompleteImg = "isCompleteImg" in option ? option.isCompleteImg : this.isCompleteImg;
// 上传地址
this.uploadUrl = option.uploadUrl || this.uploadUrl;
// 除了图片内容以外的其他数据
this.data = option.data;
// 上传成功时的回调函数
this.success = option.success || function(data) {
console.log(data);
};
// 上传失败时的回调函数
this.error = option.error || function(error) {
console.log(error);
};
};
/**
* [createInputTarget 创建div元素用于响应paste事件]
* @return {Element} [description]
*/
ctrlVUtil.prototype.createInputTarget = function() {
var imgContinaer = document.createElement("div");
// 使其不可见
imgContinaer.style.cssText = "border:none;margin:0;padding:0;font-size: 0;height:1px;width:1px;opacity:0;position:fixed;z-index:-1;";
// 让其可编辑,能响应paste事件
imgContinaer.contentEditable = true;
imgContinaer.class = "ui-ctrlv-uploadInput";
// 插入targeElementn前面
this.targetElement.parentNode.insertBefore(imgContinaer, this.targetElement);
return imgContinaer;
};
/**
* [handlePaste 处理粘贴行为]
* @param {Event} e [粘贴事件]
* @return {[type]} [description]
*/
ctrlVUtil.prototype.handlePaste = function(e){
var that = this;
// webkit 内核支持items方法
if (e && e.clipboardData && e.clipboardData.items) {
// 获取item
var item = e.clipboardData.items[0],
that = this;
if (item.type.indexOf('image') != -1) {
var blob = item.getAsFile();
// 创建读取对象
var fileReader = new FileReader();
// 将文件读取为字符串
fileReader.readAsDataURL(blob);
fileReader.addEventListener('load', function(e) {
var file = e.target.result;
that.send(file);
}, false);
} else {
//that.alertMsg("请粘贴image类型");
layer.msg('请粘贴image类型!');
}
// firefox无法使用items方法,在粘贴时,图片会作为img标签插入targetElement中,
// 获取img标签的src内容进行上传
} else {
setTimeout(function() {
var $img = that.uploadInput.querySelector("img");
if ($img) {
that.send($img.src);
} else {
//that.alertMsg("浏览器不支持剪贴板操作");
layer.msg('当前浏览器不支持剪贴板操作!');
return;
}
}, 200);
}
};
/**
* [send 上传图片]
* @param {string} imgcontent [图片内容base64格式]
* @return {[type]} [description]
*/
ctrlVUtil.prototype.send = function(imgcontent) {
//自己添加的,显示上传加载
layer.load();
var that = this;
that.uploadInput.innerHTML = "";
var data = that.data || {};
// 根据sCompleteImg来决定上传的是整体的base64字符串还是仅仅为内容部分
data.content = this.isCompleteImg ? imgcontent : imgcontent.split(';')[1].split(',')[1];
var xhr = new XMLHttpRequest();
xhr.open("post",that.uploadUrl,true);
xhr.onreadystatechange = function(e) {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
var ret = JSON.parse(xhr.responseText);
that.success && that.success(ret);
} else {
that.error && that.error(e, xhr);
}
}
};
xhr.onerror = function(e) {
that.error && that.error(e, xhr);
};
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
var dataString = [];
for(var key in data){
dataString.push(key+"="+encodeURIComponent(data[key]));
}
xhr.send(dataString.join("&"));
};
ctrlVUtil.prototype.alertMsg = function(content){
alert(content);
}
// 暴露构造函数
return ctrlVUtil;
}));

4
static/jquery.min.js vendored

File diff suppressed because one or more lines are too long

2
static/layui/css/layui.css

File diff suppressed because one or more lines are too long

2
static/layui/css/layui.mobile.css

File diff suppressed because one or more lines are too long

2
static/layui/css/modules/code.css

@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
/** layui-v2.2.6 MIT License By https://www.layui.com */
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}

2
static/layui/css/modules/laydate/default/laydate.css

File diff suppressed because one or more lines are too long

BIN
static/layui/css/modules/layer/default/icon-ext.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

BIN
static/layui/css/modules/layer/default/icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

2
static/layui/css/modules/layer/default/layer.css

File diff suppressed because one or more lines are too long

BIN
static/layui/css/modules/layer/default/loading-0.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

BIN
static/layui/css/modules/layer/default/loading-1.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 701 B

BIN
static/layui/css/modules/layer/default/loading-2.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

BIN
static/layui/font/iconfont.eot

Binary file not shown.

483
static/layui/font/iconfont.svg

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 269 KiB

BIN
static/layui/font/iconfont.ttf

Binary file not shown.

BIN
static/layui/font/iconfont.woff

Binary file not shown.

BIN
static/layui/images/face/0.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

BIN
static/layui/images/face/1.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

BIN
static/layui/images/face/10.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

BIN
static/layui/images/face/11.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

BIN
static/layui/images/face/12.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

BIN
static/layui/images/face/13.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

BIN
static/layui/images/face/14.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

BIN
static/layui/images/face/15.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

BIN
static/layui/images/face/16.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

BIN
static/layui/images/face/17.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

BIN
static/layui/images/face/18.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

BIN
static/layui/images/face/19.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

BIN
static/layui/images/face/2.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

BIN
static/layui/images/face/20.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

BIN
static/layui/images/face/21.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

BIN
static/layui/images/face/22.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

BIN
static/layui/images/face/23.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

BIN
static/layui/images/face/24.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

BIN
static/layui/images/face/25.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

BIN
static/layui/images/face/26.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

BIN
static/layui/images/face/27.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

BIN
static/layui/images/face/28.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

BIN
static/layui/images/face/29.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

BIN
static/layui/images/face/3.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

BIN
static/layui/images/face/30.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

BIN
static/layui/images/face/31.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save