Browse Source

2.0

pull/35/head v2.0
xiaoz 6 years ago
parent
commit
4a5e2537ab
  1. 4
      .htaccess
  2. 47
      README.md
  3. 6
      application/.htaccess
  4. 11
      application/cache/index.html
  5. 135
      application/config/autoload.php
  6. 523
      application/config/config.php
  7. 85
      application/config/constants.php
  8. 96
      application/config/database.php
  9. 24
      application/config/doctypes.php
  10. 103
      application/config/foreign_chars.php
  11. 13
      application/config/hooks.php
  12. 11
      application/config/index.html
  13. 19
      application/config/memcached.php
  14. 84
      application/config/migration.php
  15. 184
      application/config/mimes.php
  16. 14
      application/config/profiler.php
  17. 54
      application/config/routes.php
  18. 64
      application/config/smileys.php
  19. 214
      application/config/user_agents.php
  20. 41
      application/controllers/Admin.php
  21. 107
      application/controllers/Compress.php
  22. 195
      application/controllers/Deal.php
  23. 42
      application/controllers/Del.php
  24. 52
      application/controllers/Found.php
  25. 44
      application/controllers/Home.php
  26. 75
      application/controllers/Img.php
  27. 273
      application/controllers/Install.php
  28. 63
      application/controllers/Maintain.php
  29. 92
      application/controllers/Manage.php
  30. 37
      application/controllers/Page.php
  31. 172
      application/controllers/Set.php
  32. 106
      application/controllers/Setting.php
  33. 32
      application/controllers/Storage.php
  34. 402
      application/controllers/Upload.php
  35. 91
      application/controllers/User.php
  36. 25
      application/controllers/Welcome.php
  37. 11
      application/controllers/index.html
  38. 11
      application/core/index.html
  39. 142
      application/helpers/basic_helper.php
  40. 11
      application/helpers/index.html
  41. 11
      application/hooks/index.html
  42. 11
      application/index.html
  43. 11
      application/language/english/index.html
  44. 11
      application/language/index.html
  45. 106
      application/libraries/Basic.php
  46. 46
      application/libraries/Image.php
  47. 1692
      application/libraries/Medoo.php
  48. 1679
      application/libraries/Parsedown.php
  49. 11
      application/libraries/index.html
  50. 11
      application/logs/index.html
  51. 21
      application/models/Delete.php
  52. 56
      application/models/Insert.php
  53. 269
      application/models/Query.php
  54. 86
      application/models/Update.php
  55. 11
      application/models/index.html
  56. 11
      application/third_party/index.html
  57. 59
      application/views/admin/footer.php
  58. 49
      application/views/admin/header.php
  59. 40
      application/views/admin/identify.php
  60. 85
      application/views/admin/images.php
  61. 59
      application/views/admin/imginfo.php
  62. 0
      application/views/admin/index.html
  63. 55
      application/views/admin/index.php
  64. 50
      application/views/admin/left.php
  65. 26
      application/views/admin/localhost.php
  66. 54
      application/views/admin/site.php
  67. 39
      application/views/admin/tinypng.php
  68. 33
      application/views/admin/uplimit.php
  69. 16
      application/views/admin/upto2.php
  70. 24
      application/views/admin/urlup.php
  71. 8
      application/views/errors/cli/error_404.php
  72. 8
      application/views/errors/cli/error_db.php
  73. 21
      application/views/errors/cli/error_exception.php
  74. 8
      application/views/errors/cli/error_general.php
  75. 21
      application/views/errors/cli/error_php.php
  76. 11
      application/views/errors/cli/index.html
  77. 64
      application/views/errors/html/error_404.php
  78. 64
      application/views/errors/html/error_db.php
  79. 32
      application/views/errors/html/error_exception.php
  80. 64
      application/views/errors/html/error_general.php
  81. 33
      application/views/errors/html/error_php.php
  82. 11
      application/views/errors/html/index.html
  83. 11
      application/views/errors/index.html
  84. 11
      application/views/index.html
  85. 31
      application/views/user/footer.php
  86. 77
      application/views/user/found.php
  87. 65
      application/views/user/header.php
  88. 136
      application/views/user/home.php
  89. 139
      application/views/user/img.php
  90. 55
      application/views/user/install1.php
  91. 45
      application/views/user/install2.php
  92. 17
      application/views/user/install3.php
  93. 23
      application/views/user/login.php
  94. 106
      application/views/user/multiple.php
  95. 19
      application/views/user/page.php
  96. 89
      application/views/welcome_message.php
  97. 2
      data/.htaccess
  98. BIN
      data/imgurl-simple.db3
  99. 0
      data/index.html
  100. 39
      data/pages/readme.md
  101. Some files were not shown because too many files have changed in this diff Show More

4
.htaccess

@ -0,0 +1,4 @@
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

47
README.md

@ -0,0 +1,47 @@
# ImgURL
ImgURL是一款简单、好用的图床程序,使用PHP + SQLite 3开发,不需要复杂的配置,开箱即用。
![](https://i.bmp.ovh/imgs/2018/12/06cf0ac3b7625b6b.png)
![](https://i.bmp.ovh/imgs/2018/12/f0b565e2e0ffa166.png)
![](https://i.bmp.ovh/imgs/2018/12/017c5e66b53db4d1.png)
### 主要功能
* 支持拽拖上传、多图上传、Ctrl + V粘贴上传、URL上传
* 支持图片裁剪,自动生成缩略图
* 限制访客上传数量
* 图片压缩
* 图片鉴黄
* 友好的后台管理界面
### 环境要求
* PHP >= 5.6
* PDO_SQLite
* GD2
* ImageMagick
* fileinfo
* pathinfo
### 安装
请参考帮助文档:[https://doc.xiaoz.me/](https://doc.xiaoz.me/#/imgurl2/)
### Demo
* [http://test.imgurl.org/](http://test.imgurl.org/)
* 账号:xiaoz
* 密码:xiaoz.me
### 请我喝一杯咖啡
![](https://www.xiaoz.me/wp-content/uploads/2013/12/juanzeng260.png)
### 鸣谢
* [LayUI](https://github.com/sentsin/layui)
* [CodeIgniter](https://github.com/bcit-ci/CodeIgniter)
* [clipBoard.js](https://github.com/baixuexiyang/clipBoard.js)
* [Parsedown](https://github.com/erusev/parsedown)
* [jQuery](https://github.com/jquery/jquery)
### 联系我
* Blog:[https://www.xiaoz.me/](https://www.xiaoz.me/)
* 社区支持:[https://ttt.sh/](https://ttt.sh/category/6/)
* QQ:337003006

6
application/.htaccess

@ -0,0 +1,6 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>

11
application/cache/index.html vendored

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

135
application/config/autoload.php

@ -0,0 +1,135 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
| is made regarding whether you intend to use it. This file lets
| you globally define which systems you would like loaded with every
| request.
|
| -------------------------------------------------------------------
| Instructions
| -------------------------------------------------------------------
|
| These are the things you can load automatically:
|
| 1. Packages
| 2. Libraries
| 3. Drivers
| 4. Helper files
| 5. Custom config files
| 6. Language files
| 7. Models
|
*/
/*
| -------------------------------------------------------------------
| Auto-load Packages
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
$autoload['packages'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in system/libraries/ or your
| application/libraries/ directory, with the addition of the
| 'database' library, which is somewhat of a special case.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'email', 'session');
|
| You can also supply an alternative library name to be assigned
| in the controller:
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Drivers
| -------------------------------------------------------------------
| These classes are located in system/libraries/ or in your
| application/libraries/ directory, but are also placed inside their
| own subdirectory and they extend the CI_Driver_Library class. They
| offer multiple interchangeable driver options.
|
| Prototype:
|
| $autoload['drivers'] = array('cache');
|
| You can also supply an alternative property name to be assigned in
| the controller:
|
| $autoload['drivers'] = array('cache' => 'cch');
|
*/
$autoload['drivers'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files. Otherwise, leave it blank.
|
*/
$autoload['config'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['language'] = array('lang1', 'lang2');
|
| NOTE: Do not include the "_lang" part of your file. For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/
$autoload['language'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Models
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['model'] = array('first_model', 'second_model');
|
| You can also supply an alternative model name to be assigned
| in the controller:
|
| $autoload['model'] = array('first_model' => 'first');
*/
$autoload['model'] = array();

523
application/config/config.php

@ -0,0 +1,523 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try guess the protocol and path
| your installation, but due to security concerns the hostname will be set
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
|
| If you need to allow multiple domains, remember that this file is still
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = '';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'REQUEST_URI' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/core_classes.html
| https://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';
/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = FALSE;
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
/*
|--------------------------------------------------------------------------
| Allow $_GET array
|--------------------------------------------------------------------------
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['allow_get_array'] = TRUE;
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| You can also pass an array with threshold levels to show individual error types
|
| array(2) = Debug Messages, without Error Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 0;
/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ directory. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
/*
|--------------------------------------------------------------------------
| Log File Extension
|--------------------------------------------------------------------------
|
| The default filename extension for log files. The default 'php' allows for
| protecting the log files via basic scripting, when they are to be stored
| under a publicly accessible directory.
|
| Note: Leaving it blank will default to 'php'.
|
*/
$config['log_file_extension'] = '';
/*
|--------------------------------------------------------------------------
| Log File Permissions
|--------------------------------------------------------------------------
|
| The file system permissions to be applied on newly created log files.
|
| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
| integer notation (i.e. 0700, 0644, etc.)
*/
$config['log_file_permissions'] = 0644;
/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
/*
|--------------------------------------------------------------------------
| Error Views Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/views/errors/ directory. Use a full server path with trailing slash.
|
*/
$config['error_views_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/cache/ directory. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Include Query String
|--------------------------------------------------------------------------
|
| Whether to take the URL query string into consideration when generating
| output cache files. Valid options are:
|
| FALSE = Disabled
| TRUE = Enabled, take all query parameters into account.
| Please be aware that this may result in numerous cache
| files generated for the same page over and over again.
| array('q') = Enabled, but only take into account the specified list
| of query parameters.
|
*/
$config['cache_query_string'] = FALSE;
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class, you must set an encryption key.
| See the user guide for more info.
|
| https://codeigniter.com/user_guide/libraries/encryption.html
|
*/
$config['encryption_key'] = '';
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_driver'
|
| The storage driver to use: files, database, redis, memcached
|
| 'sess_cookie_name'
|
| The session cookie name, must contain only [0-9a-z_-] characters
|
| 'sess_expiration'
|
| The number of SECONDS you want the session to last.
| Setting to 0 (zero) means expire when the browser is closed.
|
| 'sess_save_path'
|
| The location to save sessions to, driver dependent.
|
| For the 'files' driver, it's a path to a writable directory.
| WARNING: Only absolute paths are supported!
|
| For the 'database' driver, it's a table name.
| Please read up the manual for the format with other session drivers.
|
| IMPORTANT: You are REQUIRED to set a valid save path!
|
| 'sess_match_ip'
|
| Whether to match the user's IP address when reading the session data.
|
| WARNING: If you're using the database driver, don't forget to update
| your session table's PRIMARY KEY when changing this setting.
|
| 'sess_time_to_update'
|
| How many seconds between CI regenerating the session ID.
|
| 'sess_regenerate_destroy'
|
| Whether to destroy session data associated with the old session ID
| when auto-regenerating the session ID. When set to FALSE, the data
| will be later deleted by the garbage collector.
|
| Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path' = Typically will be a forward slash
| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
|
| Note: These settings (with the exception of 'cookie_prefix' and
| 'cookie_httponly') will also affect sessions.
|
*/
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
/*
|--------------------------------------------------------------------------
| Standardize newlines
|--------------------------------------------------------------------------
|
| Determines whether to standardize newline characters in input data,
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['standardize_newlines'] = FALSE;
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['global_xss_filtering'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
| checked on a submitted form. If you are accepting user data, it is strongly
| recommended CSRF protection be enabled.
|
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
| 'csrf_regenerate' = Regenerate token on every submission
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
*/
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads. When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| Only used if zlib.output_compression is turned off in your php.ini.
| Please do not use it together with httpd-level output compression.
|
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts. For
| compression to work, nothing can be sent before the output buffer is called
| by the output class. Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are 'local' or any PHP supported timezone. This preference tells
| the system whether to use your server's local time as the master 'now'
| reference, or convert it to the configured one timezone. See the 'date
| helper' page of the user guide for information regarding date handling.
|
*/
$config['time_reference'] = 'local';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
| Note: You need to have eval() enabled for this to work.
|
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy
| IP addresses from which CodeIgniter should trust headers such as
| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
| the visitor's IP address.
|
| You can use both an array or a comma-separated list of proxy addresses,
| as well as specifying whole subnets. Here are a few examples:
|
| Comma-separated: '10.0.1.200,192.168.5.0/24'
| Array: array('10.0.1.200', '192.168.5.0/24')
*/
$config['proxy_ips'] = '';

85
application/config/constants.php

@ -0,0 +1,85 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Display Debug backtrace
|--------------------------------------------------------------------------
|
| If set to TRUE, a backtrace will be displayed along with php errors. If
| error_reporting is disabled, the backtrace will not display, regardless
| of this setting
|
*/
defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
/*
|--------------------------------------------------------------------------
| File and Directory Modes
|--------------------------------------------------------------------------
|
| These prefs are used when checking and setting modes when working
| with the file system. The defaults are fine on servers with proper
| security, but you may wish (or even need) to change the values in
| certain environments (Apache running a separate process for each
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
| always be used to set the mode correctly.
|
*/
defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644);
defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);
defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755);
defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
/*
|--------------------------------------------------------------------------
| File Stream Modes
|--------------------------------------------------------------------------
|
| These modes are used when working with fopen()/popen()
|
*/
defined('FOPEN_READ') OR define('FOPEN_READ', 'rb');
defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b');
defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab');
defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');
defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
/*
|--------------------------------------------------------------------------
| Exit Status Codes
|--------------------------------------------------------------------------
|
| Used to indicate the conditions under which the script is exit()ing.
| While there is no universal standard for error codes, there are some
| broad conventions. Three such conventions are mentioned below, for
| those who wish to make use of them. The CodeIgniter defaults were
| chosen for the least overlap with these conventions, while still
| leaving room for others to be defined in future versions and user
| applications.
|
| The three main conventions used for determining exit status codes
| are as follows:
|
| Standard C/C++ Library (stdlibc):
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
| (This link also contains other GNU-specific conventions)
| BSD sysexits.h:
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
| Bash scripting:
| http://tldp.org/LDP/abs/html/exitcodes.html
|
*/
defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code

96
application/config/database.php

@ -0,0 +1,96 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
| ['dsn'] The full DSN string describe a connection to the database.
| ['hostname'] The hostname of your database server.
| ['username'] The username used to connect to the database
| ['password'] The password used to connect to the database
| ['database'] The name of the database you want to connect to
| ['dbdriver'] The database driver. e.g.: mysqli.
| Currently supported:
| cubrid, ibase, mssql, mysql, mysqli, oci8,
| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
| ['dbprefix'] You can add an optional prefix, which will be added
| to the table name when using the Query Builder class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
| ['cachedir'] The path to the folder where cache files should be stored
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| NOTE: For MySQL and MySQLi databases, this setting is only used
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
| (and in table creation queries made with DB Forge).
| There is an incompatibility in PHP with mysql_real_escape_string() which
| can make your site vulnerable to SQL injection if you are using a
| multi-byte character set and are running versions lower than these.
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['encrypt'] Whether or not to use an encrypted connection.
|
| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
|
| 'ssl_key' - Path to the private key file
| 'ssl_cert' - Path to the public key certificate file
| 'ssl_ca' - Path to the certificate authority file
| 'ssl_capath' - Path to a directory containing trusted CA certificates in PEM format
| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not ('mysqli' only)
|
| ['compress'] Whether or not to use client compression (MySQL only)
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
| ['failover'] array - A array with 0 or more data for connections if the main should fail.
| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
| NOTE: Disabling this will also effectively disable both
| $this->db->last_query() and profiling of DB queries.
| When you run a query, with this setting set to TRUE (default),
| CodeIgniter will store the SQL statement for debugging purposes.
| However, this may cause high memory usage, especially if you run
| a lot of SQL queries ... disable this to avoid that problem.
|
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
|
| The $query_builder variables lets you determine whether or not to load
| the query builder class.
*/
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => 'sqlite:'.FCPATH.'data/imgurl.db3',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'database' => '',
'dbdriver' => 'pdo',
'dbprefix' => 'img_',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);

24
application/config/doctypes.php

@ -0,0 +1,24 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$_doctypes = array(
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
'html5' => '<!DOCTYPE html>',
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">'
);

103
application/config/foreign_chars.php

@ -0,0 +1,103 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| Foreign Characters
| -------------------------------------------------------------------
| This file contains an array of foreign characters for transliteration
| conversion used by the Text helper
|
*/
$foreign_characters = array(
'/ä|æ|ǽ/' => 'ae',
'/ö|œ/' => 'oe',
'/ü/' => 'ue',
'/Ä/' => 'Ae',
'/Ü/' => 'Ue',
'/Ö/' => 'Oe',
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A',
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a',
'/Б/' => 'B',
'/б/' => 'b',
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
'/ç|ć|ĉ|ċ|č/' => 'c',
'/Д/' => 'D',
'/д/' => 'd',
'/Ð|Ď|Đ|Δ/' => 'Dj',
'/ð|ď|đ|δ/' => 'dj',
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E',
'/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e',
'/Ф/' => 'F',
'/ф/' => 'f',
'/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G',
'/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g',
'/Ĥ|Ħ/' => 'H',
'/ĥ|ħ/' => 'h',
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I',
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i',
'/Ĵ/' => 'J',
'/ĵ/' => 'j',
'/Ķ|Κ|К/' => 'K',
'/ķ|κ|к/' => 'k',
'/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L',
'/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l',
'/М/' => 'M',
'/м/' => 'm',
'/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N',
'/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n',
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O',
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o',
'/П/' => 'P',
'/п/' => 'p',
'/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R',
'/ŕ|ŗ|ř|ρ|р/' => 'r',
'/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S',
'/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's',
'/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T',
'/ț|ţ|ť|ŧ|т/' => 't',
'/Þ|þ/' => 'th',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U',
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u',
'/Ƴ|Ɏ|Ỵ|Ẏ|Ӳ|Ӯ|Ў|Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y',
'/ẙ|ʏ|ƴ|ɏ|ỵ|ẏ|ӳ|ӯ|ў|ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y',
'/В/' => 'V',
'/в/' => 'v',
'/Ŵ/' => 'W',
'/ŵ/' => 'w',
'/Ź|Ż|Ž|Ζ|З/' => 'Z',
'/ź|ż|ž|ζ|з/' => 'z',
'/Æ|Ǽ/' => 'AE',
'/ß/' => 'ss',
'/IJ/' => 'IJ',
'/ij/' => 'ij',
'/Œ/' => 'OE',
'/ƒ/' => 'f',
'/ξ/' => 'ks',
'/π/' => 'p',
'/β/' => 'v',
'/μ/' => 'm',
'/ψ/' => 'ps',
'/Ё/' => 'Yo',
'/ё/' => 'yo',
'/Є/' => 'Ye',
'/є/' => 'ye',
'/Ї/' => 'Yi',
'/Ж/' => 'Zh',
'/ж/' => 'zh',
'/Х/' => 'Kh',
'/х/' => 'kh',
'/Ц/' => 'Ts',
'/ц/' => 'ts',
'/Ч/' => 'Ch',
'/ч/' => 'ch',
'/Ш/' => 'Sh',
'/ш/' => 'sh',
'/Щ/' => 'Shch',
'/щ/' => 'shch',
'/Ъ|ъ|Ь|ь/' => '',
'/Ю/' => 'Yu',
'/ю/' => 'yu',
'/Я/' => 'Ya',
'/я/' => 'ya'
);

13
application/config/hooks.php

@ -0,0 +1,13 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
| files. Please see the user guide for info:
|
| https://codeigniter.com/user_guide/general/hooks.html
|
*/

11
application/config/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

19
application/config/memcached.php

@ -0,0 +1,19 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Memcached settings
| -------------------------------------------------------------------------
| Your Memcached servers can be specified below.
|
| See: https://codeigniter.com/user_guide/libraries/caching.html#memcached
|
*/
$config = array(
'default' => array(
'hostname' => '127.0.0.1',
'port' => '11211',
'weight' => '1',
),
);

84
application/config/migration.php

@ -0,0 +1,84 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Enable/Disable Migrations
|--------------------------------------------------------------------------
|
| Migrations are disabled by default for security reasons.
| You should enable migrations whenever you intend to do a schema migration
| and disable it back when you're done.
|
*/
$config['migration_enabled'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migration Type
|--------------------------------------------------------------------------
|
| Migration file names may be based on a sequential identifier or on
| a timestamp. Options are:
|
| 'sequential' = Sequential migration naming (001_add_blog.php)
| 'timestamp' = Timestamp migration naming (20121031104401_add_blog.php)
| Use timestamp format YYYYMMDDHHIISS.
|
| Note: If this configuration value is missing the Migration library
| defaults to 'sequential' for backward compatibility with CI2.
|
*/
$config['migration_type'] = 'timestamp';
/*
|--------------------------------------------------------------------------
| Migrations table
|--------------------------------------------------------------------------
|
| This is the name of the table that will store the current migrations state.
| When migrations runs it will store in a database table which migration
| level the system is at. It then compares the migration level in this
| table to the $config['migration_version'] if they are not the same it
| will migrate up. This must be set.
|
*/
$config['migration_table'] = 'migrations';
/*
|--------------------------------------------------------------------------
| Auto Migrate To Latest
|--------------------------------------------------------------------------
|
| If this is set to TRUE when you load the migrations class and have
| $config['migration_enabled'] set to TRUE the system will auto migrate
| to your latest migration (whatever $config['migration_version'] is
| set to). This way you do not have to call migrations anywhere else
| in your code to have the latest migration.
|
*/
$config['migration_auto_latest'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migrations version
|--------------------------------------------------------------------------
|
| This is used to set migration version that the file system should be on.
| If you run $this->migration->current() this is the version that schema will
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 0;
/*
|--------------------------------------------------------------------------
| Migrations Path
|--------------------------------------------------------------------------
|
| Path to your migrations folder.
| Typically, it will be within your application path.
| Also, writing permission is required within the migrations path.
|
*/
$config['migration_path'] = APPPATH.'migrations/';

184
application/config/mimes.php

@ -0,0 +1,184 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| MIME TYPES
| -------------------------------------------------------------------
| This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types.
|
*/
return array(
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
'cpt' => 'application/mac-compactpro',
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => array('application/octet-stream', 'application/x-msdownload'),
'class' => 'application/octet-stream',
'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
'ai' => array('application/pdf', 'application/postscript'),
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'),
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
'wbxml' => 'application/wbxml',
'wmlc' => 'application/wmlc',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'gzip' => 'application/x-gzip',
'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'),
'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'js' => array('application/x-javascript', 'text/plain'),
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
'z' => 'application/x-compress',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
'aif' => array('audio/x-aiff', 'audio/aiff'),
'aiff' => array('audio/x-aiff', 'audio/aiff'),
'aifc' => 'audio/x-aiff',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'),
'gif' => 'image/gif',
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
'jpe' => array('image/jpeg', 'image/pjpeg'),
'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'png' => array('image/png', 'image/x-png'),
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'css' => array('text/css', 'text/plain'),
'html' => array('text/html', 'text/plain'),
'htm' => array('text/html', 'text/plain'),
'shtml' => array('text/html', 'text/plain'),
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => array('text/plain', 'text/x-log'),
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => array('application/xml', 'text/xml', 'text/plain'),
'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
'movie' => 'video/x-sgi-movie',
'doc' => array('application/msword', 'application/vnd.ms-office'),
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
'dot' => array('application/msword', 'application/vnd.ms-office'),
'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'),
'word' => array('application/msword', 'application/octet-stream'),
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => array('application/json', 'text/json'),
'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
'p10' => array('application/x-pkcs10', 'application/pkcs10'),
'p12' => 'application/x-pkcs12',
'p7a' => 'application/x-pkcs7-signature',
'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
'p7r' => 'application/x-pkcs7-certreqresp',
'p7s' => 'application/pkcs7-signature',
'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
'crl' => array('application/pkix-crl', 'application/pkcs-crl'),
'der' => 'application/x-x509-ca-cert',
'kdb' => 'application/octet-stream',
'pgp' => 'application/pgp',
'gpg' => 'application/gpg-keys',
'sst' => 'application/octet-stream',
'csr' => 'application/octet-stream',
'rsa' => 'application/x-pkcs7',
'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
'3g2' => 'video/3gpp2',
'3gp' => array('video/3gp', 'video/3gpp'),
'mp4' => 'video/mp4',
'm4a' => 'audio/x-m4a',
'f4v' => array('video/mp4', 'video/x-f4v'),
'flv' => 'video/x-flv',
'webm' => 'video/webm',
'aac' => 'audio/x-acc',
'm4u' => 'application/vnd.mpegurl',
'm3u' => 'text/plain',
'xspf' => 'application/xspf+xml',
'vlc' => 'application/videolan',
'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'),
'au' => 'audio/x-au',
'ac3' => 'audio/ac3',
'flac' => 'audio/x-flac',
'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'),
'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
'ics' => 'text/calendar',
'ical' => 'text/calendar',
'zsh' => 'text/x-scriptzsh',
'7z' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
'7zip' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
'vcf' => 'text/x-vcard',
'srt' => array('text/srt', 'text/plain'),
'vtt' => array('text/vtt', 'text/plain'),
'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'),
'odc' => 'application/vnd.oasis.opendocument.chart',
'otc' => 'application/vnd.oasis.opendocument.chart-template',
'odf' => 'application/vnd.oasis.opendocument.formula',
'otf' => 'application/vnd.oasis.opendocument.formula-template',
'odg' => 'application/vnd.oasis.opendocument.graphics',
'otg' => 'application/vnd.oasis.opendocument.graphics-template',
'odi' => 'application/vnd.oasis.opendocument.image',
'oti' => 'application/vnd.oasis.opendocument.image-template',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
'odt' => 'application/vnd.oasis.opendocument.text',
'odm' => 'application/vnd.oasis.opendocument.text-master',
'ott' => 'application/vnd.oasis.opendocument.text-template',
'oth' => 'application/vnd.oasis.opendocument.text-web'
);

14
application/config/profiler.php

@ -0,0 +1,14 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Profiler Sections
| -------------------------------------------------------------------------
| This file lets you determine whether or not various sections of Profiler
| data are displayed when the Profiler is enabled.
| Please see the user guide for info:
|
| https://codeigniter.com/user_guide/general/profiling.html
|
*/

54
application/config/routes.php

@ -0,0 +1,54 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
| https://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There are three reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router which controller/method to use if those
| provided in the URL cannot be matched to a valid route.
|
| $route['translate_uri_dashes'] = FALSE;
|
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method
*/
$route['default_controller'] = 'home';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

64
application/config/smileys.php

@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| SMILEYS
| -------------------------------------------------------------------
| This file contains an array of smileys for use with the emoticon helper.
| Individual images can be used to replace multiple smileys. For example:
| :-) and :) use the same image replacement.
|
| Please see user guide for more info:
| https://codeigniter.com/user_guide/helpers/smiley_helper.html
|
*/
$smileys = array(
// smiley image name width height alt
':-)' => array('grin.gif', '19', '19', 'grin'),
':lol:' => array('lol.gif', '19', '19', 'LOL'),
':cheese:' => array('cheese.gif', '19', '19', 'cheese'),
':)' => array('smile.gif', '19', '19', 'smile'),
';-)' => array('wink.gif', '19', '19', 'wink'),
';)' => array('wink.gif', '19', '19', 'wink'),
':smirk:' => array('smirk.gif', '19', '19', 'smirk'),
':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'),
':-S' => array('confused.gif', '19', '19', 'confused'),
':wow:' => array('surprise.gif', '19', '19', 'surprised'),
':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'),
':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
'%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'),
':P' => array('raspberry.gif', '19', '19', 'raspberry'),
':blank:' => array('blank.gif', '19', '19', 'blank stare'),
':long:' => array('longface.gif', '19', '19', 'long face'),
':ohh:' => array('ohh.gif', '19', '19', 'ohh'),
':grrr:' => array('grrr.gif', '19', '19', 'grrr'),
':gulp:' => array('gulp.gif', '19', '19', 'gulp'),
'8-/' => array('ohoh.gif', '19', '19', 'oh oh'),
':down:' => array('downer.gif', '19', '19', 'downer'),
':red:' => array('embarrassed.gif', '19', '19', 'red face'),
':sick:' => array('sick.gif', '19', '19', 'sick'),
':shut:' => array('shuteye.gif', '19', '19', 'shut eye'),
':-/' => array('hmm.gif', '19', '19', 'hmmm'),
'>:(' => array('mad.gif', '19', '19', 'mad'),
':mad:' => array('mad.gif', '19', '19', 'mad'),
'>:-(' => array('angry.gif', '19', '19', 'angry'),
':angry:' => array('angry.gif', '19', '19', 'angry'),
':zip:' => array('zip.gif', '19', '19', 'zipper'),
':kiss:' => array('kiss.gif', '19', '19', 'kiss'),
':ahhh:' => array('shock.gif', '19', '19', 'shock'),
':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'),
':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'),
':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'),
':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'),
':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'),
':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
':snake:' => array('snake.gif', '19', '19', 'snake'),
':exclaim:' => array('exclaim.gif', '19', '19', 'exclaim'),
':question:' => array('question.gif', '19', '19', 'question')
);

