%@ page isThreadSafe="false" %><%@ include file="globalPaths.jsp" %><%@ include file="globalDefinitions.jsp" %><%
// This code prevents caching for malicious cnt parameter specified by user
int artworksPerPage = 60;
int count = -1;
try
{
if (request.getParameter("cnt") != null)
{
count = Integer.parseInt(request.getParameter("cnt"));
}
}
catch (Exception e)
{
count = -1;
}
int cnt = count - count % artworksPerPage;
if (cnt < 0) cnt = 0;
String newurl = "ps.jsp";
String queryString = "?";
if (request.getParameter("type") != null)
{
queryString = queryString + "type=" + request.getParameter("type") + "&";
}
if (request.getParameter("cat") != null)
{
queryString = queryString + "cat=" + request.getParameter("cat") + "&";
}
newurl = newurl + queryString;
if (cnt != count)
{
sendRedirect(newurl + "cnt=" + cnt);
return;
}
String referrer = request.getHeader("referer");
if (referrer != null)
{
if (referrer.indexOf("google") != -1 || referrer.indexOf("search") != -1)
{
sendRedirect("packages1.jsp?type=privatestudio");
return;
}
}
%><%@ include file="cacheBegin.jsp" %><%
Cookie[] cookies;
cookies = request.getCookies();
String cookieArtist = "";
for (int icook = 0; cookies != null && icook < cookies.length; icook ++)
{
Cookie cookie = cookies[icook];
if ((cookie.getName()).equals("galleryArtistID"))
{
cookieArtist = cookie.getValue();
}
}
String remoteIP = "UndefinedIP";
if (request.getRemoteAddr() != null)
{
remoteIP = request.getRemoteAddr();
}
%><%
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
String query = "";
%><%
Vector artworkIDs = new Vector();
Vector names = new Vector();
Vector artistNames = new Vector();
Vector artists = new Vector();
Vector smallshots = new Vector();
Vector imageHeights = new Vector();
Vector imageWidths = new Vector();
Vector artistCategories = new Vector();
Vector shortBios = new Vector();
Vector portfolios = new Vector();
boolean needCaching = true;
%><%
try
{
connection = openConnection();
statement = connection.createStatement();
query = "SELECT A.id, A.firstName, A.lastName, A.shortBiography, A.portfolio, "
+ " A.activeflag, W.* FROM galleryArtist A, galleryArtwork W WHERE"
+ " W.artist = A.id "
+ " AND A.package = 2"
+ " AND (W.activeflag='Y' OR W.activeflag='L')"
+ " AND (A.activeflag='Y' OR A.id="
+ quoteString(cookieArtist)
+ " OR A.ipLastLoggedFrom=" + quoteString(remoteIP) + " OR 'admin'="
+ quoteString((String)session.getValue("logged")) + ")"
+ " ORDER BY A.lastName, A.firstName, A.id, W.activeflag, W.id";
resultSet = statement.executeQuery(query);
String lastId = null;
String artistCategory = "?";
String shortBio;
boolean pai= false;
boolean gra= false;
boolean pri= false;
boolean pho= false;
boolean scu= false;
boolean mix= false;
boolean med= false;
boolean cer= false;
boolean gla= false;
boolean jew= false;
boolean fur= false;
boolean fib= false;
boolean boo= false;
boolean cal= false;
boolean ill= false;
boolean prd= false;
boolean typ= false;
boolean web= false;
while (resultSet.next())
{
String id = resultSet.getString("A.id");
if (!id.equals(lastId))
{
String af = resultSet.getString("A.activeflag");
if (!"Y".equals(af))
{
needCaching = false;
}
if (!"?".equals(artistCategory))
{
if (pai) artistCategory+="Painting, ";
if (gra) artistCategory+="Graphics, ";
if (pri) artistCategory+="Printmaking, ";
if (pho) artistCategory+="Photography, ";
if (scu) artistCategory+="Sculpture, ";
if (mix) artistCategory+="Mixed Media, ";
if (med) artistCategory+="New Media, ";
if (cer) artistCategory+="Ceramics, ";
if (gla) artistCategory+="Glass, ";
if (jew) artistCategory+="Jewelry, ";
if (fur) artistCategory+="Furniture, ";
if (fib) artistCategory+="Fiber Art, ";
if (boo) artistCategory+="Book Art, ";
if (cal) artistCategory+="Calligraphy, ";
if (ill) artistCategory+="Illustration, ";
if (prd) artistCategory+="Print Design, ";
if (typ) artistCategory+="Typography, ";
if (web) artistCategory+="Web Design, ";
artistCategory = artistCategory.trim();
if (artistCategory.endsWith(","))
artistCategory = artistCategory.substring(0,artistCategory.length()
- 1);
artistCategories.addElement(artistCategory);
pai= false;
gra= false;
pri= false;
pho= false;
scu= false;
mix= false;
med= false;
cer= false;
gla= false;
jew= false;
fur= false;
fib= false;
boo= false;
cal= false;
ill= false;
prd= false;
typ= false;
web= false;
}
artistCategory = "";
artworkIDs.addElement(resultSet.getString("W.id"));
names.addElement(resultSet.getString("W.name"));
String fln;
String fn = resultSet.getString("A.firstName");
String ln = resultSet.getString("A.lastName");
if (fn.equals(""))
fln = ln;
else
fln = fn + " " + ln;
artistNames.addElement(fln);
artists.addElement(resultSet.getString("A.id"));
if (resultSet.getString("smallshot") == null
|| "".equals(resultSet.getString("smallshot")))
{
smallshots.addElement("ima/e1.gif");
}
else
{
smallshots.addElement(resultSet.getString("smallshot"));
}
shortBio = resultSet.getString("A.shortBiography");
shortBio = convertHTMLSymbolsToPlainNew(shortBio);
// Remove malicious code (youtube) from description
shortBio = prepareForListing(shortBio);
shortBios.addElement(shortBio);
portfolios.addElement(resultSet.getString("A.portfolio"));
if (resultSet.getString("W.heightImage") == null
|| "".equals(resultSet.getString("W.heightImage")))
{
imageHeights.addElement("1");
}
else
{
imageHeights.addElement(resultSet.getString("W.heightImage"));
}
if (resultSet.getString("W.widthImage") == null
|| "".equals(resultSet.getString("W.widthImage")))
{
imageWidths.addElement("1");
}
else
{
imageWidths.addElement(resultSet.getString("W.widthImage"));
}
lastId = id;
}
if ("painting".equals(resultSet.getString("W.category")))
pai = true;
if ("graphics".equals(resultSet.getString("W.category")))
gra = true;
if ("printmaking".equals(resultSet.getString("W.category")))
pri = true;
if ("photography".equals(resultSet.getString("W.category")))
pho = true;
if ("sculpture".equals(resultSet.getString("W.category")))
scu = true;
if ("mixedmedia".equals(resultSet.getString("W.category")))
mix = true;
if ("newmedia".equals(resultSet.getString("W.category")))
med = true;
if ("ceramics".equals(resultSet.getString("W.category")))
cer = true;
if ("glass".equals(resultSet.getString("W.category")))
gla = true;
if ("jewelry".equals(resultSet.getString("W.category")))
jew = true;
if ("furniture".equals(resultSet.getString("W.category")))
fur = true;
if ("textile".equals(resultSet.getString("W.category")))
fib = true;
if ("booksart".equals(resultSet.getString("W.category")))
boo = true;
if ("calligraphy".equals(resultSet.getString("W.category")))
cal = true;
if ("illustration".equals(resultSet.getString("W.category")))
ill = true;
if ("printdesign".equals(resultSet.getString("W.category")))
prd = true;
if ("typography".equals(resultSet.getString("W.category")))
typ = true;
if ("webdesign".equals(resultSet.getString("W.category")))
web = true;
}
if (pai) artistCategory+="Painting, ";
if (gra) artistCategory+="Graphics, ";
if (pri) artistCategory+="Printmaking, ";
if (pho) artistCategory+="Photography, ";
if (scu) artistCategory+="Sculpture, ";
if (mix) artistCategory+="Mixed Media, ";
if (med) artistCategory+="New Media, ";
if (cer) artistCategory+="Ceramics, ";
if (gla) artistCategory+="Glass, ";
if (jew) artistCategory+="Jewelry, ";
if (fur) artistCategory+="Furniture, ";
if (fib) artistCategory+="Fiber Art, ";
if (boo) artistCategory+="Book Art, ";
if (cal) artistCategory+="Calligraphy, ";
if (ill) artistCategory+="Illustration, ";
if (prd) artistCategory+="Print Design, ";
if (typ) artistCategory+="Typography, ";
if (web) artistCategory+="Web Design, ";
artistCategory = artistCategory.trim();
if (artistCategory.endsWith(","))
artistCategory = artistCategory.substring(0,artistCategory.length()
- 1);
artistCategories.addElement(artistCategory);
resultSet.close();
connection.close();
}
catch (Exception e)
{
errorLog(e, query);
sendRedirect(globalErrorPage + "?errorDescription="
+ URLEncoder.encode(e.getMessage() + "."));
return;
}
finally
{
if (resultSet != null) resultSet.close();
if (connection != null && !connection.isClosed()) connection.close();
}
%><%
int numpages = (int)Math.ceil((double)artworkIDs.size() / (double)artworksPerPage);
int[] pageindex = new int[numpages];
for (int i = 0; i < numpages; i ++)
{
pageindex[i] = i * artworksPerPage;
}
if (cnt > artworkIDs.size() - 1)
{
if (numpages > 0)
{
cnt = pageindex[numpages - 1];
}
else
{
cnt = 0;
}
}
if (cnt != count) {
sendRedirect(newurl + "cnt=" + cnt);
return;
}
int fromindex = cnt;
int toindex = cnt + artworksPerPage - 1;
if (toindex > artworkIDs.size() - 1) toindex = artworkIDs.size() - 1;
int previndex = fromindex - artworksPerPage;
if (previndex < 0) previndex = 0;
%><%
if (needCaching)
{
%><%@ include file="cacheLaunch.jsp" %><%
}
%>
Artist Gallery Websites
<%@ include file="inc/head.txt" %>
<%@ include file="inc/top.txt" %>
<%@ include file="inc/bottom.txt" %>
<%
artworkIDs.removeAllElements();
names.removeAllElements();
artistNames.removeAllElements();
artists.removeAllElements();
smallshots.removeAllElements();
imageHeights.removeAllElements();
imageWidths.removeAllElements();
artistCategories.removeAllElements();
portfolios.removeAllElements();
shortBios.removeAllElements();
%>
<%
if (needCaching)
{
%><%@ include file="cacheEnd.jsp" %><%
}
%><%@ include file="globalFinally.jsp" %>