200, $colconf['target'], filemtime($colconf['target'])
);
}
- print "<input";
- if (empty($colconf['target'])) print ' readonly';
- printf(' type="%s" name="%s" id="%2$s" value="%s"',
- @$colconf['type'] ?: 'text',
- $col,
- htmlspecialchars(@$colconf['value'])
- );
- if (@$colconf['type'] == 'file') {
- printf(' accept="%s"', 'image/jpeg');
+
+ {
+ $attrs = [
+ 'type' => @$colconf['type'] ?: 'text',
+ 'name' => $col,
+ 'id' => $col,
+ 'value' => htmlspecialchars(@$colconf['value']),
+ 'placeholder' => "Niet ingesteld",
+ 'readonly' => empty($colconf['target']),
+ ];
+ if (@$colconf['type'] == 'file') {
+ $attrs['accept'] = "image/jpeg";
+ }
+
+ print '<input';
+ foreach ($attrs as $attr => $attrval) {
+ if ($attrval === FALSE) {
+ continue;
+ }
+ print ' ' . $attr;
+ if ($attrval !== TRUE) {
+ printf('="%s"', $attrval);
+ }
+ }
+ print ' />';
}
- print ' placeholder="Niet ingesteld"';
- print " />";
if ($error = @$colwarn[$col]) {
print " <span class=warn>$error</span>\n";
}
if (isset($user['pass'])) {
- $hide = empty($_POST['newpass']);
?>
- <li id="pass"<?php if ($hide) print ' hidden style="display:none"'; ?>>
- <label for="newpass">Wachtwoord:</label>
- <input type="password" name="oldpass" value="" placeholder="Huidig wachtwoord" />
- <input type="password" name="newpass" value="" placeholder="Nieuw wachtwoord" />
- <input type="password" name="passconf" value="" placeholder="Nogmaals" />
+ <li><label for="newpass">Wachtwoord:</label>
+<?php
+ if ($hide = empty($_POST['newpass'])) {
+?>
+ <a onclick="document.getElementById('pass').removeAttribute('hidden'); this.remove()">Wijzigen</a>
+<?php
+ }
+?>
+ <span id="pass"<?php if ($hide) print ' hidden'; ?>>
+ <input type="password" name="oldpass" value="" placeholder="Huidig wachtwoord" />
+ <input type="password" name="newpass" value="" placeholder="Nieuw wachtwoord" />
+ <input type="password" name="passconf" value="" placeholder="Nogmaals" />
<?php
if ($error = @$colwarn['pass']) {
print " <span class=warn>$error</span>\n";
}
?>
</ul>
- <input type="submit" value="Opslaan" />
+ <p><input type="submit" value="Opslaan" /></p>
</form>
-
-<?php
- if ($hide) {
-?>
- <p><a onclick="document.getElementById('pass').removeAttribute('style'); this.remove()">Wachtwoord wijzigen</a></p>
-<?php
- }