214
application/config/user_agents.php

@ -0,0 +1,214 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| USER AGENT TYPES
| -------------------------------------------------------------------
| This file contains four arrays of user agent data. It is used by the
| User Agent Class to help identify browser, platform, robot, and
| mobile device data. The array keys are used to identify the device
| and the array values are used to set the actual name of the item.
*/
$platforms = array(
'windows nt 10.0' => 'Windows 10',
'windows nt 6.3' => 'Windows 8.1',
'windows nt 6.2' => 'Windows 8',
'windows nt 6.1' => 'Windows 7',
'windows nt 6.0' => 'Windows Vista',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.1' => 'Windows XP',
'windows nt 5.0' => 'Windows 2000',
'windows nt 4.0' => 'Windows NT 4.0',
'winnt4.0' => 'Windows NT 4.0',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows phone' => 'Windows Phone',
'windows' => 'Unknown Windows OS',
'android' => 'Android',
'blackberry' => 'BlackBerry',
'iphone' => 'iOS',
'ipad' => 'iOS',
'ipod' => 'iOS',
'os x' => 'Mac OS X',
'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
'linux' => 'Linux',
'debian' => 'Debian',
'sunos' => 'Sun Solaris',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'gnu' => 'GNU/Linux',
'unix' => 'Unknown Unix OS',
'symbian' => 'Symbian OS'
);
// The order of this array should NOT be changed. Many browsers return
// multiple browser types so we want to identify the sub-type first.
$browsers = array(
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => 'Edge',
'Chrome' => 'Chrome',
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
'Opera.*?Version' => 'Opera',
'Opera' => 'Opera',
'MSIE' => 'Internet Explorer',
'Internet Explorer' => 'Internet Explorer',
'Trident.* rv' => 'Internet Explorer',
'Shiira' => 'Shiira',
'Firefox' => 'Firefox',
'Chimera' => 'Chimera',
'Phoenix' => 'Phoenix',
'Firebird' => 'Firebird',
'Camino' => 'Camino',
'Netscape' => 'Netscape',
'OmniWeb' => 'OmniWeb',
'Safari' => 'Safari',
'Mozilla' => 'Mozilla',
'Konqueror' => 'Konqueror',
'icab' => 'iCab',
'Lynx' => 'Lynx',
'Links' => 'Links',
'hotjava' => 'HotJava',
'amaya' => 'Amaya',
'IBrowse' => 'IBrowse',
'Maxthon' => 'Maxthon',
'Ubuntu' => 'Ubuntu Web Browser'
);
$mobiles = array(
// legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave',
// 'opera mini' => 'Opera Mini',
// 'operamini' => 'Opera Mini',
// 'elaine' => 'Palm',
'palmsource' => 'Palm',
// 'digital paths' => 'Palm',
// 'avantgo' => 'Avantgo',
// 'xiino' => 'Xiino',
'palmscape' => 'Palmscape',
// 'nokia' => 'Nokia',
// 'ericsson' => 'Ericsson',
// 'blackberry' => 'BlackBerry',
// 'motorola' => 'Motorola'
// Phones and Manufacturers
'motorola' => 'Motorola',
'nokia' => 'Nokia',
'palm' => 'Palm',
'iphone' => 'Apple iPhone',
'ipad' => 'iPad',
'ipod' => 'Apple iPod Touch',
'sony' => 'Sony Ericsson',
'ericsson' => 'Sony Ericsson',
'blackberry' => 'BlackBerry',
'cocoon' => 'O2 Cocoon',
'blazer' => 'Treo',
'lg' => 'LG',
'amoi' => 'Amoi',
'xda' => 'XDA',
'mda' => 'MDA',
'vario' => 'Vario',
'htc' => 'HTC',
'samsung' => 'Samsung',
'sharp' => 'Sharp',
'sie-' => 'Siemens',
'alcatel' => 'Alcatel',
'benq' => 'BenQ',
'ipaq' => 'HP iPaq',
'mot-' => 'Motorola',
'playstation portable' => 'PlayStation Portable',
'playstation 3' => 'PlayStation 3',
'playstation vita' => 'PlayStation Vita',
'hiptop' => 'Danger Hiptop',
'nec-' => 'NEC',
'panasonic' => 'Panasonic',
'philips' => 'Philips',
'sagem' => 'Sagem',
'sanyo' => 'Sanyo',
'spv' => 'SPV',
'zte' => 'ZTE',
'sendo' => 'Sendo',
'nintendo dsi' => 'Nintendo DSi',
'nintendo ds' => 'Nintendo DS',
'nintendo 3ds' => 'Nintendo 3DS',
'wii' => 'Nintendo Wii',
'open web' => 'Open Web',
'openweb' => 'OpenWeb',
// Operating Systems
'android' => 'Android',
'symbian' => 'Symbian',
'SymbianOS' => 'SymbianOS',
'elaine' => 'Palm',
'series60' => 'Symbian S60',
'windows ce' => 'Windows CE',
// Browsers
'obigo' => 'Obigo',
'netfront' => 'Netfront Browser',
'openwave' => 'Openwave Browser',
'mobilexplorer' => 'Mobile Explorer',
'operamini' => 'Opera Mini',
'opera mini' => 'Opera Mini',
'opera mobi' => 'Opera Mobile',
'fennec' => 'Firefox Mobile',
// Other
'digital paths' => 'Digital Paths',
'avantgo' => 'AvantGo',
'xiino' => 'Xiino',
'novarra' => 'Novarra Transcoder',
'vodafone' => 'Vodafone',
'docomo' => 'NTT DoCoMo',
'o2' => 'O2',
// Fallback
'mobile' => 'Generic Mobile',
'wireless' => 'Generic Mobile',
'j2me' => 'Generic Mobile',
'midp' => 'Generic Mobile',
'cldc' => 'Generic Mobile',
'up.link' => 'Generic Mobile',
'up.browser' => 'Generic Mobile',
'smartphone' => 'Generic Mobile',
'cellphone' => 'Generic Mobile'
);
// There are hundreds of bots but these are the most common.
$robots = array(
'googlebot' => 'Googlebot',
'msnbot' => 'MSNBot',
'baiduspider' => 'Baiduspider',
'bingbot' => 'Bing',
'slurp' => 'Inktomi Slurp',
'yahoo' => 'Yahoo',
'ask jeeves' => 'Ask Jeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos',
'yandex' => 'YandexBot',
'mediapartners-google' => 'MediaPartners Google',
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
'adsbot-google' => 'AdsBot Google',
'feedfetcher-google' => 'Feedfetcher Google',
'curious george' => 'Curious George',
'ia_archiver' => 'Alexa Crawler',
'MJ12bot' => 'Majestic-12',
'Uptimebot' => 'Uptimebot'
);

