📄 managernews.java
字号:
System.out.println(s4);
for (ResultSet resultset1 = dbConn.ExeQuery(s4); resultset1.next();) {
if (j == i)
break;
String as1[] = CheckSplit(s1, resultset1
.getString("pagination"), resultset1.getString("id"),
resultset1.getString("topic"), resultset1
.getString("date_time"));
if (!as1[1].equals(s6)) {
as2[j] = as1[0];
as3[j] = as1[1];
as4[j] = handle.Split(" ", as1[2])[0];
s6 = as1[1];
j++;
}
}
dbConn.CloseConn();
} catch (SQLException sqlexception) {
System.err.println("PrintNTitlePreView():"
+ sqlexception.getMessage());
}
hashtable.put("path", as2);
hashtable.put("title", as3);
hashtable.put("date_time", as4);
return hashtable;
}
public Hashtable ReadDataAdmin(HttpServletRequest httpservletrequest,
int i, String s, String s1, String s2, String s3, String s4,
String s5) throws Exception {
Object obj = null;
int j = 0;
float f = 0.0F;
boolean flag = false;
Hashtable hashtable = new Hashtable();
Hashtable hashtable1 = new Hashtable();
Vector vector = new Vector();
String s7 = handle.getString(httpservletrequest, "CurrentPage", "0");
String s8 = handle.getString(httpservletrequest, "keywords");
String s9 = handle.getString(httpservletrequest, "type");
String s10 = getVisitorConditionStr(httpservletrequest, s3);
try {
s8 = handle.GBK2ISO(s8);
String s6;
if (s9.equals("topic"))
s6 = "SELECT * FROM " + s1 + " WHERE topic LIKE '%" + s8
+ "%' AND (" + s10 + ") ORDER BY id DESC";
else if (s9.equals("content"))
s6 = "SELECT * FROM " + s1 + " WHERE content LIKE '%" + s8
+ "%' AND (" + s10 + ") ORDER BY id DESC";
else if (s9.equals("commend"))
s6 = "SELECT * FROM " + s1 + " WHERE commend="
+ Integer.parseInt(s8) + " AND (" + s10
+ ") ORDER BY id DESC";
else if (s9.equals("type_id"))
s6 = "SELECT * FROM " + s1 + " WHERE type_id="
+ Integer.parseInt(s8) + " AND (" + s10
+ ") ORDER BY id DESC";
else
s6 = "SELECT * FROM " + s1 + " WHERE " + s10
+ " ORDER BY id DESC";
System.out.println(s6);
ResultSet resultset = dbConn.ExeQuery(s6);
resultset.last();
j = resultset.getRow();
hashtable = turn_page(s7, i, j);
int l = Integer.parseInt(String.valueOf(hashtable.get("pt_st"))) + 1;
int i1 = Integer.parseInt(String.valueOf(hashtable.get("pt_en"))) + 1;
resultset.absolute(l);
for (int k = l; k < i1; k++) {
f++;
int j1 = resultset.getInt("id");
newsBean newsbean = new newsBean();
newsbean.setId(resultset.getInt("id"));
newsbean.setTypeId(resultset.getInt("type_id"));
newsbean.setTopic(resultset.getString("topic"));
newsbean.setKeywords(resultset.getString("keywords"));
newsbean.setClick(resultset.getInt("click"));
newsbean.setSource(resultset.getString("source"));
newsbean.setPublishHtml(resultset.getInt("publish_html"));
newsbean.setDateTime(resultset.getString("date_time"));
newsbean.setCommend(resultset.getInt("commend"));
vector.addElement(newsbean);
newsbean.setTypeName(getTypeName(s2, resultset
.getInt("type_id")));
newsbean.setLight(resultset.getString("light"));
newsbean.setModule(getModule(resultset.getInt("type_id"), s4,
s5));
if (!resultset.next())
break;
}
dbConn.CloseConn();
} catch (SQLException sqlexception) {
System.err.println("ReadDataAdmin():" + sqlexception.getMessage());
}
String s11 = search_turn(hashtable, s, s8, s9);
hashtable1.put("RecordCount", String.valueOf(j));
hashtable1.put("newsBeanVector", vector);
hashtable1.put("TurpageStr", s11);
return hashtable1;
}
public Vector RelationNews(String s, HttpServletRequest httpservletrequest,
int i) throws Exception {
String s3 = "";
String s4 = "";
String s5 = "";
String s6 = "";
String s7 = "";
int j = handle.getInt(httpservletrequest, "Nid");
Vector vector = new Vector();
try {
String s1 = "SELECT * FROM " + s + " WHERE id=" + j;
ResultSet resultset = dbConn.ExeQuery(s1);
resultset.next();
s3 = resultset.getString("topic");
s4 = resultset.getString("pagination");
s5 = resultset.getString("keywords");
dbConn.CloseConn();
} catch (SQLException sqlexception) {
System.err.println("RelationNews():" + sqlexception.getMessage());
}
s5 = handle.GBK2ISO(s5);
String as[] = handle.Split(",", s5);
if (as.length == 1) {
s6 = s6 + "keywords LIKE '%" + as[0] + "%'";
} else {
int k;
for (k = 0; k < as.length - 1; k++)
s6 = s6 + "keywords LIKE '%" + as[k] + "%' OR ";
s6 = s6 + "keywords LIKE '%" + as[k] + "%'";
}
try {
String s2 = "SELECT * FROM " + s + " WHERE " + s6
+ " ORDER BY id DESC";
for (ResultSet resultset1 = dbConn.ExeQuery(s2); resultset1.next()
&& vector.size() != i;) {
String as1[] = CheckSplit(s,
resultset1.getString("pagination"), resultset1
.getString("id"),
resultset1.getString("topic"), resultset1
.getString("date_time"));
if (!as1[1].equals(s7) && !as1[1].equals(s3)
&& !as1[3].equals(s4)) {
newsBean newsbean = new newsBean();
newsbean.setHtmlFileName(handle.Convert2Path(Integer
.parseInt(as1[0]), as1[2]));
newsbean.setTopic(as1[1]);
newsbean.setDateTime(handle.Split(" ", as1[2])[0]);
vector.addElement(newsbean);
s7 = as1[1];
}
}
dbConn.CloseConn();
} catch (SQLException sqlexception1) {
System.err.println("RelationNews():" + sqlexception1.getMessage());
}
return vector;
}
public String ShowAllType(String s, String s1) throws Exception {
String s4 = "";
String s5 = "";
String as[] = new String[3];
try {
String s2 = "SELECT * FROM " + s
+ " WHERE id != 9 ORDER BY id DESC";
for (ResultSet resultset = dbConn.ExeQuery(s2); resultset.next();) {
s4 = s4
+ "<table width=97% border=0 align=center cellpadding=3 cellspacing=0>\n";
s4 = s4 + "<tr>\n";
s4 = s4
+ "<td colspan=2 align=left valign=middle bgcolor=#0099CC class=line1><font color=#FFFFFF>■ "
+ resultset.getString("title") + "</font></td>\n";
s4 = s4 + "</tr>\n";
String s3 = "SELECT * FROM " + s1 + " WHERE type_id = "
+ resultset.getInt("id") + " ORDER BY id DESC";
for (ResultSet resultset1 = dbConn.ExeQuery(s3); resultset1
.next();) {
String as1[] = CheckSplit(s1, resultset1
.getString("pagination"), resultset1
.getString("id"), resultset1.getString("topic"),
resultset1.getString("date_time"));
if (!as1[1].equals(s5)) {
String s6 = handle.Convert2Path(Integer
.parseInt(as1[0]), as1[2]);
s4 = s4 + "<tr>\n";
s4 = s4
+ "<td width=82% align=left valign=middle bgcolor=eeeeee>\267<a href=../"
+ s6 + ">" + as1[1] + "</a></td>\n";
s4 = s4
+ "<td width=18% align=center valign=middle bgcolor=eeeeee>"
+ handle.Split(" ", as1[2])[0] + "</td>\n";
s4 = s4 + "</tr>\n";
s5 = as1[1];
}
}
s4 = s4 + "</table>\n";
s4 = s4 + "<br>\n";
}
dbConn.CloseConn();
} catch (SQLException sqlexception) {
System.err.println("ShowAllType():" + sqlexception.getMessage());
}
return s4;
}
public Hashtable TopNNews(String s, String s1, int i) throws Exception {
String s4 = "";
String as[] = new String[i];
String as1[] = new String[i];
String as2[] = new String[i];
String as3[] = new String[i];
Hashtable hashtable = new Hashtable();
try {
String s2 = "SELECT * FROM " + s
+ " WHERE type_id != 9 ORDER BY id DESC";
ResultSet resultset = dbConn.ExeQuery(s2);
int j = 0;
while (resultset.next()) {
if (j == i)
break;
String as4[] = CheckSplit(s, resultset.getString("pagination"),
resultset.getString("id"),
resultset.getString("topic"), resultset
.getString("date_time"));
if (!as4[1].equals(s4)) {
as[j] = handle.Convert2Path(Integer.parseInt(as4[0]),
as4[2]);
as1[j] = as4[1];
s4 = as1[j];
as2[j] = as4[2];
String s3 = "SELECT * FROM " + s1 + " WHERE id="
+ resultset.getInt("type_id");
ResultSet resultset1 = dbConn.ExeQuery(s3);
resultset1.next();
as3[j] = resultset1.getString("title");
j++;
}
}
dbConn.CloseConn();
} catch (SQLException sqlexception) {
System.err.println("TopNNews():" + sqlexception.getMessage());
}
hashtable.put("path", as);
hashtable.put("topic", as1);
hashtable.put("date_time", as2);
hashtable.put("type", as3);
return hashtable;
}
public void addModule(HttpServletRequest httpservletrequest, String s)
throws Exception {
String s2 = handle.getString(httpservletrequest, "module").trim();
handle.MkDir(httpservletrequest, "module\\" + s2);
String s1 = "INSERT INTO " + s + "(module) VALUES(?)";
dbConn.getPreparedStatement(s1);
dbConn.setString(1, s2);
dbConn.ExeUpdate();
}
public boolean checkStation(HttpServletRequest httpservletrequest, String s) {
boolean flag = true;
String s1 = httpservletrequest.getRemoteAddr();
String s2 = "127.0.0.1";
if (!s1.equals(s) && !s1.equals(s2))
flag = false;
return flag;
}
public boolean checkTimeLimit() {
boolean flag = true;
Date date = new Date();
SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyy");
SimpleDateFormat simpledateformat1 = new SimpleDateFormat("MM");
SimpleDateFormat simpledateformat2 = new SimpleDateFormat("dd");
String s = simpledateformat.format(date);
String s1 = simpledateformat1.format(date);
String s2 = simpledateformat2.format(date);
if (Integer.parseInt(s) > 2003)
flag = false;
if (Integer.parseInt(s1) > 6)
flag = false;
if (Integer.parseInt(s2) > 20)
flag = false;
return flag;
}
public void commendNews(HttpServletRequest httpservletrequest, String s)
throws Exception {
String s1 = null;
int i = handle.getInt(httpservletrequest, "Nid");
s1 = "UPDATE " + s + " SET commend=1 WHERE id=" + i;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -