curiouswebster
asked on
How do I "activate" the .php files in Windows? Isn't that what WAMP does?
I have downloaded, installed and started WAMP Server. Â I have also downloaded this photo gallery:
http://gallery.menalto.com/
which contains .php files that explain how to install the gallery. Â The problem is that I have never used php and the files are not recognzed by Windows. Â So when I follow the directions and navigate to the Install directory, which has a file called "index.php", but my browser does not load it when I try and open it. Â It acts like it does not know what to do with .php files and suggests I download something from the web.
I get "WAMPSERVER - server Online" when I put the cursor over the WAMP tool in the toolbar. Â How do I get php to be "understood" by Windows?
I'm a bit stuck.
Thanks,
newbieweb
http://gallery.menalto.com/
which contains .php files that explain how to install the gallery. Â The problem is that I have never used php and the files are not recognzed by Windows. Â So when I follow the directions and navigate to the Install directory, which has a file called "index.php", but my browser does not load it when I try and open it. Â It acts like it does not know what to do with .php files and suggests I download something from the web.
I get "WAMPSERVER - server Online" when I put the cursor over the WAMP tool in the toolbar. Â How do I get php to be "understood" by Windows?
I'm a bit stuck.
Thanks,
newbieweb
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I unzipped the zipfile to photogallery where it added gallery2.
But this does not work
http://localhost/photogallery/gallery2/
and neither does this:
http://localhost/photogallery/
newbieweb
But this does not work
http://localhost/photogallery/gallery2/
and neither does this:
http://localhost/photogallery/
newbieweb
ASKER
this is not recognized:
http://localhost/photogallery/gallery2/install/index.php
although the file exists.
Do I need to do domething to get php to be recognized?
newbieweb
http://localhost/photogallery/gallery2/install/index.php
although the file exists.
Do I need to do domething to get php to be recognized?
newbieweb
Maybe it's
http://localhost/gallery2/install/index.php
You could also locate the error.log file inside the wamp directory and check the message there. What do the lines contain?
http://localhost/gallery2/install/index.php
You could also locate the error.log file inside the wamp directory and check the message there. What do the lines contain?
ASKER
I found the apache_error.log in C:\wamp\logs\
but it was empty.
Also, I removed the photogallery folder and put the gallery2 folder inside htdocs.
But this:
http://localhost/gallery2/install/index.php
still fails to load the page.
Should the .php file type be executable in Windows Explorer??
newbieweb
but it was empty.
Also, I removed the photogallery folder and put the gallery2 folder inside htdocs.
But this:
http://localhost/gallery2/install/index.php
still fails to load the page.
Should the .php file type be executable in Windows Explorer??
newbieweb
ASKER
Should the WAMP server, when online, make the .PHP file type exectuable?
Here's what I see when I look at the file type from Windows Explorer.
newbieweb
PHP-Not-recognized.JPG
Here's what I see when I look at the file type from Windows Explorer.
newbieweb
PHP-Not-recognized.JPG
No the php-files don't get executed via windows-exporer. THe files get executed via Internet Explorer/Firefox. So you need to open in that Browser:
http:://localhost/gallery2/
http:://localhost/gallery2/
ASKER
This does URL does not work. Â I enter this into my browser:
http://localhost/gallery2/index.php
index.php is a legitemate php file, but my browser can not load the page.
It's located at:
C:\wamp\bin\apache\apache2 .2.8\htdoc s\gallery2 \index.php
do I need to set the default directory with WAMP so htdocs will be used?
thanks,
newbieweb
http://localhost/gallery2/index.php
index.php is a legitemate php file, but my browser can not load the page.
It's located at:
C:\wamp\bin\apache\apache2
do I need to set the default directory with WAMP so htdocs will be used?
thanks,
newbieweb
Regarding to question http:Q_23652964.html you will need to enter
http://localhost:8080/gallery2/index.php
http://localhost:8080/gallery2/index.php
ASKER
It's stil not working. Don't I need to download php? Â Don't I need to install from php.net?
If so, what version should I choose?
newbieweb
If so, what version should I choose?
newbieweb
ASKER
Now I have installed everything on my Vista machine, as a test, and I get the same "The webpage cannot be found" message from Internet Explorer.
I have:
1) installed WAMP on my Vista computer
2) installed gallery.menalto to the htdocs folder of apache2.2.8
3) changed the httpd.conf to include LISTEN 127.0.0.1:8080
4) brought the server succesfully online
But when I try and open a php file it does not recognize it. Â I open this way:
http://localhost:8080/gallery2/index.php
Can anyone see what I am missing? Â Do I need to change some other configuration for for 8080?
I also find that this URL fails as well:
http://localhost:8080/gallery/
shouldn't this open the folder and display the files within?? Â Or because the index file block browsing, and the index is a php file, it fails?
thanks,
newbieweb
I have:
1) installed WAMP on my Vista computer
2) installed gallery.menalto to the htdocs folder of apache2.2.8
3) changed the httpd.conf to include LISTEN 127.0.0.1:8080
4) brought the server succesfully online
But when I try and open a php file it does not recognize it. Â I open this way:
http://localhost:8080/gallery2/index.php
Can anyone see what I am missing? Â Do I need to change some other configuration for for 8080?
I also find that this URL fails as well:
http://localhost:8080/gallery/
shouldn't this open the folder and display the files within?? Â Or because the index file block browsing, and the index is a php file, it fails?
thanks,
newbieweb
ASKER
My primary question now is whether I need to also install PHP, or if WAMP shuld contain that.
thanks,
newbieweb
thanks,
newbieweb
ASKER
Here is the contents if index.php, which redirectws to main.php. Â I have posted both pages here.
<?php
/*
 * Gallery - a web based photo album viewer and editor
 * Copyright (C) 2000-2007 Bharat Mediratta
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * 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 <bharat@menalto.com>
 * @version $Revision: 15513 $
 */