41
application/controllers/Admin.php

@ -0,0 +1,41 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Admin extends CI_Controller{
//构造函数
public function __construct(){
parent::__construct();
//加载模型
$this->load->model('query','',TRUE);
//加载辅助函数
$this->load->helper('basic');
$info = $this->query->userinfo()->values;
$info = json_decode($info);
//验证用户是否登录
is_login($info->username,$info->password);
}
//后台首页
public function index(){
$this->load->library('basic');
$data = $this->basic->analyze();
$data['admin_title'] = '后台首页';
//加载视图
$this->load->view('admin/header',$data);
$this->load->view('admin/left');
$this->load->view('admin/index');
$this->load->view('admin/footer');
}
//URL上传
public function urlup(){
$data['admin_title'] = 'URL上传';
//加载视图
$this->load->view('admin/header',$data);
$this->load->view('admin/left');
$this->load->view('admin/urlup');
$this->load->view('admin/footer');
}
}
?>

107
application/controllers/Compress.php

@ -0,0 +1,107 @@
<?php
/*
name:图片压缩类
anthor:xiaoz.me
QQ:337003006
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Compress extends CI_Controller{
//构造函数
public function __construct(){
parent::__construct();
//设置超时时间
ini_set('max_execution_time','0');
}
//压缩单张图片,需要传入图片ID
public function img($id){
$t1 = microtime(true);
//通过图片ID查询出图片基本信息
$this->load->model('query','',TRUE);
$img = $this->query->img($id);
//如果图片没有压缩过,则调用压缩接口
if($img->compression == 0){
//获取图片完整路径
$fullpath = FCPATH.$img->path;
$this->tinypng($fullpath);
//更新数据库
$this->load->model('update','',TRUE);
$this->update->compress($id);
$t2 = microtime(true);
//计算执行时间
$used_time = round($t2 - $t1).'s';
$info = array(
"code" => 200,
"used_time" => $used_time,
"msg" => 'compressing.'
);
$info = json_encode($info);
echo $info;
}
//图片已经压缩过情况
else{
$info = array(
"code" => 0,
"msg" => 'error:The image has been compressed!'
);
$info = json_encode($info);
echo $info;
}
}
//请求tinypng压缩接口,传入图片完整路径
protected function tinypng($path){
//tinypng API地址
$api_url = "https://api.tinify.com/shrink";
$data = file_get_contents($path);
//$post_data = array ("username" => "bob","key" => "12345");
//$ch = curl_init();
$ch = curl_init();
$user = "api";
$pass = "F8rNr5lh25WYcOECQvAqvcilBMAkhtIM";
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "{$user}:{$pass}");
// post数据
curl_setopt($ch, CURLOPT_POST, 1);
// post的变量
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
//https
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
$data = json_decode($output);
//获取图片压缩后的URL
$url = $data->output->url;
//保存图片
$this->save($url,$path);
}
//传递图片URL,并保存文件
protected function save($url,$path){
//获取图片数据并保存
$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.110 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, 1);
$filedata = curl_exec($curl);
curl_close($curl);
//将图片数据覆盖源文件
file_put_contents($path,$filedata);
}
}
?>

195
application/controllers/Deal.php

@ -0,0 +1,195 @@
<?php
/*
name:图片处理控制器,图片鉴黄、图片压缩...
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Deal extends CI_Controller{
//构造函数
public function __construct(){
parent::__construct();
//设置超时时间为5分钟
set_time_limit(300);
//加载数据库类
$this->load->database();
}
//图片压缩服务,传入images的id
public function compress($id){
//只有管理员才有压缩权限
$this->load->library('basic');
$this->basic->is_login(TRUE);
$id = (int)$id;
//生成SQL语句
$sql = "SELECT a.`id`,a.`path`,a.`compression`,b.`mime` FROM img_images AS a INNER JOIN img_imginfo AS b ON a.imgid = b.imgid AND a.id = $id";
$query = $this->db->query($sql);
$row = $query->row_array();
//图片绝对路径
$path = FCPATH.$row['path'];
//如果图片已经压缩过,就不要再压缩了
if($row['compression'] == 1){
$this->err_msg('此图片已经压缩!');
}
//检查MIME类型,仅压缩jpeg & png
if(($row['mime'] != 'image/jpeg') && ($row['mime'] != 'image/png')){
$this->err_msg('此图片类型不支持压缩!');
}
//先取出tinypng信息
$sql = "SELECT * FROM img_options WHERE name = 'tinypng' LIMIT 1";
$row = $this->db->query($sql)->row_array();
//验证是否启用了压缩功能
if($row['switch'] == 'OFF'){
$this->err_msg('您没有启用压缩功能!');
}
//上面验证通过,继续执行
//取出tinypng key
$kyes = $row['values'];
$kyes = json_decode($kyes);
$i = 'api'.rand(1,2);
$key = $kyes->$i;
$url = "https://api.tinify.com/shrink";
$data = file_get_contents($path);
$ch = curl_init();
$user = "api";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "{$user}:{$key}");
// post数据
curl_setopt($ch, CURLOPT_POST, 1);
// post的变量
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
//https
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$output = curl_exec($ch);
curl_close($ch);
$output = json_decode($output);
//获取压缩后的图片链接
$outurl = $output->output->url;
//先判断是否是正常的URL,万一请求接口失败了呢
if(!filter_var($outurl, FILTER_VALIDATE_URL)){
//糟糕,没有验证通过,那就结束了
$this->err_msg('请求接口失败!');
}
//下载图片并保存覆盖
$curl = curl_init($outurl);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 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(可选)
$data = curl_exec($curl);
curl_close($curl);
//重新保存图片
file_put_contents($path,$data);
//最后别忘了更新数据库呀
$sql = "UPDATE img_images SET compression = 1 WHERE `id` = $id";
if($this->db->query($sql)){
$this->suc_msg('压缩完成!');
}
}
//图片鉴黄识别
public function identify($id){
$id = (int)$id;
//生成SQL语句
$sql = "SELECT a.id,a.path,a.level,b.domains FROM img_images AS a INNER JOIN img_storage AS b ON b.engine = 'localhost' AND a.id = $id";
$query = $this->db->query($sql);
$row = $query->row_array();
$imgurl = $row['domains'].$row['path'];
//echo $row['level'];
//如果图片已经识别过,就不要再次识别了
if(($row['level'] != 'unknown') && ($row['level'] != NULL)){
$this->err_msg('此图片已经识别过!');
}
//继续执行
$sql = "SELECT * FROM img_options WHERE name = 'moderate' LIMIT 1";
$row = $this->db->query($sql)->row_array();
//如果没有启用压缩功能
if($row['switch'] == 'OFF'){
$this->err_msg('未启用图片鉴黄识别!');
}
$apiurl = "https://www.moderatecontent.com/api/v2?key=".$row['values']."&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_label;
@$error_code = (int)$html->error_code;
//最后更新数据库
$sql = "UPDATE img_images SET level = '$level' WHERE `id` = $id";
//如果执行成功才进行更新
if($error_code === 0){
//更新数据库
$this->db->query($sql);
if($level == 'adult'){
$arr = array(
"code" => 400,
"msg" => '您的IP已记录,请不要上传违规图片!'
);
$arr = json_encode($arr);
echo $arr;
}
else{
$this->suc_msg('识别完成!');
}
}
else{
$this->err_msg('识别失败!');
}
}
//批量识别图片
public function identify_more(){
$sql = "SELECT * FROM img_images WHERE (`level` = 'unknown') OR (`level` = NULL) ORDER BY `id` DESC LIMIT 5";
//查询数据库
$query = $this->db->query($sql);
$result = $query->result();
//循环识别图片
foreach($result as $row){
$this->identify($row->id);
}
}
//返回错误码
protected function err_msg($msg){
$arr = array(
"code" => 0,
"msg" => $msg
);
$arr = json_encode($arr);
echo $arr;
exit;
}
//成功,返回正确的状态码
protected function suc_msg($msg){
$arr = array(
"code" => 200,
"msg" => $msg
);
$arr = json_encode($arr);
echo $arr;
}
}
?>

42
application/controllers/Del.php

@ -0,0 +1,42 @@
<?php
// 该控制器删除图片
defined('BASEPATH') OR exit('No direct script access allowed');
class Del extends CI_Controller{
//构造函数
public function __construct(){
parent::__construct();
//加载模型
$this->load->model('query','',TRUE);
//加载类
$this->load->library('basic');
//检测是否登录
$this->basic->is_login(TRUE);
}
//根据img_images ID删除图片
public function id($id){
@$id = (int)$id;
$img = $this->query->img_id($id);
//加载数据库模型
$this->load->model('delete','',TRUE);
//从数据库中删除
$this->delete->del_img($img->imgid);
//从磁盘中删除
$path = FCPATH.$img->path;
$thumbnail_path = FCPATH.$img->thumb_path;
//缩略图地址
unlink($path);
unlink($thumbnail_path);
$re = array(
"code" => 200,
"id" => $id,
"msg" => "删除成功!"
);
$re = json_encode($re);
echo $re;
}
}
?>

52
application/controllers/Found.php

@ -0,0 +1,52 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Found extends CI_Controller{
//构造函数
public function __construct(){
parent::__construct();
//加载模型
$this->load->model('query','',TRUE);
//加载辅助函数
}
//探索发现页面
public function index(){
$siteinfo = $this->query->site_setting();
$siteinfo = $siteinfo->values;
$siteinfo = json_decode($siteinfo);
$siteinfo->title = '探索发现 - '.$siteinfo->title;
//查询图片信息,返回对象
$data['imgs'] = $this->query->found(32);
//查询域名
$data['domain'] = $this->query->domain('localhost');
//加载视图
$this->load->view('user/header',$siteinfo);
$this->load->view('user/found',$data);
$this->load->view('user/footer');
}
//链接页面
public function link($id){
$id = strip_tags($id);
$id = (int)$id;
$siteinfo = $this->query->site_setting();
$siteinfo = $siteinfo->values;
$siteinfo = json_decode($siteinfo);
//查询图片信息,返回对象
$data['imgs'] = $this->query->found(32);
//查询域名
$data['domain'] = $this->query->domain('localhost');
//加载视图
$this->load->view('user/header',$siteinfo);
$this->load->view('user/link',$data);
$this->load->view('user/footer');
}
}
?>

44
application/controllers/Home.php

@ -0,0 +1,44 @@
<?php
/*
name:首页
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Home extends CI_Controller{
public function __construct(){
parent::__construct();
//检测是否已安装
$lock_file = FCPATH.'data/install.lock';
//如果锁文件不存在
if(!is_file($lock_file)){
header("location:/install/");
exit;
}
}
public function index(){
//加载数据库模型
$this->load->model('query','',TRUE);
$siteinfo = $this->query->site_setting();
$siteinfo = json_decode($siteinfo->values);
//echo $siteinfo->title;
//$data['title'] = '图片上传';
$this->load->view('user/header.php',$siteinfo);
$this->load->view('user/home.php');
$this->load->view('user/footer.php');
}
//首页多图上传
public function multiple(){
//加载数据库模型
$this->load->model('query','',TRUE);
$siteinfo = $this->query->site_setting();
$siteinfo = json_decode($siteinfo->values);
//echo $siteinfo->title;
//$data['title'] = '图片上传';
$this->load->view('user/header.php',$siteinfo);
$this->load->view('user/multiple.php');
$this->load->view('user/footer.php');
}
}
?>

75
application/controllers/Img.php

@ -0,0 +1,75 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Img extends CI_Controller{
public function _remap($imgid){
//加载数据库模型
$this->load->model('query','',TRUE);
$siteinfo = $this->query->site_setting();
$siteinfo = json_decode($siteinfo->values);
//过滤imgid
$imgid = strip_tags($imgid);
//计算imgid长度
$id_length = strlen($imgid);
//判断是否是有效的ID
if($id_length != 16){
show_404();
}
//继续执行
//加载模型
$this->load->model('query','',TRUE);
$this->load->model('update','',TRUE);
//浏览测试+1
$this->update->views($imgid);
//查询图片信息
$imginfo = $this->query->onepic($imgid);
//查询的img_imginfo
$picinfo = $this->query->imginfo($imgid);
//查询图片域名
@$domain = $this->query->domain($imginfo->storage);
//如果没有查询到结果
if(!$domain){
show_404();
}
//var_dump($siteinfo);
//获取文件大小
$this->load->helper('basic');
$fullpath = FCPATH.$imginfo->path;
$size = file_size($fullpath);
//重组数组
$datas = array(
"logo" => $siteinfo->logo,
"title" => $picinfo->client_name,
"url" => $domain.$imginfo->path,
"date" => $imginfo->date,
"mime" => $picinfo->mime,
"width" => $picinfo->width,
"height" => $picinfo->height,
"views" => $picinfo->views,
"tags" => $picinfo->tags,
"keywords" => $picinfo->client_name,
"analytics" => $siteinfo->analytics,
"description" => $siteinfo->description,
"comments" => $siteinfo->comments,
"ext" => $picinfo->ext,
"size" => $size
);
// $data['title'] = '图片浏览';
// $data['url'] = $domain.$imginfo->path;
// $data['date'] = $imginfo->date;
//echo $domain.$imginfo->path;
//加载视图
$this->load->view('user/header',$datas);
$this->load->view('user/img',$datas);
$this->load->view('user/footer');
}
}
?>

273
application/controllers/Install.php

@ -0,0 +1,273 @@
<?php
//安装ImgURL
defined('BASEPATH') OR exit('No direct script access allowed');
class Install extends CI_Controller {
public function index(){
//检查是否已经安装
$this->is_install();
$setup = (int)$_GET['setup'];
$data['env'] = $this->check('full');
$data['sum'] = $this->check('part');
//var_dump($data['sum']);
$data['title'] = "ImgURL安装向导";
$data['logo'] = "/static/images/logo.png";
//安装步骤
switch ($setup) {
//安装步骤1
case 1:
$this->load->view('user/header.php',$data);
$this->load->view('user/install1.php',$data);
$this->load->view('user/footer.php');
break;
//安装步骤2
case 2:
//获取网站域名
$data['domain'] = $this->get_domain();
//加载视图
$this->load->view('user/header.php',$data);
$this->load->view('user/install2.php',$data);
$this->load->view('user/footer.php');
break;
case 3:
//获取域名
@$info['domain'] = $this->input->post('domain',TRUE);
//获取用户名
@$info['user'] = $this->input->post('user',TRUE);
//获取密码
@$info['pass1'] = $this->input->post('pass1',TRUE);
@$info['pass2'] = $this->input->post('pass2',TRUE);
//验证信息
$this->verify($info,'domain');
$this->verify($info,'user');
$this->verify($info,'pass');
$this->verify($info,'pass2');
//开始安装ImgURL
$this->setup($info);
//加载视图
$this->load->view('user/header.php',$data);
$this->load->view('user/install3.php',$data);
$this->load->view('user/footer.php');
break;
default:
header("location:/install/?setup=1");
break;
}
}
//环境检测
protected function check($type){
//检测通过
$yes = '<span style = "color:green;">通过!</span>';
$no = '<span style = "color:red;">未通过!</span>';
//获取组件信息
$ext = get_loaded_extensions();
//PHP版本信息
$env['php'] = array(
"name" => 'PHP',
"requir" => 'PHP >= 5.6',
"info" => PHP_VERSION,
"result" => is_php('5.6') ? $yes : $no
);
//PDO_SQLite
$env['sqlite'] = array(
"name" => 'PDO_SQLite',
"requir" => '必须支持',
"info" => array_search('pdo_sqlite',$ext) ? 'Yes':'No',
"result" => array_search('pdo_sqlite',$ext) ? $yes : $no
);
//GD2
$env['gd'] = array(
"name" => 'GD2',
"requir" => '必须支持',
"info" => array_search('gd',$ext) ? 'Yes':'No',
"result" => array_search('gd',$ext) ? $yes : $no
);
//imagick
$env['imagick'] = array(
"name" => 'ImageMagick',
"requir" => '必须支持',
"info" => array_search('imagick',$ext) ? 'Yes':'No',
"result" => array_search('imagick',$ext) ? $yes : $no
);
//fileinfo
$env['fileinfo'] = array(
"name" => 'Fileinfo',
"requir" => '必须支持',
"info" => array_search('fileinfo',$ext) ? 'Yes':'No',
"result" => array_search('fileinfo',$ext) ? $yes : $no
);
//检查目录是否可写
$env['data'] = array(
"name" => '/data',
"requir" => '可写',
"info" => is_writable(FCPATH.'data') ? 'Yes':'No',
"result" => is_writable(FCPATH.'data') ? $yes : $no
);
$env['upload'] = array(
"name" => '/imgs',
"requir" => '可写',
"info" => is_writable(FCPATH.'imgs') ? 'Yes':'No',
"result" => is_writable(FCPATH.'imgs') ? $yes : $no
);
//遍历结果
if($type == 'part'){
//检测不通过
foreach($env as $value){
//echo $value['result'];
if($value['result'] == $no){
return FALSE;
exit;
}
}
}
else{
return $env;
}
}
//获取网站域名
protected function get_domain(){
$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;
//$domain = str_replace("install.php?setup=2","",$domain);
return $domain;
}
//验证函数
protected function verify($data,$type){
switch ($type) {
//检查用户名
case 'user':
$pattern = '/^[a-zA-Z0-9]+$/';
if($data['user'] == ''){
echo '请填写用户名!';
exit;
}
if(!preg_match($pattern,$data['user'])){
echo '用户名格式有误!';
exit;
}
break;
case 'pass':
$pattern = '/^[a-zA-Z0-9!@#$%^&*.]+$/';
if(!preg_match($pattern,$data['pass1'])){
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;
}
}
//安装函数
protected function setup($data){
//默认数据库路径
$default_db = FCPATH."data/imgurl-simple.db3";
//数据库路径
$db_path = FCPATH."data/imgurl.db3";
//锁文件
$lock_file = FCPATH."data/install.lock";
//用户密码
$password = md5($data['pass2'].'imgurl');
//用户信息,json格式
$user_values = array(
"username" => $data['user'],
"password" => $password
);
$user_values = json_encode($user_values);
//拷贝数据库
copy($default_db,$db_path);
//写入默认数据
//连接数据库
$this->load->database();
//用户信息
$userinfo = array(
'name' => 'userinfo',
'values' => $user_values
);
//本地存储信息
$local_storage = array(
"engine" => "localhost",
"domains" => $data['domain'],
"switch" => 'ON'
);
//站点地址
$site_url = array(
"name" => 'site_url',
"values" => $data['domain']
);
//$where = "name = 'site_url'";
// var_dump($this->db->update_string('options', $site_url, $where));
// exit;
// var_dump($site_url);
// exit;
//设置用户信息
$this->db->insert('options', $userinfo);
$this->db->insert('options', $site_url);
//设置默认存储
$this->db->insert('storage', $local_storage);
//创建锁文件
$myfile = fopen($lock_file, "w") or die("Unable to open file!");
$txt = "ImgURL";
fwrite($myfile, $txt);
fclose($myfile);
return TRUE;
}
//检查是否已经安装过
protected function is_install(){
//锁文件
$lock_file = FCPATH."data/install.lock";
if(is_file($lock_file)){
header("location:/");
exit;
}
}
public function test(){
echo $this->get_domain();
}
}
?>

63
application/controllers/Maintain.php

@ -0,0 +1,63 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Maintain extends CI_Controller{
//构造函数
public function __construct(){
parent::__construct();
//加载辅助类
$this->load->library('basic');
$this->basic->is_login(TRUE);
//加载模型
$this->load->model('query','',TRUE);
}
//后台首页
public function index(){
$data['admin_title'] = '管理维护';
//加载视图
$this->load->view('admin/header',$data);
$this->load->view('admin/left');
$this->load->view('admin/index');
$this->load->view('admin/footer');
}
//当前版本
public function version(){
$v_file = FCPATH.'data/version.txt';
$version = file_get_contents($v_file);
echo $version;
}
//升级至2.0
public function upto2(){
$data['admin_title'] = '1.x升级至2.x';
//加载视图
$this->load->view('admin/header',$data);
$this->load->view('admin/left');
$this->load->view('admin/upto2');
$this->load->view('admin/footer');
}
//导入1.x的数据
public function import($id){
$id = (int)$id;
//加载medoo
include_once(APPPATH.'libraries/Medoo.php');
echo APPPATH.'libraries/Medoo.php';
$database = new Medoo([
'database_type' => 'sqlite',
'database_file' => FCPATH.'/data/temp/imgurl.db3'
]);
//$this->load->database($db['old']);
// $sql = "SELECT * FROM imginfo WHERE id = $id";
// $query = $this->db->query($sql)->row();
// var_dump($query);
}
}
?>

92
application/controllers/Manage.php

@ -0,0 +1,92 @@
<?php
/*
name:图片管理
author:xiaoz.me
QQ:337003006
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Manage extends CI_Controller{
//构造函数
public function __construct(){
parent::__construct();
//加载基础操作类
$this->load->library('basic');
//验证用户是否登录
$this->basic->is_login(TRUE);
//加载查询模型
$this->load->model('query','',TRUE);
}
//管理员上传
public function images($type = 'all',$page = 0){
$type = strip_tags($type);
$page = (int)strip_tags($page);
$limit = 16; //要查询的条数
$data['admin_title'] = '图片管理';
$sql1 = "SELECT a.id,a.imgid,a.path,a.thumb_path,a.date,a.compression,a.level,b.mime,b.width,b.height,b.views,b.ext,b.client_name FROM img_images AS a INNER JOIN img_imginfo AS b ON a.imgid = b.imgid ";
//根据不同的条件生成不同的SQL语句
switch ($type) {
case 'all':
$sql = $sql1."ORDER BY a.id DESC LIMIT $limit OFFSET $page";
$num = $this->db->count_all("images");
break;
case 'admin':
$sql = $sql1."AND a.user = 'admin' ORDER BY a.id DESC LIMIT $limit OFFSET $page";
$num = $this->query->count_num('admin')->num;
break;
case 'visitor':
$sql = $sql1."AND a.user = 'visitor' ORDER BY a.id DESC LIMIT $limit OFFSET $page";
$num = $this->query->count_num('visitor')->num;
break;
case 'dubious':
$sql = $sql1."AND a.level = 'adult' ORDER BY a.id DESC";
//$num = $this->query->count_num('visitor')->num;
break;
default:
$sql = $sql1."AND a.user = '$type' ORDER BY a.id DESC LIMIT $limit OFFSET $page";
break;
}
//连接数据库
$this->load->database();
$data['imgs'] = $this->db->query($sql)->result_array();
//调用分页类
$this->load->library('pagination');
$config['base_url'] = "/manage/images/$type/";
$config['total_rows'] = $num;
$config['per_page'] = $limit;
$config['first_url'] = 0;
$config['first_link'] = '首页';
$config['last_link'] = '尾页';
$config['attributes'] = array('class' => 'paging'); //设置分页的class
$config['next_link'] = '下一页'; //下一页文本
$config['prev_link'] = '上一页'; //上一页文本
$this->pagination->initialize($config);
$data['page'] = $this->pagination->create_links();
//获取域名
$data['domain'] = $this->query->domain('localhost');
//加载视图
$this->load->view('admin/header',$data);
$this->load->view('admin/left');
$this->load->view('admin/images',$data);
$this->load->view('admin/footer');
}
//获取单张图片信息
public function imginfo($imgid){
$imgid = strip_tags($imgid);
$row = $this->query->picinfo($imgid);
//获取文件大小
$this->load->helper('basic');
$fullpath = FCPATH.$row->path;
$size = file_size($fullpath);
$row->size = $size;
//加载视图
$this->load->view("admin/imginfo",$row);
}
}
?>

37
application/controllers/Page.php

@ -0,0 +1,37 @@
<?php
/*
name:页面
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Page extends CI_Controller{
public function _remap($name){
//获取URI
$name = strip_tags($name);
//查找文件
$pagefile = FCPATH.'data/pages/'.$name.'.md';
$pagefile = str_replace('\\','/',$pagefile);
//如果文件不存在,直接返回404
if(!is_file($pagefile)){
show_404();
}
//读取文件内容
$content = file_get_contents($pagefile);
//载入markdown解析类
$this->load->library("parsedown");
$content = $this->parsedown->text($content);
//$data['content'] = $content;
//加载数据库视图
$this->load->model('query','',TRUE);
$data = $this->query->site_setting('1');
$data->content = $content;
//载入页面视图
$this->load->view('/user/header',$data);
$this->load->view('/user/page',$data);
$this->load->view('/user/footer');
}
}
?>

172
application/controllers/Set.php

@ -0,0 +1,172 @@
<?php
/*
name:各种设置、更新、删除操作
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Set extends CI_Controller{
//构造函数
public function __construct(){
parent::__construct();
//加载模型
$this->load->model('update','',TRUE);
//加载类
$this->load->library('basic');
//验证用户是否登录
$this->basic->is_login(TRUE);
}
//更新站点设置
public function site(){
//var_dump($data);
//接收表单数据
$data['logo'] = $this->input->post('logo',TRUE);
$data['title'] = $this->input->post('title',TRUE);
$data['keywords'] = $this->input->post('keywords',TRUE);
$data['description'] = $this->input->post('description',TRUE);
$data['analytics'] = $this->input->post('analytics');
//$data['comments'] = $this->input->post('comments');
$data = json_encode($data);
//如果更新成功
if($this->update->site('site_setting',$data)){
$ref = $_SERVER["HTTP_REFERER"];
echo '更新成功,3s后返回上一页!';
header("Refresh:3;url=$ref");
}
else{
echo '更新发生错误!';
exit;
}
}
//更新上传限制
public function uplimit(){
$data['max_size'] = (int)$this->input->post('max_size',TRUE);
$data['limit'] = (int)$this->input->post('limit',TRUE);
$data = json_encode($data);
//如果更新成功
if($this->update->site('uplimit',$data)){
$ref = $_SERVER["HTTP_REFERER"];
echo '更新成功,3s后返回上一页!';
header("Refresh:3;url=$ref");
}
else{
echo '更新发生错误!';
exit;
}
}
//更新tinypng设置
public function tinypng(){
$data['api1'] = $this->input->post('api1',TRUE);
$data['api2'] = $this->input->post('api2',TRUE);
@$switch = $this->input->post('switch',TRUE);
if($switch != 'on'){
$switch = 'OFF';
}
else{
$switch = 'ON';
}
$data = json_encode($data);
//如果更新成功
if($this->update->tinypng($data,$switch)){
$ref = $_SERVER["HTTP_REFERER"];
echo '更新成功,3s后返回上一页!';
header("Refresh:3;url=$ref");
}
else{
echo '更新发生错误!';
exit;
}
}
//更新moderate
public function moderate(){
//获取API key
$data['api'] = $this->input->post('api',TRUE);
//获取开关
@$switch = $this->input->post('switch',TRUE);
if($switch != 'on'){
$switch = 'OFF';
}
else{
$switch = 'ON';
}
//更新数据库
//如果更新成功
if($this->update->moderate($data['api'],$switch)){
$ref = $_SERVER["HTTP_REFERER"];
echo '更新成功,3s后返回上一页!';
header("Refresh:3;url=$ref");
}
else{
echo '更新发生错误!';
exit;
}
}
//更新存储引擎
public function storage($engine){
//获取API key
$data['domains'] = $this->input->post('domain',TRUE);
$data['switch'] = 'ON';
//更新数据库
//如果更新成功
if($this->update->storage($data,$engine)){
$ref = $_SERVER["HTTP_REFERER"];
echo '更新成功,3s后返回上一页!';
header("Refresh:3;url=$ref");
}
else{
echo '更新发生错误!';
exit;
}
}
//删除单张图片,需传入图片ID,及文件路径
public function del_img(){
//获取数据
@$imgid = $this->input->post('imgid',TRUE);
@$path = $this->input->post('path',TRUE);
@$thumbnail_path = $this->input->post('thumbnail_path',TRUE);
//加载数据库模型
$this->load->model('delete','',TRUE);
//从数据库中删除
$this->delete->del_img($imgid);
//从磁盘中删除
$path = FCPATH.$path;
$thumbnail_path = FCPATH.$thumbnail_path;
//缩略图地址
unlink($path);
unlink($thumbnail_path);
$re = array(
"code" => 200,
"msg" => "删除成功!"
);
$re = json_encode($re);
echo $re;
}
//取消图片可疑状态
public function cancel($id){
$id = (int)$id;
$sql = "UPDATE img_images SET level = 'everyone' WHERE `id` = $id";
$this->load->database();
if($this->db->query($sql)){
$this->suc_msg('操作成功!');
}
}
//操作成功返回json
protected function suc_msg($msg){
$arr = array(
"code" => 200,
"msg" => $msg
);
$info = json_encode($arr);
echo $info;
}
}
?>

106
application/controllers/Setting.php

@ -0,0 +1,106 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Setting extends CI_Controller{
//构造函数
public function __construct(){
parent::__construct();
//加载模型
$this->load->model('query','',TRUE);
//加载辅助函数
$this->load->helper('basic');
$info = $this->query->userinfo()->values;
$info = json_decode($info);
//验证用户是否登录
is_login($info->username,$info->password);
}
//站点设置
public function site(){
$siteinfo = $this->query->site_setting();
$siteinfo = json_decode($siteinfo->values);
//页面标题
$siteinfo->admin_title = '站点设置';
//加载视图
$this->load->view('admin/header',$siteinfo);
$this->load->view('admin/left');
$this->load->view('admin/site');
$this->load->view('admin/footer');
}
//上传限制
public function uplimit(){
$siteinfo = $this->query->option('uplimit');
$siteinfo = json_decode($siteinfo->values);
if($siteinfo->limit != 0){
$switch = 'checked';
}
else{
$switch = '';
}
//页面标题
$siteinfo->admin_title = '上传限制';
$siteinfo->switch = $switch;
//var_dump($siteinfo);
//加载视图
$this->load->view('admin/header',$siteinfo);
$this->load->view('admin/left');
$this->load->view('admin/uplimit');
$this->load->view('admin/footer');
}
//图片压缩
public function compress(){
//页面标题
$data['admin_title'] = '图片压缩';
//加载模型
$this->load->model('query','',TRUE);
$tinypng = $this->query->option('tinypng');
$data['switch'] = $tinypng->switch;
if($data['switch'] == 'OFF'){
$data['switch'] = '';
}
else{
$data['switch'] = 'checked';
}
$data['values'] = json_decode($tinypng->values);
//var_dump($data['values']->api1);
//exit;
//加载视图
$this->load->view('admin/header',$data);
$this->load->view('admin/left');
$this->load->view('admin/tinypng',$data);
$this->load->view('admin/footer');
}
//图片鉴黄
public function identify(){
//页面标题
$data['admin_title'] = '图片鉴黄';
//加载模型
$this->load->model('query','',TRUE);
$moderate = $this->query->option('moderate');
$data['switch'] = $moderate->switch;
$data['values'] = $moderate->values;
if($data['switch'] == 'OFF'){
$data['switch'] = '';
}
else{
$data['switch'] = 'checked';
}
//加载视图
$this->load->view('admin/header',$data);
$this->load->view('admin/left');
$this->load->view('admin/identify');
$this->load->view('admin/footer');
}
}
?>

32
application/controllers/Storage.php

@ -0,0 +1,32 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Storage extends CI_Controller{
//构造函数
public function __construct(){
parent::__construct();
//加载模型
$this->load->model('query','',TRUE);
//加载辅助函数
$this->load->helper('basic');
$info = $this->query->userinfo()->values;
$info = json_decode($info);
//验证用户是否登录
is_login($info->username,$info->password);
}
//后台首页
public function localhost(){
$localhost = $this->query->storage('localhost');
$data['admin_title'] = '存储设置(localhost)';
$data['domains'] = $localhost->domains;
//加载视图
$this->load->view('admin/header',$data);
$this->load->view('admin/left');
$this->load->view('admin/localhost',$data);
$this->load->view('admin/footer');
}
}
?>

402
application/controllers/Upload.php

@ -0,0 +1,402 @@
<?php
/*
name:ImgURL上传控制器
author:xiaoz.me
QQ:337003006
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Upload extends CI_Controller{
//声明上传文件路径
public $upload_path;
//声明文件相对路径
public $relative_path;
public $image_lib;
//当前时间
public $date;
//设置临时目录
public $temp;
//用户是否已经登录的属性
protected $user;
//构造函数
public function __construct()
{
parent::__construct();
//设置上传文件路径
$this->upload_path = FCPATH.'imgs/'.date('Y',time()).'/'.date('m',time()).'/';
$this->upload_path = str_replace('\\','/',$this->upload_path);
$this->relative_path = "/imgs/".date('Y',time()).'/'.date('m',time()).'/';
$this->relative_path = str_replace('\\','/',$this->relative_path);
$this->temp = FCPATH.'data/temp/';
//如果文件夹不存在,则创建文件夹
if(!is_dir($this->upload_path)){
//递归模式创建目录
mkdir($this->upload_path,0777,TRUE);
}
$this->date = date('Y-m-d H:i',time());
//加载辅助函数
$this->load->helper('basic');
$ip = get_ip();
//加载基本类
$this->load->library('basic');
//加载查询模型
$this->load->model('query','',TRUE);
//用户已经登录
if($this->basic->is_login(FALSE)){
$this->user = 'admin';
}
else{
$this->user = 'visitor';
//限制上传数量
if($this->query->uplimit($ip) === FALSE){
$this->error_msg("上传达到上限!");
}
}
}
//通用上传设置
protected function config($upload_path = ''){
//设置上传路径
if($upload_path == ''){
$upload_path = $this->upload_path;
}
// var_dump();
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png|bmp|webp';
$config['max_size'] = 5120;
$config['file_ext_tolower'] = TRUE; //文件名转换为小写
$config['overwrite'] = TRUE; //覆盖同名文件
$config['encrypt_name'] = TRUE; //随机命名图片
return $config;
}
public function localhost(){
//加载上传的配置选项
$config = $this->config();
//加载上传类
$this->load->library('upload', $config);
//上传失败
if ( ! $this->upload->do_upload('file'))
{
$msg = $this->upload->display_errors();
$msg = strip_tags($msg);
$this->error_msg($msg);
}
else
{
$data = $this->upload->data();
//加载模型
$this->load->model('insert','',TRUE);
$this->load->model('query','',TRUE);
//计算文件MD5
$file_name = md5_file($data['full_path']);
$file_name = substr($file_name,8,16);
//图片唯一ID
$imgid = $file_name;
$file_name = $file_name.$data['file_ext'];
//新图片完整路径
$full_path = $this->upload_path.$file_name;
$full_path = str_replace("\\","/",$full_path);
//新图片相对路径
$relative_path = $this->relative_path.$file_name;
//缩略图相对路径
$thumbnail_path = $this->relative_path.$imgid.'_thumb'.$data['file_ext'];
//获取域名
$domain = $this->query->domain('localhost');
//获取图片URL地址
$url = $domain.$relative_path;
//缩略图地址
$thumbnail_url = $domain.$thumbnail_path;
//重命名文件
rename($data['full_path'],$full_path);
//生成缩略图
$this->load->library('image');
$this->image->thumbnail($full_path,290,175);
//查询图片是否上传过
if($imginfo = $this->query->repeat($imgid)){
$id = $imginfo->id;
//重组数组
$info = array(
"code" => 200,
"id" => $id,
"imgid" => $imgid,
"relative_path" => $relative_path,
"url" => $url,
"thumbnail_url" => $thumbnail_url,
"width" => $data['image_width'],
"height" => $data['image_height']
);
$this->succeed_msg($info);
}
//图片没有上传过
else{
//需要插入到images表的数据
$datas = array(
"imgid" => $imgid,
"path" => $relative_path,
"thumb_path"=> $thumbnail_path,
"storage" => "localhost",
"ip" => get_ip(),
"ua" => get_ua(),
"date" => $this->date,
"user" => $this->user,
"level" => 'unknown'
);
//需要插入到imginfo表的数据
$imginfo = array(
"imgid" => $imgid,
"mime" => $data['file_type'],
"width" => $data['image_width'],
"height" => $data['image_height'],
"ext" => $data['file_ext'],
"client_name" => $data['client_name']
);
//插入数据到img_images表
$id = $this->insert->images($datas);
$this->insert->imginfo($imginfo);
//重组数组
$info = array(
"code" => 200,
"id" => $id,
"imgid" => $imgid,
"relative_path" => $relative_path,
"url" => $url,
"thumbnail_url" => $thumbnail_url,
"width" => $data['image_width'],
"height" => $data['image_height']
);
}
//var_dump($info);
//exit;
$this->succeed_msg($info);
}
}
//上传成功返回json
protected function succeed_msg($data){
$info = json_encode($data);
echo $info;
exit;
}
//上传失败返回json
protected function error_msg($msg){
$data = array(
"code" => 0,
"msg" => $msg
);
$data = json_encode($data);
echo $data;
exit;
}
//URL上传
public function url(){
$url = @$this->input->post('url',TRUE);
$url = trim($url);
//检测用户是否登录
$this->load->library('basic');
$this->basic->is_login(TRUE);
//判断URL是否合法
if(!filter_var($url, FILTER_VALIDATE_URL)){
$this->error_msg('不是有效的URL地址!');
}
//继续执行
//获取图片后缀名
$url_arr = explode('.',$url);
$ext = strtolower(end($url_arr));
//判断是否是允许的后缀
switch($ext){
case 'png':
case 'jpg':
case 'jpeg':
case 'bmp':
case 'gif':
case 'bmp':
break;
default:
$this->error_msg('不是有效的图片地址!');
exit;
}
//继续执行
//下载图片
$pic_data = $this->basic->dl_pic($url);
//临时文件路径
$tmp_name = $this->temp.md5($url);
//写入临时文件
file_put_contents($tmp_name,$pic_data);
//计算文件MD5
$imgid = md5_file($tmp_name);
$imgid = substr($imgid,8,16);
$file_name = $imgid.'.'.$ext;
//图片相对路径
$relative_path = $this->relative_path.$file_name;
$ext = '.'.$ext;
//查询图片是否已经上传过
if($this->query->repeat($imgid)){
//删除临时文件
unlink($tmp_name);
$this->error_msg('文件已经上传过!');
exit;
}
//没有上传过继续执行
//复制图片到上传目录
$full_path = $this->upload_path.$file_name;
copy($tmp_name,$full_path);
//删除临时文件
unlink($tmp_name);
//生成缩略图
$this->load->library('image');
$this->image->thumbnail($full_path,290,175);
//获取图片信息
$img_info = getimagesize($full_path);
//缩略图相对地址
$thumbnail_path = $this->relative_path.$imgid.'_thumb'.$ext;
//需要插入到images表的数据
$datas = array(
"imgid" => $imgid,
"path" => $relative_path,
"thumb_path"=> $thumbnail_path,
"storage" => "localhost",
"ip" => get_ip(),
"ua" => get_ua(),
"date" => $this->date,
"user" => $this->user,
"level" => 'unknown'
);
//需要插入到imginfo表的数据
$imginfo = array(
"imgid" => $imgid,
"mime" => $img_info['mime'],
"width" => $img_info[0],
"height" => $img_info[1],
"ext" => $ext,
"client_name" => $file_name
);
//加载数据库模型
$this->load->model('insert','',TRUE);
//插入数据到img_images表
$id = $this->insert->images($datas);
$this->insert->imginfo($imginfo);
//获取域名
$domain = $this->query->domain('localhost');
//获取图片URL地址
$url = $domain.$relative_path;
//返回成功的信息
$re = array(
"code" => 200,
"msg" => $url
);
$re = json_encode($re);
echo $re;
}
//粘贴上传
public function parse(){
$date = date('Y-m-d H:i:s',time());
//临时文件名
$tmp_name = get_ip().get_ua().$date;
$tmp_name = md5($tmp_name);
//图片临时路径
$tmp_file = $this->temp.$tmp_name;
//接接收ase64图片
$picfile = $_POST['content'];
$picfile = base64_decode($picfile);
//echo $picfile;
//存储图片
file_put_contents($tmp_file, $picfile);
//判断图片MIME类型
if(!mime($tmp_file)){
unlink($tmp_file);
$this->error_msg('不允许的文件类型!');
exit;
}
//继续执行
//计算文件MD5
$imgid = md5_file($tmp_file);
$imgid = substr($imgid,8,16);
//获取文件后缀
$ext = ext($tmp_file);
$file_name = $imgid.$ext;
//图片相对路径
$relative_path = $this->relative_path.$file_name;
//图片完整路径
$full_path = $this->upload_path.$file_name;
//查询图片是否已经上传过
if($this->query->repeat($imgid)){
//删除临时文件
unlink($tmp_file);
$this->error_msg('文件已经上传过!');
exit;
}
//没有上传过继续执行
//复制图片到上传目录
copy($tmp_file,$full_path);
$file_name = $imgid.$ext;
//删除临时文件
unlink($tmp_file);
//生成缩略图
$this->load->library('image');
$this->image->thumbnail($full_path,290,175);
//缩略图地址
$thumbnail_path = $this->relative_path.$imgid.'_thumb.'.$ext;
//获取图片信息
$img_info = getimagesize($full_path);
//需要插入到images表的数据
$datas = array(
"imgid" => $imgid,
"path" => $relative_path,
"thumb_path"=> $thumbnail_path,
"storage" => "localhost",
"ip" => get_ip(),
"ua" => get_ua(),
"date" => $this->date,
"user" => $this->user,
"level" => 'unknown'
);
//需要插入到imginfo表的数据
$imginfo = array(
"imgid" => $imgid,
"mime" => $img_info['mime'],
"width" => $img_info[0],
"height" => $img_info[1],
"ext" => $ext,
"client_name" => $file_name
);
//加载数据库模型
$this->load->model('insert','',TRUE);
//插入数据到img_images表
$id = $this->insert->images($datas);
$this->insert->imginfo($imginfo);
//获取域名
$domain = $this->query->domain('localhost');
//获取图片URL地址
$url = $domain.$relative_path;
$thumbnail_url = $domain.$this->relative_path.$imgid.'_thumb'.$ext;
//返回成功的信息
//重组数组
$info = array(
"code" => 200,
"id" => $id,
"imgid" => $imgid,
"relative_path" => $relative_path,
"url" => $url,
"thumbnail_url" => $thumbnail_url,
"width" => $img_info[0],
"height" => $img_info[1]
);
$this->succeed_msg($info);
//echo $re;
}
}
?>

91
application/controllers/User.php

@ -0,0 +1,91 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class User extends CI_Controller{
//构造函数
public function __construct(){
parent::__construct();
//加载辅助函数
$this->load->helper('basic');
}
//用户登录
public function login(){
//加载基础类
$this->load->library('basic');
//判断用户是否登录
if($this->basic->is_login(FALSE)){
//如果已经登录,则跳转到后台
header("location:/admin/");
}
//加载数据库模型
$this->load->model('query','',TRUE);
//查询站点信息
$siteinfo = $this->query->site_setting('1');
$siteinfo->title = '管理员登录 - '.$siteinfo->title;
//加载登录视图
$this->load->view('user/header',$siteinfo);
$this->load->view('user/login');
$this->load->view('user/footer');
}
//验证用户名、密码是否正确
public function verify(){
//获取用户输入的信息
$user = $this->input->post('user',TRUE);
$pass = $this->input->post('password',TRUE);
$pass = md5($pass.'imgurl');
//加载模型
$this->load->model("query",'',TRUE);
$info = $this->query->userinfo()->values;
$info = json_decode($info);
//获取真正的用户名
$username = $info->username;
$password = $info->password;
if(($user == $username) && ($pass == $password)){
$token = token($username,$password);
//生成COOKIE
setcookie("user", $username, time()+ 7 * 24 * 60 * 60,"/");
setcookie("token", $token, time()+ 7 * 24 * 60 * 60,"/");
//跳转到后台
$data = array(
"code" => 200,
"msg" => '登录成功!'
);
$data = json_encode($data);
echo $data;
exit;
}
else{
$this->err_msg('用户名或密码不正确');
//清除cookie
$this->clean_cookies();
exit;
}
}
public function logout(){
echo '您已退出,将在5s后返回首页!';
$this->clean_cookies();
header("Refresh:5;url=/");
exit;
}
//清除COOKIE
protected function clean_cookies(){
setcookie("user", '', time()-3600,"/");
setcookie("token", '', time()-3600,"/");
}
//错误消息
protected function err_msg($msg){
$data = array(
"code" => 0,
"msg" => $msg
);
$data = json_encode($data);
echo $data;
}
}
?>

25
application/controllers/Welcome.php

@ -0,0 +1,25 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->view('welcome_message');
}
}

11
application/controllers/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

11
application/core/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

142
application/helpers/basic_helper.php

@ -0,0 +1,142 @@
<?php
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
//获取真实IP
function get_ip() {
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;
}
//获取UA
function get_ua(){
$ua = $_SERVER['HTTP_USER_AGENT'];
return $ua;
}
//创建token
function token($user,$pass){
//token生成算法为:用户名 + md5后的密码 + ip + ua
$token = $user.$pass.get_ip().get_ua();
$token = md5($token);
return $token;
}
//判断用户是否登录
function is_login($user,$pass){
$token = $user.$pass.get_ip().get_ua();
$token = md5($token);
$username = $_COOKIE['user'];
$password = $_COOKIE['token'];
//进行判断
if(($user != $username) || ($password != $token)){
echo '权限不足!';
exit;
}
else{
return true;
}
}
//判断文件MIME类型
function mime($path){
$mime = mime_content_type($path);
switch ( $mime )
{
case 'image/gif':
case 'image/png':
case 'image/jpeg':
case 'image/bmp':
case 'image/webp':
return TRUE;
break;
default:
return FALSE;
break;
}
}
//根据MIME类型返回文件后缀
function ext($path){
$mime = mime_content_type($path);
switch ( $mime )
{
case 'image/gif':
return '.gif';
break;
case 'image/png':
return '.png';
break;
case 'image/jpeg':
return '.jpg';
break;
case 'image/bmp':
return '.bmp';
break;
case 'image/webp':
return '.webp';
break;
default:
return FALSE;
break;
}
}
//获取文件大小
function file_size($path){
//先判断文件是否存在
if(!is_file($path)){
$name = '0 byte';
}
else{
//继续执行
$size = filesize($path);
//转换为KB
$size = $size / 1024;
$size = round($size,1);
$name = $size.' KB';
//转换为Mb
if($size >= 1024){
$size = $size / 1024;
$size = round($size,1);
$name = $size.' MB';
}
}
return $name;
}
//缩略图函数
function thumbnail($img){
//返回路径
$dir = dirname($img['path']);
$thumbnail_name = $dir.'/'.$img['imgid'].'_thumb'.$img['ext'];
//缩略图完整地址
$fullpath = FCPATH.$thumbnail_name;
//echo $fullpath;
//判断缩略图是否存在
if(is_file($fullpath)){
return $thumbnail_name;
}
//$thumbnail_name = $dir.$name.'_thumb';
//返回缩略图地址,不带文件名
//返回原图
else{
return $img['path'];
}
}
?>

11
application/helpers/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

11
application/hooks/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

11
application/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

11
application/language/english/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

11
application/language/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

106
application/libraries/Basic.php

@ -0,0 +1,106 @@
<?php
/*
name:常用方法附属类
author:xiaoz.me
QQ:337003006
*/
class Basic{
protected $CI;
//构造函数
public function __construct(){
$this->CI = & get_instance();
}
/*
该函数检测用户是否已经登录,只需要一个参数
如果参数为FALSE时,不会exit中断只执行,仅返回bool类型结果
如果参数为TURE时,如果没有登录会exit终止执行
*/
public function is_login($type = FALSE){
//获取COOKIE信息
@$user = $_COOKIE['user'];
@$token = $_COOKIE['token'];
//加载模型
$this->CI->load->model('query','',TRUE);
//加载辅助函数
$this->CI->load->helper('basic');
//如果查询成功
if($this->CI->query->userinfo()){
$userinfo = $this->CI->query->userinfo();
$userinfo = json_decode($userinfo->values);
$username = $userinfo->username;
$password = $userinfo->password;
//echo get_ip();
$password = $username.$password.get_ip().get_ua();
$password = md5($password);
//判断用户名是否正确,用户名密码正确的情况
if(($user == $username) && ($token == $password)){
//判断需要的类型
return TRUE;
}
//用户名和密码不正确的情况下
else{
if($type === FALSE){
return false;
}
else{
echo '权限不足!';
exit;
}
}
}
else{
echo '数据库查询错误!';
exit;
}
}
//查询上传数量限制,需要传入访客IP
public function uplimit($ip){
}
//CURL下载图片
public function dl_pic($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.110 Safari/537.36");
//伪造reffer
curl_setopt ($ch, CURLOPT_REFERER, $url);
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, 60);
$html = curl_exec($curl);
curl_close($curl);
//返回数据
return $html;
}
//网站数据分析
public function analyze(){
//图片总数
$data['num'] = $this->CI->db->count_all("images");
//本月总数
$data['month'] = $this->CI->query->count_num('month')->num;
//今日总数
$data['day'] = $this->CI->query->count_num('day')->num;
//管理员上传总数
$data['admin'] = $this->CI->query->count_num('admin')->num;
//游客上传总数
$data['visitor'] = $this->CI->query->count_num('visitor')->num;
//可疑图片总数
$data['dubious'] = $this->CI->query->count_num('dubious')->num;
return $data;
}
}
?>

