幻想领域1.2
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
|
@ -0,0 +1,41 @@
|
|||
# 幻想领域
|
||||
|
||||
[哇塞,终于有一款属于自己的图床了.](http://www.52ecy.cn/post-68.html "幻想领域")
|
||||
|
||||
幻想领域是使用 PHP 语言开发的一款轻量级的新浪图床系统.
|
||||
|
||||
它的诞生,并不是最终的解决方案,开发它的目的是为了方便自己使用.
|
||||
|
||||
|
||||
|
||||
# 系统介绍
|
||||
|
||||
在 幻想领域中, 图床图片全部托管在 新浪云, 每张图片都有多张不同级别的缩略图.这便是幻想领域的最大特色之一.
|
||||
|
||||
拥有较为完善的用户系统与管理员系统。管理员在后台拥有完全权限,对网站的一切基本配置
|
||||
|
||||
我的图库,将会罗列出用户自己所上传的所有图片,管理员则显示系统托管的所有图片.你可以在这里对图片进行删除、预览或者复制它,但删除仅仅只是不再出现在本系统中,图片仍然是存在于新浪之上,这点你是要知道的.
|
||||
|
||||
探索,它是前台对用户图片预览的功能,在这里你可以发现和找到你需要的东西.如果你不需要它,可以在后台进行关闭设置.
|
||||
|
||||
上传新浪图床并非无要求,它需要你进行登录验证,但我们拥有一套独立的新浪登录程序,不依赖任何扩展,并且无验证码,cookie过期将自动为你进行登录,为你解决一切后顾之忧,所以你必须在后台设置你的新浪账号密码才能正常使用.
|
||||
|
||||
|
||||
# 安装
|
||||
|
||||
你需要将幻想领域的源代码解压缩并上传至网站根目录,访问网站域名会自动跳转到安装程序,根据向导提示安装即可。如果未跳转,请手动访问http://您的域名/install.php 进行安装
|
||||
|
||||
首次安装成功后需要登录管理员后台对图床进行一些基本配置,才能使用
|
||||
|
||||
后台地址:http://您的域名/admin 但是讽刺的是,您需要在前台进行登录
|
||||
|
||||
|
||||
## 环境支持
|
||||
|
||||
> 请注意,幻想领域自1.0版本起只支持PHP版本≥5.6,请注意更新您的PHP版本。
|
||||
|
||||
|
||||
|
||||
|
||||

|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?php return array(
|
||||
#===========网站开关================
|
||||
'register' => 'y', //注册
|
||||
'tourist' => 'n', //游客
|
||||
'verification' => 'n', //注册验证
|
||||
'explore' => 'y', //探索
|
||||
'limitip' => '1', //注册数量
|
||||
#===========网站基本配置============
|
||||
'title' => '幻想领域', //站点标题
|
||||
'siteinfo' => '', //站点副标题
|
||||
'keywords' => '', //站点关键字
|
||||
'description' => '', //站点描述
|
||||
'record' => '', //备案号
|
||||
'footerinfo' => '', //底部信息
|
||||
#===========新浪图床配置============
|
||||
'username' => '', //新浪账号
|
||||
'password' => '', //新浪密码
|
||||
'cookie' => 'SUB=', //新浪cookie
|
||||
'time' => '1522805636',
|
||||
'level' => '7', //探索缩略图级别0-7
|
||||
#===========email邮箱配置============
|
||||
'host' => 'smtp.163.com', //发信服务器
|
||||
'port' => '25', //服务器端口
|
||||
'auth' => '', // 登录账号
|
||||
'user' => '', // 账号
|
||||
'pass' => '', // 密码
|
||||
'etime' => '12', //验证码有效时间(小时)
|
||||
);
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
namespace application\controller\Admin;
|
||||
use framework\core\Controller;
|
||||
/**
|
||||
* 后台配置控制器
|
||||
*/
|
||||
class ConfigureController extends Controller{
|
||||
|
||||
public function __construct(){
|
||||
$this->checksession(true);
|
||||
}
|
||||
|
||||
// 显示后台配置界面
|
||||
public function IndexAction(){
|
||||
$this->display('application/view/Admin/header.php');
|
||||
$this->display('application/view/Admin/configure.php');
|
||||
$this->display('application/view/Admin/footer.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置数据
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function DataAction(){
|
||||
$data = array(
|
||||
'register' => configGet('register'), //注册
|
||||
'tourist' => configGet('tourist'), //游客
|
||||
'verification' => configGet('verification'), //注册验证
|
||||
'explore' => configGet('explore'),
|
||||
'limitip' => configGet('limitip'),
|
||||
'title' => configGet('title'),
|
||||
'siteinfo' => configGet('siteinfo'),
|
||||
'keywords' => configGet('keywords'),
|
||||
'description' => configGet('description'),
|
||||
'record' => configGet('record'),
|
||||
'footerinfo' => htmlspecialchars_decode(configGet('footerinfo')),
|
||||
'username' => configGet('username'),
|
||||
'password' => configGet('password'),
|
||||
'level' => configGet('level'),
|
||||
'user' => configGet('user'),
|
||||
'pass' => configGet('pass'),
|
||||
'etime' => configGet('etime')
|
||||
);
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改配置数据
|
||||
*/
|
||||
public function UpdateAction(){
|
||||
$data = [
|
||||
#===========网站开关================
|
||||
'register' => isset($_POST['register']) ? 'y' : 'n', //注册
|
||||
'tourist' => isset($_POST['tourist']) ? 'y' : 'n', //游客
|
||||
'verification' => isset($_POST['verification']) ? 'y' : 'n', //注册验证
|
||||
'explore' => isset($_POST['explore']) ? 'y' : 'n', //探索
|
||||
'limitip' => isset($_POST['limitip']) ? $_POST['limitip'] : '1',
|
||||
#===========网站基本配置============
|
||||
'title' => isset($_POST['title']) ? $_POST['title'] : '幻想领域', //站点标题
|
||||
'siteinfo' => isset($_POST['siteinfo']) ? $_POST['siteinfo'] : '', //站点副标题
|
||||
'keywords' => isset($_POST['keywords']) ? $_POST['keywords'] : '二次元图片,新浪图床,幻想领域,阿珏博客', //站点关键字
|
||||
'description' => isset($_POST['description']) ? $_POST['description'] : '', //站点描述
|
||||
'record' => isset($_POST['record']) ? $_POST['record'] : '', //备案号
|
||||
'footerinfo' => isset($_POST['footerinfo']) ? $_POST['footerinfo'] : '', //底部信息
|
||||
#===========新浪图床配置============
|
||||
'username' => isset($_POST['username']) ? $_POST['username'] : '', //新浪账号
|
||||
'password' => isset($_POST['password']) ? $_POST['password'] : '', //新浪密码
|
||||
'time' => time()-3600*24,
|
||||
'level' => isset($_POST['level']) ? $_POST['level'] : '4', //探索缩略图级别0-7
|
||||
#===========email邮箱配置============
|
||||
'auth' => isset($_POST['user']) ? $_POST['user'] : '', // 登录账号
|
||||
'user' => isset($_POST['user']) ? $_POST['user'] : '', // 账号
|
||||
'pass' => isset($_POST['pass']) ? $_POST['pass'] : '', // 密码
|
||||
'etime' => isset($_POST['etime']) ? $_POST['etime'] : '12', //验证码有效时间(小时)
|
||||
];
|
||||
echo configSet($data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
namespace application\controller\Admin;
|
||||
use framework\core\Controller;
|
||||
use framework\core\Factory;
|
||||
use framework\libraries\Autoupdate;
|
||||
|
||||
/**
|
||||
* 后台首页控制器
|
||||
*/
|
||||
class IndexController extends Controller{
|
||||
|
||||
public function __construct(){
|
||||
$this->checksession();
|
||||
}
|
||||
|
||||
// 显示后台首页
|
||||
public function IndexAction(){
|
||||
if ($_SESSION['authen']['role']) {
|
||||
$result = Factory::M('IndexModel');
|
||||
if (function_exists("imagecreate")) {
|
||||
if (function_exists('gd_info')) {
|
||||
$ver_info = gd_info();
|
||||
$gd_ver = $ver_info['GD Version'];
|
||||
} else{
|
||||
$gd_ver = '支持';
|
||||
}
|
||||
} else{
|
||||
$gd_ver = '不支持';
|
||||
}
|
||||
$this->assign('prefix',$result->getPrefix());
|
||||
$this->assign('gd_ver',$gd_ver);
|
||||
$this->assign('version',$result->getVersion());
|
||||
}else{
|
||||
$res = Factory::M('UserModel')->user_fetch($_SESSION['authen']['uid']);
|
||||
$this->assign('ip',$res['ip']);
|
||||
$this->assign('time',date('Y-m-d H:i:s',$res['time']));
|
||||
$this->assign('email',$res['email']);
|
||||
$this->assign('count',Factory::M('PicModel')->pic_count('WHERE uid= '.$_SESSION['authen']['uid']));
|
||||
}
|
||||
$this->assign('username',$_SESSION['authen']['role']=='admin'?'管理员':$_SESSION['authen']['username']);
|
||||
$this->display('application/view/Admin/header.php');
|
||||
$this->display('application/view/Admin/index.php');
|
||||
$this->display('application/view/Admin/footer.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新程序
|
||||
*/
|
||||
public function UpdateAction(){
|
||||
$update = new Autoupdate(APP_PATH,false);
|
||||
$update->currentVersion = APP_VERSION;
|
||||
$update->updateUrl = 'https://img.52ecy.cn/service/'; //幻想领域服务域名
|
||||
$latest = $update->checkUpdate();
|
||||
if ($latest !== false) {
|
||||
if ($latest > $update->currentVersion) {
|
||||
if ($update->update()) {
|
||||
if($update->replaceupdate()){
|
||||
$res=['code'=>'0000','msg'=>'更新成功,欢迎体验最新的幻想领域系统^_^'];
|
||||
}else{
|
||||
$res=['code'=>'0004','msg'=>'更新文件效验失败!'];
|
||||
}
|
||||
}else {
|
||||
$res=['code'=>'0002','msg'=>'在线更新失败,请尝试手动更新!信息:'.$update->getLastError()];
|
||||
}
|
||||
}else {
|
||||
$res=['code'=>'0001','msg'=>'没有发现可用的新版本!'];
|
||||
}
|
||||
} else {
|
||||
$res=['code'=>'0003','msg'=>$update->getLastError()];
|
||||
}
|
||||
echo json_encode($res);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
<?php
|
||||
namespace application\controller\Admin;
|
||||
use framework\core\Controller;
|
||||
use framework\core\Factory;
|
||||
/**
|
||||
* 导航栏控制器
|
||||
*/
|
||||
class NavbarController extends Controller{
|
||||
|
||||
public function __construct(){
|
||||
$this->checksession(true);
|
||||
}
|
||||
|
||||
//显示导航页面
|
||||
public function IndexAction(){
|
||||
$this->display('application/view/Admin/header.php');
|
||||
$this->display('application/view/Admin/navbar.php');
|
||||
$this->display('application/view/Admin/footer.php');
|
||||
}
|
||||
|
||||
//添加导航界面
|
||||
public function NavbaraddAction(){
|
||||
$this->display('application/view/Admin/navbaradd.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导航栏信息
|
||||
*/
|
||||
public function QueryAction(){
|
||||
$key = isset($_GET['key']) ? 'WHERE naviname=\''.$_GET['key'].'\' || url=\''.$_GET['key'].'\'' : '';
|
||||
$limit = isset($_GET['limit']) ? $_GET['limit'] : '10';
|
||||
$page = isset($_GET['page']) ? ($_GET['page'] - 1) * $limit : '0';
|
||||
$res = Factory::M('NavbarModel');
|
||||
$result = $res->navbar_queryAll($page,$limit,$key);
|
||||
$data = array();
|
||||
foreach ($result as $value) {
|
||||
$data[] = array(
|
||||
"navbarId" => $value['id'],
|
||||
"navbarName" => $value['naviname'],
|
||||
"navbarHide" => $value['hide']=='y'? 'checked':'',
|
||||
"navbarUrl" => $value['url'],
|
||||
"icon" => $value['icon']
|
||||
);
|
||||
}
|
||||
$data = array(
|
||||
'code' => '0',
|
||||
'msg' => '',
|
||||
'count' => $res->navbar_count(),
|
||||
'data' => $data
|
||||
);
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除导航
|
||||
*/
|
||||
public function DelAction(){
|
||||
$navbarsId = isset($_POST['navbarsId']) ? $_POST['navbarsId'] : '';
|
||||
if ($navbarsId != '') {
|
||||
if (is_array($navbarsId)) {
|
||||
$navbarsId = implode(',',$navbarsId);
|
||||
}
|
||||
$result = Factory::M('NavbarModel');
|
||||
if($result->navbar_del($navbarsId)){
|
||||
echo '删除成功';
|
||||
}else{
|
||||
echo '删除失败';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示或隐藏一个导航
|
||||
*/
|
||||
public function HideAction(){
|
||||
$id = isset($_POST['id']) ? $_POST['id'] : '';
|
||||
$hide = isset($_POST['hide']) ? $_POST['hide'] : '';
|
||||
if ($id != '' && $hide != '') {
|
||||
$result = Factory::M('NavbarModel');
|
||||
if($result->navbar_hide($id,$hide)){
|
||||
echo '成功';
|
||||
}else{
|
||||
echo '失败';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加或修改一个导航
|
||||
*/
|
||||
public function AddAction(){
|
||||
$navbarId = isset($_POST['navbarId']) ? $_POST['navbarId'] : '';
|
||||
$navbarName = isset($_POST['navbarName']) ? $_POST['navbarName'] : '';
|
||||
$navbarUrl = isset($_POST['navbarUrl']) ? $_POST['navbarUrl'] : '';
|
||||
$navbarIcon = isset($_POST['navbarIcon']) ? $_POST['navbarIcon'] : '';
|
||||
$navbarHide = isset($_POST['navbarHide']) ? $_POST['navbarHide'] : 'n';
|
||||
if ($navbarName != '' && $navbarUrl != '') {
|
||||
$res = Factory::M('NavbarModel');
|
||||
if ($navbarId != '') {
|
||||
echo $res->navbar_update($navbarName,$navbarUrl,$navbarHide,$navbarIcon,$navbarId);
|
||||
}else{
|
||||
echo $res->navbar_add($navbarName,$navbarUrl,$navbarHide,$navbarIcon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
namespace application\controller\Admin;
|
||||
use framework\core\Controller;
|
||||
use framework\core\Factory;
|
||||
/**
|
||||
* 图库控制器
|
||||
*/
|
||||
class PicController extends Controller{
|
||||
|
||||
public function __construct(){
|
||||
$this->checksession();
|
||||
}
|
||||
|
||||
// 显示后台我的图库界面
|
||||
public function IndexAction(){
|
||||
$this->display('application/view/Admin/header.php');
|
||||
$this->display('application/view/Admin/pic.php');
|
||||
$this->display('application/view/Admin/footer.php');
|
||||
}
|
||||
|
||||
//查询我的图库信息
|
||||
public function QueryAction(){
|
||||
$res = Factory::M('PicModel');
|
||||
$key = isset($_GET['key']) ? 'WHERE (pid=\''.$_GET['key'].'\' || username=\''.$_GET['key'].'\')' : '';
|
||||
if ($_SESSION['authen']['role'] != 'admin') {
|
||||
$key .= $key == '' ? ' WHERE' : ' and';
|
||||
$key .= ' pic.uid = \'' . $_SESSION['authen']['uid'] .'\'';
|
||||
}
|
||||
$limit = isset($_GET['limit']) ? $_GET['limit'] : '10';
|
||||
$page = isset($_GET['page']) ? ($_GET['page'] - 1) * $limit : '0';
|
||||
$result = $res->pic_query($page,$limit,$key);
|
||||
$data = array();
|
||||
foreach ($result as $value) {
|
||||
$data[] = array(
|
||||
"picId" => $value['id'],
|
||||
"picpid" => $value['pid'],
|
||||
"picuid" => $value['username']!=''? $value['username'] : '游客',
|
||||
"picip" => $value['ip'],
|
||||
"picdate" => date('Y-m-d H:i:s',$value['date'])
|
||||
);
|
||||
}
|
||||
$data = array(
|
||||
'code' => '0',
|
||||
'msg' => '',
|
||||
'count' => $res->pic_count('WHERE uid = \''.$_SESSION['authen']['uid'].'\''),
|
||||
'data' => $data
|
||||
);
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图片
|
||||
*/
|
||||
public function DelAction(){
|
||||
$picId = isset($_POST['picId']) ? $_POST['picId'] : '';
|
||||
if ($picId != '') {
|
||||
if (is_array($picId)) {
|
||||
$picId = implode(',',$picId);
|
||||
}
|
||||
$result = Factory::M('PicModel');
|
||||
if($result->pic_del($picId)){
|
||||
echo '删除成功';
|
||||
}else{
|
||||
echo '删除失败';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
namespace application\controller\Admin;
|
||||
use framework\core\Controller;
|
||||
use framework\core\Factory;
|
||||
/**
|
||||
* 用户控制器
|
||||
*/
|
||||
class UserController extends Controller{
|
||||
|
||||
public function __construct(){
|
||||
$this->checksession(true);
|
||||
}
|
||||
|
||||
// 显示后台用户管理界面
|
||||
public function IndexAction(){
|
||||
$this->display('application/view/Admin/header.php');
|
||||
$this->display('application/view/Admin/user.php');
|
||||
$this->display('application/view/Admin/footer.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户列表
|
||||
*/
|
||||
public function QueryAction(){
|
||||
$res = Factory::M('UserModel');
|
||||
$key = isset($_GET['key']) ? 'WHERE username=\''.$_GET['key'].'\' || email=\''.$_GET['key'].'\'' : '';
|
||||
$limit = isset($_GET['limit']) ? $_GET['limit'] : '10';
|
||||
$page = isset($_GET['page']) ? ($_GET['page'] - 1) * $limit : '0';
|
||||
$result = $res->user_queryAll($page,$limit,$key);
|
||||
$data = array();
|
||||
foreach ($result as $value) {
|
||||
if ($value['activation'] == 'n' && $value['role'] != 'admin' ) {
|
||||
$userStatus = '未激活';
|
||||
}else if($value['isseal'] == 'y'){
|
||||
$userStatus = '限制使用';
|
||||
}else{
|
||||
$userStatus = '正常使用';
|
||||
}
|
||||
$data[] = array(
|
||||
"usersId" => $value['uid'],
|
||||
"userName" => $value['username'],
|
||||
"userEmail" => $value['email'],
|
||||
"userIp" => $value['ip'],
|
||||
"userStatus" => $userStatus,
|
||||
"userGrade" => $value['role'] == 'admin' ? '超级管理员' : '普通用户',
|
||||
"userEndTime" => date('Y-m-d H:i:s',$value['time'])
|
||||
);
|
||||
}
|
||||
$data = array(
|
||||
'code' => '0',
|
||||
'msg' => '',
|
||||
'count' => $res->user_count(),
|
||||
'data' => $data
|
||||
);
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
public function DelAction(){
|
||||
$usersId = isset($_POST['usersId']) ? $_POST['usersId'] : '';
|
||||
if ($usersId != '') {
|
||||
if (is_array($usersId)) {
|
||||
$usersId = implode(',',$usersId);
|
||||
}
|
||||
$result = Factory::M('UserModel');
|
||||
if($result->user_del($usersId)){
|
||||
echo '删除成功';
|
||||
}else{
|
||||
echo '删除失败';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用或禁用一个用户
|
||||
*/
|
||||
public function DisableAction(){
|
||||
$uid = isset($_POST['uid']) ? $_POST['uid'] : '';
|
||||
$seal = isset($_POST['seal']) ? $_POST['seal'] : '';
|
||||
if ($uid != '' && $seal != '') {
|
||||
$result = Factory::M('UserModel');
|
||||
if($result->user_seal($uid,$seal)){
|
||||
echo '成功';
|
||||
}else{
|
||||
echo '失败';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
namespace application\controller\Admin;
|
||||
use framework\core\Controller;
|
||||
use framework\core\Factory;
|
||||
use framework\libraries\Upload;
|
||||
/**
|
||||
* 个人中心控制器
|
||||
*/
|
||||
class UserinfoController extends Controller{
|
||||
|
||||
public function __construct(){
|
||||
$this->checksession();
|
||||
}
|
||||
|
||||
// 显示个人中心
|
||||
public function IndexAction(){
|
||||
$this->display('application/view/Admin/header.php');
|
||||
$this->display('application/view/Admin/userinfo.php');
|
||||
$this->display('application/view/Admin/footer.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传头像
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function UploadAction(){
|
||||
if (isset($_FILES['file'])) {
|
||||
$upload = new Upload('file','upload/original','jpg,png,gif,bmp,jpeg');
|
||||
$result = $upload->run('1024000',false,'uid_'.$_SESSION['authen']['uid']);
|
||||
if(is_array($result)){
|
||||
if($result[0]['error'] == '0'){
|
||||
resizeImage('upload/original/'.$result[0]['name'],'upload/'.'uid_'.$_SESSION['authen']['uid'].'.jpg',200,200);
|
||||
$res = Factory::M('UserModel');
|
||||
$res->user_photo('uid_'.$_SESSION['authen']['uid'].'.jpg',$_SESSION['authen']['uid']);
|
||||
echo json_encode(['code'=>'0','src'=> PATH_URL . 'upload/'.$result[0]['name']]);
|
||||
}else{
|
||||
echo json_encode(['code' => $result[0]['error'],'msg' => Upload::getErrorText($result[0]['error'])]);
|
||||
}
|
||||
}else{
|
||||
echo json_encode(['code' => '8','msg' => $result]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资料
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function UpdateAction(){
|
||||
$username = isset($_POST['username']) ? $_POST['username'] : '';
|
||||
$pwd = isset($_POST['pwd']) ? $_POST['pwd'] : '';
|
||||
$password = isset($_POST['password']) ? $_POST['password'] : '';
|
||||
if ($username != '' && $pwd != '' && $password != '') {
|
||||
$result = Factory::M('UserModel');
|
||||
if (!$result->user_isexis($username,$_SESSION['authen']['uid'])) {
|
||||
if($result->user_pass($_SESSION['authen']['uid'])['password']==md5($pwd)){
|
||||
if($result->user_modify($username,md5($password),$_SESSION['authen']['uid'])){
|
||||
echo '资料修改成功,请退出重新登录!';
|
||||
unset($_SESSION['authen']);
|
||||
session_destroy();
|
||||
if(isset($_COOKIE[session_name()])) {
|
||||
setCookie(session_name(), "", time()-42000, "/");
|
||||
}
|
||||
}else{
|
||||
echo '出于不可抗力的因素,导致你的资料修改失败le~';
|
||||
}
|
||||
}else{
|
||||
echo '旧密码不符合!';
|
||||
}
|
||||
}else{
|
||||
echo '用户名已存在!';
|
||||
}
|
||||
}else{
|
||||
echo '参数有误!';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人中心资料查询
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function DataAction(){
|
||||
$res = Factory::M('UserModel')->user_fetch($_SESSION['authen']['uid']);
|
||||
$data = [
|
||||
'username' => $res['username'],
|
||||
'role' => $res['role']=='admin' ? '超级管理员' : '普通用户',
|
||||
'time' => date('Y-m-d H:i:s',$res['time']),
|
||||
'ip' => $res['ip'],
|
||||
'photo' => $res['photo'] == '' ? PATH_URL . 'application/view/Admin/images/author.jpg' : PATH_URL . 'upload/' .$res['photo'],
|
||||
'email' => $res['email']
|
||||
];
|
||||
echo json_encode($data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
<?php
|
||||
namespace application\controller\Home;
|
||||
use framework\core\Controller;
|
||||
use framework\core\Factory;
|
||||
use framework\libraries\code\ValidateCode;
|
||||
use framework\libraries\phpmail\Mail;
|
||||
/**
|
||||
* 用户控制器,负责用户的注册登录
|
||||
*/
|
||||
class UserController extends Controller{
|
||||
|
||||
// 登录验证
|
||||
public function LoginAction(){
|
||||
$username = isset($_POST['username']) ? $_POST['username'] : '';
|
||||
$password = isset($_POST['password']) ? $_POST['password'] : '';
|
||||
$verifycode = isset($_POST['verifycode']) ? $_POST['verifycode'] : '';
|
||||
if($username != '' && $password != '' && $verifycode != ''){
|
||||
if($this->VerifyAction()){
|
||||
$mysqli = Factory::M('UserModel');
|
||||
if($result = $mysqli->user_query($username,md5($password))){
|
||||
if ($result['role'] == 'admin') {
|
||||
$res=['code'=>'0000','username'=>$username,'msg'=>'欢迎回来,管理员!'];
|
||||
$_SESSION['authen'] = ['uid'=>$result['uid'],'username'=>$result['username'],'role'=>'admin'];
|
||||
}elseif (configGet('verification')=='y' && $result['activation'] == 'n') {
|
||||
$res=['code'=>'0004','username'=>$username,'msg'=>'当前账号未激活!'];
|
||||
}elseif ($result['isseal'] == 'y') {
|
||||
$res=['code'=>'0005','username'=>$username,'msg'=>'您的账号已被管理员禁止登录!'];
|
||||
}else{
|
||||
$res=['code'=>'0000','username'=>$username,'msg'=>'登录成功,欢迎回来!'];
|
||||
$_SESSION['authen'] = ['uid'=>$result['uid'],'username'=>$result['username'],'role'=>''];
|
||||
}
|
||||
}else{
|
||||
$res=['code'=>'0001','msg'=>'用户名或密码错误!'];
|
||||
}
|
||||
}else{
|
||||
$res=['code'=>'0002','msg'=>'您输入的验证码有误!'];
|
||||
}
|
||||
}else{
|
||||
$res=['code'=>'0003','msg'=>'提交参数有误!'];
|
||||
}
|
||||
echo json_encode($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户退出
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function LogoutAction(){
|
||||
unset($_SESSION['authen']);
|
||||
session_destroy();
|
||||
if(isset($_COOKIE[session_name()])) {
|
||||
setCookie(session_name(), "", time()-42000, "/");
|
||||
}
|
||||
Msg('安全退出!');
|
||||
}
|
||||
|
||||
// 接收注册信息
|
||||
public function DoregisterAction(){
|
||||
if(configGet('register') == 'n') Msg('网站已关闭对外注册!','error');
|
||||
$r_password = isset($_POST['password']) ?$_POST['password'] :'';
|
||||
$r_user_name = isset($_POST['username']) ? $_POST['username'] : '';
|
||||
$r_email = isset($_POST['email']) ? $_POST['email'] : '';
|
||||
if ($r_email != '' && $r_email != '' && $r_user_name != '') {
|
||||
if(checkMail($r_email) && checkPass($r_password) && checkNmae($r_user_name)){
|
||||
$mysqli = Factory::M('UserModel');
|
||||
if ($mysqli->user_limitip(getIp())< configGet('limitip')) {
|
||||
$activation = $mysqli->hasUserEmail($r_user_name,$r_email);
|
||||
if (!$activation['activation']) {
|
||||
if (configGet('verification')=='y') {
|
||||
$token = md5($r_user_name.$r_email . time());
|
||||
$result = $mysqli->user_add($r_user_name,md5($r_password),time(),$r_email,$token,getIp());
|
||||
$res = $this->Activation($r_user_name,$r_email,$token);
|
||||
}else{ //不需要验证
|
||||
$result = $mysqli->user_add($r_user_name,md5($r_password),time(),$r_email,'',getIp());
|
||||
$res = ['code'=> '0000','msg'=>'注册成功!欢迎使用' . configGet('title')];
|
||||
}
|
||||
}elseif ($activation['activation'] == 'n' && configGet('verification')=='y') { //重新注册发邮件
|
||||
$token = md5($r_user_name.$r_email . time());
|
||||
$mysqli->user_update($r_user_name,md5($r_password),time(),$r_email,$token);
|
||||
$res = $this->Activation($r_user_name,$r_email,$token);
|
||||
}else{
|
||||
$res = ['code'=> '0001','msg'=>'用户名或邮箱已存在!' ];
|
||||
}
|
||||
}else{
|
||||
$res = ['code'=> '0004','msg'=>'当前ip注册数量已达最大上限!' ];
|
||||
}
|
||||
}else{
|
||||
$res = ['code'=> '0002','msg'=>'提交参数不合法!' ];
|
||||
}
|
||||
}else{
|
||||
$res = ['code'=> '0003','msg'=>'提交参数有误!' ];
|
||||
}
|
||||
echo json_encode($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送激活邮件
|
||||
* @param [type] $r_user_name 用户名
|
||||
* @param [type] $r_email 发送的邮箱地址
|
||||
* @param [type] $token 唯一标识符
|
||||
* @return [type] [description]
|
||||
*/
|
||||
private function Activation($r_user_name,$r_email,$token){
|
||||
$title = configGet('title');
|
||||
$etime = configGet('etime');
|
||||
$url = PATH_URL;
|
||||
$html = <<<EOT
|
||||
亲爱的 $r_user_name:<br><br>欢迎使用{$title}通行证!<br><br>请点击下面的链接完成邮箱验证:<br><br><a href="{$url}Home/User/ActivateAction/token/$token">{$url}Home/User/ActivateAction/token/$token</a><br>如果以上链接无法点击,请将该链接复制到浏览器(如 Chrome)的地址栏中访问,也可以成功完成邮箱验证!<br><br><br><br>1. 为了保障您账号的安全性, 请在{$etime}小时内完成验证, 此链接将在您激活过一次后失效!<br><br>2. 如您没有注册过{$title}账号, 请您忽略此邮件, 由此给您带来的不便敬请谅解。<br><br><br><br>- {$title}<br>(这是一封自动产生的Email,请勿回复)
|
||||
EOT;
|
||||
$Mail = new Mail($GLOBALS['appconfig']['host'],$GLOBALS['appconfig']['port'],$GLOBALS['appconfig']['auth'],$GLOBALS['appconfig']['user'],$GLOBALS['appconfig']['pass']);
|
||||
if($Mail->send($r_email,'注册成功,请激活!',$html,$title)){
|
||||
$res = ['code'=> '0000','msg'=>'注册成功,请前往邮箱激活!' ];
|
||||
}else{
|
||||
$res = ['code'=> '0004','msg'=>'激活邮件发送失败,请重新注册!' ];
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
// 生成验证码
|
||||
public function MakeCaptcAction(){
|
||||
$captcha = new ValidateCode();
|
||||
$captcha->Generate();
|
||||
}
|
||||
|
||||
// 检测验证码
|
||||
private function VerifyAction(){
|
||||
$verifycode = isset($_POST['verifycode']) ? $_POST['verifycode'] : '';
|
||||
if(ValidateCode::Verify($verifycode)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户激活
|
||||
*/
|
||||
public function ActivateAction(){
|
||||
$token = isset($_GET['token']) ? $_GET['token'] :'';
|
||||
if ($token!= '') {
|
||||
$mysqli = Factory::M('UserModel');
|
||||
if($mysqli->activate($token,time(),$GLOBALS['appconfig']['etime']*3600)){
|
||||
if($mysqli->user_activate($token)){
|
||||
Msg("激活成功!","success","感谢您注册");
|
||||
}else{
|
||||
Msg("激活失败,请重试!", "error","出于不可抗力因素,到账您的账号激活失败");
|
||||
}
|
||||
}else{
|
||||
Msg("激活链接无效或已过期!", "info","请返回页面重新注册");
|
||||
}
|
||||
}else{
|
||||
Msg("参数有误!", "error","请不要随意修改链接");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
namespace application\model;
|
||||
use framework\core\Model;
|
||||
/**
|
||||
* Index模型类
|
||||
*/
|
||||
class IndexModel extends Model{
|
||||
|
||||
/**
|
||||
* 返回数据库版本
|
||||
*/
|
||||
public function getVersion(){
|
||||
return $this->mysqli->getVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回数据表前缀
|
||||
*/
|
||||
public function getPrefix(){
|
||||
return $this->prefix;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
namespace application\model;
|
||||
use framework\core\Model;
|
||||
/**
|
||||
* 导航栏模型类
|
||||
*/
|
||||
class NavbarModel extends Model{
|
||||
|
||||
/**
|
||||
* 查询导航栏
|
||||
*/
|
||||
public function navbar_queryAll($page,$limit,$where=''){
|
||||
return $this->mysqli->fetchAll("SELECT * FROM {$this->prefix}navi $where limit $page, $limit");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导航栏数量
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function navbar_count(){
|
||||
return $this->mysqli->fetch("SELECT count(*) FROM {$this->prefix}navi")['count(*)'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示或隐藏导航
|
||||
*/
|
||||
public function navbar_hide($id,$hide = 'n'){
|
||||
return $this->mysqli->query("UPDATE {$this->prefix}navi SET hide = '{$hide}' WHERE id = '{$id}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除导航
|
||||
*/
|
||||
public function navbar_del($navbarids){
|
||||
return $this->mysqli->query("DELETE FROM {$this->prefix}navi WHERE id in($navbarids)");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改一个导航
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function navbar_update($navbarName,$navbarUrl,$navbarHide,$navbarIcon,$id){
|
||||
return $this->mysqli->query("UPDATE {$this->prefix}navi SET naviname = '{$navbarName}', url = '{$navbarUrl}', hide = '{$navbarHide}', icon = '{$navbarIcon}' WHERE id = '{$id}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加一个新导航
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function navbar_add($name,$url,$hide,$iocn){
|
||||
return $this->mysqli->query("INSERT INTO {$this->prefix}navi (`naviname`,`url`,`hide`,`icon`) values('{$name}','{$url}','{$hide}','$iocn')");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
namespace application\model;
|
||||
use framework\core\Model;
|
||||
/**
|
||||
* 图库模型类
|
||||
*/
|
||||
class PicModel extends Model{
|
||||
|
||||
/**
|
||||
* 保存上传成功的图片地址
|
||||
* 多条数据形式的字符串
|
||||
*/
|
||||
public function pic_add($values){
|
||||
return $this->mysqli->query("INSERT INTO {$this->prefix}pic (`pid`, `uid`, `date`,`ip`) values $values");
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机返回指定n张图片
|
||||
*/
|
||||
public function pic_rand($n){
|
||||
return $this->mysqli->fetchAll("SELECT * FROM {$this->prefix}pic order by rand() limit {$n}");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有图片信息
|
||||
* @param [type] $page [description]
|
||||
* @param [type] $limit [description]
|
||||
* @param string $where [description]
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function pic_query($page,$limit,$where=''){
|
||||
return $this->mysqli->fetchAll("SELECT pic.*, user.username as username FROM {$this->prefix}pic as pic LEFT JOIN {$this->prefix}user as user ON pic.uid = user.uid $where ORDER BY pic.date DESC limit $page, $limit");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有图片数量
|
||||
*/
|
||||
public function pic_count($where=''){
|
||||
return $this->mysqli->fetch("SELECT count(*) FROM {$this->prefix}pic $where")['count(*)'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除图片
|
||||
*/
|
||||
public function pic_del($ids){
|
||||
return $this->mysqli->query("DELETE FROM {$this->prefix}pic WHERE id in($ids)");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定图片详细信息
|
||||
* @param [type] $pid 图片pid
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function pic_details($pid){
|
||||
return $this->mysqli->fetch("SELECT pid,date,uid FROM {$this->prefix}pic WHERE pid = '{$pid}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询最新图片
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function pic_newest($page, $limit){
|
||||
return $this->mysqli->fetchAll("SELECT pid FROM {$this->prefix}pic ORDER BY id DESC limit {$page}, {$limit}");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
<?php
|
||||
namespace application\model;
|
||||
use framework\core\Model;
|
||||
/**
|
||||
* 用户模型类
|
||||
*/
|
||||
class UserModel extends Model{
|
||||
|
||||
/**
|
||||
* 插入一个用户
|
||||
* @param string $u 用户名
|
||||
* @param string $p 密码
|
||||
* @param string $m 注册时间
|
||||
* @param string $e 邮箱
|
||||
* @param string $t 唯一标识符
|
||||
* @param string $i ip地址
|
||||
* @return boot 成功返回true,失败返回false
|
||||
*/
|
||||
public function user_add($u,$p,$m,$e,$t,$i){
|
||||
return $this->mysqli->query("INSERT INTO {$this->prefix}user (`username`, `password`, `time`, `email`,`activatecode`,`ip`) values ('{$u}','{$p}','{$m}','{$e}','{$t}','{$i}')");
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册一个用户(重新发送邮件的)
|
||||
* @param string $u 用户名
|
||||
* @param string $p 密码
|
||||
* @param string $m 注册时间
|
||||
* @param string $e 邮箱
|
||||
* @param string $t 唯一标识符
|
||||
* @return boot 成功返回true,失败返回false
|
||||
*/
|
||||
public function user_update($u,$p,$m,$e,$t){
|
||||
return $this->mysqli->query("UPDATE {$this->prefix}user SET username = '{$u}', password = '{$p}', time = '{$m}', email = '{$e}', activatecode = '{$t}' WHERE (username = '{$u}' || email = '{$e}') and activation = 'n'");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户名或邮箱是否注册
|
||||
* @param string $u 用户名
|
||||
* @param string $e 邮箱
|
||||
* @return array/false 成功返回array,失败返回false
|
||||
*/
|
||||
public function hasUserEmail($u,$e){
|
||||
return $this->mysqli->fetch("SELECT activation FROM {$this->prefix}user WHERE username = '{$u}' || email = '{$e}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户状态是否正常
|
||||
* @param string $u 用户名和密码
|
||||
* @return boot 失败返回false,成功查询结果
|
||||
*/
|
||||
public function user_query($u,$p){
|
||||
return $this->mysqli->fetch("SELECT uid,username,role,isseal,activation FROM {$this->prefix}user WHERE username = '{$u}' and password = '{$p}'");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询激活码是否有效(存在并且没有过期)
|
||||
* @param string $t 唯一激活码
|
||||
* @param string $t 当前时间
|
||||
* @param string $t 有效时间
|
||||
* @return boot 成功返回true,失败false
|
||||
*/
|
||||
public function activate($token,$time,$etime){
|
||||
return $this->mysqli->fetch("SELECT 1 FROM {$this->prefix}user WHERE activatecode = '{$token}' and {$time} - time < {$etime}");
|
||||
}
|
||||
|
||||
/**
|
||||
* 激活用户
|
||||
* @param string $token 激活码
|
||||
* @return boot 成功返回true,失败返回false
|
||||
*/
|
||||
public function user_activate($token){
|
||||
return $this->mysqli->query("UPDATE {$this->prefix}user SET activation = 'y', activatecode = '' WHERE activatecode = '{$token}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* 按条件查询所有用户
|
||||
* @param string $page 查询页数
|
||||
* @param string $limit 查询数量
|
||||
* @param string $where 查询条件
|
||||
* @return array 成功返回array,失败返回false
|
||||
*/
|
||||
public function user_queryAll($page,$limit,$where=''){
|
||||
return $this->mysqli->fetchAll("SELECT uid,username,role,time,ip,isseal,email,activation FROM {$this->prefix}user $where limit $page, $limit");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有用户数量
|
||||
*/
|
||||
public function user_count(){
|
||||
return $this->mysqli->fetch("SELECT count(*) FROM {$this->prefix}user")['count(*)'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户
|
||||
*/
|
||||
public function user_del($userids){
|
||||
return $this->mysqli->query("DELETE FROM {$this->prefix}user WHERE uid in($userids) and role != 'admin'");
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用或禁用一个用户
|
||||
*/
|
||||
public function user_seal($uid,$seal = 'y'){
|
||||
return $this->mysqli->query("UPDATE {$this->prefix}user SET isseal = '{$seal}' WHERE uid = '{$uid}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定用户信息
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function user_fetch($uid){
|
||||
return $this->mysqli->fetch("SELECT username,role,time,ip,photo,email FROM {$this->prefix}user WHERE uid = '{$uid}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户密码
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function user_pass($uid){
|
||||
return $this->mysqli->fetch("SELECT password FROM {$this->prefix}user WHERE uid = '{$uid}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户资料
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function user_modify($user,$pwd,$uid){
|
||||
return $this->mysqli->query("UPDATE {$this->prefix}user SET username = '{$user}', password = '{$pwd}' WHERE uid = '{$uid}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户头像
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function user_photo($photo,$uid){
|
||||
return $this->mysqli->query("UPDATE {$this->prefix}user SET photo = '{$photo}' WHERE uid = '{$uid}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测除自己以外用户名是否存在
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function user_isexis($user,$uid){
|
||||
return $this->mysqli->fetch("SELECT 1 FROM {$this->prefix}user WHERE username = '{$user}' and uid != '{$uid}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回指定ip在24小时内的注册数量
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function user_limitip($ip){
|
||||
return $this->mysqli->fetch("SELECT count(*) FROM {$this->prefix}user WHERE ip = '{$ip}' and (unix_timestamp(now()) - time) < (3600*24)")['count(*)'];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
<?php if(!defined('APP_PATH')) {exit('error!');}?>
|
||||
<form class="layui-form">
|
||||
<table class="layui-table mag0">
|
||||
<colgroup>
|
||||
<col width="25%">
|
||||
<col width="45%">
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>参数名</th>
|
||||
<th>参数值</th>
|
||||
<th pc>参数说明</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>开启注册</td>
|
||||
<td><input type="checkbox" name="register" id="register" lay-filter="register" lay-skin="switch" lay-text="是|否"></td>
|
||||
<td pc>是否允许游客注册</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>游客上传</td>
|
||||
<td><input type="checkbox" name="tourist" id="tourist" lay-filter="tourist" lay-skin="switch" lay-text="是|否"></td>
|
||||
<td pc>是否允许游客上传,开启后游客将可以上传图片</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>开启注册验证</td>
|
||||
<td><input type="checkbox" name="verification" id="verification" lay-filter="verification" lay-skin="switch" lay-text="是|否"></td>
|
||||
<td pc>是否需要注册激活才能登录,开启后未激活账号将无法登陆</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>开启探索</td>
|
||||
<td><input type="checkbox" name="explore" id="explore" lay-filter="explore" lay-skin="switch" lay-text="是|否"></td>
|
||||
<td pc>是否开启探索界面</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>注册限制</td>
|
||||
<td><input type="text" class="layui-input limitip" lay-verify="number" placeholder="请输入注册数量"></td>
|
||||
<td pc>一个ip在24小时内允许注册的数量</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>站点标题</td>
|
||||
<td><input type="text" class="layui-input title" lay-verify="required" placeholder="请输入站点标题"></td>
|
||||
<td pc>你网站的名字</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>站点副标题</td>
|
||||
<td><input type="text" class="layui-input siteinfo" placeholder="请输入站点副标题"></td>
|
||||
<td pc>站点浏览器标题 = 站点标题 + 副标题</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>站点关键字</td>
|
||||
<td><input type="text" class="layui-input keywords" placeholder="请输入网站关键字"></td>
|
||||
<td pc>keywords</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>站点描述</td>
|
||||
<td><textarea placeholder="请输入网站描述" class="layui-textarea description"></textarea></td>
|
||||
<td pc>description</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>网站备案号</td>
|
||||
<td><input type="text" class="layui-input record" placeholder="请输入网站备案号"></td>
|
||||
<td pc>工信部备案号</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>首页底部信息</td>
|
||||
<td><textarea placeholder="请输入底部信息" class="layui-textarea footerinfo"></textarea></td>
|
||||
<td pc>支持html,可用于添加流量统计代码</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>新浪账号</td>
|
||||
<td><input type="text" class="layui-input username" lay-verify="required" placeholder="请输入新浪微博账号"></td>
|
||||
<td pc>需要登录才能上传图片到新浪图床</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>新浪密码</td>
|
||||
<td><input type="text" class="layui-input password" lay-verify="required" placeholder="请输入新浪微博密码"></td>
|
||||
<td pc>没有小号?<a href="tencent://AddContact/?fromId=45&fromSubId=1&subcmd=all&uin=1638211921">点我购买(全新4级账号,随机送会员)</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>缩略图级别</td>
|
||||
<td><input type="text" class="layui-input level" lay-verify="number" placeholder="请输入缩略图级别"></td>
|
||||
<td pc>探索界面缩略图级别(0-7)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>163邮箱账号</td>
|
||||
<td><input type="text" class="layui-input user" lay-verify="required" lay-verify="email" placeholder="请输入163邮箱账号"></td>
|
||||
<td pc>用于用户注册发送验证码使用</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>163邮箱密码</td>
|
||||
<td><input type="text" class="layui-input pass" lay-verify="required" placeholder="请输入163邮箱密码"></td>
|
||||
<td pc>没有小号?<a href="tencent://AddContact/?fromId=45&fromSubId=1&subcmd=all&uin=1638211921">点我购买(全新163账号,已开各种服务)</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>验证码有效时间</td>
|
||||
<td><input type="text" class="layui-input etime" lay-verify="number" placeholder="请输入验证码有效时间"></td>
|
||||
<td pc>注册验证码有效时间(小时)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="magt10 layui-right">
|
||||
<div class="layui-input-block" style="text-align: right;">
|
||||
<button class="layui-btn" lay-submit="" lay-filter="systemParameter">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript" src="<?php echo PATH_VIEW;?>Admin/js/basicParameter.js"></script>
|
|
@ -0,0 +1,66 @@
|
|||
<?php if(!defined('APP_PATH')) {exit('error!');}?>
|
||||
</div>
|
||||
<div class="layui-footer">
|
||||
欢迎使用 © <a href="<?php echo PATH_URL;?>" target="_black"><?php echo configGet('title');?></a><?php if($_SESSION['authen']['role'] == 'admin'):?> V<?php echo APP_VERSION;?> <a href="JavaScript:void(0);" id="update" version="<?php echo APP_VERSION;?>">检查更新</a><?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
<?php if($_SESSION['authen']['role'] == 'admin'):?>
|
||||
layui.use(['element','layer','jquery'],function(){
|
||||
var element = layui.element,
|
||||
layer = parent.layer === undefined ? layui.layer : top.layer,
|
||||
$ = layui.jquery;
|
||||
$(function(){
|
||||
$('#update').click(function(){
|
||||
var index = layer.msg('加载中,请稍候',{icon: 16,time:false});
|
||||
$.ajax({
|
||||
url: 'https://img.52ecy.cn/service/CheckUpdate.php',
|
||||
type: 'get',
|
||||
success: function(res){
|
||||
if($('#update').attr("version") < ReadErrIni('version',res)){
|
||||
layer.confirm('发现新版本,是否立即更新?', {
|
||||
btn: ['是', '否', '手动更新']
|
||||
,btn3: function(index, layero){
|
||||
window.open(ReadErrIni('url',res));
|
||||
}}, function(index, layero){
|
||||
index = layer.msg('系统正在更新,请稍待片刻...',{icon: 16,time:false});
|
||||
$.ajax({
|
||||
url: 'UpdateAction.html',
|
||||
type: 'get',
|
||||
dataType: 'json',
|
||||
success: function(res){
|
||||
if (res.code=='0000') {
|
||||
layer.open({title: '更新成功',icon: 6,content: res.msg});
|
||||
}else{
|
||||
layer.open({title: '更新失败',icon: 5,content: res.msg});
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}else{
|
||||
layer.open({
|
||||
title: '消息'
|
||||
,content: '当前使用的已经是最新版本!'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
layer.msg('检查更新失败,可能是网络问题造成的原因!', {icon: 5});
|
||||
}
|
||||
});
|
||||
layer.close(index);
|
||||
});
|
||||
})
|
||||
});
|
||||
function ReadErrIni(err,str){
|
||||
var reg=new RegExp("\\[1\\][\\s\\S]*?"+err+"\\s*=\\s*(.*)");
|
||||
return (str.match(reg) ||["",null])[1]
|
||||
}
|
||||
<?php else:?>
|
||||
layui.use('element',function(){
|
||||
var element = layui.element;
|
||||
})
|
||||
<?php endif;?>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,51 @@
|
|||
<?php if(!defined('APP_PATH')) {exit('error!');}?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title><?php echo $_SESSION['authen']['role'] == 'admin' ? '管理后台' : '用户中心'?> - <?php echo configGet('title');?></title>
|
||||
<link rel="icon" href="<?php echo PATH_VIEW;?>Home/images/favicon.ico">
|
||||
<link rel="stylesheet" href="<?php echo PATH_VIEW;?>Admin/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="<?php echo PATH_VIEW;?>Admin/style/main.css">
|
||||
<script src="<?php echo PATH_VIEW;?>Admin/layui/layui.js"></script>
|
||||
</head>
|
||||
<body class="layui-layout-body">
|
||||
<div class="layui-layout layui-layout-admin">
|
||||
<div class="layui-header">
|
||||
<div class="layui-logo"><?php echo configGet('title');echo $_SESSION['authen']['role'] == 'admin' ? '管理后台' : '用户中心';?></div>
|
||||
<ul class="layui-nav layui-layout-left">
|
||||
<li class="layui-nav-item"><a href="<?php echo PATH_URL;?>" target="_black">首页</a></li>
|
||||
</ul>
|
||||
<ul class="layui-nav layui-layout-right">
|
||||
<li class="layui-nav-item">
|
||||
<a href="javascript:;">
|
||||
<img src="<?php $src = is_file('upload/uid_'.$_SESSION['authen']['uid'] . '.jpg') ? PATH_URL .'upload/uid_'.$_SESSION['authen']['uid'] . '.jpg' : PATH_URL.'application/view/Admin/images/author.jpg';echo $src;?>" class="layui-nav-img">
|
||||
<?php echo $_SESSION['authen']['username'];?>
|
||||
</a>
|
||||
<dl class="layui-nav-child">
|
||||
<dd><a href="<?php echo PATH_URL;?>Admin/Userinfo/IndexAction.html">基本资料</a></dd>
|
||||
<dd><a href="<?php echo PATH_URL;?>Home/User/LogoutAction.html">安全退出</a></dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="layui-side layui-bg-black">
|
||||
<div class="layui-side-scroll">
|
||||
<div class="user-photo">
|
||||
<a class="img" title="我帅气的头像" href="<?php echo PATH_URL;?>Admin/Userinfo/IndexAction.html"><img src="<?php echo $src;?>" class="userAvatar"></a>
|
||||
<p>你好!<span class="userName"><?php echo $_SESSION['authen']['username'];?></span></p>
|
||||
</div>
|
||||
<ul class="layui-nav layui-nav-tree" lay-filter="test">
|
||||
<li class="layui-nav-item"><a href="<?php echo PATH_URL;?>Admin/Index/IndexAction.html"><i class="layui-icon" style="font-size: 16px;"></i> 后台首页</a></li>
|
||||
<li class="layui-nav-item"><a href="<?php echo PATH_URL;?>Admin/Pic/IndexAction.html"><i class="layui-icon"></i> 我的图库</a></li>
|
||||
<li class="layui-nav-item"><a href="<?php echo PATH_URL;?>Admin/Userinfo/IndexAction.html"><i class="layui-icon"></i> 个人中心</a></li>
|
||||
<?php if($_SESSION['authen']['role'] == 'admin'):?>
|
||||
<li class="layui-nav-item"><a href="<?php echo PATH_URL;?>Admin/User/IndexAction.html"><i class="layui-icon"></i> 用户管理</a></li>
|
||||
<li class="layui-nav-item"><a href="<?php echo PATH_URL;?>Admin/Navbar/IndexAction.html"><i class="layui-icon"></i> 导航设置</a></li>
|
||||
<li class="layui-nav-item"><a href="<?php echo PATH_URL;?>Admin/Configure/IndexAction.html"><i class="layui-icon" style="font-size: 16px;"></i> 系统设置</a></li>
|
||||
<?php endif;?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-body" style="padding: 15px;">
|
After Width: | Height: | Size: 9.8 KiB |
|
@ -0,0 +1,89 @@
|
|||
<?php if(!defined('APP_PATH')) {exit('error!');}?>
|
||||
<blockquote class="layui-elem-quote layui-bg-green">亲爱的 <?php echo $username;?> ,<span id="nowTime"></span>
|
||||
. 欢迎使用 <?php echo configGet('title');?> 图床
|
||||
</blockquote>
|
||||
<?php if($_SESSION['authen']['role'] == 'admin'):?>
|
||||
<div class="layui-col-lg6 layui-col-md12">
|
||||
<blockquote class="layui-elem-quote title"><i class="layui-icon" style="font-size: 16px;"></i> 站点信息</blockquote>
|
||||
<table class="layui-table">
|
||||
<tbody>
|
||||
<tr><td>网站名称</td><td><?php echo configGet('title');?></td></tr>
|
||||
<tr><td>当前版本</td><td>V<?php echo APP_VERSION;?></td></tr>
|
||||
<tr><td>开发作者</td><td><a href="http://www.52ecy.cn" title="官方博客">阿珏</a></td></tr>
|
||||
<tr><td>数据库表前缀</td> <td><?php echo $prefix;?></td></tr>
|
||||
<tr><td>PHP版本</td><td><?php echo PHP_VERSION;?></td></tr>
|
||||
<tr><td>MySQL版本</td><td><?php echo $version;?></td></tr>
|
||||
<tr><td>最大上传限制</td><td><?php echo ini_get('upload_max_filesize'); ?></td></tr>
|
||||
<tr><td>允许上传文件最大数</td><td><?php echo ini_get('max_file_uploads');?></td></tr>
|
||||
<tr><td>脚本最大执行时长</td><td><?php echo ini_get('max_execution_time');?></td></tr>
|
||||
<tr><td>脚本最大消耗内存</td><td><?php echo ini_get('memory_limit');?></td></tr>
|
||||
<tr><td>脚本最大解析时长</td><td><?php echo ini_get('max_input_time');?></td></tr>
|
||||
<tr><td>服务器环境</td><td><?php echo $_SERVER['SERVER_SOFTWARE'];?></td></tr>
|
||||
<tr><td>GD图形处理库</td><td><?php echo $gd_ver;?></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="layui-col-lg6 layui-col-md12">
|
||||
<blockquote class="layui-elem-quote title"><i class="layui-icon" style="font-size: 16px;"></i> 官方消息</blockquote>
|
||||
<table class="layui-table">
|
||||
<tbody id="messenger"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
layui.use(['jquery'],function(){
|
||||
var $ = layui.jquery;
|
||||
var insertText='';
|
||||
$.ajax({
|
||||
url: 'https://img.52ecy.cn/service/messenger.php',
|
||||
type: 'get',
|
||||
dataType: 'json',
|
||||
success: function(res){
|
||||
for (var i = 0; i < res.items.length; i++) {
|
||||
insertText += '<tr><td><a href="'+res.items[i].url+'">'+res.items[i].title+'</a></td><td>'+res.items[i].time+'</td></tr>';
|
||||
}
|
||||
document.getElementById("messenger").innerHTML=insertText;
|
||||
},
|
||||
error: function(){
|
||||
document.getElementById("messenger").innerHTML='<tr><td>获取官方消息失败,可能是网络问题造成的原因</tr></td>';
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php else:?>
|
||||
<table class="layui-table">
|
||||
<tbody>
|
||||
<tr><td>网站名称</td><td><?php echo configGet('title');?></td></tr>
|
||||
<tr><td>用户组</td><td>普通用户</td></tr>
|
||||
<tr><td>注册时间</td> <td><?php echo $time;?></td></tr>
|
||||
<tr><td>注册IP</td><td><?php echo $ip;?></td></tr>
|
||||
<tr><td>我的邮箱</td><td><?php echo $email;?></td></tr>
|
||||
<tr><td>我的托管</td><td><?php echo $count; ?></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif;?>
|
||||
<script type="text/javascript">
|
||||
//获取系统时间
|
||||
var newDate = '';
|
||||
getLangDate();
|
||||
//值小于10时,在前面补0
|
||||
function dateFilter(date){
|
||||
if(date < 10){return "0"+date;}
|
||||
return date;
|
||||
}
|
||||
function getLangDate(){
|
||||
var dateObj = new Date(); //表示当前系统时间的Date对象
|
||||
var year = dateObj.getFullYear(); //当前系统时间的完整年份值
|
||||
var month = dateObj.getMonth()+1; //当前系统时间的月份值
|
||||
var date = dateObj.getDate(); //当前系统时间的月份中的日
|
||||
var day = dateObj.getDay(); //当前系统时间中的星期值
|
||||
var weeks = ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
|
||||
var week = weeks[day]; //根据星期值,从数组中获取对应的星期字符串
|
||||
var hour = dateObj.getHours(); //当前系统时间的小时值
|
||||
var minute = dateObj.getMinutes(); //当前系统时间的分钟值
|
||||
var second = dateObj.getSeconds(); //当前系统时间的秒钟值
|
||||
var timeValue = "" +((hour >= 12) ? (hour >= 18) ? "晚上" : "下午" : "上午" ); //当前时间属于上午、晚上还是下午
|
||||
newDate = dateFilter(year)+"年"+dateFilter(month)+"月"+dateFilter(date)+"日 "+" "+dateFilter(hour)+":"+dateFilter(minute)+":"+dateFilter(second);
|
||||
document.getElementById("nowTime").innerHTML = timeValue+"好!当前时间为: "+newDate+" "+week;
|
||||
setTimeout("getLangDate()",1000);
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,70 @@
|
|||
layui.use(['form','layer','jquery'],function(){
|
||||
var form = layui.form,
|
||||
layer = parent.layer === undefined ? layui.layer : top.layer,
|
||||
laypage = layui.laypage,
|
||||
$ = layui.jquery;
|
||||
|
||||
var systemParameter;
|
||||
form.on("submit(systemParameter)",function(data){
|
||||
//弹出loading
|
||||
var index = top.layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});
|
||||
$.post("UpdateAction",{
|
||||
register : $("input[name='register']:checked").val(),
|
||||
tourist : $("input[name='tourist']:checked").val(),
|
||||
verification : $("input[name='verification']:checked").val(),
|
||||
explore : $("input[name='explore']:checked").val(),
|
||||
limitip : $(".limitip").val(),
|
||||
title : $(".title").val(),
|
||||
keywords : $(".keywords").val(),
|
||||
siteinfo : $(".siteinfo").val(),
|
||||
description : $(".description").val(),
|
||||
record : $(".record").val(),
|
||||
footerinfo : $(".footerinfo").val(),
|
||||
username : $(".username").val(),
|
||||
password : $(".password").val(),
|
||||
level : $(".level").val(),
|
||||
user : $(".user").val(),
|
||||
pass : $(".pass").val(),
|
||||
etime : $(".etime").val(),
|
||||
},function(res){
|
||||
|
||||
})
|
||||
setTimeout(function(){
|
||||
layer.close(index);
|
||||
layer.msg("系统基本参数修改成功!");
|
||||
},500);
|
||||
return false;
|
||||
})
|
||||
|
||||
//加载数据
|
||||
$.ajax({
|
||||
url : "DataAction",
|
||||
type : "get",
|
||||
dataType : "json",
|
||||
success : function(data){
|
||||
fillData(data);
|
||||
}
|
||||
})
|
||||
|
||||
//填充数据方法
|
||||
function fillData(data){
|
||||
$('#register').prop('checked', data.register == 'y' ? true : false);
|
||||
$('#tourist').prop('checked', data.tourist == 'y' ? true : false);
|
||||
$('#verification').prop('checked', data.verification == 'y' ? true : false);
|
||||
$('#explore').prop('checked', data.explore == 'y' ? true : false);
|
||||
$(".limitip").val(data.limitip);
|
||||
$(".title").val(data.title);
|
||||
$(".siteinfo").val(data.siteinfo);
|
||||
$(".keywords").val(data.keywords);
|
||||
$(".description").val(data.description);
|
||||
$(".record").val(data.record);
|
||||
$(".footerinfo").val(data.footerinfo);
|
||||
$(".username").val(data.username);
|
||||
$(".password").val(data.password);
|
||||
$(".level").val(data.level)
|
||||
$(".user").val(data.user);
|
||||
$(".pass").val(data.pass);
|
||||
$(".etime").val(data.etime);
|
||||
form.render();
|
||||
}
|
||||
})
|
|
@ -0,0 +1,27 @@
|
|||
layui.use(['form','layer'],function(){
|
||||
var form = layui.form
|
||||
layer = parent.layer === undefined ? layui.layer : top.layer,
|
||||
$ = layui.jquery;
|
||||
|
||||
form.on("submit(addnavbar)",function(data){
|
||||
//弹出loading
|
||||
var index = top.layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});
|
||||
$.post("AddAction",{
|
||||
navbarId : $(".navbarId").val(),
|
||||
navbarName : $(".navbarName").val(),
|
||||
navbarUrl : $(".navbarUrl").val(),
|
||||
navbarIcon : $(".navbarIcon").val(),
|
||||
navbarHide : $("input[name='navbarHide']:checked").val(),
|
||||
},function(res){
|
||||
|
||||
})
|
||||
setTimeout(function(){
|
||||
top.layer.close(index);
|
||||
top.layer.msg("导航添加成功!");
|
||||
layer.closeAll("iframe");
|
||||
//刷新父页面
|
||||
parent.location.reload();
|
||||
},500);
|
||||
return false;
|
||||
})
|
||||
})
|
|
@ -0,0 +1,152 @@
|
|||
layui.use(['form','layer','table'],function(){
|
||||
var form = layui.form,
|
||||
layer = parent.layer === undefined ? layui.layer : top.layer,
|
||||
$ = layui.jquery,
|
||||
table = layui.table;
|
||||
index = layer.msg('加载中,请稍候',{icon: 16,time:false});
|
||||
setTimeout(function(){layer.close(index);},1000);
|
||||
//导航栏列表
|
||||
var tableIns = table.render({
|
||||
elem: '#navbarList',
|
||||
url : 'QueryAction',
|
||||
cellMinWidth : 95,
|
||||
page : true,
|
||||
height : "full-200",
|
||||
limit : 20,
|
||||
limits : [10,15,20,25],
|
||||
id : "navbarListTable",
|
||||
cols : [[
|
||||
{type: "checkbox", fixed:"left", width:50},
|
||||
{field: 'navbarId', title: 'ID', width:60, align:"center"},
|
||||
{field: 'navbarName', title: '导航', width:200},
|
||||
{field: 'navbarHide', title: '是否隐藏', align:'center',width:200, templet:function(d){
|
||||
return '<input type="checkbox" name="navbarHide" id="'+d.navbarId+'" lay-filter="navbarHide" lay-skin="switch" lay-text="是|否" '+d.navbarHide+'>'
|
||||
}},
|
||||
{field: 'icon', title: '图标'},
|
||||
{field: 'navbarUrl', title: '地址'},
|
||||
{title: '操作', width:200, templet:'#navbarListBar',fixed:"right",align:"center"}
|
||||
]]
|
||||
});
|
||||
|
||||
//是否隐藏
|
||||
form.on('switch(navbarHide)', function(data){
|
||||
// var index = layer.msg('修改中,请稍候',{icon: 16,time:false,shade:0.8}),
|
||||
hide = 'y';
|
||||
setTimeout(function(){
|
||||
// layer.close(index);
|
||||
if(data.elem.checked){
|
||||
layer.msg("隐藏成功!");
|
||||
}else{
|
||||
layer.msg("取消隐藏成功!");
|
||||
hide = 'n';
|
||||
}
|
||||
$.post("HideAction",{
|
||||
id : data.elem.id,
|
||||
hide : hide
|
||||
})
|
||||
},100);
|
||||
})
|
||||
|
||||
//搜索
|
||||
$(".search_btn").on("click",function(){
|
||||
if($(".searchVal").val() != ''){
|
||||
table.reload("navbarListTable",{
|
||||
page: {
|
||||
curr: 1 //重新从第 1 页开始
|
||||
},
|
||||
where: {
|
||||
key: $(".searchVal").val() //搜索的关键字
|
||||
}
|
||||
})
|
||||
}else{
|
||||
layer.msg("请输入搜索的内容");
|
||||
}
|
||||
});
|
||||
|
||||
//添加导航
|
||||
function addnavbar(edit){
|
||||
var index = layui.layer.open({
|
||||
type: 2,
|
||||
title: '添加导航',
|
||||
shadeClose: true,
|
||||
shade: false,
|
||||
maxmin: true,
|
||||
area: ['893px', '600px'],
|
||||
content: 'navbarAdd',
|
||||
success : function(layero, index){
|
||||
var body = layui.layer.getChildFrame('body', index);
|
||||
if(edit){
|
||||
body.find(".navbarId").val(edit.navbarId);
|
||||
body.find(".navbarName").val(edit.navbarName);
|
||||
body.find(".navbarUrl").val(edit.navbarUrl);
|
||||
body.find(".navbarIcon").val(edit.icon);
|
||||
body.find(".navbarHide input[name='navbarHide']").prop("checked",edit.navbarHide);
|
||||
form.render();
|
||||
}
|
||||
setTimeout(function(){
|
||||
layui.layer.tips('点击此处返回导航列表', '.layui-layer-setwin .layui-layer-close', {
|
||||
tips: 3
|
||||
});
|
||||
},500)
|
||||
}
|
||||
})
|
||||
layui.layer.full(index);
|
||||
//改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
|
||||
$(window).on("resize",function(){
|
||||
layui.layer.full(index);
|
||||
})
|
||||
}
|
||||
$(".addNews_btn").click(function(){
|
||||
addnavbar();
|
||||
})
|
||||
|
||||
//批量删除
|
||||
$(".delAll_btn").click(function(){
|
||||
var checkStatus = table.checkStatus('navbarListTable'),
|
||||
data = checkStatus.data,
|
||||
navbarsId = [];
|
||||
if(data.length > 0) {
|
||||
for (var i in data) {
|
||||
navbarsId.push(data[i].navbarId);
|
||||
}
|
||||
layer.confirm('确定删除选中的导航?', {icon: 3, title: '提示信息'}, function (index) {
|
||||
var index = layer.msg('批量删除中,请稍候',{icon: 16,time:false,shade:0.8});
|
||||
setTimeout(function(){
|
||||
$.post("DelAction",{
|
||||
navbarsId : navbarsId
|
||||
},function(data){
|
||||
tableIns.reload();
|
||||
index = layer.msg('加载中,请稍候',{icon: 16,time:false});
|
||||
setTimeout(function(){layer.close(index);},1000);
|
||||
})
|
||||
},100);
|
||||
})
|
||||
}else{
|
||||
layer.msg("请选择需要删除的导航");
|
||||
}
|
||||
})
|
||||
|
||||
//列表操作
|
||||
table.on('tool(navbarList)', function(obj){
|
||||
var layEvent = obj.event,
|
||||
data = obj.data;
|
||||
if(layEvent === 'edit'){ //编辑
|
||||
addnavbar(data);
|
||||
} else if(layEvent === 'del'){ //删除
|
||||
layer.confirm('确定删除此导航?',{icon:3, title:'提示信息'},function(index){
|
||||
var index = layer.msg('删除中,请稍候',{icon: 16,time:false,shade:0.8});
|
||||
setTimeout(function(){
|
||||
$.post("DelAction",{
|
||||
navbarsId : data.navbarId
|
||||
},function(data){
|
||||
tableIns.reload();
|
||||
index = layer.msg('加载中,请稍候',{icon: 16,time:false});
|
||||
setTimeout(function(){layer.close(index);},1000);
|
||||
})
|
||||
},100);
|
||||
});
|
||||
} else if(layEvent === 'look'){ //预览
|
||||
window.open(data.navbarUrl);
|
||||
}
|
||||
});
|
||||
})
|
|
@ -0,0 +1,99 @@
|
|||
layui.use(['form','layer','table'],function(){
|
||||
var form = layui.form,
|
||||
layer = parent.layer === undefined ? layui.layer : top.layer,
|
||||
$ = layui.jquery,
|
||||
table = layui.table;
|
||||
index = layer.msg('加载中,请稍候',{icon: 16,time:false});
|
||||
setTimeout(function(){layer.close(index);},1000);
|
||||
//用户列表
|
||||
var tableIns = table.render({
|
||||
elem: '#picList',
|
||||
url : 'QueryAction',
|
||||
cellMinWidth : 95,
|
||||
page : true,
|
||||
height : "full-125",
|
||||
limits : [10,15,20,25],
|
||||
limit : 20,
|
||||
id : "picListTable",
|
||||
cols : [[
|
||||
{type: "checkbox", fixed:"left", width:50},
|
||||
{field: 'picpid', title: '图片ID', minWidth:80, align:"center"},
|
||||
{field: 'picuid', title: '上传用户', minWidth:80, align:'center'},
|
||||
{field: 'picdate', title: '上传时间', align:'center'},
|
||||
{field: 'picip', title: 'IP', minWidth:80, align:'center'},
|
||||
{title: '操作', width:200, templet:'#picListBar',fixed:"right",align:"center"}
|
||||
]]
|
||||
});
|
||||
|
||||
//搜索
|
||||
$(".search_btn").on("click",function(){
|
||||
if($(".searchVal").val() != ''){
|
||||
table.reload("picListTable",{
|
||||
page: {
|
||||
curr: 1 //重新从第 1 页开始
|
||||
},
|
||||
where: {
|
||||
key: $(".searchVal").val() //搜索的关键字
|
||||
}
|
||||
})
|
||||
}else{
|
||||
layer.msg("请输入搜索的内容");
|
||||
}
|
||||
});
|
||||
|
||||
//批量删除
|
||||
$(".delAll_btn").click(function(){
|
||||
var checkStatus = table.checkStatus('picListTable'),
|
||||
data = checkStatus.data,
|
||||
picId = [];
|
||||
if(data.length > 0) {
|
||||
for (var i in data) {
|
||||
picId.push(data[i].picId);
|
||||
}
|
||||
layer.confirm('确定删除选中的图片?', {icon: 3, title: '提示信息'}, function (index) {
|
||||
var index = layer.msg('删除中,请稍候',{icon: 16,time:false,shade:0.8});
|
||||
setTimeout(function(){
|
||||
$.post("DelAction",{
|
||||
picId : picId
|
||||
},function(data){
|
||||
tableIns.reload();
|
||||
index = layer.msg('加载中,请稍候',{icon: 16,time:false});
|
||||
setTimeout(function(){layer.close(index);},1000);
|
||||
})
|
||||
},100);
|
||||
})
|
||||
}else{
|
||||
layer.msg("请选择需要删除的图片");
|
||||
}
|
||||
})
|
||||
|
||||
//列表操作
|
||||
table.on('tool(picList)', function(obj){
|
||||
var layEvent = obj.event,
|
||||
data = obj.data;
|
||||
if(layEvent === 'del'){ //删除
|
||||
layer.confirm('确定删除此图片?',{icon:3, title:'提示信息'},function(index){
|
||||
var index = layer.msg('删除中,请稍候',{icon: 16,time:false,shade:0.8});
|
||||
setTimeout(function(){
|
||||
$.post("DelAction",{
|
||||
picId : data.picId
|
||||
},function(data){
|
||||
tableIns.reload();
|
||||
index = layer.msg('加载中,请稍候',{icon: 16,time:false});
|
||||
setTimeout(function(){layer.close(index);},1000);
|
||||
})
|
||||
},100);
|
||||
});
|
||||
} else if(layEvent === 'copy'){
|
||||
copyToClipboard('https://ws3.sinaimg.cn/large/'+data.picpid);
|
||||
}else if(layEvent === 'look'){ //预览
|
||||
layer.open({
|
||||
title: false,
|
||||
type:2,
|
||||
area: ['80%','80%'],
|
||||
scrollbar: false,
|
||||
content: 'https://ws3.sinaimg.cn/large/'+data.picpid
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
|
@ -0,0 +1,70 @@
|
|||
layui.use(['form','layer','upload','laydate'],function(){
|
||||
form = layui.form;
|
||||
$ = layui.jquery;
|
||||
var layer = parent.layer === undefined ? layui.layer : top.layer,
|
||||
upload = layui.upload;
|
||||
// 获取数据
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: 'DataAction',
|
||||
dataType: 'json',
|
||||
success: function(userInfo){
|
||||
$(".username").val(userInfo.username);
|
||||
$(".role").val(userInfo.role);
|
||||
$(".time").val(userInfo.time);
|
||||
$(".ip").val(userInfo.ip);
|
||||
$(".email").val(userInfo.email);
|
||||
$("#photo").attr("src",userInfo.photo);
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
//上传头像
|
||||
upload.render({
|
||||
elem: '#upload',
|
||||
url: 'UploadAction',
|
||||
accept: 'images',
|
||||
exts: 'jpg|png|gif|bmp|jpeg',
|
||||
size: 1024,
|
||||
before: function(obj){
|
||||
layer.msg('上传头像中,请稍候',{icon: 16,time:false,shade:0.8});
|
||||
},
|
||||
done: function(res, index, upload){
|
||||
if (res.code == '0') {
|
||||
$('#photo').attr('src',res.src);
|
||||
layer.closeAll();
|
||||
}else{
|
||||
layer.msg(res.msg, {icon: 2,anim: 6});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//提交个人资料
|
||||
form.on("submit(changeUser)",function(data){
|
||||
var index = layer.msg('提交中,请稍候',{icon: 16,time:false,shade:0.8});
|
||||
setTimeout(function(){
|
||||
$.post("UpdateAction",{
|
||||
username : $(".username").val(),
|
||||
pwd : $(".pwd").val(),
|
||||
password : $(".password").val()
|
||||
},function(res){
|
||||
layer.close(index);
|
||||
layer.msg(res);
|
||||
})
|
||||
},100);
|
||||
return false;
|
||||
})
|
||||
|
||||
//添加验证规则
|
||||
form.verify({
|
||||
newPwd : function(value, item){
|
||||
if(value.length < 6){
|
||||
return "密码长度不能小于6位";
|
||||
}
|
||||
},
|
||||
confirmPwd : function(value, item){
|
||||
if(!new RegExp($("#oldPwd").val()).test(value)){
|
||||
return "两次输入密码不一致,请重新输入!";
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
|
@ -0,0 +1,137 @@
|
|||
layui.use(['form','layer','table'],function(){
|
||||
var form = layui.form,
|
||||
layer = parent.layer === undefined ? layui.layer : top.layer,
|
||||
$ = layui.jquery,
|
||||
table = layui.table;
|
||||
index = layer.msg('加载中,请稍候',{icon: 16,time:false});
|
||||
setTimeout(function(){layer.close(index);},1000);
|
||||
//用户列表
|
||||
var tableIns = table.render({
|
||||
elem: '#userList',
|
||||
url : 'QueryAction',
|
||||
cellMinWidth : 95,
|
||||
page : true,
|
||||
height : "full-125",
|
||||
limits : [10,15,20,25],
|
||||
limit : 20,
|
||||
id : "userListTable",
|
||||
cols : [[
|
||||
{type: "checkbox", fixed:"left", width:50},
|
||||
{field: 'userName', title: '用户名', minWidth:100, align:"center"},
|
||||
{field: 'userEmail', title: '用户邮箱', minWidth:200, align:'center',templet:function(d){
|
||||
return '<a class="layui-blue" href="mailto:'+d.userEmail+'">'+d.userEmail+'</a>';
|
||||
}},
|
||||
{field: 'userIp', title: 'IP', align:'center'},
|
||||
{field: 'userStatus', title: '用户状态', align:'center'},
|
||||
{field: 'userGrade', title: '用户权限', align:'center'},
|
||||
{field: 'userEndTime', title: '注册时间', align:'center',minWidth:150},
|
||||
{title: '操作', minWidth:175,fixed:"right",align:"center",templet:function(d){
|
||||
var userStatus = d.userStatus != '限制使用' ? '已启用' : '已禁用';
|
||||
return '<a class="layui-btn layui-btn-xs layui-btn-green" lay-event="usable">'+userStatus+'</a><a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>';
|
||||
}}
|
||||
]]
|
||||
});
|
||||
|
||||
//搜索
|
||||
$(".search_btn").on("click",function(){
|
||||
if($(".searchVal").val() != ''){
|
||||
table.reload("userListTable",{
|
||||
page: {
|
||||
curr: 1 //重新从第 1 页开始
|
||||
},
|
||||
where: {
|
||||
key: $(".searchVal").val() //搜索的关键字
|
||||
}
|
||||
})
|
||||
}else{
|
||||
layer.msg("请输入搜索的内容");
|
||||
}
|
||||
});
|
||||
|
||||
//批量删除
|
||||
$(".delAll_btn").click(function(){
|
||||
var checkStatus = table.checkStatus('userListTable'),
|
||||
data = checkStatus.data,
|
||||
usersId = [];
|
||||
if(data.length > 0) {
|
||||
for (var i in data) {
|
||||
if(data[i].userGrade != '超级管理员'){
|
||||
usersId.push(data[i].usersId);
|
||||
}
|
||||
}
|
||||
if (usersId.length == 0){
|
||||
layer.msg('管理员账号不允许被删除!', {icon: 2});
|
||||
return;
|
||||
}
|
||||
layer.confirm('确定删除选中的用户?', {icon: 3, title: '提示信息'}, function (index) {
|
||||
var index = layer.msg('删除中,请稍候',{icon: 16,time:false,shade:0.8});
|
||||
setTimeout(function(){
|
||||
$.post("DelAction",{
|
||||
usersId : usersId
|
||||
},function(data){
|
||||
tableIns.reload();
|
||||
index = layer.msg('加载中,请稍候',{icon: 16,time:false});
|
||||
setTimeout(function(){layer.close(index);},1000);
|
||||
})
|
||||
},100);
|
||||
})
|
||||
}else{
|
||||
layer.msg("请选择需要删除的用户");
|
||||
}
|
||||
})
|
||||
|
||||
//列表操作
|
||||
table.on('tool(userList)', function(obj){
|
||||
var layEvent = obj.event,
|
||||
data = obj.data;
|
||||
|
||||
if(layEvent === 'usable'){ //启用禁用
|
||||
if(data.userGrade == '超级管理员'){
|
||||
layer.msg('管理员账号不允许被禁用!', {icon: 2});
|
||||
return;
|
||||
}
|
||||
var _this = $(this),
|
||||
usableText = "是否确定禁用此用户?",
|
||||
btnText = "已禁用",
|
||||
seal = 'n';
|
||||
if(_this.text()=="已禁用"){
|
||||
usableText = "是否确定启用此用户?",
|
||||
btnText = "已启用",
|
||||
seal = 'y';
|
||||
}
|
||||
layer.confirm(usableText,{
|
||||
icon: 3,
|
||||
title:'系统提示',
|
||||
cancel : function(index){
|
||||
layer.close(index);
|
||||
}
|
||||
},function(index){
|
||||
$.post("DisableAction",{
|
||||
uid : data.usersId,
|
||||
seal : seal
|
||||
})
|
||||
_this.text(btnText);
|
||||
layer.close(index);
|
||||
},function(index){
|
||||
layer.close(index);
|
||||
});
|
||||
}else if(layEvent === 'del'){ //删除
|
||||
if(data.userGrade == '超级管理员'){
|
||||
layer.msg('管理员账号不允许被删除!', {icon: 2});
|
||||
return;
|
||||
}
|
||||
layer.confirm('确定删除此用户?',{icon:3, title:'提示信息'},function(index){
|
||||
var index = layer.msg('删除中,请稍候',{icon: 16,time:false,shade:0.8});
|
||||
setTimeout(function(){
|
||||
$.post("DelAction",{
|
||||
usersId : data.usersId
|
||||
},function(data){
|
||||
tableIns.reload();
|
||||
index = layer.msg('加载中,请稍候',{icon: 16,time:false});
|
||||
setTimeout(function(){layer.close(index);},1000);
|
||||
})
|
||||
},100);
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
|
@ -0,0 +1,2 @@
|
|||
/** layui-v2.2.5 MIT License By https://www.layui.com */
|
||||
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}
|
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 701 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 231 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 777 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.0 KiB |