/* Include bootstrap.inc in case config.php overrides GALLERY_MAIN_PHP */
require_once(dirname(__FIL E__) . '/bootstrap.inc');
require_once(dirname(__FIL E__) . '/modules/core/classes/Gal leryUrlGen erator.cla ss');
require_once(dirname(__FIL E__) . '/modules/core/classes/Gal leryCoreAp i.class');
/* The REQUEST_URI can either be /path/index.php or just /path/. Get rid of index.php.* */
$path = GalleryUrlGenerator::getCu rrentReque stUri();
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('base Uri');
$urlGenerator = new GalleryUrlGenerator();
$urlGenerator->init(!empty ($configBa seUri) ? $configBaseUri : null);
$phpVm = $gallery->getPhpVm();
$phpVm->header('Location: ' . $urlGenerator->makeUrl($pa th));
?>
=============
<?php
/*
 * Gallery - a web based photo album viewer and editor
 * Copyright (C) 2000-2007 Bharat Mediratta
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * 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.
 */
include(dirname(__FILE__) . '/bootstrap.inc');
/*
 * If they don't have a setup password, we assume that the config.php is empty and this is an
 * initial install
 */
if (!@$gallery->getConfig('se tup.passwo rd')) {
  /* May be invalid if a multisite install lost its config.php; galleryBaseUrl unknown */
  header('Location: install/');
  return;
}
if ($gallery->isEmbedded()) {
  require_once(dirname(__FIL E__) . '/init.inc');
} else {
  /* If this is a request for a public data file, give it to the user immediately */
  $unsanitizedView = isset($_GET[GALLERY_FORM_V ARIABLE_PR EFIX . 'view']) ?
      $_GET[GALLERY_FORM_VARIABL E_PREFIX . 'view'] : null;
  $itemId = (int)(isset($_GET[GALLERY_ FORM_VARIA BLE_PREFIX . 'itemId']) ?
             $_GET[GALLERY_FORM_VARIABL E_PREFIX . 'itemId'] : null);
  if ($unsanitizedView == 'core.DownloadItem' && !empty($itemId)) {
      /*
      * Our URLs are immutable because they have the serial numbers embedded.  If the browser
      * presents us with an If-Modified-Since then it has the latest version of the file already.
      */
      if (isset($_SERVER['HTTP_IF_M ODIFIED_SI NCE'])
           || (function_exists('getallhe aders')
             && ($headers = getallheaders())
             && (isset($headers['If-Modifi ed-Since'] )
                 || isset($headers['If-modifie d-since']) ))) {
        header('HTTP/1.0 304 Not Modified');
        return;
      }
      /*
      * Fast download depends on having data.gallery.cache set, so set it now.  If for some
      * reason we fail, we'll reset it in init.inc (but that's OK).
      */
      $gallery->setConfig(
        'data.gallery.cache', $gallery->getConfig('data. gallery.ba se') . 'cache/');
      $path = GalleryDataCache::getCache Path(
        array('type' => 'fast-download', 'itemId' => $itemId));
      /* We don't have a platform yet so we have to use the raw file_exists */
      /* Disable fast-download in maintenance mode, admins still get via core.DownloadItem */
      if (file_exists($path) && !$gallery->getConfig('mode .maintenan ce')) {
        include($path);
        if (GalleryFastDownload()) {
           return;
        }
      }
  }
  /* Otherwise, proceed with our regular process */
  require_once(dirname(__FIL E__) . '/init.inc');
  $ret = GalleryInitFirstPass();
  if ($ret) {
      _GalleryMain_errorHandler( $ret, null, false);
      return;
  }
  /* Process the request */
  GalleryMain();
}
/**
 * Main handler for all Gallery pages/requests.
 * @package Gallery
 */
function GalleryMain($embedded=fals e) {
  global $gallery;
  /* Process the request */
  list ($ret, $g2Data) = _GalleryMain($embedded);
  if (!$ret) {
      $gallery->performShutdownA ctions();
      /* Write out our session data */
      $session =& $gallery->getSession();
      $ret = $session->save();
  }
  /* Complete our transaction */
  if (!$ret && $gallery->isStorageInitial ized()) {
      $storage =& $gallery->getStorage();
      $ret = $storage->commitTransactio n();
  }
  /* Error handling (or redirect info in debug mode) */
  if ($ret) {
      _GalleryMain_errorHandler( $ret, $g2Data);
      $g2Data['isDone'] = true;
      if ($ret && $gallery->isStorageInitial ized()) {
        /* Nuke our transaction, too */
        $storage =& $gallery->getStorage();
        $storage->rollbackTransact ion();
        /* Reset the auth token */
        if ($ret->getErrorCode() & ERROR_REQUEST_FORGED) {
           $session =& $gallery->getSession();
           $ret2 = $storage->beginTransaction ();
           if (!$ret2) {
             $ret2 = $session->save();
           }
           if (!$ret2) {
             $storage->commitTransactio n();
           }
        }
      }
  } else if (isset($g2Data['redirectUr l'])) {
      /* If we're in debug mode, show a redirect page */
      print '<h1> Debug Redirect </h1> ' .
        'Not automatically redirecting you to the next page because we\'re in debug mode<br/>';
      printf('<a href="%s">Continue to the next page</a>', $g2Data['redirectUrl']);
      print '<hr/>';
      print '<pre>';
      print $gallery->getDebugBuffer() ;
      print '</pre>';
  }
  return $g2Data;
}
/**
 * Process our request.
 * @return array object GalleryStatus a status code
 *        array
 */