46
application/libraries/Image.php

@ -0,0 +1,46 @@
<?php
/* 图片处理类 */
defined('BASEPATH') OR exit('No direct script access allowed');
class Image{
public function thumbnail($source,$width,$height){
//获取缩略图名称
$source = str_replace("\\","/",$source);
$imgarr = explode("/",$source);
//获取图片信息
$imginfo = getimagesize($source);
//图片宽
$img_w = $imginfo[0];
//图片高
$img_h = $imginfo[1];
//获取源文件名
$filename = end($imgarr);
$imgname = explode(".",$filename);
//缩略图名称
$thumbnail_name = $imgname[0].'_thumb'.'.'.$imgname[1];
//获取文件路径
$dirname = dirname($source); //获取的路径最后没有/
//缩略图完整路径
$thumbnail_full = $dirname.'/'.$thumbnail_name;
$image = new Imagick($source);
// 创建缩略图
//原图宽高大于缩略图
if(($img_w > $width) || ($img_h > $height)){
//$image->setImageCompressionQuality(90);
$image->cropThumbnailImage( $width, $height );
}
//将缩略图输出到文件
$image->writeImage( $thumbnail_full );
//清理工作
$image->clear();
}
//压缩图片
public function compress($source){
}
}
?>

1692
application/libraries/Medoo.php

