* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /** * @version $Revision: 1.19 $ $Date: 2006/03/06 05:33:32 $ * @package Gallery * @author Bharat Mediratta <*****@*****.**> */ /* * This script will just redirect to main.php. But the Location header requires * an absolute url to conform with HTTP/1.1 * (Include bootstrap.inc in case config.php overrides GALLERY_MAIN_PHP) */ require_once dirname(__FILE__) . '/bootstrap.inc'; require_once dirname(__FILE__) . '/modules/core/classes/GalleryUrlGenerator.class'; /* The REQUEST_URI can either be /path/index.php or just /path/. Get rid of index.php.* */ $path = GalleryUrlGenerator::getCurrentRequestUri(); if (preg_match('|^(/(?:[^?#/]+/)*)(.*)|', $path, $matches)) { $path = $matches[1] . GALLERY_MAIN_PHP; if (!empty($matches[2]) && ($pos = strpos($matches[2], '?')) !== false) { $path .= substr($matches[2], $pos); } } $configBaseUri = @$gallery->getConfig('baseUri'); $urlGenerator =& new GalleryUrlGenerator(); $urlGenerator->init(!empty($configBaseUri) ? $configBaseUri : null); header('Location: ' . $urlGenerator->makeUrl($path));
function _GalleryMain_doRedirect($redirectUrl, $template = null, $controller = null) { global $gallery; /* Create a valid sessionId for guests, if required */ $session =& $gallery->getSession(); $ret = $session->start(); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } $redirectUrl = $session->replaceTempSessionIdIfNecessary($redirectUrl); $session->doNotUseTempId(); /* * UserLogin returnUrls don't have a sessionId in the URL to replace, make sure * there's a sessionId in the redirectUrl for users that don't use cookies */ if (!$session->isUsingCookies() && $session->isPersistent() && strpos($redirectUrl, $session->getKey()) === false) { $redirectUrl = GalleryUrlGenerator::appendParamsToUrl($redirectUrl, array($session->getKey() => $session->getId())); } if ($gallery->getDebug() == false || $gallery->getDebug() == 'logged') { /* * The URL generator makes HTML 4.01 compliant URLs using * & but we don't want those in our Location: header. */ $redirectUrl = str_replace('&', '&', $redirectUrl); $redirectUrl = rtrim($redirectUrl, '&? '); /* * IIS 3.0 - 5.0 webservers will ignore all other headers if the location header is set. * It will simply not send other headers, e.g. the set-cookie header, which is important * for us in the login and logout requests / redirects. * see: http://support.microsoft.com/kb/q176113/ * Our solution: detect IIS version and append GALLERYSID to the Location URL if necessary */ if (in_array($controller, array('core.Logout', 'core.UserLogin', 'publishxp.Login'))) { /* Check if it's IIS and if the version is < 6.0 */ $webserver = GalleryUtilities::getServerVar('SERVER_SOFTWARE'); if (!empty($webserver) && preg_match('|^Microsoft-IIS/(\\d)\\.\\d$|', trim($webserver), $matches) && $matches[1] < 6) { /* * It is IIS and it's a version with this bug, check if GALLERYSID is already in * the URL, else append it */ $session =& $gallery->getSession(); $sessionParamString = GalleryUtilities::prefixFormVariable(urlencode($session->getKey())) . '=' . urlencode($session->getId()); if ($session->isPersistent() && !strstr($redirectUrl, $sessionParamString)) { $redirectUrl .= strpos($redirectUrl, '?') === false ? '?' : '&'; $redirectUrl .= $sessionParamString; } } } /* Use our PHP VM for testability */ $phpVm = $gallery->getPhpVm(); $phpVm->header("Location: {$redirectUrl}"); return array('isDone' => true); } else { return array('isDone' => true, 'redirectUrl' => $redirectUrl, 'template' => $template); } }
generateUrl('index.php?import'); ?> ">Import Database</a> </h2> <p class="description"> Restore your Gallery database from an export that was made from the site administration maintenance screen or from the Database Backup step of the Gallery upgrader. </p> <hr class="faint" /> <h2> <?php require_once '../../embed.php'; $ret = GalleryEmbed::init(array('fullInit' => false, 'noDatabase' => true)); /* Ignore error */ $url = GalleryUrlGenerator::appendParamsToUrl('../../' . GALLERY_MAIN_PHP, array('view' => 'core.UserAdmin', 'subView' => 'core.UserRecoverPasswordAdmin')); ?> <a href="<?php print $url; ?> ">Reset User Password</a> </h2> <p class="description"> Set new password for any user. Can be used to regain access to an administrator account when the "forgot password" feature cannot be used due to invalid/missing email address or other email problems. </p> </div> </body> </html>
/** Returns the URL to the G2 folder, e.g. http://example.com/gallery2/. */ function getGalleryDirUrl() { global $g2Base; require_once $g2Base . 'modules/core/classes/GalleryUrlGenerator.class'; $urlPath = preg_replace('|^(.*/)install/index.php(?:\\?.*)?$|s', '$1', GalleryUrlGenerator::getCurrentRequestUri()); return getBaseUrl() . $urlPath; }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /** * This script will just redirect to main.php * The Location header requires an absolute url to conform with HTTP/1.1 * @package Gallery * @author Bharat Mediratta <*****@*****.**> * @version $Revision: 17580 $ */ /* Include bootstrap.inc in case config.php overrides GALLERY_MAIN_PHP */ require_once dirname(__FILE__) . '/bootstrap.inc'; require_once dirname(__FILE__) . '/modules/core/classes/GalleryUrlGenerator.class'; require_once dirname(__FILE__) . '/modules/core/classes/GalleryCoreApi.class'; /* The REQUEST_URI can either be /path/index.php or just /path/. Get rid of index.php.* */ $path = GalleryUrlGenerator::getCurrentRequestUri(); if (preg_match('|^(/(?:[^?#/]+/)*)(.*)|', $path, $matches)) { $path = $matches[1] . GALLERY_MAIN_PHP; if (!empty($matches[2]) && ($pos = strpos($matches[2], '?')) !== false) { $path .= substr($matches[2], $pos); } } $configBaseUri = @$gallery->getConfig('baseUri'); $urlGenerator = new GalleryUrlGenerator(); $urlGenerator->init(!empty($configBaseUri) ? $configBaseUri : null); $phpVm = $gallery->getPhpVm(); $phpVm->header('Location: ' . $urlGenerator->makeUrl($path));