Пример #1
0
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);
    }
}
Пример #2
0
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>