File diff suppressed because it is too large Load Diff

1679
application/libraries/Parsedown.php

File diff suppressed because it is too large Load Diff

11
application/libraries/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

11
application/logs/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

21
application/models/Delete.php

@ -0,0 +1,21 @@
<?php
class Delete extends CI_Model {
public function __construct()
{
parent::__construct();
// Your own constructor code
}
//删除单张图片数据,需要传入图片ID
public function del_img($imgid){
$sql1 = "DELETE FROM `img_images` WHERE imgid = '$imgid'";
$sql2 = "DELETE FROM `img_imginfo` WHERE imgid = '$imgid'";
//执行删除数据库
$this->db->query($sql1);
$this->db->query($sql2);
}
}
?>

56
application/models/Insert.php

@ -0,0 +1,56 @@
<?php
class Insert extends CI_Model {
public function __construct()
{
parent::__construct();
// Your own constructor code
}
//插入到images表
public function images($datas){
if($this->db->insert('images', $datas)){
//如果插入成功返回ID
return $this->db->insert_id();
}
else{
return false;
exit;
}
}
//插入到imginfo表
public function imginfo($datas){
if($this->db->insert('imginfo', $datas)){
//如果插入成功返回ID
return $this->db->insert_id();
}
else{
return false;
exit;
}
}
//插入安装的默认数据
public function default(){
//上传限制初始数据
// $uplimit_values = array(
// "max_size" => 5,
// "number" => 10
// );
// $uplimit_values = json_encode($uplimit_values);
// $uplimit = array(
// "name" => "uplimit",
// "values" => $uplimit_values,
// "switch" => "ON"
// );
// //插入数据
// $this->db->insert('options',$uplimit);
//图片压缩初始数据
}
}
?>

269
application/models/Query.php

