Ejemplo n.º 1
0
$stepOrder[] = 'Secure';
$stepOrder[] = 'Finished';
foreach ($stepOrder as $stepName) {
    $className = $stepName . 'Step';
    require "steps/{$className}.class";
}
GallerySetupUtilities::startSession();
require_once $g2Base . 'modules/core/classes/GalleryStatus.class';
require_once $g2Base . 'modules/core/classes/GalleryTranslator.class';
if (empty($_SESSION['language'])) {
    /* Select language based on preferences sent from browser */
    $_SESSION['language'] = GalleryTranslator::getLanguageCodeFromRequest();
}
if (function_exists('dgettext')) {
    $gallery = new GalleryStub();
    $translator = new GalleryTranslator();
    $translator->init($_SESSION['language'], true);
    unset($gallery);
    bindtextdomain('gallery2_install', dirname(dirname(__FILE__)) . '/locale');
    textdomain('gallery2_install');
    if (function_exists('bind_textdomain_codeset')) {
        bind_textdomain_codeset('gallery2_install', 'UTF-8');
    }
    /* Set the appropriate charset in our HTTP header */
    if (!headers_sent()) {
        header('Content-Type: text/html; charset=UTF-8');
    }
}
/*
 * If register_globals is on then a global $galleryStub may have already been created.
 * Clear it here and initialize ourselves.
Ejemplo n.º 2
0
 /**
  * Initialize our GalleryTranslator
  *
  * @param boolean $dontUseDatabase (optional) true if we should not use the database
  * @return GalleryStatus a status code
  */
 function initTranslator($dontUseDatabase = false)
 {
     if (empty($this->_translator)) {
         /* Load the translator class */
         MyOOS_CoreApi::requireOnce('modules/core/classes/GalleryTranslator.class');
         /* Do we already have an activeLanguage for this session? */
         list($ret, $language) = $this->getActiveLanguageCode();
         if ($ret) {
             return $ret;
         }
         $this->_translator = new GalleryTranslator();
         list($ret, $languageCode) = $this->_translator->init($language, $dontUseDatabase);
         if ($ret) {
             return $ret;
         }
         $ret = $this->setActiveLanguageCode($languageCode);
         if ($ret) {
             return $ret;
         }
     }
     return null;
 }
Ejemplo n.º 3
0
/* Check if config.php is ok */
$storageConfig = @$gallery->getConfig('storage.config');
if (!empty($storageConfig)) {
    /* We want to avoid using the cache */
    GalleryDataCache::setFileCachingEnabled(false);
    $ret = GalleryInitFirstPass(array('debug' => 'buffered', 'noDatabase' => 1));
    if ($ret) {
        print $ret->getAsHtml();
        return;
    }
    $translator =& $gallery->getTranslator();
    if (!$translator->canTranslate()) {
        unset($translator);
    } else {
        if (empty($_SESSION['language'])) {
            $_SESSION['language'] = GalleryTranslator::getLanguageCodeFromRequest();
        }
        $translator->init($_SESSION['language'], true);
        /* Select domain for translation */
        bindtextdomain('gallery2_upgrade', dirname(dirname(__FILE__)) . '/locale');
        textdomain('gallery2_upgrade');
        if (function_exists('bind_textdomain_codeset')) {
            bind_textdomain_codeset('gallery2_upgrade', 'UTF-8');
        }
        /* Set the appropriate charset in our HTTP header */
        if (!headers_sent()) {
            header('Content-Type: text/html; charset=UTF-8');
        }
    }
    /* Preallocate at least 5 minutes for the upgrade */
    $gallery->guaranteeTimeLimit(300);