Пример #1
0
?>
<form method="post">
    <select name='option' title='Options'>
        <?php 
echo get_options('options', 'key', 'key', @$_POST['option']);
?>
    
    </select> 
    <select name='group' title='Groups of options'>
        <?php 
echo get_options('options_groups', 'group', 'group', @$_POST['group']);
?>
    
    </select>
    <select  name='type' title='Type of variable'>
        <?php 
echo array2options(Options::types(), @$_POST['type']);
?>
    </select>
    <input type='hidden' name='action' value='update' />
    <input type='submit' class='input-large' value='Update' />
</form>

<?php 
if (isset($_POST)) {
    if (isset($_POST['action']) && $_POST['action'] == 'update') {
        Options::set($_POST['option'], Options::get($_POST['option']), $_POST['type'], $_POST['group']);
    }
}
echo "<br />Options: <hr />";
printr(Options::getList(false, 'META Data'));
Пример #2
0
function select($name, $array, $default = null, $class = '')
{
    $out = tab() . "<select class='" . $class . "' name='" . $name . "'>" . nl();
    $out .= array2options($array, $default);
    $out .= tab() . "</select>";
    return $out;
}
Пример #3
0
function form_config()
{
    global $msg, $config;
    $selecttrue = $selectfalse = '';
    $form = '<form name="config" action="" method="post" id="config">';
    foreach ($config as $cle => $val) {
        if ($cle != 'login' && $cle != 'update_url' && $cle != 'pass' && $cle != 'salt' && $cle != 'encryption_key' && $cle != 'version') {
            $form .= '<label for="' . $cle . '">' . msg($cle) . '</label>';
            if (is_bool($val) || $val == 'true' || $val == 'false') {
                if ($val == true || $val == 'true') {
                    $val = 'true';
                    $selecttrue = ' selected="selected" ';
                    $selectfalse = '';
                } else {
                    $val = 'false';
                    $selectfalse = ' selected="selected" ';
                    $selecttrue = '';
                }
                $form .= '<select id="' . $cle . '" name="' . $cle . '"><option value="true" ' . $selecttrue . '>' . msg('true') . '</option><option value="false"' . $selectfalse . '>' . msg('false') . '</option></select>';
            } elseif (stripos($cle, '_textarea')) {
                $form .= '<textarea name="' . $cle . '" id="' . $cle . '" >' . $val . '</textarea>';
            } elseif ($cle == 'highlight_theme' || $cle == 'highlight_embed_theme') {
                $form .= '<select  id="' . $cle . '" name="' . $cle . '">';
                $form .= array2options(glob('styles/*.css'), true, $val);
                $form .= '</select>';
            } elseif ($cle == 'snippetvamp_theme') {
                $form .= '<select  id="' . $cle . '" name="snippetvamp_theme">';
                $form .= array2options(glob('theme/*'), true, $val);
                $form .= '</select>';
            } elseif ($cle == 'lang') {
                $form .= '<select  id="' . $cle . '" name="lang">';
                $form .= array2options($msg, false, $val);
                $form .= '</select>';
            } else {
                $form .= '<input type="text" name="' . $cle . '" value="' . $val . '"/>';
            }
        }
    }
    $form .= '<label for="login">Login</label><input type="text" name="login" value="' . $config['login'] . '"/><label for="password">' . msg('Password (leave blank if you don\'t want to change)') . '</label><input type="password" name="password"/>';
    $form .= '<input type="submit" value="' . msg('Save') . '" title="' . msg('save this configuration') . '"/></form>';
    return $form;
}