@ -0,0 +1,269 @@
<?php
class Query extends CI_Model {
public function __construct()
{
parent::__construct();
// Your own constructor code
}
//查询域名
public function domain($storage){
$sql = "SELECT domains FROM img_storage WHERE `engine` = '$storage'";
$query = $this->db->query($sql);
if($query){
$row = $query->row();
$domain = $row->domains;
//var_dump($domain);
return $domain;
}
else{
return FALSE;
}
}
//查询是否重复
public function repeat($imgid){
$sql = "SELECT * FROM img_images WHERE `imgid` = '$imgid'";
$query = $this->db->query($sql);
if($query){
$row = $query->row();
//var_dump($domain);
return $row;
}
else{
return false;
}
}
//根据ID查询1张图片
public function onepic($imgid){
$sql = "SELECT * FROM img_images WHERE `imgid` = '$imgid'";
$query = $this->db->query($sql);
if($query){
$row = $query->row();
//var_dump($domain);
return $row;
}
else{
return false;
}
}
public function img($id){
$id = strip_tags($id);
$id = (int)$id;
$sql = "SELECT * FROM img_images WHERE `id` = '$id'";
$query = $this->db->query($sql);
if($query){
$row = $query->row();
//var_dump($domain);
return $row;
}
else{
return false;
}
}
//查询图片信息
public function imginfo($imgid){
$sql = "SELECT * FROM img_imginfo WHERE `imgid` = '$imgid'";
$query = $this->db->query($sql);
if($query){
$row = $query->row();
//var_dump($domain);
return $row;
}
else{
return false;
}
}
//查询用户信息
public function userinfo(){
$sql = "SELECT * FROM `img_options` WHERE `name` = 'userinfo' LIMIT 1";
$query = $this->db->query($sql);
if($query){
$row = $query->row();
return $row;
}
else{
return false;
}
}
//查询tinypng设置
public function tinypng(){
$sql = "SELECT * FROM `img_options` WHERE `name` = 'tinypng' LIMIT 1";
@$query = $this->db->query($sql);
if($query){
$row = $query->row();
return $row;
}
else{
return FALSE;
}
}
//查询站点信息
public function site_setting($type = ''){
$sql = "SELECT * FROM 'img_options' WHERE name = 'site_setting' LIMIT 1";
$query = $this->db->query($sql);
//如果类型为空,则返回完整对象
if($type == '') {
if($query){
$row = $query->row();
return $row;
}
else{
return FALSE;
}
}
else{
if($query){
$row = $query->row();
$row = json_decode($row->values);
return $row;
}
else{
return FALSE;
}
}
}
//新版查询站点信息
public function siteinfo(){
$sql = "SELECT * FROM 'img_options' WHERE name = 'site_setting' LIMIT 1";
$query = $this->db->query($sql);
if($query){
$row = $query->row();
var_dump($row);
return $row;
}
else{
return FALSE;
}
}
//查询各种设置
public function option($name){
$sql = "SELECT * FROM 'img_options' WHERE name = '$name' LIMIT 1";
$query = $this->db->query($sql);
if($query){
$row = $query->row();
return $row;
}
else{
return FALSE;
}
}
//查询上传数量限制,传入参数IP
public function uplimit($ip){
//获取今天的日期
$date = date('Y-m-d',time());
$date = $date.'%';
//查询出今天上传的数量
$sql = "select count(*) num from img_images where `ip` = '$ip' AND `user` = 'visitor' AND `date` LIKE '$date'";
$query = $this->db->query($sql);
//获取用户已经上传的数量
$num = (int)$query->row()->num;
// var_dump($num);
// exit;
//查询系统限制的条数
$sql = "SELECT * FROM 'img_options' WHERE name = 'uplimit' LIMIT 1";
$query = $this->db->query($sql);
$limit = $query->row();
$limit = $limit->values;
$limit = json_decode($limit);
$limit = $limit->limit;
//进行判断
//上传达到限制了,返回FALSE
if($num >= $limit){
return FALSE;
}
else{
return TRUE;
}
}
//查询图片完整信息,用于探索发现,$num为要查询的图片数量
public function found($num){
//先写一个强大的SQL语句
$sql = "SELECT a.id,a.imgid,a.path,a.date,b.mime,b.width,b.height,b.views,b.ext,b.client_name FROM img_images AS a INNER JOIN img_imginfo AS b ON a.imgid = b.imgid AND a.user = 'visitor' AND a.level != 'adult' ORDER BY a.id DESC LIMIT $num";
$query = $this->db->query($sql);
$query = $query->result_array();
return $query;
}
//查询存储引擎
public function storage($name){
$sql = "SELECT * FROM `img_storage` WHERE `engine` = '$name' LIMIT 1";
$query = $this->db->query($sql);
if($query){
$row = $query->row();
return $row;
}
else{
return FALSE;
}
}
//统计数量
public function count_num($type){
switch ($type) {
case 'admin':
$sql = "SELECT count(*) AS num FROM `img_images` WHERE `user` = 'admin'";
break;
case 'visitor':
$sql = "SELECT count(*) AS num FROM `img_images` WHERE `user` = 'visitor'";
break;
case 'dubious':
$sql = "SELECT count(*) AS num FROM `img_images` WHERE `level` = 'adult'";
break;
case 'day':
$sql = "SELECT count(*) AS num FROM `img_images` WHERE date LIKE date('now') || '%'";
break;
case 'month':
$sql = "SELECT count(*) AS num FROM `img_images` WHERE date LIKE strftime('%Y-%m','now') || '%'";
break;
default:
# code...
break;
}
$query = $this->db->query($sql);
$row = $query->row();
return $row;
}
//查询单张图片信息
public function picinfo($imgid){
$sql = "SELECT a.id,a.ip,a.imgid,a.path,a.date,b.mime,b.width,b.height,b.views,b.ext,b.client_name FROM img_images AS a INNER JOIN img_imginfo AS b ON a.imgid = b.imgid AND b.imgid = '$imgid' LIMIT 1";
$query = $this->db->query($sql);
$query = $query->row();
return $query;
}
//根据img_images id查出图片信息
public function img_id($id){
$id = (int)$id;
//先获取img id
$sql = "SELECT a.*,b.mime,b.width,b.height,b.views,b.ext,b.client_name FROM img_images AS a INNER JOIN img_imginfo AS b ON a.id = $id AND a.imgid = b.imgid";
$imginfo = $this->db->query($sql)->row();
return $imginfo;
}
}
?>

86
application/models/Update.php

@ -0,0 +1,86 @@
<?php
class Update extends CI_Model {
public function __construct()
{
parent::__construct();
// Your own constructor code
}
//浏览次数+1
public function views($imgid){
$sql = "update img_imginfo set views=views+1 where `imgid` = '$imgid'";
$query = $this->db->query($sql);
if($query){
return true;
}
else{
return false;
}
}
//更新图片压缩
public function compress($id){
$id = strip_tags($id);
$id = (int)$id;
$sql = "UPDATE img_images SET `compression` = 1";
$query = $this->db->query($sql);
if($query){
return TRUE;
}
else{
return FALSE;
}
}
//更新站点信息
public function site($name,$data){
$id = strip_tags($name);
$sql = "UPDATE img_options SET `values` = '$data' WHERE `name` = '$name'";
$query = $this->db->query($sql);
if($query){
return TRUE;
}
else{
return FALSE;
}
}
//更新tinypng设置
public function tinypng($values,$switch){
$sql = "UPDATE img_options SET `values` = '$values',`switch` = '$switch' WHERE `name` = 'tinypng'";
//echo $sql;
$query = $this->db->query($sql);
if($query){
return TRUE;
}
else{
return FALSE;
}
}
//更新moderate
public function moderate($values,$switch){
$sql = "UPDATE img_options SET `values` = '$values',`switch` = '$switch' WHERE `name` = 'moderate'";
$query = $this->db->query($sql);
if($query){
return TRUE;
}
else{
return FALSE;
}
}
//更新存储引擎
public function storage($data,$engine){
$this->db->where('engine', $engine);
$up = $this->db->update('storage', $data);
if($up){
return TRUE;
}
else{
return FALSE;
}
}
}
?>

11
application/models/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

11
application/third_party/index.html vendored

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

59
application/views/admin/footer.php

