-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXenForo.java
115 lines (103 loc) · 3.55 KB
/
XenForo.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/**************************************************************************
* This file is part of MCbb.
* MCbb 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 3 of the License, or
* (at your option) any later version.
* MCbb 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 MCbb. If not, see <http://www.gnu.org/licenses/>.
*************************************************************************/
import java.sql.ResultSet;
import java.sql.SQLException;
import de.javakara.manf.software.Software;
import de.javakara.manf.software.User;
public class XenForo extends Software {
@Override
public String getForumGroup(User user) {
try {
int id = user.getId();
if (id != 0) {
ResultSet rs = database.executeQuery("SELECT servergroup FROM "
+ this.config.getString("mysql.prefix")
+ "user_group WHERE user_group_id='" + id + "'");
if (rs.next()) {
return rs.getString("servergroup");
}
} else {
System.out.println("[MCbb] Sorry... Theres a fail in there!");
}
} catch (SQLException e) {
System.out.println("ForumUserError: " + e.toString());
}
System.out.println("User Forum Group not recognised!");
return null;
}
@Override
public int getNewPosts() {
return 0;
}
@Override
protected boolean isRegisteredOld(User user) {
try {
String name = user.getName();
ResultSet rs = database.executeQuery("SELECT user_id,username,user_group_id FROM "
+ this.config.getString("mysql.prefix")
+ "user WHERE username="
+ "lower('" + name + "')"
+ " LIMIT 1");
if (rs.next()) {
int id = rs.getInt("user_id");
int gid = rs.getInt("user_group_id");
int type = rs.getInt("is_banned");
user.setGroupId(gid);
user.setUserId(id);
user.setUserType(type);
return (type != 1);
}
} catch (SQLException e) {
System.out.println("Qwertzy2");
e.printStackTrace();
}
return false;
}
@Override
protected boolean isCustomFieldRegistered(User user) {
try {
String name = user.getName();
ResultSet rs = database.executeQuery("SELECT user_id FROM "
+ this.config.getString("mysql.prefix")
+ "user_identity WHERE account_name='" + name
+ "' AND identity_service_id='" + this.config.getString("field.id")
+ "' LIMIT 1");
if (rs.next()) {
int id = rs.getInt("user_id");
user.setUserId(id);
rs = database.executeQuery("SELECT username,user_group_id,is_banned FROM "
+ this.config.getString("mysql.prefix")
+ "user WHERE user_id='" + id + "' LIMIT 1");
if (rs.next()) {
int gid = rs.getInt("user_group_id");
int type = rs.getInt("is_banned");
user.setGroupId(gid);
user.setUserType(type);
return (type != 1);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
@Override
public boolean isPasswordCorrect(User user,String password) {
return false;
}
@Override
protected String getName() {
return "XenForo";
}
}