diff --git a/gallery.module b/gallery.module index d9639c335371cd3dafec1e49f548fbc709a22933..ede709f3b8a0c6f55a9d3684946930d08ff5624e 100644 --- a/gallery.module +++ b/gallery.module @@ -236,12 +236,15 @@ function _gallery_init($full = false) { $relativeG2Path = $galleryDir; $embedUri = url('gallery', NULL, NULL, TRUE); if (variable_get('clean_url', 0)) { - if (arg(0) != 'gallery' && trim('http://'.$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], '/') != $base_url) { - for ($i = 0; $i < count(explode('/', $_GET['q'])); $i++ ) { + $path = str_replace($base_url . '/', '','http://'.$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + print ""; + if (arg(0) != 'gallery' && $path) { + for ($i = 0; $i < count(explode('/', $path)); $i++ ) { $relativeG2Path = '../' . $relativeG2Path; } } } + $embedUri = url('gallery', NULL, NULL, TRUE); $params = array('embedUri' => $embedUri, 'relativeG2Path' => $relativeG2Path, 'loginRedirect' => url('user/login', NULL, NULL, TRUE),