changed behavior of post attachment display for all image/* MIME types

(the "Mera fix"); also updated some SQL query syntax to be compatible with
MySQL 5.0.12+ versions (which is what my workstation has now)
This commit is contained in:
Eric J. Bowersox 2006-06-29 02:34:31 +00:00
parent 2ffacedd54
commit 8088e4fba0
6 changed files with 30 additions and 31 deletions

7
lib/.gitignore vendored
View File

@ -1,10 +1,3 @@
bsf.jar
commons-collections.jar
jacl.jar
jakarta-regexp*.jar
js.jar
log4j.jar
mysql.jar
mysql-connector-*.jar
mm.mysql*.jar
tcljava.jar

View File

@ -1437,9 +1437,9 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
// create the SQL statement
StringBuffer sql =
new StringBuffer("SELECT c.confid, t.topicid, t.num, p.postid, p.num, p.creator_uid, p.posted, "
+ "p.linecount, d.data FROM confs c, sigtoconf s, topics t, posts p, postdata d, "
+ "users u LEFT JOIN sigmember m ON (s.sigid = m.sigid AND u.uid = m.uid) "
+ "LEFT JOIN confmember x ON (c.confid = x.confid AND u.uid = x.uid) "
+ "p.linecount, d.data FROM confs c JOIN sigtoconf s JOIN topics t JOIN posts p "
+ "JOIN postdata d JOIN users u LEFT JOIN sigmember m ON (s.sigid = m.sigid "
+ "AND u.uid = m.uid) LEFT JOIN confmember x ON (c.confid = x.confid AND u.uid = x.uid) "
+ "WHERE u.uid = ");
sql.append(env.getUserID()).append(" AND c.confid = s.confid AND s.sigid = ");
sql.append(cid);
@ -1495,9 +1495,9 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
// create the SQL statement
StringBuffer sql =
new StringBuffer("SELECT COUNT(*) FROM confs c, sigtoconf s, topics t, posts p, postdata d, "
+ "users u LEFT JOIN sigmember m ON (s.sigid = m.sigid AND u.uid = m.uid) "
+ "LEFT JOIN confmember x ON (c.confid = x.confid AND u.uid = x.uid) "
new StringBuffer("SELECT COUNT(*) FROM confs c JOIN sigtoconf s JOIN topics t JOIN posts p "
+ "JOIN postdata d JOIN users u LEFT JOIN sigmember m ON (s.sigid = m.sigid "
+ "AND u.uid = m.uid) LEFT JOIN confmember x ON (c.confid = x.confid AND u.uid = x.uid) "
+ "WHERE u.uid = ");
sql.append(env.getUserID()).append(" AND c.confid = s.confid AND s.sigid = ");
sql.append(cid);

View File

@ -2086,7 +2086,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
// within the community is then taken to be the user's access level within the conference.
StringBuffer sql =
new StringBuffer("SELECT c.confid, c.createdate, c.name, c.descr, s.granted_lvl, m.granted_lvl "
+ "FROM sigtoconf s, confs c LEFT JOIN confmember m ON c.confid = m.confid "
+ "FROM sigtoconf s JOIN confs c LEFT JOIN confmember m ON c.confid = m.confid "
+ "AND m.uid = ");
sql.append(env.getUserID()).append(" WHERE s.confid = c.confid AND s.sigid = ");
sql.append(env.getCommunityID());
@ -2144,7 +2144,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
// conference ID as a search term (thus we can return at most one row).
StringBuffer sql =
new StringBuffer("SELECT c.createdate, c.name, c.descr, s.granted_lvl, m.granted_lvl "
+ "FROM sigtoconf s, confs c LEFT JOIN confmember m ON c.confid = m.confid "
+ "FROM sigtoconf s JOIN confs c LEFT JOIN confmember m ON c.confid = m.confid "
+ "AND m.uid = ");
sql.append(env.getUserID()).append(" WHERE s.confid = c.confid AND s.sigid = ");
sql.append(env.getCommunityID()).append(" AND c.confid = ").append(confid).append(';');
@ -2196,7 +2196,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
// everything is joined on the conference ID...
StringBuffer sql =
new StringBuffer("SELECT c.confid, c.createdate, c.name, c.descr, s.granted_lvl, m.granted_lvl "
+ "FROM sigtoconf s, confalias a, confs c LEFT JOIN confmember m ON "
+ "FROM sigtoconf s JOIN confalias a JOIN confs c LEFT JOIN confmember m ON "
+ "c.confid = m.confid AND m.uid = ");
sql.append(env.getUserID()).append(" WHERE s.confid = c.confid AND a.confid = c.confid AND s.sigid = ");
sql.append(env.getCommunityID()).append(" AND a.alias = '").append(SQLUtil.encodeString(alias));
@ -2249,7 +2249,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
// a ConferenceUserContextImpl object.
StringBuffer sql =
new StringBuffer("SELECT h.sigid, h.confid, c.name, c.descr, c.createdate, s.granted_lvl, "
+ "f.granted_lvl, h.sequence FROM confhotlist h, sigtoconf s, confs c "
+ "f.granted_lvl, h.sequence FROM confhotlist h JOIN sigtoconf s JOIN confs c "
+ "LEFT JOIN confmember f ON h.confid = f.confid AND h.uid = f.uid "
+ "WHERE h.confid = s.confid AND c.confid = h.confid AND h.uid = ");
sql.append(env.getUserID()).append(" ORDER BY h.sequence ASC;");

View File

@ -1596,7 +1596,7 @@ class TopicMessageUserContextImpl implements TopicMessageContext
StringBuffer sql =
new StringBuffer("SELECT p.postid, p.parent, p.topicid, p.num, p.linecount, p.creator_uid, "
+ "p.posted, p.hidden, p.scribble_uid, p.scribble_date, p.pseud, a.datalen, "
+ "a.filename, a.mimetype, a.stgmethod FROM topics t, posts p LEFT JOIN "
+ "a.filename, a.mimetype, a.stgmethod FROM topics t JOIN posts p LEFT JOIN "
+ "postattach a ON p.postid = a.postid WHERE t.topicid = p.topicid AND "
+ "t.confid = ");
sql.append(env.getConfID()).append(" AND p.postid = ").append(postid).append(';');

View File

@ -1534,14 +1534,15 @@ class UserContextImpl implements UserContext, ServiceProvider, PropertyProvider
// create the SQL statement
stmt = conn.prepareStatement("SELECT s.sigid, c.confid, t.topicid, t.num, p.postid, p.num, p.creator_uid, "
+ "p.posted, p.linecount, d.data FROM confs c, sigtoconf s, topics t, posts p, "
+ "postdata d, users u, sigmember m, sigftrs f LEFT JOIN confmember x "
+ "ON (c.confid = x.confid AND u.uid = x.uid) WHERE u.uid = ? AND "
+ "s.sigid = m.sigid AND m.uid = u.uid AND s.sigid = f.sigid AND f.ftr_code = ? "
+ " AND c.confid = s.confid AND GREATEST(u.base_lvl,m.granted_lvl,s.granted_lvl,"
+ "IFNULL(x.granted_lvl,0)) >= c.read_lvl AND t.confid = c.confid AND "
+ "t.topicid = p.topicid AND p.scribble_uid IS NULL AND p.postid = d.postid "
+ "AND MATCH(d.data) AGAINST (?) LIMIT ?, ?;");
+ "p.posted, p.linecount, d.data FROM confs c JOIN sigtoconf s JOIN topics t "
+ "JOIN posts p JOIN postdata d JOIN users u JOIN sigmember m JOIN sigftrs f "
+ "LEFT JOIN confmember x ON (c.confid = x.confid AND u.uid = x.uid) "
+ "WHERE u.uid = ? AND s.sigid = m.sigid AND m.uid = u.uid AND s.sigid = f.sigid "
+ "AND f.ftr_code = ? AND c.confid = s.confid "
+ "AND GREATEST(u.base_lvl,m.granted_lvl,s.granted_lvl,IFNULL(x.granted_lvl,0)) "
+ ">= c.read_lvl AND t.confid = c.confid AND t.topicid = p.topicid "
+ "AND p.scribble_uid IS NULL AND p.postid = d.postid AND MATCH(d.data) "
+ "AGAINST (?) LIMIT ?, ?;");
stmt.setInt(1,uid);
stmt.setInt(2,conf_token.getIndex());
stmt.setString(3,search_terms);
@ -1592,10 +1593,11 @@ class UserContextImpl implements UserContext, ServiceProvider, PropertyProvider
conn = globalsite.getConnection(null);
// create the SQL statement
stmt = conn.prepareStatement("SELECT COUNT(*) FROM confs c, sigtoconf s, topics t, posts p, postdata d, "
+ "users u, sigmember m, sigftrs f LEFT JOIN confmember x ON (c.confid = x.confid "
+ "AND u.uid = x.uid) WHERE u.uid = ? AND s.sigid = m.sigid AND m.uid = u.uid "
+ "AND s.sigid = f.sigid AND f.ftr_code = ? AND c.confid = s.confid AND "
stmt = conn.prepareStatement("SELECT COUNT(*) FROM confs c JOIN sigtoconf s JOIN topics t JOIN posts p "
+ "JOIN postdata d JOIN users u JOIN sigmember m JOIN sigftrs f "
+ "LEFT JOIN confmember x ON (c.confid = x.confid AND u.uid = x.uid) "
+ "WHERE u.uid = ? AND s.sigid = m.sigid AND m.uid = u.uid AND s.sigid = f.sigid "
+ "AND f.ftr_code = ? AND c.confid = s.confid AND "
+ "GREATEST(u.base_lvl,m.granted_lvl,s.granted_lvl,IFNULL(x.granted_lvl,0)) "
+ ">= c.read_lvl AND t.confid = c.confid AND t.topicid = p.topicid AND "
+ "p.scribble_uid IS NULL AND p.postid = d.postid AND MATCH(d.data) AGAINST (?);");

View File

@ -79,7 +79,11 @@ public class AttachmentContent extends ThrowableContent implements ContentExecut
public void execute(RequestExec req) throws IOException
{
req.sendBinary(type,filename,length,stm);
// EJB 6/28/2006 - special processing for images (the "Mera fix")
if (type.startsWith("image/"))
req.sendBinary(type,length,stm);
else
req.sendBinary(type,filename,length,stm);
} // end execute