<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'));
<?php $i = 0; foreach (Options::groups() as $group) { $active = ''; if ($i == 0) { $active = " active in"; } $hash = strtolower(str_replace(" ", "", $group['group'])); $title = $group['desc']; $name = $group['group']; echo '<div id="' . $hash . '" class="tab-pane fade' . $active . '"> <div class="well"> <h3>' . $name . ' <small>' . $title . '</small></h3> <br />'; $options = Options::getList(false, $name); if (empty($options)) { echo "No results found"; } else { foreach ($options as $option => $value) { $type = $value['type']; $label = camelcase2space($option); echo '<label class="control-label" for="' . $option . '">' . $label . '</label> <div class="controls">'; if ($type == 'input') { echo '<input type="text" class="input-xlarge" id="' . $option . '" name="' . $option . '" value="' . $value['value'] . '">'; } if ($type == 'textarea') { echo '<textarea class="textarea input-xxlarge" id="' . $option . '" name="' . $option . '">' . $value['value'] . '</textarea>'; } echo "</div>";
echo $inputValue[1]; ?> "> </div> <div class='hide' id='passwordWarning'> <br /> <div class="alert alert-error"> <strong>Warning</strong> <br /> Changing your password will log you out </div> </div> </div> <!-- Default settings above, now for the dynamic fields --> <?php $options = Options::getList(false, 'User Settings'); if (!empty($options)) { foreach ($options as $option => $value) { $type = $value['type']; // Get the user specific values from the Options_users table $val = Options::userGet($userId, $option); $label = camelcase2space($option); echo '<div class="control-group">' . nl(); echo ' <label class="control-label" for="' . $option . '">' . $label . '</label>' . nl(); echo ' <div class="controls">' . nl(); if ($type == 'input') { echo '<input type="text" class="input-xlarge" id="' . $option . '" name="' . $option . '" value="' . $val . '">' . nl(); } if ($type == 'textarea') { echo '<textarea class="textarea input-xxlarge" id="' . $option . '" name="' . $option . '">' . $val . '</textarea>' . nl(); }
} ?> <div class="modal hide fade" id="myModal" style="display: none;"> <div class="modal-header"> <button data-dismiss="modal" class="close" type="button">×</button> <h3>List of available variables, <small>and their values</small></h3> </div> <div class="modal-body"> <?php foreach (Options::groups() as $group) { $title = $group['desc']; $name = $group['group']; $groupOptions = Options::getList(false, $name); if (!empty($groupOptions)) { echo '<ul class="unstyled">'; foreach ($groupOptions as $variable => $value) { echo "<li><strong>Options::get('" . $variable . "');</strong> = " . nl2br($value['value']) . "</li>"; } echo '</ul>'; } } ?> </div> <div class="modal-footer"> <a data-dismiss="modal" class="btn" href="#" style="">Close</a> </div> </div>
$_REQUEST = fix_slashes($_REQUEST); $_COOKIE = fix_slashes($_COOKIE); } // Load our config settings $Config = Config::getConfig(); // Run the options and install functions, this would be if there are no information present in the db require DOC_ROOT . '/includes/install.inc.php'; // Check for installation and create the tables needed require DOC_ROOT . '/includes/options.inc.php'; // Get the options from the DB // Store session info in the database? if (Config::get('useDBSessions') === true) { DBSession::register(); } // Initialize our session session_name('spfs'); session_start(); // Initialize current user $Auth = Auth::getAuth(); // This dynamically creates the options variables except for the User Settings foreach (Options::getList(false, false, "WHERE `group`!='User Settings'") as $option => $values) { ${$option} = $values['value']; } // This dynamically creates the User Variables if ($Auth->loggedIn()) { foreach (Options::getList(false, 'User Settings') as $option => $val) { ${$option} = Options::userGet($Auth->id, $option); } } // Object for tracking and displaying error messages $Error = Error::getError();