function xoFormFieldCollation($name, $value, $label, $help = '') { $collations = getDbCollations(); $myts = MyTextSanitizer::getInstance(); $label = $myts->htmlspecialchars($label, ENT_QUOTES, _UPGRADE_CHARSET, false); $name = $myts->htmlspecialchars($name, ENT_QUOTES, _UPGRADE_CHARSET, false); $value = $myts->htmlspecialchars($value, ENT_QUOTES); $field = "<label for='{$name}'>{$label}</label>\n"; if ($help) { $field .= '<div class="xoform-help">' . $help . "</div>\n"; } $field .= "<select name='{$name}' id='{$name}'\">"; $field .= "<option value=''>" . DB_COLLATION_NOCHANGE . "</option>"; $collation_default = ""; $options = ""; foreach ($collations as $key => $charset) { $field .= "<optgroup label='{$key} - ({$charset['desc']})'>"; foreach ($charset['collation'] as $collation) { $field .= "<option value='{$collation}'" . ($value == $collation ? " selected='selected'" : "") . ">{$collation}</option>"; } $field .= "</optgroup>"; } $field .= "</select>"; return $field; }
function xoFormFieldCollation( $name, $value, $label, $help = '' ) { $collations = getDbCollations(); $label = htmlspecialchars( $label ); $name = htmlspecialchars( $name, ENT_QUOTES ); $value = htmlspecialchars( $value, ENT_QUOTES ); $field = "<label for='$name'>$label</label>\n"; if ($help) { $field .= '<div class="xoform-help1">' . $help . "</div>\n"; } $field .= "<select name='$name' id='$name'\">"; $field .= "<option value=''>None</option>"; $collation_default = ""; $options = ""; foreach ($collations as $key => $charset) { $field .= "<optgroup label='{$key} - ({$charset['desc']})'>"; foreach ($charset['collation'] as $collation) { $field .= "<option value='{$collation}'" . ( ($value == $collation) ? " selected='selected'" : "" ) . ">{$collation}</option>"; } $field .= "</optgroup>"; } $field .= "</select>"; return $field; }
function xoFormFieldCollation($name, $value, $label, $help = '', $link, $charset) { if (version_compare(mysql_get_server_info($link), "4.1.0", "lt")) { return ""; } if (empty($charset) || !($collations = getDbCollations($link, $charset))) { return ""; } $label = htmlspecialchars($label); $name = htmlspecialchars($name, ENT_QUOTES); $value = htmlspecialchars($value, ENT_QUOTES); $field = "<label for='{$name}'>{$label}</label>\n"; if ($help) { $field .= '<div class="xoform-help">' . $help . "</div><div class='clear'> </div>\n"; } $field .= "<select name='{$name}' id='{$name}'\">"; $collation_default = ""; $options = ""; foreach ($collations as $key => $isDefault) { if ($isDefault) { $collation_default = $key; continue; } $options .= "<option value='{$key}'" . ($value == $key ? " selected='selected'" : "") . ">{$key}</option>"; } if ($collation_default) { $field .= "<option value='{$collation_default}'" . ($value == $collation_default || empty($value) ? " 'selected'" : "") . ">{$collation_default} (Default)</option>"; } $field .= $options; $field .= "</select>"; return $field; }
/** * @param string $name * @param string $value * @param string $label * @param string $help * @param resource $link * @param string $charset * @return string */ function xoFormFieldCollation($name, $value, $label, $help, $link, $charset) { if (version_compare(mysql_get_server_info($link), "4.1.0", "lt")) { return ""; } if (empty($charset) || !($collations = getDbCollations($link, $charset))) { return ""; } $myts = MyTextSanitizer::getInstance(); $label = $myts->htmlspecialchars($label, ENT_QUOTES, _INSTALL_CHARSET, false); $name = $myts->htmlspecialchars($name, ENT_QUOTES, _INSTALL_CHARSET, false); $value = $myts->htmlspecialchars($value, ENT_QUOTES); $field = "<label class='xolabel' for='{$name}'>{$label}</label>\n"; if ($help) { $field .= '<div class="xoform-help">' . $help . "</div>\n"; } $field .= "<select name='{$name}' id='{$name}'\">"; $collation_default = ""; $options = ""; foreach ($collations as $key => $isDefault) { if ($isDefault) { $collation_default = $key; continue; } $options .= "<option value='{$key}'" . ($value == $key ? " selected='selected'" : "") . ">{$key}</option>"; } if ($collation_default) { $field .= "<option value='{$collation_default}'" . ($value == $collation_default || empty($value) ? " 'selected'" : "") . ">{$collation_default} (Default)</option>"; } $field .= $options; $field .= "</select>"; return $field; }