Beispiel #1
0
$html->set_variable('tools_footprints_autoload', $config['tools']['footprints']['autoload'], 'boolean');
$html->set_variable('developer_mode_available', file_exists(BASE . '/development'), 'boolean');
$html->set_variable('enable_developer_mode', $config['developer_mode'], 'boolean');
$html->set_variable('enable_dokuwiki_write_perms', file_exists(DOKUWIKI_PERMS_FILENAME), 'boolean');
// popup settings
$html->set_variable('use_modal_popup', $config['popup']['modal'], 'boolean');
$html->set_variable('popup_width', $config['popup']['width'], 'integer');
$html->set_variable('popup_height', $config['popup']['height'], 'integer');
// site properties
$html->set_variable('page_title', $config['page_title'], 'string');
$html->set_variable('startup_banner', $config['startup']['custom_banner'], 'string');
// server
$html->set_variable('php_version', phpversion(), 'string');
$html->set_variable('htaccess_works', getenv('htaccessWorking') == 'true', 'boolean');
$html->set_variable('is_online_demo', $config['is_online_demo'], 'boolean');
// check if the server supports the selected language and print a warning if not
if (!own_setlocale(LC_ALL, $config['language'])) {
    $messages[] = array('text' => 'Achtung:', 'strong' => true, 'color' => 'red');
    $messages[] = array('text' => 'Die gewählte Sprache "' . $config['language'] . '" wird vom Server nicht unterstützt!', 'color' => 'red');
    $messages[] = array('text' => 'Bitte installieren Sie diese Sprache oder wählen Sie eine andere.', 'color' => 'red');
}
/********************************************************************************
 *
 *   Generate HTML Output
 *
 *********************************************************************************/
$html->print_header($messages);
if (!$fatal_error) {
    $html->print_template('system_config');
}
$html->print_footer();
Beispiel #2
0
/**
 * @brief Convert a float number to a formatted money string (with currency)
 *
 * @param float|NULL    $number     @li The price as a float number
 *                                  @li NULL if you mean "there is no price",
 *                                      then this function will return the string "-"
 * @param string        $language   @li language (locale) string, like "de_DE" or "de_DE.utf-8".
 *                                  @li an empty string means that we use the default language from $config
 *
 * @retval string       The formatted money string
 */
function float_to_money_string($number, $language = '')
{
    if ($number === NULL) {
        return '-';
    }
    // settype($number, 'float');
    global $config;
    if (strlen($language) == 0) {
        $language = $config['language'];
    }
    if ($language != $config['language']) {
        // change locale, because the $language is not the default language!
        if (!own_setlocale(LC_MONETARY, $language)) {
            debug('error', 'Sprache "' . $language . '" kann nicht gesetzt werden!', __FILE__, __LINE__, __METHOD__);
        }
    }
    // get the money format from config(_defaults).php
    if (isset($config['money_format'][$language])) {
        $format = $config['money_format'][$language];
    } else {
        // not set in config, so generate it
        $locale = localeconv();
        // number of digits used in current language
        $local_digits = $locale['int_frac_digits'];
        // digits of the number
        $number_digits = (int) $number != $number ? strlen($number) - strpos($number, $locale['decimal_point']) - 1 : 0;
        // international or local format?
        $format_type = $language == $config['language'] ? 'n' : 'i';
        if ($number_digits > $local_digits) {
            $n = $number_digits > 5 ? 5 : $number_digits;
            $format = "%." . $n . $format_type;
        } else {
            $format = '%' . $format_type;
        }
    }
    $result = trim(money_format($format, $number));
    if ($language != $config['language']) {
        own_setlocale(LC_MONETARY, $config['language']);
    }
    // change locale back to default
    return $result;
}