diff --git a/admin/admin_ajax.php b/admin/admin_ajax.php
index 24687cb9..bedbdc19 100644
--- a/admin/admin_ajax.php
+++ b/admin/admin_ajax.php
@@ -2,8 +2,8 @@
/**
* @Author: prpr
* @Date: 2016-02-04 13:53:55
- * @Last Modified by: prpr
- * @Last Modified time: 2016-02-08 22:06:43
+ * @Last Modified by: printempw
+ * @Last Modified time: 2016-03-06 15:34:29
*/
require "../includes/session.inc.php";
@@ -38,10 +38,24 @@ if (isset($_GET['action'])) {
$json['errno'] = 0;
$json['msg'] = "成功更改了 ".$_GET['uname']." 的密码。";
} // Will raise exception if password invalid
- } else if ($action == "delete") {
+ } else if ($action == "deleteAccount") {
$user->unRegister();
$json['errno'] = 0;
$json['msg'] = "成功删除了该用户。";
+ } else if ($action == "deleteTexture") {
+ for ($i = 1; $i <= 3; $i++) {
+ switch($i) {
+ case 1: $type = "steve"; break;
+ case 2: $type = "alex"; break;
+ case 3: $type = "cape"; break;
+ }
+ if ($_POST[$type] == "true" && $user->getTexture($type) != "") {
+ Utils::remove("./textures/".$user->getTexture($type));
+ $user->db->update($user->uname, 'hash_'.$type, '');
+ }
+ }
+ $json['errno'] = 0;
+ $json['msg'] = "成功地删除了该用户的所选材质。";
} else if ($action == "model") {
if (isset($_POST['model']) && $_POST['model'] == 'slim' || $_POST['model'] == 'default') {
$user->setPreference($_POST['model']);
diff --git a/admin/manage.php b/admin/manage.php
index a6ca51bb..9d99e41c 100644
--- a/admin/manage.php
+++ b/admin/manage.php
@@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-03-06 14:19:20
* @Last Modified by: printempw
- * @Last Modified time: 2016-03-06 14:44:26
+ * @Last Modified time: 2016-03-06 15:32:20
*/
require "../includes/session.inc.php";
if (!$user->is_admin) header('Location: ../index.php?msg=看起来你并不是管理员');
@@ -76,6 +76,7 @@ if (!$user->is_admin) header('Location: ../index.php?msg=看起来你并不是
()
+ 删除材质
更改密码
删除用户
|
@@ -90,7 +91,7 @@ if (!$user->is_admin) header('Location: ../index.php?msg=看起来你并不是
-
+
«
@@ -100,7 +101,7 @@ if (!$user->is_admin) header('Location: ../index.php?msg=看起来你并不是
if ($i == $page_now) {
echo ''.(string)$i.'';
} else {
- echo ''.(string)$i.'';
+ echo ''.(string)$i.'';
}
}
@@ -110,7 +111,7 @@ if (!$user->is_admin) header('Location: ../index.php?msg=看起来你并不是
-
+
»
diff --git a/assets/css/admin.style.css b/assets/css/admin.style.css
index 6bafbcf7..0600ba82 100644
--- a/assets/css/admin.style.css
+++ b/assets/css/admin.style.css
@@ -2,8 +2,13 @@
* @Author: prpr
* @Date: 2016-02-04 16:47:54
* @Last Modified by: printempw
-* @Last Modified time: 2016-03-06 14:19:55
+* @Last Modified time: 2016-03-06 15:33:44
*/
+@media screen and (min-width: 48em) {
+ .container {
+ width: 90%;
+ }
+}
.overview {
margin: 80px auto 0;
width: 100%;
@@ -25,6 +30,15 @@ input {
width: 100%;
margin: 10px 0 20px;
}
+input[type=checkbox] {
+ width: initial;
+ margin: 0;
+ margin: 0 5px 0 5px;
+}
+label {
+ display: block;
+ margin: 6px 0;
+}
.fw {
width: 100%;
}
diff --git a/assets/js/admin.utils.js b/assets/js/admin.utils.js
index 22350c09..61132bd0 100644
--- a/assets/js/admin.utils.js
+++ b/assets/js/admin.utils.js
@@ -1,8 +1,8 @@
/*
* @Author: prpr
* @Date: 2016-02-04 16:48:42
-* @Last Modified by: prpr
-* @Last Modified time: 2016-02-05 22:01:44
+* @Last Modified by: printempw
+* @Last Modified time: 2016-03-06 15:23:40
*/
'use strict';
@@ -53,6 +53,43 @@ function uploadTexture(uname, type) {
ply.open();
}
+function deleteTexture(uname) {
+ var ply = new Ply({
+ el: '选择要删除的 '+uname+' 的当前材质:
'+
+ ''+
+ ''+
+ ''+
+ ''+
+ '',
+ effect: "fade",
+ onaction: function() {
+ var steve = $('#steve').prop('checked');
+ var alex = $('#alex').prop('checked');
+ var cape = $('#cape').prop('checked');
+ if ($('#all').prop('checked')) {
+ steve = alex = cape = true;
+ }
+ $.ajax({
+ type: "POST",
+ url: "admin_ajax.php?action=deleteTexture&uname="+uname,
+ dataType: "json",
+ data: {
+ "steve" : steve,
+ "alex" : alex,
+ "cape" : cape
+ },
+ success: function(json) {
+ if (json.errno == 0) {
+ showAlert(json.msg);
+ } else {
+ showAlert(json.msg);
+ }
+ }
+ });
+ },
+ });
+ ply.open();
+}
function changePasswd(uname) {
Ply.dialog("prompt", {
@@ -82,7 +119,7 @@ function deleteAccount(uname) {
}).done(function(ui){
$.ajax({
type: "POST",
- url: "admin_ajax.php?action=delete&uname="+uname,
+ url: "admin_ajax.php?action=deleteAccount&uname="+uname,
dataType: "json",
success: function(json) {
if (json.errno == 0) {
diff --git a/includes/User.class.php b/includes/User.class.php
index 4cf2e9e8..cce710cc 100644
--- a/includes/User.class.php
+++ b/includes/User.class.php
@@ -2,13 +2,13 @@
/**
* @Author: printempw
* @Date: 2016-01-16 23:01:33
- * @Last Modified by: prpr
- * @Last Modified time: 2016-02-14 16:21:53
+ * @Last Modified by: printempw
+ * @Last Modified time: 2016-03-06 15:27:00
*/
class User
{
- private $uname = "";
+ public $uname = "";
private $passwd = "";
private $token = "";