@ -0,0 +1,59 @@
<?php
//获取版本号
$ver_file = FCPATH.'data/version.txt';
if(is_file($ver_file)){
@$version = file_get_contents($ver_file);
}
?>
</div>
<div class="layui-footer">
<!-- 底部固定区域 -->
Copyright © 2017-2018 Powered by <a href="https://imgurl.org/" target = "_blank">ImgURL</a> | Author <a href="https://www.xiaoz.me/" target = "_blank">xiaoz.me</a>
</div>
</div>
<script src="/static/layui/layui.js"></script>
<script src="/static/js/admin.js?v=<?php echo $version; ?>"></script>
<script src="/static/clipBoard.min.js"></script>
<!-- 获取图片链接 -->
<div class="layui-row" id = "imglink">
<div class="layui-col-lg10 layui-col-md-offset1">
<!-- 显示地址 -->
<div class="layui-col-lg12">
<div id="links">
<table class="layui-table" lay-skin="nob">
<colgroup>
<col width="80">
<col width="320">
<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="copyurl('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="copyurl('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="copyurl('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="copyurl('bbcode')">复制</a></td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- 图片显示区域END -->
</div>
</div>
<!-- 获取图片链接END -->
</body>
</html>

49
application/views/admin/header.php

@ -0,0 +1,49 @@
<?php
//获取版本号
$ver_file = FCPATH.'data/version.txt';
if(is_file($ver_file)){
@$version = file_get_contents($ver_file);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title><?php echo $admin_title; ?> - ImgURL后台管理</title>
<link rel="stylesheet" href="/static/layui/css/layui.css">
<link rel="stylesheet" href="/static/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/static/css/admin.css?v=<?php echo $version; ?>">
<script src = "/static/js/jquery.min.js"></script>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
<div class="layui-header">
<div class="layui-logo"><a href="/admin/index">ImgURL后台管理</a></div>
<!-- 头部区域(可配合layui已有的水平导航) -->
<ul class="layui-nav layui-layout-left">
<li class="layui-nav-item"><a href="/"><i class="layui-icon layui-icon-home"></i> 前台首页</a></li>
<li class="layui-nav-item"><a href="/home/multiple"><i class="layui-icon layui-icon-upload"></i> 多图上传</a></li>
<li class="layui-nav-item"><a href="/admin/urlup"><i class="layui-icon layui-icon-link"></i> URL上传</a></li>
<!-- <li class="layui-nav-item">
<a href="javascript:;">其它系统</a>
<dl class="layui-nav-child">
<dd><a href="">邮件管理</a></dd>
<dd><a href="">消息管理</a></dd>
<dd><a href="">授权管理</a></dd>
</dl>
</li> -->
</ul>
<ul class="layui-nav layui-layout-right">
<li class="layui-nav-item">
<a href="javascript:;">
<img src="/static/images/touxiang_100.jpg" class="layui-nav-img">
<?php echo $_COOKIE['user']; ?>
</a>
<dl class="layui-nav-child">
<dd><a href="">修改密码</a></dd>
</dl>
</li>
<li class="layui-nav-item"><a href="/user/logout">退出</a></li>
</ul>
</div>

40
application/views/admin/identify.php

@ -0,0 +1,40 @@
<div class="layui-container site">
<div class="layui-row">
<div class="layui-col-lg8">
<div class="setting-msg">
ImgURL需要使用Moderate Content提供的API来进行鉴黄识别,详细说明请参考帮助文档。
</div>
<div class = "identify-msg">
<ol>
<li>由于某些原因可能接口会超时或者识别错误,建议配合 crontab 来定时识别图片。</li>
<li>鉴黄接口地址为:/deal/identify_more</li>
<li>Moderate Content无法做到100%精准,可能存在误判,识别后的图片会标记为可疑图片。</li>
</ol>
</div>
</div>
<div class="layui-col-lg6">
<div id="site">
<form class="layui-form" action="/set/moderate" method = "post">
<div class="layui-form-item">
<label class="layui-form-label">API key</label>
<div class="layui-input-block">
<input type="text" name="api" value = "<?php echo $values; ?>" required lay-verify="required" placeholder="请输入Moderate Content API KEY" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">启用鉴黄</label>
<div class="layui-input-block">
<input type="checkbox" name="switch" lay-filter="jhswitch" lay-skin="switch" lay-text="ON|OFF" <?php echo $switch; ?>>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formModerate">保存</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>

85
application/views/admin/images.php

@ -0,0 +1,85 @@
<div class="layui-container" style = "margin-top:2em;margin-bottom:6em;">
<div class="layui-row layui-col-space10 showimgs" id = "showimgs">
<?php
foreach ($imgs as $img)
{
//一些简单的逻辑处理
//获取缩略图地址
$thumbpath = thumbnail($img);
$thumburl = $domain.$thumbpath;
//源图像地址
$img_url = $domain.$img['path'];
//判断是否压缩设置不同样式的CSS
if($img['compression'] == 1){
$css = 'layui-btn-normal';
}
else{
$css = 'layui-btn-primary';
}
//如果是可疑图片
if($img['level'] == 'adult'){
$thumburl = $domain.'/static/images/dubious_290.png';
}
?>
<div class="layui-col-lg3" id = "img<?php echo $img['id']; ?>">
<div class = "operate">
<!-- 选择按钮 -->
<div class = "choose"><input type="checkbox" name="" value = "<?php echo $img['id']; ?>"></div>
<!-- 压缩图标 -->
<div>
<button class="layui-btn layui-btn-xs <?php echo $css; ?>" title = "压缩图片" onclick = "compress(<?php echo $img['id']; ?>)">
<i class="fa fa-compress"></i>
</button>
</div>
<!-- 链接图标 -->
<div>
<button class="layui-btn layui-btn-xs layui-btn-normal" title = "获取图片链接" onclick = "showlink('<?php echo $img_url; ?>','<?php echo $thumburl; ?>')">
<i class="fa fa-link"></i>
</button>
</div>
<!-- 信息图标 -->
<div>
<button class="layui-btn layui-btn-xs layui-btn-normal" title = "查看图片信息" onclick = "imginfo('<?php echo $img['imgid']; ?>','<?php echo $img['client_name']; ?>')">
<i class="fa fa-info-circle"></i>
</button>
</div>
<!-- 直达链接 -->
<div>
<a href="/img/<?php echo $img['imgid']; ?>" target = "_blank" class="layui-btn layui-btn-xs layui-btn-normal"><i class="fa fa-globe"></i></a>
</div>
<!-- 删除按钮 -->
<div>
<button class="layui-btn layui-btn-xs layui-btn-danger" title = "删除这张图片" onclick = "del_img('<?php echo $img['id']; ?>','<?php echo $img['imgid'] ?>','<?php echo $img['path']; ?>','<?php echo $thumbpath; ?>')">
<i class="fa fa-trash-o"></i>
</button>
</div>
<!-- 取消可疑状态 -->
<?php if($img['level'] == 'adult'){ ?>
<div>
<button class="layui-btn layui-btn-xs" title = "取消可疑状态" onclick = "cancel(<?php echo $img['id']; ?>)">
<i class="fa fa-check"></i>
</button>
</div>
<?php } ?>
</div>
<div class = "img_thumb">
<img src="<?php echo $thumburl; ?>" alt="<?php echo $img['client_name']; ?>" layer-src= "<?php echo $img_url; ?>" lay-src = "<?php echo $thumburl; ?>">
</div>
</div>
<?php
}
?>
</div>
<!-- 分页按钮 -->
<div class="layui-row" style = "margin-top:2em;">
<div class="layui-col-lg4" id = "paging">
<?php echo $page; ?>
</div>
<div class="layui-col-lg8">
<label>选中项:</label><button class="layui-btn layui-btn-sm layui-btn-danger" onclick = "del_more()">删除</button>
</div>
</div>
<!-- 分页按钮 -->
</div>

59
application/views/admin/imginfo.php

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>New Document</title>
<meta name="generator" content="EverEdit" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="stylesheet" href="/static/layui/css/layui.css">
</head>
<body>
<div class="layui-container">
<div class="layui-row">
<div class = "layui-col-lg12">
<!--后台管理查看图片信息-->
<table class="layui-table">
<colgroup>
<col width="150">
<col>
</colgroup>
<tbody>
<tr>
<td>分辨率</td>
<td><?php echo $width; ?> x <?php echo $height; ?></td>
</tr>
<tr>
<td>MIME类型</td>
<td><?php echo $mime; ?></td>
</tr>
<tr>
<td>扩展名</td>
<td><?php echo $ext; ?></td>
</tr>
<tr>
<td>上传时间</td>
<td><?php echo $date; ?></td>
</tr>
<tr>
<td>上传者IP</td>
<td><?php echo $ip; ?></td>
</tr>
<tr>
<td>浏览次数</td>
<td><?php echo $views; ?></td>
</tr>
<tr>
<td>文件大小</td>
<td><?php echo $size; ?></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script src="/static/layui/layui.js"></script>
</body>
</html>

0
application/views/admin/index.html

55
application/views/admin/index.php

@ -0,0 +1,55 @@
<div class="layui-container" style = "margin-top:2em;">
<div class="layui-row layui-col-space20">
<div class="layui-col-lg3">
<div class = "analyze">
<h3><i class="fa fa-upload"></i> 累计上传</h3>
<p><?php echo $num; ?></p>
</div>
</div>
<div class="layui-col-lg3">
<div class = "analyze">
<h3><i class="fa fa-user-plus"></i> 管理员累积上传</h3>
<p><?php echo $admin; ?></p>
</div>
</div>
<div class="layui-col-lg3">
<div class = "analyze">
<h3><i class="fa fa-user-o"></i> 游客累积上传</h3>
<p><?php echo $visitor; ?></p>
</div>
</div>
<div class="layui-col-lg3">
<div class = "analyze">
<h3><i class="fa fa-question"></i> 可疑图片</h3>
<p><?php echo $dubious; ?></p>
</div>
</div>
<div class="layui-col-lg3">
<div class = "analyze">
<h3><i class="fa fa-calendar-check-o"></i> 本月上传</h3>
<p><?php echo $month; ?></p>
</div>
</div>
<div class="layui-col-lg3">
<div class = "analyze">
<h3><i class="fa fa-calendar-plus-o"></i> 今日上传</h3>
<p><?php echo $day; ?></p>
</div>
</div>
<div class="layui-col-lg3">
<div class = "analyze">
<h3><i class="fa fa-comments"></i> 社区支持</h3>
<p><a href="https://dwz.ovh/imgurl2" target = "_blank" title = "ImgURL社区支持">https://ttt.sh/</a></p>
</div>
</div>
<div class="layui-col-lg3">
<div class = "analyze">
<h3><i class="fa fa-github"></i> 源码下载</h3>
<p><a href="https://github.com/helloxz/imgurl" target = "_blank">https://github.com/</a></p>
</div>
</div>
</div>
</div>

50
application/views/admin/left.php

@ -0,0 +1,50 @@
<div class="layui-side layui-bg-black">
<div class="layui-side-scroll">
<!-- 左侧导航区域(可配合layui已有的垂直导航) -->
<ul class="layui-nav layui-nav-tree" lay-filter="test">
<li class="layui-nav-item layui-nav-itemed">
<a href="javascript:;"><i class="layui-icon layui-icon-picture-fine"></i> 图片管理</a>
<dl class="layui-nav-child">
<dd><a href="/manage/images/all/0">所有图片</a></dd>
<dd><a href="/manage/images/admin/0">管理员上传</a></dd>
<dd><a href="/manage/images/visitor/0">游客上传</a></dd>
<dd><a href="/manage/images/dubious/0">可疑图片</a></dd>
</dl>
</li>
<li class="layui-nav-item layui-nav-itemed">
<a class="" href="javascript:;"><i class="layui-icon layui-icon-set"></i> 系统设置</a>
<dl class="layui-nav-child">
<dd><a href="/setting/site">站点设置</a></dd>
<dd><a href="/setting/uplimit">上传限制</a></dd>
<dd><a href="/setting/compress">图片压缩</a></dd>
<dd><a href="/setting/identify">图片鉴黄</a></dd>
</dl>
</li>
<li class="layui-nav-item">
<a href="javascript:;"><i class="layui-icon layui-icon-app"></i> 存储方案</a>
<dl class="layui-nav-child">
<dd><a href="/storage/localhost">localhost</a></dd>
<!-- <dd><a href="javascript:;">FTP</a></dd> -->
<!-- <dd><a href="">七牛云</a></dd>
<dd><a href="">又拍云</a></dd>
<dd><a href="">腾讯COS</a></dd>
<dd><a href="">阿里OSS</a></dd> -->
</dl>
</li>
<li class="layui-nav-item">
<a href="javascript:;"><i class="layui-icon layui-icon-app"></i> 管理维护</a>
<dl class="layui-nav-child">
<dd><a href="javascript:;" onclick = "version()">当前版本</a></dd>
<dd><a href="/maintain/upto2">1.x升级2.x</a></dd>
<!-- <dd><a href="/maintain/upto2">检查更新</a></dd> -->
<!-- <dd><a href="javascript:;">FTP</a></dd> -->
<!-- <dd><a href="">七牛云</a></dd>
<dd><a href="">又拍云</a></dd>
<dd><a href="">腾讯COS</a></dd>
<dd><a href="">阿里OSS</a></dd> -->
</dl>
</li>
</ul>
</div>
</div>
<div class="layui-body">

26
application/views/admin/localhost.php

@ -0,0 +1,26 @@
<div class="layui-container site">
<div class="layui-row">
<div class="layui-col-lg12">
<div class="setting-msg">
请在下方填写localhost绑定域名(默认为站点域名),需要带有http(s),注意末尾没有/
</div>
</div>
<div class="layui-col-lg6">
<div id="site">
<form class="layui-form" action="/set/storage/localhost" method = "post">
<div class="layui-form-item">
<label class="layui-form-label">绑定域名</label>
<div class="layui-input-block">
<input type="text" name="domain" value = "<?php echo $domains; ?>" required lay-verify="required|url" placeholder="请输入绑定域名" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formlocalhost">保存</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>

54
application/views/admin/site.php

@ -0,0 +1,54 @@
<div class="layui-container site">
<div class="layui-row">
<div class="layui-col-lg12">
<div id="site">
<form class="layui-form" action = "/set/site" method = "post">
<div class="layui-form-item">
<label class="layui-form-label">Logo地址</label>
<div class="layui-input-block">
<input type="text" name="logo" required lay-verify="required" placeholder="可输入绝对路径或URL地址" autocomplete="off" class="layui-input" value = "<?php echo $logo; ?>">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">网站标题</label>
<div class="layui-input-block">
<input type="text" name="title" required lay-verify="required" placeholder="请输入网站标题标题" autocomplete="off" class="layui-input" value = "<?php echo $title; ?>">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">网站关键词</label>
<div class="layui-input-block">
<input type="text" name="keywords" placeholder="多个关键词用英文状态下的逗号(,)分隔" autocomplete="off" class="layui-input" value = "<?php echo $keywords; ?>">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">站点描述</label>
<div class="layui-input-block">
<textarea name="description" placeholder="请输入网站描述" class="layui-textarea">
<?php echo $description; ?>
</textarea>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">统计代码</label>
<div class="layui-input-block">
<textarea name="analytics" placeholder="请输入统计代码" class="layui-textarea"><?php echo $analytics; ?></textarea>
</div>
</div>
<!-- <div class="layui-form-item layui-form-text">
<label class="layui-form-label">Disqus</label>
<div class="layui-input-block">
<textarea name="comments" placeholder="请输入统Disqus评论代码" class="layui-textarea"></textarea>
</div>
</div> -->
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formsite">保存</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>

39
application/views/admin/tinypng.php

@ -0,0 +1,39 @@
<div class="layui-container site">
<div class="layui-row">
<div class="layui-col-lg8">
<div class="setting-msg">
ImgURL需要使用TinyPNG提供的API来压缩图片,可同时设置2个API KEY,详细说明请查看帮助文档。
</div>
</div>
<div class="layui-col-lg6">
<div id="site">
<form class="layui-form" action="/set/tinypng" method = "post">
<div class="layui-form-item">
<label class="layui-form-label">API key 1</label>
<div class="layui-input-block">
<input type="text" name="api1" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input" value = "<?php echo @$values->api1; ?>">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">API key 2</label>
<div class="layui-input-block">
<input type="text" name="api2" lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input" value = "<?php echo @$values->api2; ?>">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">启用压缩</label>
<div class="layui-input-block">
<input type="checkbox" name="switch" lay-skin="switch" lay-text="ON|OFF" <?php echo $switch; ?>>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formtiny">保存</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>

33
application/views/admin/uplimit.php

@ -0,0 +1,33 @@
<div class="layui-container setting">
<div class="layui-row">
<div class="layui-col-lg4">
<div id="site">
<form class="layui-form" action = "/set/uplimit" method = "post">
<div class="layui-form-item">
<label class="layui-form-label">游客上传</label>
<div class="layui-input-block">
<input type="checkbox" lay-filter="upswitch" name="switch" lay-skin="switch" <?php echo $switch;?>>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">上传数量</label>
<div class="layui-input-block">
<input type="text" id = "limit" name="limit" required lay-verify="required" placeholder="指的是游客每日上传数量" autocomplete="off" class="layui-input" value = "<?php echo $limit; ?>">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">上传大小</label>
<div class="layui-input-block">
<input type="text" name="max_size" required lay-verify="required" placeholder="后端上传大小,单位为Mb" autocomplete="off" class="layui-input" value = "<?php echo $max_size; ?>">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formuplimit">保存</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>

16
application/views/admin/upto2.php

@ -0,0 +1,16 @@
<div class="layui-container" style = "margin-top:2em;">
<div class="layui-row">
<div class="layui-col-lg12">
<div>
<ol>
<li>1. 访问 <a href="http://soft.xiaoz.org/php/imgurl_import.zip">imgurl_import.zip</a> 将解压后的 <code>import.php</code> 放到站点根目录</li>
<li>2. 请将ImgURL 1.x的数据库放到2.x的data/temp/目录,看起来应该是data/temp/imgurl.db3</li>
<li>3. 将1.x的图片目录upload、temp放到2.x根目录</li>
<li>4. 准备完毕后点击下方按钮进行升级</li>
<li>5. 升级完毕后删除<code>data/temp/imgurl.db3</code><code>import.php</code></li>
</ol>
</div>
<div style = "margin-top:1em;"><a href="/import.php?id=1" class="layui-btn">开始升级</a></div>
</div>
</div>
</div>

24
application/views/admin/urlup.php

@ -0,0 +1,24 @@
<div class="layui-container site">
<div class="layui-row layui-col-space30">
<div class="layui-col-lg12">
<div class="setting-msg">
请输入图片地址,一行一个,一次不超过10个
</div>
</div>
<div class="layui-col-lg6">
<div class="urltext">
<label>输入链接</label>
<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>
</div>
<div class="layui-col-lg6">
<div class="urlupmsg">
<label>上传结果(返回结果顺序可能有偏差)</label>
<textarea rows="10" id="urlupmsg" class="layui-textarea" placeholder="这里返回上传结果" readonly="readonly"></textarea>
</div>
</div>
</div>
</div>

8
application/views/errors/cli/error_404.php

@ -0,0 +1,8 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
echo "\nERROR: ",
$heading,
"\n\n",
$message,
"\n\n";

8
application/views/errors/cli/error_db.php

@ -0,0 +1,8 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
echo "\nDatabase error: ",
$heading,
"\n\n",
$message,
"\n\n";

21
application/views/errors/cli/error_exception.php

@ -0,0 +1,21 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
An uncaught Exception was encountered
Type: <?php echo get_class($exception), "\n"; ?>
Message: <?php echo $message, "\n"; ?>
Filename: <?php echo $exception->getFile(), "\n"; ?>
Line Number: <?php echo $exception->getLine(); ?>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
Backtrace:
<?php foreach ($exception->getTrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
File: <?php echo $error['file'], "\n"; ?>
Line: <?php echo $error['line'], "\n"; ?>
Function: <?php echo $error['function'], "\n\n"; ?>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>

8
application/views/errors/cli/error_general.php

@ -0,0 +1,8 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
echo "\nERROR: ",
$heading,
"\n\n",
$message,
"\n\n";

21
application/views/errors/cli/error_php.php

@ -0,0 +1,21 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
A PHP Error was encountered
Severity: <?php echo $severity, "\n"; ?>
Message: <?php echo $message, "\n"; ?>
Filename: <?php echo $filepath, "\n"; ?>
Line Number: <?php echo $line; ?>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
Backtrace:
<?php foreach (debug_backtrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
File: <?php echo $error['file'], "\n"; ?>
Line: <?php echo $error['line'], "\n"; ?>
Function: <?php echo $error['function'], "\n\n"; ?>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>

11
application/views/errors/cli/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

64
application/views/errors/html/error_404.php

@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>404 Page Not Found</title>
<style type="text/css">
::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

64
application/views/errors/html/error_db.php

@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Database Error</title>
<style type="text/css">
::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

32
application/views/errors/html/error_exception.php

@ -0,0 +1,32 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>An uncaught Exception was encountered</h4>
<p>Type: <?php echo get_class($exception); ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $exception->getFile(); ?></p>
<p>Line Number: <?php echo $exception->getLine(); ?></p>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
<p>Backtrace:</p>
<?php foreach ($exception->getTrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
<p style="margin-left:10px">
File: <?php echo $error['file']; ?><br />
Line: <?php echo $error['line']; ?><br />
Function: <?php echo $error['function']; ?>
</p>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>
</div>

64
application/views/errors/html/error_general.php

@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
<style type="text/css">
::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

33
application/views/errors/html/error_php.php

@ -0,0 +1,33 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: <?php echo $severity; ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $filepath; ?></p>
<p>Line Number: <?php echo $line; ?></p>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
<p>Backtrace:</p>
<?php foreach (debug_backtrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
<p style="margin-left:10px">
File: <?php echo $error['file'] ?><br />
Line: <?php echo $error['line'] ?><br />
Function: <?php echo $error['function'] ?>
</p>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>
</div>

11
application/views/errors/html/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

11
application/views/errors/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

11
application/views/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

31
application/views/user/footer.php

@ -0,0 +1,31 @@
<?php
//获取版本号
$ver_file = FCPATH.'data/version.txt';
if(is_file($ver_file)){
@$version = file_get_contents($ver_file);
}
?>
<!-- 底部 -->
<div class = "footer">
<div class = "layui-container">
<div class = "layui-row">
<div class = "layui-col-lg12">
Copyright © 2017-2018 Powered by <a href="https://imgurl.org/" target = "_blank">ImgURL</a> | Author <a href="https://www.xiaoz.me/" target = "_blank">xiaoz.me</a> |
<!-- 简单判断用户是否登录 -->
<?php if((isset($_COOKIE['user'])) && (isset($_COOKIE['token']))){ ?>
<a href="/user/logout">logout</a>
<?php }else{ ?>
<a href="/user/login">login</a>
<?php } ?>
<!-- 简单判断用户是否登录END -->
</div>
</div>
</div>
</div>
<!-- 底部END -->
<script src="/static/layui/layui.js"></script>
<script src="/static/embed.js?v=<?php echo $version; ?>"></script>
<script src="/static/clipBoard.min.js?v=1.40"></script>
</body>
</html>

77
application/views/user/found.php

@ -0,0 +1,77 @@
<?php
// 很无奈的将逻辑写到这里
// 写一个获取缩略图的函数
$this->load->helper('basic');
?>
<div class="layui-container" style = "margin-top:2em;margin-bottom:6em;">
<div class="layui-row layui-col-space5" id = "found">
<?php
foreach ($imgs as $img)
{
//一些简单的逻辑处理
//获取缩略图地址
$thumbpath = thumbnail($img);
$thumburl = $domain.$thumbpath;
//源图像地址
$img_url = $domain.$img['path'];
?>
<div class="layui-col-lg3" id = "img<?php echo $img['id']; ?>">
<div class = "img_thumb" onmouseover = "show_imgcon(<?php echo $img['id']; ?>)" onmouseout = "hide_imgcon(<?php echo $img['id']; ?>)">
<img src="<?php echo $thumburl; ?>" alt="<?php echo $img['client_name']; ?>" layer-src= "<?php echo $img_url; ?>" lay-src = "<?php echo $thumburl; ?>">
<div class="imgcon" id="imgcon<?php echo $img['id']; ?>">
<!-- 图片链接 -->
<a href="javascript:;" title="图片链接" class="layui-btn layui-btn-xs layui-btn-normal" onclick = "showlink('<?php echo $img_url; ?>','<?php echo $thumburl; ?>')"><i class="fa fa-link"></i></a>
<a href="/img/<?php echo $img['imgid']; ?>" target = "_blank" class="layui-btn layui-btn-xs layui-btn-normal"><i class="fa fa-globe"></i></a>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
<div class="layui-row" id = "imglink">
<div class="layui-col-lg10 layui-col-md-offset1">
<!-- 图片显示区域 -->
<!-- 显示缩略图 -->
<div class="layui-col-lg12">
<div id = "img-thumb"><a href="" target = "_blank"><center><img src="" alt=""></center></a></div>
</div>
<!-- 显示地址 -->
<div class="layui-col-lg12">
<div id="links">
<table class="layui-table" lay-skin="nob">
<colgroup>
<col width="80">
<col width="320">
<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="copyurl('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="copyurl('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="copyurl('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="copyurl('bbcode')">复制</a></td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- 图片显示区域END -->
</div>
</div>

65
application/views/user/header.php

@ -0,0 +1,65 @@
<?php
//获取版本号
$ver_file = FCPATH.'data/version.txt';
if(is_file($ver_file)){
@$version = file_get_contents($ver_file);
}
?>
<!DOCTYPE html>
<html lang="zh-cmn-Hans" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title><?php echo @$title; ?></title>
<meta name="generator" content="EverEdit" />
<meta name="author" content="" />
<meta name="keywords" content="<?php echo @$keywords; ?>" />
<meta name="description" content="<?php echo @$description; ?>" />
<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/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/static/lightGallery/src/css/lightgallery.css">
<link rel="stylesheet" href="/static/style.css?v=<?php echo $version; ?>">
<script src="/static/jquery.min.js"></script>
<!-- 统计代码 -->
<?php echo @$analytics; ?>
<!-- 统计代码END -->
</head>
<body>
<!-- 顶部导航栏 -->
<div class = "header">
<div class = "layui-container">
<div class = "layui-row">
<div class = "layui-col-lg12">
<div class="left-menu">
<a href="/">
<div id="logo">
<img src="<?php echo @$logo; ?>">
</div>
</a>
</div>
<div class = "layui-hide-xs menu">
<ul class="layui-nav" lay-filter="">
<li class="layui-nav-item"><a href="/home/multiple"><i class="layui-icon layui-icon-upload"></i> 多图上传</a></li>
<li class="layui-nav-item"><a href="/found"><i class="layui-icon layui-icon-search"></i> 探索发现</a></li>
<li class="layui-nav-item"><a href="https://doc.xiaoz.me/#/imgurl2/" target = "_blank" rel = "nofollow"><i class="layui-icon">&#xe705;</i> 帮助文档</a></li>
<li class="layui-nav-item"><a href="https://github.com/helloxz/imgurl" target = "_blank" rel = "nofollow"><i class="layui-icon">&#xe635;</i> 源码</a></li>
<li class="layui-nav-item"><a href="/page/use"><i class="layui-icon">&#xe60b;</i> 关于</a></li>
<!-- 简单判断用户是否登录 -->
<?php if((isset($_COOKIE['user'])) && (isset($_COOKIE['token']))){ ?>
<li class="layui-nav-item"><a href="/admin/index"><i class="layui-icon layui-icon-console"></i> 后台管理</a></li>
<?php }?>
<!-- 简单判断用户是否登录END -->
</ul>
</div>
<div class = "layui-hide-lg layui-hide-xs">
<ul class="layui-nav menu" lay-filter="">
<li class="layui-nav-item"><a href="found.php">探索发现</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- 顶部导航栏END -->

136
application/views/user/home.php

@ -0,0 +1,136 @@
<div class="layui-container">
<div class="layui-row">
<!-- 首页主要区域 -->
<div class="layui-col-lg12">
<div id="main">
<div class="alert alert-warning" role="alert">
<span class="alert-inner--icon"><i class="layui-icon"></i></span>
<span class="alert-inner--text"><strong>注意:</strong>游客限制每日上传10张,单张图片不能超过5M,上传的图片将公开显示,使用之前请先阅读《<a href="/page/use">使用协议</a></span>
</div>
<!-- 选择按钮 -->
<!-- 上传地址 -->
<!-- <div id = "storage">
<form class="layui-form" action="">
<div class="layui-form-item">
<label class="layui-form-label">存储方式</label>
<div class="layui-input-block">
<input type="radio" name="storage" value="localhost" title="本地" checked = "checked">
<input type="radio" name="storage" value="qiniu" title="七牛云">
<input type="radio" name="storage" value="upyun" title="又拍云">
<input type="radio" name="storage" value="oss" title="阿里OSS">
</div>
</div>
</form>
</div> -->
<!-- 选择按钮END -->
<!-- 上传区域 -->
<div class="layui-form-item">
<div class="layui-upload-drag" id="upimg">
<i class="layui-icon"></i>
<p>将图片拖拽到此处,支持Ctrl + V粘贴上传</p>
</div>
</div>
<!-- 上传区域END -->
</div>
</div>
<!-- 首页主要区域END -->
</div>
<div class="layui-row">
<div class="layui-col-lg12" id = "imgshow">
<!-- 图片显示区域 -->
<!-- 显示缩略图 -->
<div class="layui-col-lg4">
<div id = "img-thumb"><a href="" target = "_blank"><img src="" alt=""></a></div>
</div>
<!-- 显示地址 -->
<div class="layui-col-lg7 layui-col-md-offset1">
<div id="links">
<table class="layui-table" lay-skin="nob">
<colgroup>
<col width="80">
<col width="450">
<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="copyurl('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="copyurl('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="copyurl('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="copyurl('bbcode')">复制</a></td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- 图片显示区域END -->
</div>
</div>
</div>
<!--Ctrl + V粘贴上传-->
<script src = "/static/js/PasteUpload.js"></script>
<script>
var load1 = document.querySelector("#upimg");
// 实例化即可
new ctrlVUtil({
uploadUrl: "/upload/parse",
targetElement: load1,
isCompleteImg:false,
data:{
name:"alanzhang",
},
success:function(data){
//转为对象
var res = data;
//上传成功
if(res.code == 200){
layer.closeAll('loading');
//layer.closeAll('loading');
$("#img-thumb a").attr('href','/img/' + res.imgid);
$("#img-thumb img").attr('src',res.thumbnail_url);
$("#url").val(res.url);
$("#html").val("<img src = '" + res.url + "' />");
$("#markdown").val("![](" + res.url + ")");
$("#bbcode").val("[img]" + res.url + "[/img]");
$("#imgshow").show();
//对图片进行鉴黄识别
$.get("/deal/identify/" + res.id,function(data,status){
var re = JSON.parse(data);
//状态码为400,说明该图片存在异常
if(re.code == 400){
layer.open({
title: '警告!'
,content: '您的IP已被记录,请不要上传违规图片!'
});
}
else{
console.log(re.code);
}
});
}
else{
layer.msg(res.msg);
}
},
error: function(error){
layer.closeAll('loading');
layer.msg('上传失败!');
}
});
</script>
<!--粘贴上传END-->

139
application/views/user/img.php

@ -0,0 +1,139 @@
<div class="layui-container" style = "margin-top:1em;margin-bottom:4em;">
<div class="layui-row layui-col-space20 img-main">
<!-- 图片主要区域 -->
<div class="layui-col-lg8">
<div id = "onepic">
<div class="onepic">
<div class="title"><h2><?php echo $title; ?></h2></div>
<div id = "lightgallery">
<img layer-src="<?php echo $url; ?>" src="<?php echo $url; ?>" alt="<?php echo $title; ?>">
</div>
</div>
<!-- 图片底部信息 -->
<div class="picinfo">
<p>
<span><a href="javascript:;" title = "上传时间"><i class="fa fa-calendar-check-o"></i> <?php echo $date; ?></a></span>
<span><a href="javascript:;" title = "浏览次数"><i class="fa fa-eye"></i> <?php echo $views; ?></a></span>
<span><a href="<?php echo $url; ?>" download = ""><i class="fa fa-cloud-download"></i> 下载</a></span>
</p>
<div class = "statement">
<i class="fa fa-warning"></i> 此图片来自网友上传,不代表本站立场,若有侵权,请联系管理员删除!(QQ:337003006)
</div>
</div>
<!-- 评论按钮 -->
<div id="comments">
</div>
<!-- 评论按钮END -->
</div>
<!-- 图片右侧 -->
<!-- 图片右侧END -->
</div>
<div class="layui-col-lg4" id = "pic-right">
<div class="sidebar">
<!-- 右侧选项卡 -->
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
<ul class="layui-tab-title">
<li class="layui-this">图片链接</li>
<li>图片信息</li>
</ul>
<div class="layui-tab-content">
<!-- 第一个选项卡 -->
<div class="layui-tab-item layui-show">
<div id="links">
<table class="layui-table" lay-skin="nob">
<colgroup>
<col width="60">
<col width="450">
<col>
</colgroup>
<tbody>
<tr>
<td>URL</td>
<td><input type="text" class="layui-input" id="url" data-cip-id="url" value = "<?php echo $url; ?>"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="copyurl('url')">复制</a></td>
</tr>
<tr>
<td>HTML</td>
<td><input type="text" class="layui-input" id="html" data-cip-id="html" value = "<img src = '<?php echo $url; ?>' />"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="copyurl('html')">复制</a></td>
</tr>
<tr>
<td>MarkDown</td>
<td><input type="text" class="layui-input" id="markdown" data-cip-id="markdown" value = "![](<?php echo $url; ?>)"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="copyurl('markdown')">复制</a></td>
</tr>
<tr>
<td>BBcode</td>
<td><input type="text" class="layui-input" id="bbcode" data-cip-id="bbcode" value = "[img]<?php echo $url; ?>[/img]"></td>
<td><a href="javascript:;" class="layui-btn layui-btn-sm" onclick="copyurl('bbcode')">复制</a></td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- 第1个选项卡END -->
<!-- 第二个选项卡 -->
<div class="layui-tab-item">
<table class="layui-table">
<colgroup>
<col width="150">
<col>
</colgroup>
<!-- <thead>
<tr>
<th>属性</th>
<th>对应值</th>
</tr>
</thead> -->
<tbody>
<tr>
<td>分辨率</td>
<td><?php echo $width; ?> x <?php echo $height; ?></td>
</tr>
<tr>
<td>MIME类型</td>
<td><?php echo $mime; ?></td>
</tr>
<tr>
<td>扩展名</td>
<td><?php echo $ext; ?></td>
</tr>
<tr>
<td>上传日期</td>
<td><?php echo $date; ?></td>
</tr>
<tr>
<td>浏览次数</td>
<td><?php echo $views; ?></td>
</tr>
<tr>
<td>文件大小</td>
<td><?php echo $size; ?></td>
</tr>
</tbody>
</table>
</div>
<!-- 第二个选项卡END -->
</div>
</div>
<!-- 右侧选项卡END -->
</div>
<!-- 第二个sidebar -->
<div class="sideba">
<!-- <a href="https://e.aiguobit.com/?from=xiaoz"><img src="https://www.xiaoz.me/wp-content/uploads/2017/06/netssocks_300.png" alt=""></a> -->
</div>
<!-- 第二个sidebar结束 -->
</div>
<!-- 图片主要区域END -->
</div>
</div>
<script>
//调用示例
</script>

55
application/views/user/install1.php

@ -0,0 +1,55 @@
<div class="layui-container">
<div class="layui-row" style = "margin-top:2em;">
<div class="layui-col-lg8 layui-col-md-offset2">
<center style = "margin-bottom:2em;"><h1>ImgURL安装向导(1/3)</h1></center>
<!-- 检测结果表格 -->
<table class="layui-table">
<colgroup>
<col width="220">
<col width="220">
<col>
</colgroup>
<thead>
<tr>
<th>名称</th>
<th>要求</th>
<th>当前信息</th>
<th>检测结果</th>
</tr>
</thead>
<tbody>
<?php foreach($env as $value) { ?>
<tr>
<?php foreach($value as $info) { ?>
<td>
<?php
if($info == FALSE){
echo '<span style = "color:red;">不支持!</span>';
}
else{
echo $info;
}
?>
</td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
<!-- 检测结果表格EDN -->
<!-- 下一步按钮 -->
<div>
<!-- 对检测结果进行判断 -->
<?php
if($sum === NULL){
echo '<a href="/install/?setup=2" class="layui-btn" id = "next">下一步</a>';
}
elseif($sum === FALSE){
echo '<span style = "color:red;">您必须先解决上述问题才能进一步安装!</span>';
}
?>
</div>
<!-- 下一步按钮END -->
</div>
</div>
</div>

45
application/views/user/install2.php

@ -0,0 +1,45 @@
<div class="layui-container">
<div class="layui-row" style = "margin-top:2em;">
<div class="layui-col-lg8 layui-col-md-offset2">
<center style = "margin-bottom:2em;"><h1>ImgURL安装向导(2/3)</h1></center>
<!-- 表单 -->
<form class="layui-form" action="/install/?setup=3" method = "post">
<div class="layui-form-item">
<label class="layui-form-label">网站域名</label>
<div class="layui-input-block">
<input type="text" name="domain" required lay-verify="required" placeholder="一般保持默认" autocomplete="off" class="layui-input" value = "<?php echo $domain; ?>">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">用户名</label>
<div class="layui-input-block">
<input type="text" name="user" required lay-verify="required" placeholder="字母或数字组合" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">密码</label>
<div class="layui-input-block">
<input type="password" name="pass1" required lay-verify="required" placeholder="设置密码" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">确认密码</label>
<div class="layui-input-block">
<input type="password" name="pass2" required lay-verify="required" placeholder="再次确认密码" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<a href="/install/?setup=1" class="layui-btn">上一步</a>
<button class="layui-btn" lay-submit lay-filter="formDemo">开始安装</button>
</div>
</div>
</form>
<!-- 表单EDN -->
<!-- 下一步按钮 -->
<!-- 下一步按钮END -->
</div>
</div>
</div>

17
application/views/user/install3.php

@ -0,0 +1,17 @@
<div class="layui-container">
<div class="layui-row" style = "margin-top:2em;">
<div class="layui-col-lg8 layui-col-md-offset2">
<center style = "margin-bottom:2em;"><h1>安装完成!(3/3)</h1></center>
<!-- 安装完成 -->
<div style = "text-align:center;">
<div class="layui-btn-group">
<a href="/" class="layui-btn">返回首页</a>
<a href="/user/login" class="layui-btn">登录后台</a>
<a class="layui-btn" href="https://doc.xiaoz.me/#/imgurl/">查看帮助文档</a>
<a class="layui-btn" href="https://dwz.ovh/imgurl" rel = "nofollow" target = "_blank">打赏支持</a>
</div>
</div>
<!-- 安装完成END -->
</div>
</div>
</div>

23
application/views/user/login.php

@ -0,0 +1,23 @@
<!-- 内容部分 -->
<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 -->

106
application/views/user/multiple.php

@ -0,0 +1,106 @@
<div class="layui-container" style = "">
<div class="layui-row">
<!-- 首页主要区域 -->
<div class="layui-col-lg12">
<div id="main">
<div class="alert alert-warning" role="alert">
<span class="alert-inner--icon"><i class="layui-icon"></i></span>
<span class="alert-inner--text"><strong>注意:</strong>游客限制每日上传10张,单张图片不能超过5M,上传的图片将公开显示,使用之前请先阅读《<a href="/page/use">使用协议</a></span>
</div>
<!-- 上传区域 -->
<div class="layui-form-item">
<div class="layui-upload-drag" id="multiple">
<i class="layui-icon layui-icon-upload"></i>
<p>点击这里可选择多张图片,支持拖拽。</p>
</div>
</div>
<!-- 上传区域END -->
</div>
</div>
<!-- 多图上传结果 -->
<div class="layui-col-lg12" id = "multiple-re">
<div class="layui-tab layui-tab-brief">
<ul class="layui-tab-title">
<li class="layui-this">URL</li>
<li>HTML</li>
<li>Markdown</li>
<li>BBCode</li>
</ul>
<div class="layui-tab-content" style="height: 100px;">
<!-- 第一个选显卡结果 -->
<div class="layui-tab-item layui-show" id = "re-url">
<pre></pre>
</div>
<!-- 返回HTML结果 -->
<div class="layui-tab-item" id = "re-html">
<pre></pre>
</div>
<!-- 返回Markdown结果 -->
<div class="layui-tab-item" id = "re-md">
<pre></pre>
</div>
<!-- 返回BBCode结果 -->
<div class="layui-tab-item" id = "re-bbc">
<pre></pre>
</div>
</div>
</div>
</div>
<!-- 多图上传结果END -->
<!-- 首页主要区域END -->
</div>
</div>
<!--Ctrl + V粘贴上传-->
<script src = "/static/js/PasteUpload.js"></script>
<script>
var load1 = document.querySelector("#upimg");
// 实例化即可
new ctrlVUtil({
uploadUrl: "/upload/parse",
targetElement: load1,
isCompleteImg:false,
data:{
name:"alanzhang",
},
success:function(data){
//转为对象
var res = data;
//上传成功
if(res.code == 200){
layer.closeAll('loading');
//layer.closeAll('loading');
$("#img-thumb a").attr('href','/img/' + res.imgid);
$("#img-thumb img").attr('src',res.thumbnail_url);
$("#url").val(res.url);
$("#html").val("<img src = '" + res.url + "' />");
$("#markdown").val("![](" + res.url + ")");
$("#bbcode").val("[img]" + res.url + "[/img]");
$("#imgshow").show();
//对图片进行鉴黄识别
$.get("/deal/identify/" + res.id,function(data,status){
var re = JSON.parse(data);
//状态码为400,说明该图片存在异常
if(re.code == 400){
layer.open({
title: '警告!'
,content: '您的IP已被记录,请不要上传违规图片!'
});
}
else{
console.log(re.code);
}
});
}
else{
layer.msg(res.msg);
}
},
error: function(error){
layer.closeAll('loading');
layer.msg('上传失败!');
}
});
</script>
<!--粘贴上传END-->

19
application/views/user/page.php

@ -0,0 +1,19 @@
<div class="layui-container" style = "margin-top:2em;margin-bottom:4em;">
<div class="layui-row layui-col-space18">
<div class="layui-col-lg9">
<div class = "htmlcontent"><?php echo $content; ?></div>
</div>
<div class="layui-col-lg3">
<div id="page-sidebar">
<div class = "sidebar">
<a href="https://e.aiguobit.com/?from=xiaoz" target="_blank" rel="nofollow noopener"><img class="alignnone size-full wp-image-6279" src="https://www.xiaoz.me/wp-content/uploads/2017/06/netssocks_300.png" /></a>
</div>
<div class = "sidebar">
<a href="https://www.xiaoz.me/laoxue" target="_blank" rel="nofollow">
<img src = 'https://i.bmp.ovh/imgs/2018/12/17d94aafd02d1fbd.png' />
</a>
</div>
</div>
</div>
</div>
</div>

89
application/views/welcome_message.php

@ -0,0 +1,89 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
<style type="text/css">
::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#body {
margin: 0 15px 0 15px;
}
p.footer {
text-align: right;
font-size: 11px;
border-top: 1px solid #D0D0D0;
line-height: 32px;
padding: 0 10px 0 10px;
margin: 20px 0 0 0;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}
</style>
</head>
<body>
<div id="container">
<h1>Welcome to CodeIgniter!</h1>
<div id="body">
<p>The page you are looking at is being generated dynamically by CodeIgniter.</p>
<p>If you would like to edit this page you'll find it located at:</p>
<code>application/views/welcome_message.php</code>
<p>The corresponding controller for this page is found at:</p>
<code>application/controllers/Welcome.php</code>
<p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a href="user_guide/">User Guide</a>.</p>
</div>
<p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds. <?php echo (ENVIRONMENT === 'development') ? 'CodeIgniter Version <strong>' . CI_VERSION . '</strong>' : '' ?></p>
</div>
</body>
</html>

2
data/.htaccess

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

BIN
data/imgurl-simple.db3

Binary file not shown.

0
data/index.html

39
data/pages/readme.md

@ -0,0 +1,39 @@
# zdir
使用PHP开发的目录列表程序
![](https://imgurl.org/upload/1806/349f3b54028d58d6.png)
### 使用方法
* 下载源码放到站点根目录
* 修改`config.php`设置自己的网站标题/关键词/描述
* 如果需要排除某个目录,再次修改`config.php` ,里面有说明
* 更多说明请查看帮助文档:[https://doc.xiaoz.me/docs/zdir](https://doc.xiaoz.me/docs/zdir)
### 主要功能
* 目录浏览
* MarkDown文件预览
* CSS/JavaScript一键复制
* 文件hash
* 图片预览
* 视频播放(仅支持mp4格式)
* 文本查看器(支持的格式有.txt .sh .py .go .c .cpp)
* 文件索引
* 二维码生成
* 文件删除
* 详细说明请访问: [Zdir 实用的目录列表程序](https://www.xiaoz.me/archives/10465)
### 注意事项
* ~~不要使用中文命名目录/文件,否则可能发生不可预料的错误。~~
* 2018.08.30 已解决中文命名问题(仅在Linux下做过测试)
### Demo
* [http://soft.xiaoz.org/](http://soft.xiaoz.org/)
### 获取捐赠版
扫描下方二维码,并留言您的网址可获取捐赠版,捐赠版可去除底部版权。
![](https://imgurl.org/upload/1712/cb349aa4a1b95997.png)
### 联系我
* Blog:[https://www.xiaoz.me/](https://www.xiaoz.me/)
* QQ:337003006

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

Loading…
Cancel
Save