From 7a9066e2faee16129db5d3ebd640d24533e6f24b Mon Sep 17 00:00:00 2001 From: Pierre-Luc Paour Date: Mon, 25 Apr 2005 13:08:09 +0000 Subject: [PATCH] 2005-04-25 Pierre-Luc Paour (1.4.2-b14) * Added support for the applet to force the version of Gallery it's embedded in, to overcome instances of Apache sending a 200 error code even though gallery_remote2.php doesn't exist instead of 404 (in G2). --- ChangeLog | 7 ++++ com/gallery/GalleryRemote/GRApplet.java | 9 +++++ com/gallery/GalleryRemote/GalleryComm.java | 38 +++++++++++--------- com/gallery/GalleryRemote/model/Gallery.java | 3 +- defaults.properties | 4 +-- 5 files changed, 41 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index a5a8d5b..f6fb116 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-04-25 Pierre-Luc Paour (1.4.2-b14) + + * Added support for the applet to force the version of Gallery + it's embedded in, to overcome instances of Apache sending + a 200 error code even though gallery_remote2.php doesn't exist + instead of 404 (in G2). + 2005-04-22 Pierre-Luc Paour (1.4.2-b13) * Fixed error message for self-signed cert to point to GR documentation. diff --git a/com/gallery/GalleryRemote/GRApplet.java b/com/gallery/GalleryRemote/GRApplet.java index 8a68c57..cf99a21 100644 --- a/com/gallery/GalleryRemote/GRApplet.java +++ b/com/gallery/GalleryRemote/GRApplet.java @@ -96,6 +96,7 @@ protected AppletInfo getGRAppletInfo() { String cookieDomain = getParameter("gr_cookie_domain"); String cookiePath = getParameter("gr_cookie_path"); String userAgent = getParameter("gr_user_agent"); + String galleryVersion = getParameter("gr_gallery_version"); String cookie1Name = getParameter("gr_cookie1_name"); String cookie1Value = getParameter("gr_cookie1_value"); @@ -111,6 +112,7 @@ protected AppletInfo getGRAppletInfo() { Log.log(Log.LEVEL_INFO, MODULE, "gr_cookie1_name: " + cookie1Name); Log.log(Log.LEVEL_INFO, MODULE, "gr_album: " + info.albumName); Log.log(Log.LEVEL_INFO, MODULE, "gr_user_agent: " + userAgent); + Log.log(Log.LEVEL_INFO, MODULE, "gr_gallery_version: " + galleryVersion); if (cookieDomain == null || cookieDomain.length() < 1) { try { @@ -196,6 +198,13 @@ protected AppletInfo getGRAppletInfo() { info.gallery.setUserAgent(userAgent); info.gallery.cookieLogin = true; + if (galleryVersion != null) { + try { + info.gallery.forceGalleryVersion = Integer.parseInt(galleryVersion); + } catch (RuntimeException e) { + Log.logException(Log.LEVEL_ERROR, MODULE, e); + } + } CookieModule.discardAllCookies(); Cookie cookie = new Cookie(cookieName, cookieValue, cookieDomain, cookiePath, null, false); diff --git a/com/gallery/GalleryRemote/GalleryComm.java b/com/gallery/GalleryRemote/GalleryComm.java index f2dea61..73a73fc 100644 --- a/com/gallery/GalleryRemote/GalleryComm.java +++ b/com/gallery/GalleryRemote/GalleryComm.java @@ -270,25 +270,29 @@ public static GalleryComm getCommInstance(StatusUpdate su, URL url, Gallery g) { // assemble the URL String urlPath = url.getFile(); - Log.log(Log.LEVEL_TRACE, MODULE, "Trying protocol 2 for " + url); - // Test GalleryComm2 - String urlPath2 = urlPath + ((urlPath.endsWith("/")) ? GalleryComm2.SCRIPT_NAME : "/" + GalleryComm2.SCRIPT_NAME); - if (tryComm(su, mConnection, urlPath2, null)) { - Log.log(Log.LEVEL_TRACE, MODULE, "Server has protocol 2"); - return new GalleryComm2(g); + if (g.forceGalleryVersion == 0 || g.forceGalleryVersion == 1) { + Log.log(Log.LEVEL_TRACE, MODULE, "Trying protocol 2 for " + url); + // Test GalleryComm2 + String urlPath2 = urlPath + ((urlPath.endsWith("/")) ? GalleryComm2.SCRIPT_NAME : "/" + GalleryComm2.SCRIPT_NAME); + if (tryComm(su, mConnection, urlPath2, null)) { + Log.log(Log.LEVEL_TRACE, MODULE, "Server has protocol 2"); + return new GalleryComm2(g); + } } - Log.log(Log.LEVEL_TRACE, MODULE, "Trying protocol 2.5 for " + url); - // Test GalleryComm2 - String urlPath2_5 = urlPath + ((urlPath.endsWith("/")) ? GalleryComm2_5.SCRIPT_NAME : "/" + GalleryComm2_5.SCRIPT_NAME); - StringBuffer sb = new StringBuffer(); - if (tryComm(su, mConnection, urlPath2_5, sb)) { - if (sb != null && sb.indexOf("ERROR_PERMISSION_DENIED") == -1) { - Log.log(Log.LEVEL_TRACE, MODULE, "Server has protocol 2.5"); - return new GalleryComm2_5(g); - } else { - // G2 remote module is deactivated - su.error(GRI18n.getString(MODULE, "g2.moduleDisabled")); + if (g.forceGalleryVersion == 0 || g.forceGalleryVersion == 2) { + Log.log(Log.LEVEL_TRACE, MODULE, "Trying protocol 2.5 for " + url); + // Test GalleryComm2 + String urlPath2_5 = urlPath + ((urlPath.endsWith("/")) ? GalleryComm2_5.SCRIPT_NAME : "/" + GalleryComm2_5.SCRIPT_NAME); + StringBuffer sb = new StringBuffer(); + if (tryComm(su, mConnection, urlPath2_5, sb)) { + if (sb != null && sb.indexOf("ERROR_PERMISSION_DENIED") == -1) { + Log.log(Log.LEVEL_TRACE, MODULE, "Server has protocol 2.5"); + return new GalleryComm2_5(g); + } else { + // G2 remote module is deactivated + su.error(GRI18n.getString(MODULE, "g2.moduleDisabled")); + } } } diff --git a/com/gallery/GalleryRemote/model/Gallery.java b/com/gallery/GalleryRemote/model/Gallery.java index 7157082..03e9631 100644 --- a/com/gallery/GalleryRemote/model/Gallery.java +++ b/com/gallery/GalleryRemote/model/Gallery.java @@ -58,7 +58,7 @@ public class Gallery extends DefaultTreeModel implements Serializable, Preferenc String username; String password; String alias; - String userAgent = null; + String userAgent = null; int type = TYPE_STANDALONE; transient GalleryComm comm = null; @@ -69,6 +69,7 @@ public class Gallery extends DefaultTreeModel implements Serializable, Preferenc transient private boolean blockWrites = false; transient public boolean cookieLogin = false; transient public int galleryVersion = 1; + transient public int forceGalleryVersion = 0; public static String types[] = new String[]{STANDALONE, POSTNUKE, PHPNUKE, GEEKLOG}; public static final int TYPE_STANDALONE = 0; diff --git a/defaults.properties b/defaults.properties index 9b76c4b..1193b01 100644 --- a/defaults.properties +++ b/defaults.properties @@ -242,6 +242,6 @@ updateUrlBeta=http://gallery.sourceforge.net/gallery_remote_version_check_beta.p # # --- Do not edit below this line --- # -version=1.4.2-b13 -releaseDate=2005/04/22 +version=1.4.2-b14 +releaseDate=2005/04/25 aboutText=Gallery Remote\n \n \nA part of the Gallery Open-Source Project\nhttp://gallery.sourceforge.net\n \n \nMaintained by:\n \nPierre-Luc Paour\n \n \nInitial version by Chris Smith\n \n \nContributors:\n \nTim Miller\nDolan Halbrook\nMarkus Cozowicz\nScott Gartner\nAmedeo Paglione\nChris Schwerdt\nSeth Ladd\n \n \nArtwork by Ross A. Reyman\n \n \nBundled software:\n \nImageMagick\nJava look and feel Graphics Repository icons\njpegtran, Guido Vollbeding's version\nMetadataExtractor