<commit_before><?

$status = '';

if (empty($_REQUEST['id'])) {
  $id = '';
} else {
  $id = $_REQUEST['id'];
  if (!isset($default_config[$id])) {
    print $GLOBALS['I18N']->get('invalid request');
    return;
  }
}

$val = $default_config[$id];
printf('%s<div class="configEditing">' . $GLOBALS['I18N']->get('editing') . ' <b>%s</b></div>',formStart(' class="configForm" '),$GLOBALS['I18N']->get($val[1]));
printf('<div class="configValue"><input type="hidden" name="id" value="%s" />',$id);
$dbval = getConfig($id);
#  print $dbval.'<br/>';
if (isset($dbval))
  $value = $dbval;
else
  $value = $val[0];
#  print $id.' '.$value . " ".$website . " ".$domain.'<br/>';

if ($id != "website" && $id != "domain") {
  $value = str_replace($domain,'[DOMAIN]', $value);
  $value = str_replace($website,'[WEBSITE]', $value);
}

#  print "VALUE:".$value . '<br/>';
if ($val[2] == "textarea")
  printf('<textarea name="values[%s]" rows=25 cols=55>%s</textarea>',
    $id,htmlspecialchars(stripslashes($value)));
else if ($val[2] == "text")
  printf('<input type="text" name="values[%s]" size="70" value="%s" />',
  $id,htmlspecialchars(stripslashes($value)));
else if ($val[2] == "boolean")
  printf('<input type="text" name="values[%s]" size="10" value="%s" />',
  $id,htmlspecialchars(stripslashes($value)));
print '</div><input type="hidden" name="save" value="1" /><input class="submit" type="submit" name="savebutton" value="' . $GLOBALS['I18N']->get('save changes') . '" /></form>';
<commit_msg>configure boolean values with a dropdown<commit_after><?php

$status = '';

if (empty($_REQUEST['id'])) {
  $id = '';
} else {
  $id = $_REQUEST['id'];
  if (!isset($default_config[$id])) {
    print $GLOBALS['I18N']->get('invalid request');
    return;
  }
}

$val = $default_config[$id];
printf('%s<div class="configEditing">' . $GLOBALS['I18N']->get('editing') . ' <b>%s</b></div>',formStart(' class="configForm" '),$GLOBALS['I18N']->get($val[1]));
printf('<div class="configValue"><input type="hidden" name="id" value="%s" />',$id);
$dbval = getConfig($id);
#  print $dbval.'<br/>';
if (isset($dbval))
  $value = $dbval;
else
  $value = $val[0];
#  print $id.' '.$value . " ".$website . " ".$domain.'<br/>';

if ($id != "website" && $id != "domain") {
  $value = str_replace($domain,'[DOMAIN]', $value);
  $value = str_replace($website,'[WEBSITE]', $value);
}

#  print "VALUE:".$value . '<br/>';
if ($val[2] == "textarea") {
  printf('<textarea name="values[%s]" rows=25 cols=55>%s</textarea>',
    $id,htmlspecialchars(stripslashes($value)));
} else if ($val[2] == "text") {
  printf('<input type="text" name="values[%s]" size="70" value="%s" />',
  $id,htmlspecialchars(stripslashes($value)));
} else if ($val[2] == "boolean") {
  printf ('<select name="values[%s]">',$id);
  print '<option value="true" ';
  if ($value == 'true') {
    print 'selected="selected"';
  }
  print '>';
  print $GLOBALS['I18N']->get('Yes') ;
  print '  </option>';
  print '<option value="false" ';
  if ($value == 'false') {
    print 'selected="selected"';
  }
  print '>';
  print $GLOBALS['I18N']->get('No') ;
  print '  </option>';
  print '</select>';
}
print '</div><input type="hidden" name="save" value="1" /><input class="submit" type="submit" name="savebutton" value="' . $GLOBALS['I18N']->get('save changes') . '" /></form>';

{'fraction_non_alphanumeric': 0.281711358843025, 'fraction_numerical': 0.01385959626393492, 'mean_word_length': 5.360153256704981, 'pattern_counts': {'":': 0, '<': 44, '<?xml version=': 0, '>': 52, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3097926', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1240, 'n_words': 228}