Browse Source

Missing theme conf type "checkbox"

pull/40/head
Michael Foster 11 years ago
parent
commit
5051e0572a
  1. 5
      inc/mod/pages.php
  2. 19
      templates/mod/theme_config.html

5
inc/mod/pages.php

@ -2155,7 +2155,10 @@ function mod_theme_configure($theme_name) {
$query = prepare("INSERT INTO ``theme_settings`` VALUES(:theme, :name, :value)");
$query->bindValue(':theme', $theme_name);
$query->bindValue(':name', $conf['name']);
$query->bindValue(':value', $_POST[$conf['name']]);
if ($conf['type'] == 'checkbox')
$query->bindValue(':value', isset($_POST[$conf['name']]) ? 1 : 0);
else
$query->bindValue(':value', $_POST[$conf['name']]);
$query->execute() or error(db_error($query));
}

19
templates/mod/theme_config.html

@ -7,12 +7,21 @@
<tr>
<th>{{ conf.title }}</th>
<td>
<input type="text" name="{{ conf.name }}"
{% if settings[conf.name] %}value="{{ settings[conf.name] }}"{% else %}{% if conf.default %}value="{{ conf.default }}"{% endif %}{% endif %}
{% if conf.size %}
size="{{ conf.size }}"
{% if conf.type == 'checkbox' %}
<input type="checkbox" name="{{ conf.name }}"
{% if settings[conf.name] or (not settings[conf.name] is defined and conf.default) %}
checked
{% endif %}>
{% else %}
<input type="text" name="{{ conf.name }}"
{% if settings[conf.name] %}
value="{{ settings[conf.name] }}"
{% else %}
{% if conf.default %}value="{{ conf.default }}"{% endif %}{% endif %}
{% if conf.size %}
size="{{ conf.size }}"
{% endif %}>
{% endif %}
/>
{% if conf.comment %}
<span class="unimportant">{{ conf.comment }}</span>
{% endif %}

Loading…
Cancel
Save