function _GalleryMain($embedded=fal se) {
  global $gallery;
  $urlGenerator =& $gallery->getUrlGenerator( );
  /* Figure out the target view/controller */
  list ($controllerName, $viewName) = GalleryUtilities::getReque stVariable s('control ler', 'view');
  $controllerName = is_string($controllerName) ? $controllerName : null;
  $viewName = is_string($viewName) ? $viewName : null;
  $gallery->debug("controlle r $controllerName, view $viewName");
  /* Check if core module needs upgrading */
  list ($ret, $core) = GalleryCoreApi::loadPlugin ('module', 'core', true);
  if ($ret) {
      return array($ret, null);
  }
  $installedVersions = $core->getInstalledVersion s();
  if ($installedVersions['core' ] != $core->getVersion()) {
      if ($redirectUrl = @$gallery->getConfig('mode .maintenan ce')) {
        /* Maintenance mode - redirect if given URL, else simple message */
        if ($redirectUrl === true) {
           print $core->translate('Site is temporarily down for maintenance.');
           exit;
        }
      } else {
        $gallery->debug('Redirect to the upgrade wizard, core module version is out of date');
        $redirectUrl = $urlGenerator->getCurrentU rlDir(true ) . 'upgrade/index.php';
      }
      return array(null, _GalleryMain_doRedirect($r edirectUrl ));
  }
  $ret = GalleryInitSecondPass();
  if ($ret) {
      return array($ret, null);
  }
  /* Load and run the appropriate controller */
  $results = array();
  if (!empty($controllerName)) {
      GalleryCoreApi::requireOnc e('modules /core/clas ses/Galler yControlle r.class');
      list ($ret, $controller) = GalleryController::loadCon troller($c ontrollerN ame);
      if ($ret) {
        return array($ret, null);
      }
      if (!$embedded && $gallery->getConfig('mode. embed.only ')
           && !$controller->isAllowedInE mbedOnly() ) {
        /* Lock out direct access when embed-only is set */
        if (($redirectUrl = $gallery->getConfig('mode. embed.only ')) === true) {
           return array(GalleryCoreApi::erro r(ERROR_PE RMISSION_D ENIED), null);
        }
        return array(null, _GalleryMain_doRedirect($r edirectUrl ));
      }
      if ($gallery->getConfig('mode .maintenan ce') && !$controller->isAllowedInM aintenance ()) {
        /* Maintenance mode - allow admins, else redirect to given or standard URL */
        list ($ret, $isAdmin) = GalleryCoreApi::isUserInSi teAdminGro up();
        if ($ret) {
           return array($ret, null);
        }
        if (!$isAdmin) {
           if (($redirectUrl = $gallery->getConfig('mode. maintenanc e')) === true) {
             $redirectUrl = $urlGenerator->generateUrl (
                 array('view' => 'core.MaintenanceMode'), array('forceFullUrl' => true));
           }
           return array(null, _GalleryMain_doRedirect($r edirectUrl ));
        }
      }
      /* Get our form and return variables */
      $form = GalleryUtilities::getFormV ariables(' form');
      /* Verify the genuineness of the request */
      if (!$controller->omitAuthTok enCheck()) {
        $ret = GalleryController::assertI sGenuineRe quest();
        if ($ret) {
           return array($ret, null);
        }
      }
      /* Let the controller handle the input */
      list ($ret, $results) = $controller->handleRequest ($form);
      if ($ret) {
        return array($ret, null);
      }
      /* Check to make sure we got back everything we want */
      if (!isset($results['status'] )
           || !isset($results['error'])
           || (!isset($results['redirect '])
             && !isset($results['delegate' ])
             && !isset($results['return']) )) {
        return array(GalleryCoreApi::erro r(ERROR_BA D_PARAMETE R, __FILE__, __LINE__,
           'Controller results are missing status, error, (redirect, delegate, return)'),
           null);
      }
      /* Try to return if the controller instructs it */
      if (!empty($results['return'] )) {
        list ($ret, $navigationLinks) = $urlGenerator->getNavigati onLinks(1) ;
        if ($ret) {
           return array($ret, null);
        }
        if (count($navigationLinks) > 0) {
           /* Go back to the previous navigation point in our history */
           $redirectUrl = $navigationLinks[0]['url'] ;
        } else {
           $redirectUrl = GalleryUtilities::getReque stVariable s('return' );
           if (empty($redirectUrl)) {
             $redirectUrl = GalleryUtilities::getReque stVariable s('formUrl ');
           }
        }
      }
      /* Failing that, redirect if so instructed */
      if (empty($redirectUrl) && !empty($results['redirect' ])) {
        /* If we have a status, store its data in the session and attach it to the URL */
        if (!empty($results['status'] )) {
           $session =& $gallery->getSession();
           $results['redirect']['stat usId'] = $session->putStatus($resul ts['status ']);
        }
        $urlToGenerate = $results['redirect'];
        /* Keep our navId in the URL */
        $navId = $urlGenerator->getNavigati onId();
        if (!empty($navId)) {
           $urlToGenerate['navId'] = $navId;
        }
        $redirectUrl = $urlGenerator->generateUrl ($urlToGen erate,
                                    array('forceFullUrl' => true));
      }
      /* If we have a redirect URL use it */
      if (!empty($redirectUrl)) {
        return array(null, _GalleryMain_doRedirect($r edirectUrl , null, $controllerName));
      }
      /* Let the controller specify the next view */
      if (!empty($results['delegate '])) {
        /* Load any errors into the request */
        if (!empty($results['error']) ) {
           foreach ($results['error'] as $error) {
             GalleryUtilities::putReque stVariable ($error, 1);
           }
        }
        /* Save the view name, put the rest into the request so the view can get it */
        foreach ($results['delegate'] as $key => $value) {
           switch($key) {
           case 'view':
             $viewName = $value;
             break;
           default:
             GalleryUtilities::putReque stVariable ($key, $value);
             break;
           }
        }
      }
  }
  /* Load and run the appropriate view */
  if (empty($viewName)) {
      $viewName = GALLERY_DEFAULT_VIEW;
      GalleryUtilities::putReque stVariable ('view', $viewName);
  }
  list ($ret, $view) = GalleryView::loadView($vie wName);
  if ($ret) {
      return array($ret, null);
  }
  if ($gallery->getConfig('mode .maintenan ce') && !$view->isAllowedInMainten ance()) {
      /* Maintenance mode - allow admins, else redirect to given url or show standard view */
      list ($ret, $isAdmin) = GalleryCoreApi::isUserInSi teAdminGro up();
      if ($ret) {
        return array($ret, null);
      }
      if (!$isAdmin) {
        if (($redirectUrl = $gallery->getConfig('mode. maintenanc e')) !== true) {
           return array(null, _GalleryMain_doRedirect($r edirectUrl ));
        }
        $viewName = 'core.MaintenanceMode';
        list ($ret, $view) = GalleryView::loadView($vie wName);
        if ($ret) {
           return array($ret, null);
        }
      }
  }
  if (!$embedded && $gallery->getConfig('mode. embed.only ') && !$view->isAllowedInEmbedOn ly()) {
      /* Lock out direct access when embed-only is set */
      if (($redirectUrl = $gallery->getConfig('mode. embed.only ')) === true) {
        return array(GalleryCoreApi::erro r(ERROR_PE RMISSION_D ENIED), null);
      }
      return array(null, _GalleryMain_doRedirect($r edirectUrl ));
  }
  /* Check if the page is cached and return the cached version, else generate the page */
  list ($ret, $shouldCache) = GalleryDataCache::shouldCa che('read' , 'full');
  if ($ret) {
      return array($ret, null);
  }
  $html = '';
  if ($shouldCache) {
      $session =& $gallery->getSession();
      list ($ret, $html) = GalleryDataCache::getPageD ata(
        'page', $urlGenerator->getCacheabl eUrl());
      if ($ret) {
        return array($ret, null);
      }
      if (!empty($html) && $embedded) {
        /* Also get the theme data */
        list ($ret, $themeData) = GalleryDataCache::getPageD ata(
           'theme', $urlGenerator->getCacheabl eUrl());
        if ($ret) {
           return array($ret, null);
        }
      }
  }
  if (!empty($html) && (!$embedded || !empty($themeData))) {
      /* TODO: If we cache all the headers and replay them here, we could send a 304 back */
      $session =& $gallery->getSession();
      if (!$embedded) {
        /* Set the appropriate charset in our HTTP header */
        if (!headers_sent()) {
           header('Content-Type: text/html; charset=UTF-8');
        }
        print $session->replaceTempSessi onIdIfNece ssary($htm l);
        $data['isDone'] = true;
      } else {
        $html = unserialize($html);
        $themeData = unserialize($themeData);
        $data = $session->replaceSessionId InData($ht ml);
        $data['themeData'] = $session->replaceSessionId InData($th emeData);
        $data['isDone'] = false;
      }
  } else {
      /* Initialize our container for template data */
      $gallery->setCurrentView($ viewName);
      if ($view->isControllerLike() ) {
        /* Verify the genuineness of the request */
        $ret = GalleryController::assertI sGenuineRe quest();
        if ($ret) {
           return array($ret, null);
        }
      }
      /* If we render directly to the browser, we need a session before, or no session at all */
      if ($view->isImmediate() || $viewName == 'core.ProgressBar') {
        /*
        * Session: Find out whether we need to send a cookie & get a new sessionId and save it
        * (make sure there's a sessionId before starting to render, but only if we need a
        * session)
        */
        $session =& $gallery->getSession();
        $ret = $session->start();
        if ($ret) {
           return array($ret, null);
        }
        /* From now on, don't add navId/sessionId to URLs if there's no persistent session */
        $session->doNotUseTempId() ;
      }
      /*
      * If this is an immediate view, it will send its own output directly.  This is used in the
      * situation where we want to send back data that's not controlled by the layout.  That's
      * usually something that's not user-visible like a binary file.
      */
      $data = array();
      if ($view->isImmediate()) {
        $status = isset($results['status']) ? $results['status'] : array();
        $error = isset($results['error']) ? $results['error'] : array();
        $ret = $view->renderImmediate($st atus, $error);
        if ($ret) {
           if ($ret->getErrorCode() & ERROR_MISSING_OBJECT) {
             /* Normalize error to GalleryView::_permissionCh eck() */
             $ret->addErrorCode(ERROR_P ERMISSION_ DENIED);
           }
           return array($ret, null);
        }
        $data['isDone'] = true;
      } else {
        GalleryCoreApi::requireOnc e('modules /core/clas ses/Galler yTemplate. class');
        $template = new GalleryTemplate(dirname(__ FILE__));
        list ($ret, $results, $theme) = $view->doLoadTemplate($tem plate);
        if ($ret) {
           list ($ret, $results) = $view->_permissionCheck($r et);
           if ($ret) {
             return array($ret, null);
           }
        }
        if (isset($results['redirect' ]) || isset($results['redirectUr l'])) {
           if (isset($results['redirectU rl'])) {
             $redirectUrl = $results['redirectUrl'];
           } else {
             $redirectUrl = $urlGenerator->generateUrl ($results[ 'redirect' ],
                                          array('forceFullUrl' => true));
           }
           return array(null, _GalleryMain_doRedirect($r edirectUrl , $template));
        }
        if (empty($results['body'])) {
           return array(GalleryCoreApi::erro r(ERROR_BA D_PARAMETE R, __FILE__, __LINE__,
                                   'View results are missing body file'), null);
        }
        $templatePath = 'gallery:' . $results['body'];
        $template->setVariable('l1 0Domain', $theme->getL10Domain());
        $template->setVariable('is Embedded', $embedded);
        if ($viewName == 'core.ProgressBar') {
           @ini_set('output_buffering ', '0');
           if (function_exists('apache_s etenv')) {
             @apache_setenv('no-gzip', '1');
           }
           /* Render progress bar pages immediately so that the user sees the bar moving */
           $ret = $template->display($templa tePath);
           if ($ret) {
             return array($ret, null);
           }
           $data['isDone'] = true;
        } else {
           list ($ret, $html) = $template->fetch($template Path);
           if ($ret) {
             return array($ret, null);
           }
           /*
            * Session: Find out whether we need to send a cookie & need a new session (only if
            * we don't have one yet)
            */
           $session =& $gallery->getSession();
           $ret = $session->start();
           if ($ret) {
             return array($ret, null);
           }
           list ($ret, $shouldCache) = GalleryDataCache::shouldCa che('write ', 'full');
           if ($ret) {
             return array($ret, null);
           }
           if ($embedded) {
             $html = $theme->splitHtml($html, $results);
           }
           if ($shouldCache && $results['cacheable']) {
             $htmlForCache = $html;
             if ($embedded) {
                 $themeDataForCache = $template->getVariable('th eme');
             }
           }
           if ($embedded) {
             $data = $session->replaceSessionId InData($ht ml);
             $data['themeData'] =& $template->getVariableByRe ference('t heme');
             $data['themeData'] = $session->replaceSessionId InData($da ta['themeD ata']);
             $data['isDone'] = false;
           } else {
             /* Set the appropriate charset in our HTTP header */
             if (!headers_sent()) {
                 header('Content-Type: text/html; charset=UTF-8');
             }
             print $session->replaceTempSessi onIdIfNece ssary($htm l);
             $data['isDone'] = true;
           }
           if ($shouldCache && $results['cacheable']) {
             $session =& $gallery->getSession();
             $cacheKey = $urlGenerator->getCacheabl eUrl();
             $sessionId = $session->getId();
             if (!empty($sessionId) && $sessionId != SESSION_TEMP_ID) {
                 $htmlForCache = $session->replaceSessionId InData(
                      $htmlForCache, $sessionId, SESSION_TEMP_ID);
                 if ($embedded) {
                   $data['themeData'] = $session->replaceSessionId InData(
                        $data['themeData'], $sessionId, SESSION_TEMP_ID);
                 }
             }
             if ($embedded) {
                 $htmlForCache = serialize($htmlForCache);
                 $ret = GalleryDataCache::putPageD ata('theme ', $results['cacheable'],
                      $cacheKey, serialize($data['themeData ']));
                 if ($ret) {
                   return array($ret, null);
                 }
             }
             $ret = GalleryDataCache::putPageD ata('page' , $results['cacheable'],
                 $cacheKey, $htmlForCache);
             if ($ret) {
                 return array($ret, null);
             }
           }
        }
      }
  }
  return array(null, $data);
}
function _GalleryMain_doRedirect($r edirectUrl , $template=null, $controller=null) {
  global $gallery;
  $session =& $gallery->getSession();
  $urlGenerator =& $gallery->getUrlGenerator( );
  /* Create a valid sessionId for guests, if required */
  $ret = $session->start();
  if ($ret) {
      return array($ret, null);
  }
  $redirectUrl = $session->replaceTempSessi onIdIfNece ssary($red irectUrl);
  $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::appen dParamsToU rl($redire ctUrl,
        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, '&? ');
      $redirectUrl = $urlGenerator->makeAbsolut eUrl($redi rectUrl);
      /*
      * IIS 3.0 - 5.0 webservers will ignore all other headers if the location header is set.  It
      * will simply not send other headers, eg. 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::getServe rVar('SERV ER_SOFTWAR E');
        if (!empty($webserver)
             && preg_match('|^Microsoft-II S/(\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::prefixFo rmVariable (urlencode ($session- >getKey()) ) . '='
             . urlencode($session->getId( ));
           if ($session->isPersistent() && !strstr($redirectUrl, $sessionParamString)) {
             $redirectUrl .= (strpos($redirectUrl, '?') === false) ? '?' : '&';
             $redirectUrl .= $sessionParamString;
           }
        }
      }
      GalleryUtilities::setRespo nseHeader( "Location: $redirectUrl");
      return array('isDone' => true);
  }
  return array('isDone' => true, 'redirectUrl' => $redirectUrl, 'template' => $template);
}
function _GalleryMain_errorHandler( $error, $g2Data=null, $initOk=true) {
  GalleryCoreApi::requireOnc e('modules /core/Erro rPage.inc' );
  ErrorPageView::errorHandle r($error, $g2Data, $initOk);
}
?>
<?php
/*
 * Gallery - a web based photo album viewer and editor
 * Copyright (C) 2000-2007 Bharat Mediratta
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * 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 <bharat@menalto.com>
 * @version $Revision: 15513 $
 */
/* Include bootstrap.inc in case config.php overrides GALLERY_MAIN_PHP */
require_once(dirname(__FIL
require_once(dirname(__FIL
require_once(dirname(__FIL
/* The REQUEST_URI can either be /path/index.php or just /path/. Get rid of index.php.* */
$path = GalleryUrlGenerator::getCu
if (preg_match('|^(/(?:[^?#/]
  $path = $matches[1] . GALLERY_MAIN_PHP;
  if (!empty($matches[2]) && ($pos = strpos($matches[2], '?')) !== false) {
      $path .= substr($matches[2], $pos);
  }
}
$configBaseUri = @$gallery->getConfig('base
$urlGenerator = new GalleryUrlGenerator();
$urlGenerator->init(!empty
$phpVm = $gallery->getPhpVm();
$phpVm->header('Location: ' . $urlGenerator->makeUrl($pa
?>
=============
<?php
/*
 * Gallery - a web based photo album viewer and editor
 * Copyright (C) 2000-2007 Bharat Mediratta
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * 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.
 */
include(dirname(__FILE__) . '/bootstrap.inc');
/*
 * If they don't have a setup password, we assume that the config.php is empty and this is an
 * initial install
 */
if (!@$gallery->getConfig('se
  /* May be invalid if a multisite install lost its config.php; galleryBaseUrl unknown */
  header('Location: install/');
  return;
}
if ($gallery->isEmbedded()) {
  require_once(dirname(__FIL
} else {
  /* If this is a request for a public data file, give it to the user immediately */
  $unsanitizedView = isset($_GET[GALLERY_FORM_V
      $_GET[GALLERY_FORM_VARIABL
  $itemId = (int)(isset($_GET[GALLERY_
             $_GET[GALLERY_FORM_VARIABL
  if ($unsanitizedView == 'core.DownloadItem' && !empty($itemId)) {
      /*
      * Our URLs are immutable because they have the serial numbers embedded.  If the browser
      * presents us with an If-Modified-Since then it has the latest version of the file already.
      */
      if (isset($_SERVER['HTTP_IF_M
           || (function_exists('getallhe
             && ($headers = getallheaders())
             && (isset($headers['If-Modifi
                 || isset($headers['If-modifie
        header('HTTP/1.0 304 Not Modified');
        return;
      }
      /*
      * Fast download depends on having data.gallery.cache set, so set it now.  If for some
      * reason we fail, we'll reset it in init.inc (but that's OK).
      */
      $gallery->setConfig(
        'data.gallery.cache', $gallery->getConfig('data.
      $path = GalleryDataCache::getCache
        array('type' => 'fast-download', 'itemId' => $itemId));
      /* We don't have a platform yet so we have to use the raw file_exists */
      /* Disable fast-download in maintenance mode, admins still get via core.DownloadItem */
      if (file_exists($path) && !$gallery->getConfig('mode
        include($path);
        if (GalleryFastDownload()) {
           return;
        }
      }
  }
  /* Otherwise, proceed with our regular process */
  require_once(dirname(__FIL
  $ret = GalleryInitFirstPass();
  if ($ret) {
      _GalleryMain_errorHandler(
      return;
  }
  /* Process the request */
  GalleryMain();
}
/**
 * Main handler for all Gallery pages/requests.
 * @package Gallery
 */
function GalleryMain($embedded=fals
  global $gallery;
  /* Process the request */
  list ($ret, $g2Data) = _GalleryMain($embedded);
  if (!$ret) {
      $gallery->performShutdownA
      /* Write out our session data */
      $session =& $gallery->getSession();
      $ret = $session->save();
  }
  /* Complete our transaction */
  if (!$ret && $gallery->isStorageInitial
      $storage =& $gallery->getStorage();
      $ret = $storage->commitTransactio
  }
  /* Error handling (or redirect info in debug mode) */
  if ($ret) {
      _GalleryMain_errorHandler(
      $g2Data['isDone'] = true;
      if ($ret && $gallery->isStorageInitial
        /* Nuke our transaction, too */
        $storage =& $gallery->getStorage();
        $storage->rollbackTransact
        /* Reset the auth token */
        if ($ret->getErrorCode() & ERROR_REQUEST_FORGED) {
           $session =& $gallery->getSession();
           $ret2 = $storage->beginTransaction
           if (!$ret2) {
             $ret2 = $session->save();
           }
           if (!$ret2) {
             $storage->commitTransactio
           }
        }
      }
  } else if (isset($g2Data['redirectUr
      /* If we're in debug mode, show a redirect page */
      print '<h1> Debug Redirect </h1> ' .
        'Not automatically redirecting you to the next page because we\'re in debug mode<br/>';
      printf('<a href="%s">Continue to the next page</a>', $g2Data['redirectUrl']);
      print '<hr/>';
      print '<pre>';
      print $gallery->getDebugBuffer()
      print '</pre>';
  }
  return $g2Data;
}
/**
 * Process our request.
 * @return array object GalleryStatus a status code
 *        array
 */
function _GalleryMain($embedded=fal
  global $gallery;
  $urlGenerator =& $gallery->getUrlGenerator(
  /* Figure out the target view/controller */
  list ($controllerName, $viewName) = GalleryUtilities::getReque
  $controllerName = is_string($controllerName)
  $viewName = is_string($viewName) ? $viewName : null;
  $gallery->debug("controlle
  /* Check if core module needs upgrading */
  list ($ret, $core) = GalleryCoreApi::loadPlugin
  if ($ret) {
      return array($ret, null);
  }
  $installedVersions = $core->getInstalledVersion
  if ($installedVersions['core'
      if ($redirectUrl = @$gallery->getConfig('mode
        /* Maintenance mode - redirect if given URL, else simple message */
        if ($redirectUrl === true) {
           print $core->translate('Site is temporarily down for maintenance.');
           exit;
        }
      } else {
        $gallery->debug('Redirect to the upgrade wizard, core module version is out of date');
        $redirectUrl = $urlGenerator->getCurrentU
      }
      return array(null, _GalleryMain_doRedirect($r
  }
  $ret = GalleryInitSecondPass();
  if ($ret) {
      return array($ret, null);
  }
  /* Load and run the appropriate controller */
  $results = array();
  if (!empty($controllerName)) {
      GalleryCoreApi::requireOnc
      list ($ret, $controller) = GalleryController::loadCon
      if ($ret) {
        return array($ret, null);
      }
      if (!$embedded && $gallery->getConfig('mode.
           && !$controller->isAllowedInE
        /* Lock out direct access when embed-only is set */
        if (($redirectUrl = $gallery->getConfig('mode.
           return array(GalleryCoreApi::erro
        }
        return array(null, _GalleryMain_doRedirect($r
      }
      if ($gallery->getConfig('mode
        /* Maintenance mode - allow admins, else redirect to given or standard URL */
        list ($ret, $isAdmin) = GalleryCoreApi::isUserInSi
        if ($ret) {
           return array($ret, null);
        }
        if (!$isAdmin) {
           if (($redirectUrl = $gallery->getConfig('mode.
             $redirectUrl = $urlGenerator->generateUrl
                 array('view' => 'core.MaintenanceMode'), array('forceFullUrl' => true));
           }
           return array(null, _GalleryMain_doRedirect($r
        }
      }
      /* Get our form and return variables */
      $form = GalleryUtilities::getFormV
      /* Verify the genuineness of the request */
      if (!$controller->omitAuthTok
        $ret = GalleryController::assertI
        if ($ret) {
           return array($ret, null);
        }
      }
      /* Let the controller handle the input */
      list ($ret, $results) = $controller->handleRequest
      if ($ret) {
        return array($ret, null);
      }
      /* Check to make sure we got back everything we want */
      if (!isset($results['status']
           || !isset($results['error'])
           || (!isset($results['redirect
             && !isset($results['delegate'
             && !isset($results['return'])
        return array(GalleryCoreApi::erro
           'Controller results are missing status, error, (redirect, delegate, return)'),
           null);
      }
      /* Try to return if the controller instructs it */
      if (!empty($results['return']
        list ($ret, $navigationLinks) = $urlGenerator->getNavigati
        if ($ret) {
           return array($ret, null);
        }
        if (count($navigationLinks) > 0) {
           /* Go back to the previous navigation point in our history */
           $redirectUrl = $navigationLinks[0]['url']
        } else {
           $redirectUrl = GalleryUtilities::getReque
           if (empty($redirectUrl)) {
             $redirectUrl = GalleryUtilities::getReque
           }
        }
      }
      /* Failing that, redirect if so instructed */
      if (empty($redirectUrl) && !empty($results['redirect'
        /* If we have a status, store its data in the session and attach it to the URL */
        if (!empty($results['status']
           $session =& $gallery->getSession();
           $results['redirect']['stat
        }
        $urlToGenerate = $results['redirect'];
        /* Keep our navId in the URL */
        $navId = $urlGenerator->getNavigati
        if (!empty($navId)) {
           $urlToGenerate['navId'] = $navId;
        }
        $redirectUrl = $urlGenerator->generateUrl
                                    array('forceFullUrl' => true));
      }
      /* If we have a redirect URL use it */
      if (!empty($redirectUrl)) {
        return array(null, _GalleryMain_doRedirect($r
      }
      /* Let the controller specify the next view */
      if (!empty($results['delegate
        /* Load any errors into the request */
        if (!empty($results['error'])
           foreach ($results['error'] as $error) {
             GalleryUtilities::putReque
           }
        }
        /* Save the view name, put the rest into the request so the view can get it */
        foreach ($results['delegate'] as $key => $value) {
           switch($key) {
           case 'view':
             $viewName = $value;
             break;
           default:
             GalleryUtilities::putReque
             break;
           }
        }
      }
  }
  /* Load and run the appropriate view */
  if (empty($viewName)) {
      $viewName = GALLERY_DEFAULT_VIEW;
      GalleryUtilities::putReque
  }
  list ($ret, $view) = GalleryView::loadView($vie
  if ($ret) {
      return array($ret, null);
  }
  if ($gallery->getConfig('mode
      /* Maintenance mode - allow admins, else redirect to given url or show standard view */
      list ($ret, $isAdmin) = GalleryCoreApi::isUserInSi
      if ($ret) {
        return array($ret, null);
      }
      if (!$isAdmin) {
        if (($redirectUrl = $gallery->getConfig('mode.
           return array(null, _GalleryMain_doRedirect($r
        }
        $viewName = 'core.MaintenanceMode';
        list ($ret, $view) = GalleryView::loadView($vie
        if ($ret) {
           return array($ret, null);
        }
      }
  }
  if (!$embedded && $gallery->getConfig('mode.
      /* Lock out direct access when embed-only is set */
      if (($redirectUrl = $gallery->getConfig('mode.
        return array(GalleryCoreApi::erro
      }
      return array(null, _GalleryMain_doRedirect($r
  }
  /* Check if the page is cached and return the cached version, else generate the page */
  list ($ret, $shouldCache) = GalleryDataCache::shouldCa
  if ($ret) {
      return array($ret, null);
  }
  $html = '';
  if ($shouldCache) {
      $session =& $gallery->getSession();
      list ($ret, $html) = GalleryDataCache::getPageD
        'page', $urlGenerator->getCacheabl
      if ($ret) {
        return array($ret, null);
      }
      if (!empty($html) && $embedded) {
        /* Also get the theme data */
        list ($ret, $themeData) = GalleryDataCache::getPageD
           'theme', $urlGenerator->getCacheabl
        if ($ret) {
           return array($ret, null);
        }
      }
  }
  if (!empty($html) && (!$embedded || !empty($themeData))) {
      /* TODO: If we cache all the headers and replay them here, we could send a 304 back */
      $session =& $gallery->getSession();
      if (!$embedded) {
        /* Set the appropriate charset in our HTTP header */
        if (!headers_sent()) {
           header('Content-Type: text/html; charset=UTF-8');
        }
        print $session->replaceTempSessi
        $data['isDone'] = true;
      } else {
        $html = unserialize($html);
        $themeData = unserialize($themeData);
        $data = $session->replaceSessionId
        $data['themeData'] = $session->replaceSessionId
        $data['isDone'] = false;
      }
  } else {
      /* Initialize our container for template data */
      $gallery->setCurrentView($
      if ($view->isControllerLike()
        /* Verify the genuineness of the request */
        $ret = GalleryController::assertI
        if ($ret) {
           return array($ret, null);
        }
      }
      /* If we render directly to the browser, we need a session before, or no session at all */
      if ($view->isImmediate() || $viewName == 'core.ProgressBar') {
        /*
        * Session: Find out whether we need to send a cookie & get a new sessionId and save it
        * (make sure there's a sessionId before starting to render, but only if we need a
        * session)
        */
        $session =& $gallery->getSession();
        $ret = $session->start();
        if ($ret) {
           return array($ret, null);
        }
        /* From now on, don't add navId/sessionId to URLs if there's no persistent session */
        $session->doNotUseTempId()
      }
      /*
      * If this is an immediate view, it will send its own output directly.  This is used in the
      * situation where we want to send back data that's not controlled by the layout.  That's
      * usually something that's not user-visible like a binary file.
      */
      $data = array();
      if ($view->isImmediate()) {
        $status = isset($results['status']) ? $results['status'] : array();
        $error = isset($results['error']) ? $results['error'] : array();
        $ret = $view->renderImmediate($st
        if ($ret) {
           if ($ret->getErrorCode() & ERROR_MISSING_OBJECT) {
             /* Normalize error to GalleryView::_permissionCh
             $ret->addErrorCode(ERROR_P
           }
           return array($ret, null);
        }
        $data['isDone'] = true;
      } else {
        GalleryCoreApi::requireOnc
        $template = new GalleryTemplate(dirname(__
        list ($ret, $results, $theme) = $view->doLoadTemplate($tem
        if ($ret) {
           list ($ret, $results) = $view->_permissionCheck($r
           if ($ret) {
             return array($ret, null);
           }
        }
        if (isset($results['redirect'
           if (isset($results['redirectU
             $redirectUrl = $results['redirectUrl'];
           } else {
             $redirectUrl = $urlGenerator->generateUrl
                                          array('forceFullUrl' => true));
           }
           return array(null, _GalleryMain_doRedirect($r
        }
        if (empty($results['body'])) {
           return array(GalleryCoreApi::erro
                                   'View results are missing body file'), null);
        }
        $templatePath = 'gallery:' . $results['body'];
        $template->setVariable('l1
        $template->setVariable('is
        if ($viewName == 'core.ProgressBar') {
           @ini_set('output_buffering
           if (function_exists('apache_s
             @apache_setenv('no-gzip', '1');
           }
           /* Render progress bar pages immediately so that the user sees the bar moving */
           $ret = $template->display($templa
           if ($ret) {
             return array($ret, null);
           }
           $data['isDone'] = true;
        } else {
           list ($ret, $html) = $template->fetch($template
           if ($ret) {
             return array($ret, null);
           }
           /*
            * Session: Find out whether we need to send a cookie & need a new session (only if
            * we don't have one yet)
            */
           $session =& $gallery->getSession();
           $ret = $session->start();
           if ($ret) {
             return array($ret, null);
           }
           list ($ret, $shouldCache) = GalleryDataCache::shouldCa
           if ($ret) {
             return array($ret, null);
           }
           if ($embedded) {
             $html = $theme->splitHtml($html, $results);
           }
           if ($shouldCache && $results['cacheable']) {
             $htmlForCache = $html;
             if ($embedded) {
                 $themeDataForCache = $template->getVariable('th
             }
           }
           if ($embedded) {
             $data = $session->replaceSessionId
             $data['themeData'] =& $template->getVariableByRe
             $data['themeData'] = $session->replaceSessionId
             $data['isDone'] = false;
           } else {
             /* Set the appropriate charset in our HTTP header */
             if (!headers_sent()) {
                 header('Content-Type: text/html; charset=UTF-8');
             }
             print $session->replaceTempSessi
             $data['isDone'] = true;
           }
           if ($shouldCache && $results['cacheable']) {
             $session =& $gallery->getSession();
             $cacheKey = $urlGenerator->getCacheabl
             $sessionId = $session->getId();
             if (!empty($sessionId) && $sessionId != SESSION_TEMP_ID) {
                 $htmlForCache = $session->replaceSessionId
                      $htmlForCache, $sessionId, SESSION_TEMP_ID);
                 if ($embedded) {
                   $data['themeData'] = $session->replaceSessionId
                        $data['themeData'], $sessionId, SESSION_TEMP_ID);
                 }
             }
             if ($embedded) {
                 $htmlForCache = serialize($htmlForCache);
                 $ret = GalleryDataCache::putPageD
                      $cacheKey, serialize($data['themeData
                 if ($ret) {
                   return array($ret, null);
                 }
             }
             $ret = GalleryDataCache::putPageD
                 $cacheKey, $htmlForCache);
             if ($ret) {
                 return array($ret, null);
             }
           }
        }
      }
  }
  return array(null, $data);
}
function _GalleryMain_doRedirect($r
  global $gallery;
  $session =& $gallery->getSession();
  $urlGenerator =& $gallery->getUrlGenerator(
  /* Create a valid sessionId for guests, if required */
  $ret = $session->start();
  if ($ret) {
      return array($ret, null);
  }
  $redirectUrl = $session->replaceTempSessi
  $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
        && strpos($redirectUrl, $session->getKey()) === false) {
      $redirectUrl = GalleryUrlGenerator::appen
        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, '&? ');
      $redirectUrl = $urlGenerator->makeAbsolut
      /*
      * IIS 3.0 - 5.0 webservers will ignore all other headers if the location header is set.  It
      * will simply not send other headers, eg. 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::getServe
        if (!empty($webserver)
             && preg_match('|^Microsoft-II
             && $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::prefixFo
             . urlencode($session->getId(
           if ($session->isPersistent() && !strstr($redirectUrl, $sessionParamString)) {
             $redirectUrl .= (strpos($redirectUrl, '?') === false) ? '?' : '&';
             $redirectUrl .= $sessionParamString;
           }
        }
      }
      GalleryUtilities::setRespo
      return array('isDone' => true);
  }
  return array('isDone' => true, 'redirectUrl' => $redirectUrl, 'template' => $template);
}
function _GalleryMain_errorHandler(
  GalleryCoreApi::requireOnc
  ErrorPageView::errorHandle
}
?>
ASKER
C:\wamp\bin\apache\apache2
So I should unzip the gallery-2.2.5-developer.zi
Thanks for the help!
newbieweb