insanelyBlog/includes/admin/settings.php

47 lines
1.2 KiB
PHP

<?php
if (isset($_POST['save_settings']))
{
$fail = false;
$settings = new settings();
foreach ($_POST AS $var => $val)
if (substr($var, 0, 13) == 'settings_var_')
{
$var = substr($var, 13, strlen($var) - 13);
if (isset($_set[$var]) && $_set[$var] != $val)
if (!$settings -> update($var, $val))
$fail = true;
}
if ($fail) array_push($error, $_locale['settings_update_failed']);
else array_push($info, $_locale['settings_updated']);
unset($fail);
unset($var);
unset($settings);
}
$_set_settings = settings::getdata();
?>
<h1>{locale:site_settings}</h1>
<form action="<?=get_current_link()?>" method="post" name="entry-edit">
<table class="designed settings">
<thead>
<tr>
<th>{locale:settings_variable}</th>
<th>{locale:settings_value}</th>
</tr>
</thead>
<tbody>
<?php foreach ($_set_settings AS $var => $val): ?>
<tr>
<td>{locale:settings_var_<?=$var?>}</td>
<td><input type="text" name="settings_var_<?=$var?>" value="<?=htmlentities($val)?>" /></td>
</tr>
<?php endforeach; unset($_set_settings); ?>
</tbody>
</table>
<button type="submit" name="save_settings" value="1">{locale:settings_save}</button>
</form>