function BuildSelect($words, $mode) { $first = true; if ($mode == SINGLE_TRACKS_ONLY) { $SelectStmt = "SELECT 'Track' as Type, * FROM Tracks WHERE "; // Dont take those where artist and album matches $SelectStmt .= " (Preset NOT IN (" . BuildSelect($words, 2) . "))"; $first = false; } if ($mode == ALBUMS_ONLY) { $SelectStmt = "SELECT 'Album' as Type, * FROM Tracks WHERE "; $SelectStmt .= "(TrackSeq = 1)"; // Take first track as representative for the album $first = false; } if ($mode == ALBUM_PRESET_ONLY) { $SelectStmt = "SELECT Preset FROM Tracks WHERE "; $SelectStmt .= "(TrackSeq = 1)"; // Take first track as representative for the album $first = false; } foreach ($words as $key => $value) { //echo "key: $key, value: $value\n"; if ($mode == SINGLE_TRACKS_ONLY) { $Add = "(Title LIKE :q{$key} OR Album LIKE :q{$key} OR ArtistPerformer LIKE :q{$key} OR ArtistAlbumArtist LIKE :q{$key})"; } else { $Add = "(Album LIKE :q{$key} OR ArtistPerformer LIKE :q{$key} OR ArtistAlbumArtist LIKE :q{$key})"; } if ($first) { $SelectStmt .= "{$Add}"; } else { $SelectStmt .= " AND " . "{$Add}"; } $first = false; } //echo "BuildSelect: $SelectStmt\n"; return $SelectStmt; }
/** * Displays the form to add new time */ function printForm($data = '', $action = 'add') { global $__FM_CONFIG; $time_weekdays = $time_id = 0; $time_name = $time_comment = null; $time_start_date = $time_start_time = $time_end_date = $time_end_time = null; $ucaction = ucfirst($action); if (!empty($_POST) && !array_key_exists('is_ajax', $_POST)) { if (is_array($_POST)) { extract($_POST); } } elseif (@is_object($data[0])) { extract(get_object_vars($data[0])); } /* Time options */ for ($x = 0; $x < 24; $x++) { $houropt[$x][] = sprintf("%02d", $x); $houropt[$x][] = sprintf("%02d", $x); } for ($x = 0; $x < 60; $x++) { $minopt[$x][] = sprintf("%02d", $x); $minopt[$x][] = sprintf("%02d", $x); } @(list($start_hour, $start_min) = explode(':', $time_start_time)); @(list($end_hour, $end_min) = explode(':', $time_end_time)); $time_name_length = getColumnLength('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'time', 'time_name'); $time_start_hour = BuildSelect('time_start_time_hour', 1, $houropt, $start_hour, 1); $time_start_min = BuildSelect('time_start_time_min', 1, $minopt, $start_min, 1); $time_end_hour = BuildSelect('time_end_time_hour', 1, $houropt, $end_hour, 1); $time_end_min = BuildSelect('time_end_time_min', 1, $minopt, $end_min, 1); /** Weekdays */ $weekdays_form = null; foreach ($__FM_CONFIG['weekdays'] as $day => $bit) { $weekdays_form .= '<label><input type="checkbox" name="time_weekdays[' . $bit . ']" '; if ($bit & $time_weekdays) { $weekdays_form .= 'checked'; } $weekdays_form .= '/>' . $day . "</label>\n"; } $popup_title = $action == 'add' ? __('Add Restriction') : __('Edit Restriction'); $popup_header = buildPopup('header', $popup_title); $popup_footer = buildPopup('footer'); $return_form = sprintf('<form name="manage" id="manage" method="post" action=""> %s <input type="hidden" name="action" value="%s" /> <input type="hidden" name="time_id" value="%d" /> <table class="form-table"> <tr> <th width="33%" scope="row"><label for="time_name">%s</label></th> <td width="67%"><input name="time_name" id="time_name" type="text" value="%s" size="40" maxlength="%d" /></td> </tr> <tr> <th width="33%" scope="row"><label for="time_start_date">%s</label></th> <td width="67%"><input name="time_start_date" id="time_start_date" type="date" value="%s" size="40" class="datepicker" /></td> </tr> <tr> <th width="33%" scope="row"><label for="time_start_time">%s</label></th> <td width="67%">%s</td> </tr> <tr> <th width="33%" scope="row"><label for="time_end_date">%s</label></th> <td width="67%"><input name="time_end_date" id="time_end_date" type="date" value="%s" size="40" class="datepicker" /></td> </tr> <tr> <th width="33%" scope="row"><label for="time_end_time">%s</label></th> <td width="67%">%s</td> </tr> <tr> <th width="33%" scope="row">%s</th> <td width="67%" style="white-space: nowrap;">%s</td> </tr> <tr> <th width="33%" scope="row"><label for="time_comment">%s</label></th> <td width="67%"><textarea id="time_comment" name="time_comment" rows="4" cols="30">%s</textarea></td> </tr> </table> %s </form> <script> $(document).ready(function() { $("#manage select").select2({ width: "70px", minimumResultsForSearch: 10 }); }); </script>', $popup_header, $action, $time_id, __('Name'), $time_name, $time_name_length, __('Start Date'), $time_start_date, __('Start Time'), "{$time_start_hour} : {$time_start_min}", __('End Date'), $time_end_date, __('End Time'), "{$time_end_hour} : {$time_end_min}", __('Weekdays'), $weekdays_form, __('Comment'), $time_comment, $popup_footer); return $return_form; }
* LinnDS-jukebox * * Copyright (c) 2011-2015 Henrik Tolbøl, http://tolbøl.dk * * Licensed under the MIT license: * http://www.opensource.org/licenses/mit-license.php */ require_once "setup.php"; $menu = $_GET["menu"]; function BuildSelect() { $SelectStmt = "SELECT distinct ArtistFirst FROM Album WHERE RootMenuNo == :q1 order by ArtistFirst"; //echo "BuildSelect: $SelectStmt\n"; return $SelectStmt; } $SelectStmtAlbum = BuildSelect(); //echo "$SelectStmt\n"; $db = new SQLite3($DATABASE_FILENAME); $stmtAlbum = $db->prepare($SelectStmtAlbum); $stmtAlbum->bindValue(":q1", $menu); $resultAlbum = $stmtAlbum->execute(); $R = array(); for ($alpha = 0; $alpha < $ALPHABET_SIZE; $alpha++) { $Letter = $ALPHABET[$alpha]; if ($Letter == "#") { $R["NUM"] = 0; } else { $R[$Letter] = 0; } } $i = 0;
function getInputForm($type, $new, $parent_domain_id, $results = null, $start = 1) { global $__FM_CONFIG, $zone_access_allowed; $form = $record_status = $record_class = $record_name = $record_ttl = null; $record_value = $record_comment = $record_priority = $record_weight = $record_port = null; $action = $new ? 'create' : 'update'; $end = $new ? $start + 3 : 1; $show_value = true; $value_textarea = false; $append = array('CNAME', 'NS', 'MX', 'SRV', 'DNAME', 'CERT', 'RP'); $priority = array('MX', 'SRV', 'KX'); if ($results) { $results = get_object_vars($results); extract($results); } $yeschecked = isset($record_append) && $record_append == 'yes' ? 'checked' : ''; $nochecked = isset($record_append) && $record_append == 'no' ? 'checked' : ''; $statusopt[0][] = __('Active'); $statusopt[0][] = 'active'; $statusopt[1][] = __('Disabled'); $statusopt[1][] = 'disabled'; $status = BuildSelect($action . '[_NUM_][record_status]', 'status__NUM_', $statusopt, $record_status); $field_values['class'] = $record_status; $class = buildSelect($action . '[_NUM_][record_class]', 'class__NUM_', enumMYSQLSelect('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'records', 'record_class'), $record_class); if ($type == 'PTR') { $domain_map = getNameFromID($parent_domain_id, 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'domains', 'domain_', 'domain_id', 'domain_mapping'); } $domain = getNameFromID($parent_domain_id, 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'domains', 'domain_', 'domain_id', 'domain_name'); if ((currentUserCan('manage_records', $_SESSION['module']) || currentUserCan('manage_zones', $_SESSION['module'])) && $zone_access_allowed && ($new || $domain_id == $parent_domain_id)) { if ($type == 'PTR') { $input_box = '<input '; $input_box .= $domain_map == 'forward' ? 'size="40"' : 'style="width: 40px;" size="4"'; $input_box .= ' type="text" name="' . $action . '[_NUM_][record_name]" value="' . $record_name . '" />'; if (strpos($domain, 'arpa')) { $field_values['data']['Record'] = '>' . $input_box . ' .' . $domain; } elseif ($domain_map == 'forward') { $field_values['data']['Record'] = '>' . $input_box; } else { $field_values['data']['Record'] = '>' . $domain . '. ' . $input_box; } } else { $field_values['data']['Record'] = '><input size="40" type="text" name="' . $action . '[_NUM_][record_name]" value="' . $record_name . '" />'; } $field_values['data']['TTL'] = '><input style="width: 35px;" type="text" name="' . $action . '[_NUM_][record_ttl]" value="' . $record_ttl . '" onkeydown="return validateNumber(event)" />'; $field_values['data']['Class'] = '>' . $class; if ($type == 'CERT') { $field_values['data']['Type'] = '>' . buildSelect($action . '[_NUM_][record_cert_type]', '_NUM_', $__FM_CONFIG['records']['cert_types'], $record_cert_type); $field_values['data']['Key Tag'] = '><input style="width: 45px;" type="text" name="' . $action . '[_NUM_][record_key_tag]" value="' . $record_key_tag . '" onkeydown="return validateNumber(event)" />'; $field_values['data']['Algorithm'] = '>' . buildSelect($action . '[_NUM_][record_algorithm]', '_NUM_', $__FM_CONFIG['records']['cert_algorithms'], $record_algorithm); $value_textarea = true; } if ($type == 'SSHFP') { $field_values['data']['Algorithm'] = '>' . buildSelect($action . '[_NUM_][record_algorithm]', '_NUM_', $__FM_CONFIG['records']['sshfp_algorithms'], $record_algorithm); $value_textarea = true; } if ($type == 'HINFO') { $field_values['data']['Hardware'] = '><input maxlength="255" type="text" name="' . $action . '[_NUM_][record_value]" value="' . $record_value . '" />'; $field_values['data']['OS'] = '><input maxlength="255" type="text" name="' . $action . '[_NUM_][record_os]" value="' . $record_os . '" />'; $show_value = false; } if (in_array($type, array('DNSKEY', 'KEY'))) { $flags = enumMYSQLSelect('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'records', 'record_flags'); $algorithms = $__FM_CONFIG['records']['cert_algorithms']; $value_textarea = true; if ($type == 'KEY') { array_pop($flags); for ($i = 1; $i <= 4; $i++) { array_pop($algorithms); } } $field_values['data']['Flags'] = '>' . buildSelect($action . '[_NUM_][record_flags]', '_NUM_', $flags, $record_flags); $field_values['data']['Algorithm'] = '>' . buildSelect($action . '[_NUM_][record_algorithm]', '_NUM_', $algorithms, $record_algorithm); } if ($show_value) { if ($value_textarea) { $field_values['data']['Value'] = '><textarea rows="2" name="' . $action . '[_NUM_][record_value]">' . $record_value . '</textarea>'; } else { $field_values['data']['Value'] = '><input size="40" type="text" name="' . $action . '[_NUM_][record_value]" value="' . $record_value . '" />'; } } if ($type == 'RP') { $field_values['data']['Text'] = '><input maxlength="255" type="text" name="' . $action . '[_NUM_][record_text]" value="' . $record_text . '" />'; } if (in_array($type, $priority)) { $field_values['data']['Priority'] = '><input style="width: 35px;" type="text" name="' . $action . '[_NUM_][record_priority]" value="' . $record_priority . '" onkeydown="return validateNumber(event)" />'; } if ($type == 'SRV') { $field_values['data']['Weight'] = '><input style="width: 35px;" type="text" name="' . $action . '[_NUM_][record_weight]" value="' . $record_weight . '" onkeydown="return validateNumber(event)" />'; $field_values['data']['Port'] = '><input style="width: 35px;" type="text" name="' . $action . '[_NUM_][record_port]" value="' . $record_port . '" onkeydown="return validateNumber(event)" />'; } $field_values['data']['Comment'] = '><input maxlength="200" type="text" name="' . $action . '[_NUM_][record_comment]" value="' . $record_comment . '" />'; if (in_array($type, $append)) { $field_values['data']['Append Domain'] = ' align="center"><input ' . $yeschecked . ' type="radio" id="record_append[_NUM_][0]" name="' . $action . '[_NUM_][record_append]" value="yes" /><label class="radio" for="record_append[_NUM_][0]"> ' . __('yes') . '</label> <input ' . $nochecked . ' type="radio" id="record_append[_NUM_][1]" name="' . $action . '[_NUM_][record_append]" value="no" /><label class="radio" for="record_append[_NUM_][1]"> ' . __('no') . '</label>'; } $field_values['data']['Status'] = '>' . $status; if ($new) { $field_values['data']['Actions'] = in_array($type, array('A')) ? ' align="center"><label><input type="checkbox" name="' . $action . '[_NUM_][PTR]" />' . __('Create PTR') . '</label>' : null; } else { $field_values['data']['Actions'] = in_array($type, array('A')) ? ' align="center"><label><input type="checkbox" name="' . $action . '[_NUM_][PTR]" />' . __('Create PTR') . '</label><br />' : ' align="center">'; $field_values['data']['Actions'] .= '<label><input type="checkbox" id="record_delete_' . $record_id . '" name="' . $action . '[_NUM_][Delete]" />' . __('Delete') . '</label>'; } } else { $domain = strlen($domain) > 23 ? substr($domain, 0, 20) . '...' : $domain; $field_values['data']['Record'] = '>' . $record_name . '<span class="grey">.' . $domain . '</span>'; $field_values['data']['TTL'] = '>' . $record_ttl; $field_values['data']['Class'] = '>' . $record_class; if ($show_value) { $field_values['data']['Value'] = '>' . $record_value; } $field_values['data']['Comment'] = '>' . $record_comment; if (in_array($type, $priority)) { $field_values['data']['Priority'] = '>' . $record_priority; } if ($type == 'SRV') { $field_values['data']['Weight'] = '>' . $record_weight; $field_values['data']['Port'] = '>' . $record_port; } if (in_array($type, $append)) { $field_values['data']['Append Domain'] = ' style="text-align: center;">' . $record_append; } $field_values['data']['Status'] = '>' . $record_status; if ((currentUserCan('manage_records', $_SESSION['module']) || currentUserCan('manage_zones', $_SESSION['module'])) && $zone_access_allowed && $domain_id != $parent_domain_id) { $field_values['data']['Actions'] = ' align="center"><input type="hidden" name="' . $action . '[_NUM_][record_skipped]" value="off" /><label><input type="checkbox" name="' . $action . '[_NUM_][record_skipped]" '; if (in_array($record_id, $this->getSkippedRecordIDs($parent_domain_id))) { $field_values['data']['Actions'] .= ' checked'; $field_values['class'] = 'disabled'; } else { $field_values['data']['Actions'] .= null; } $field_values['data']['Actions'] .= '/>' . __('Skip Import') . '</label>'; } elseif (!currentUserCan('manage_records', $_SESSION['module']) && $zone_access_allowed && $domain_id != $parent_domain_id) { if (in_array($record_id, $this->getSkippedRecordIDs($parent_domain_id))) { return null; } } } for ($i = $start; $i <= $end; $i++) { $form .= '<tr class="' . $field_values['class'] . '">' . "\n"; foreach ($field_values['data'] as $key => $val) { $val = !$val ? '>' : $val; $num = $new ? $i : $record_id; $val = str_replace('_NUM_', $num, $val); $form .= "\t<td{$val}</td>\n"; } $form .= "</tr>\n"; } return $form; }
<?php echo BuildBooleanSelect(__("Drop The Signature From Mail", "postie"), "postie-settings[drop_signature]", $drop_signature); ?> <?php echo BuildTextArea(__("Signature Patterns", "postie"), "postie-settings[sig_pattern_list]", $sig_pattern_list, __("Put each pattern on a separate line. Patterns are <a href='http://regex101.com/' target='_blank'>regular expressions</a>", "postie")); ?> </table> </div> <div id="simpleTabs-content-4" class="simpleTabs-content"> <table class='form-table'> <?php echo BuildBooleanSelect(__("Use First Image as Featured Image", "postie"), "postie-settings[featured_image]", $featured_image, __("If any images are attached, the first one will be the featured image for the post", "postie")); echo BuildBooleanSelect(__("Automatically insert image gallery", "postie"), "postie-settings[auto_gallery]", $auto_gallery, __("If any images are attached, they will automatically be inserted as a gallery", "postie")); echo BuildSelect(__("Gallery Link Type", "postie"), "postie-settings[auto_gallery_link]", $auto_gallery_link, array('Default', 'Post', 'File', 'None'), "Select the type of link the gallery should use"); echo BuildBooleanSelect(__("Image Location", "postie"), "postie-settings[images_append]", $images_append, __("Location of attachments if using 'plain' format. Before or After content.", "postie"), array('After', 'Before')); echo BuildBooleanSelect(__("Generate Thumbnails", "postie"), "postie-settings[generate_thumbnails]", $generate_thumbnails, __("Some hosts crash during thumbnail generation. Set this to 'No' if you have this issue", "postie")); echo BuildBooleanSelect(__("Start Image Count At", "postie"), "postie-settings[start_image_count_at_zero]", $start_image_count_at_zero, __('For use if using "Image Place Holder Tag" below.', "postie"), array('Start at 0', 'Start at 1')); ?> <tr> <th scope="row"><?php _e('Image Place Holder Tag', 'postie'); ?> </th> <td> <input name='postie-settings[image_placeholder]' type="text" id='postie-settings-image_placeholder' value="<?php echo esc_attr($image_placeholder); ?> " size="50" /><br /> <p class='description'><?php