Ejemplo n.º 1
0
 $languages = generateLanguageList(true);
 $languages[''] = '';
 foreach ($languages as $text => $lang) {
     if ($lang == $newloc || isset($_POST['language_allow_' . $lang])) {
         setOption('disallow_' . $lang, 0);
     } else {
         setOption('disallow_' . $lang, 1);
     }
 }
 if ($newloc != $oldloc) {
     if (!empty($newloc) && getOption('disallow_' . $newloc)) {
         $notify = '?local_failed=' . $newloc;
     } else {
         zp_clearCookie('dynamic_locale');
         // clear the language cookie
         $result = i18nSetLocale($newloc);
         if (!empty($newloc) && $result === false) {
             $notify = '?local_failed=' . $newloc;
         }
         setOption('locale', $newloc);
     }
 }
 setOption('mod_rewrite', (int) isset($_POST['mod_rewrite']));
 setOption('mod_rewrite_image_suffix', sanitize($_POST['mod_rewrite_image_suffix'], 3));
 if (isset($_POST['time_zone'])) {
     setOption('time_zone', sanitize($_POST['time_zone'], 3));
     $offset = 0;
 } else {
     $offset = sanitize($_POST['time_offset'], 3);
 }
 setOption('time_offset', $offset);
Ejemplo n.º 2
0
        $i = strpos($po, 'Project-Id-Version:');
        if ($i !== false) {
            $j = strpos($po, '\\n', $i);
            if ($j !== false) {
                $pversion = strtolower(substr($po, $i + 19, $j - $i - 19));
                $vers = explode('.', trim(str_replace('zenphoto', '', $pversion)));
                while (count($vers) < 3) {
                    $vers[] = 0;
                }
                $version = (int) $vers[0] . '.' . (int) $vers[1] . '.' . (int) $vers[2];
            }
        }
        if (is_null(getOption('disallow_' . $dirname)) && $version < $zpversion) {
            setOptionDefault('disallow_' . $dirname, 1);
        }
        if (i18nSetLocale($dirname)) {
            purgeOption('unsupported_' . $dirname);
        } else {
            setOption('unsupported_' . $dirname, 1);
        }
    }
}
//The following should be done LAST so it catches anything done above
//set plugin default options by instantiating the options interface
$plugins = getPluginFiles('*.php');
?>
<p>
	<?php 
$plugins = array_keys($plugins);
//clean up cacheManager storage
$key = array_search('cacheManager', $plugins);
Ejemplo n.º 3
0
/**
 * Setup code for gettext translation
 * Returns the result of the setlocale call
 *
 * @param string $override force locale to this
 * @return mixed
 */
function setupCurrentLocale($override = NULL)
{
    if (is_null($override)) {
        $locale = getOption('locale');
    } else {
        $locale = $override;
    }
    if (getOption('disallow_' . $locale)) {
        if (DEBUG_LOCALE) {
            debugLogBacktrace("setupCurrentLocale({$override}): {$locale} denied by option.");
        }
        $locale = getOption('locale');
        if (empty($locale) || getOption('disallow_' . $locale)) {
            $languages = generateLanguageList();
            $locale = array_shift($languages);
        }
    }
    // gettext setup
    @putenv("LANG={$locale}");
    // Windows ???
    @putenv("LANGUAGE={$locale}");
    // Windows ???
    $result = i18nSetLocale($locale);
    if (!$result) {
        if (isset($_REQUEST['locale']) || is_null($override)) {
            // and it was chosen via locale
            if (isset($_REQUEST['oldlocale'])) {
                $locale = sanitize($_REQUEST['oldlocale'], 3);
                setOption('locale', $locale, false);
                zp_clearCookie('dynamic_locale');
            }
        }
    }
    if (DEBUG_LOCALE) {
        debugLogBacktrace("setupCurrentLocale({$override}): locale={$locale}, \$result={$result}");
    }
    setupDomain();
    return $result;
}
Ejemplo n.º 4
0
function setupLanguageSelector()
{
    $languages = generateLanguageList();
    if (isset($_REQUEST['locale'])) {
        $locale = sanitize($_REQUEST['locale']);
        if (getOption('locale') != $locale || getOption('unsupported_' . $locale)) {
            ?>
			<div class="errorbox">
				<h2>
					<?php 
            printf(gettext('<em>%s</em> is not available.'), html_encode($languages[$locale]));
            ?>
					<?php 
            printf(gettext('The locale %s is not supported on your server.'), html_encode($locale));
            ?>
					<br />
					<?php 
            echo gettext('You can use the <em>debug</em> plugin to see which locales your server supports.');
            ?>
				</h2>
			</div>
			<?php 
        }
    }
    ?>
	<ul class="sflags">
		<?php 
    $_languages = generateLanguageList();
    krsort($_languages, SORT_LOCALE_STRING);
    $currentValue = getOption('locale');
    foreach ($_languages as $text => $lang) {
        if (i18nSetLocale($lang)) {
            ?>
				<li<?php 
            if ($lang == $currentValue) {
                echo ' class="currentLanguage"';
            }
            ?>
>
					<?php 
            if ($lang != $currentValue) {
                ?>
						<a href="javascript:launchScript('',['locale=<?php 
                echo $lang;
                ?>
']);" >
							<?php 
            }
            if (file_exists(SERVERPATH . '/' . ZENFOLDER . '/locale/' . $lang . '/flag.png')) {
                $flag = WEBPATH . '/' . ZENFOLDER . '/locale/' . $lang . '/flag.png';
            } else {
                $flag = WEBPATH . '/' . ZENFOLDER . '/locale/missing_flag.png';
            }
            ?>
						<img src="<?php 
            echo $flag;
            ?>
" alt="<?php 
            echo $text;
            ?>
" title="<?php 
            echo $text;
            ?>
" />
						<?php 
            if ($lang != $currentValue) {
                ?>
						</a>
						<?php 
            }
            ?>
				</li>
				<?php 
        }
    }
    ?>
	</ul>
	<?php 
}