/** * @param array $input * @param DefaultForm $form */ function user_search_conditions($input = array(), &$form) { global $mybb, $db, $lang; if (!$input) { $input = $mybb->input; } if (!is_array($input['conditions'])) { $input['conditions'] = my_unserialize($input['conditions']); } if (!is_array($input['profile_fields'])) { $input['profile_fields'] = my_unserialize($input['profile_fields']); } if (!is_array($input['fields'])) { $input['fields'] = my_unserialize($input['fields']); } $form_container = new FormContainer($lang->find_users_where); $form_container->output_row($lang->username_contains, "", $form->generate_text_box('conditions[username]', $input['conditions']['username'], array('id' => 'username')), 'username'); $form_container->output_row($lang->email_address_contains, "", $form->generate_text_box('conditions[email]', $input['conditions']['email'], array('id' => 'email')), 'email'); $options = array(); $query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title')); while ($usergroup = $db->fetch_array($query)) { $options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']); } $form_container->output_row($lang->is_member_of_groups, $lang->additional_user_groups_desc, $form->generate_select_box('conditions[usergroup][]', $options, $input['conditions']['usergroup'], array('id' => 'usergroups', 'multiple' => true, 'size' => 5)), 'usergroups'); $form_container->output_row($lang->website_contains, "", $form->generate_text_box('conditions[website]', $input['conditions']['website'], array('id' => 'website')) . " {$lang->or} " . $form->generate_check_box('conditions[website_blank]', 1, $lang->is_not_blank, array('id' => 'website_blank', 'checked' => $input['conditions']['website_blank'])), 'website'); $form_container->output_row($lang->icq_number_contains, "", $form->generate_text_box('conditions[icq]', $input['conditions']['icq'], array('id' => 'icq')) . " {$lang->or} " . $form->generate_check_box('conditions[icq_blank]', 1, $lang->is_not_blank, array('id' => 'icq_blank', 'checked' => $input['conditions']['icq_blank'])), 'icq'); $form_container->output_row($lang->aim_handle_contains, "", $form->generate_text_box('conditions[aim]', $input['conditions']['aim'], array('id' => 'aim')) . " {$lang->or} " . $form->generate_check_box('conditions[aim_blank]', 1, $lang->is_not_blank, array('id' => 'aim_blank', 'checked' => $input['conditions']['aim_blank'])), 'aim'); $form_container->output_row($lang->yahoo_contains, "", $form->generate_text_box('conditions[yahoo]', $input['conditions']['yahoo'], array('id' => 'yahoo')) . " {$lang->or} " . $form->generate_check_box('conditions[yahoo_blank]', 1, $lang->is_not_blank, array('id' => 'yahoo_blank', 'checked' => $input['conditions']['yahoo_blank'])), 'yahoo'); $form_container->output_row($lang->skype_contains, "", $form->generate_text_box('conditions[skype]', $input['conditions']['skype'], array('id' => 'skype')) . " {$lang->or} " . $form->generate_check_box('conditions[skype_blank]', 1, $lang->is_not_blank, array('id' => 'skype_blank', 'checked' => $input['conditions']['skype_blank'])), 'skype'); $form_container->output_row($lang->google_contains, "", $form->generate_text_box('conditions[google]', $input['conditions']['google'], array('id' => 'google')) . " {$lang->or} " . $form->generate_check_box('conditions[google_blank]', 1, $lang->is_not_blank, array('id' => 'google_blank', 'checked' => $input['conditions']['google_blank'])), 'google'); $form_container->output_row($lang->signature_contains, "", $form->generate_text_box('conditions[signature]', $input['conditions']['signature'], array('id' => 'signature')) . " {$lang->or} " . $form->generate_check_box('conditions[signature_blank]', 1, $lang->is_not_blank, array('id' => 'signature_blank', 'checked' => $input['conditions']['signature_blank'])), 'signature'); $form_container->output_row($lang->user_title_contains, "", $form->generate_text_box('conditions[usertitle]', $input['conditions']['usertitle'], array('id' => 'usertitle')) . " {$lang->or} " . $form->generate_check_box('conditions[usertitle_blank]', 1, $lang->is_not_blank, array('id' => 'usertitle_blank', 'checked' => $input['conditions']['usertitle_blank'])), 'usertitle'); $greater_options = array("greater_than" => $lang->greater_than, "is_exactly" => $lang->is_exactly, "less_than" => $lang->less_than); $form_container->output_row($lang->post_count_is, "", $form->generate_select_box('conditions[postnum_dir]', $greater_options, $input['conditions']['postnum_dir'], array('id' => 'numposts_dir')) . " " . $form->generate_text_box('conditions[postnum]', $input['conditions']['postnum'], array('id' => 'numposts')), 'numposts'); $form_container->output_row($lang->thread_count_is, "", $form->generate_select_box('conditions[threadnum_dir]', $greater_options, $input['conditions']['threadnum_dir'], array('id' => 'numthreads_dir')) . " " . $form->generate_text_box('conditions[threadnum]', $input['conditions']['threadnum'], array('id' => 'numthreads')), 'numthreads'); $form_container->output_row($lang->reg_in_x_days, '', $form->generate_text_box('conditions[regdate]', $input['conditions']['regdate'], array('id' => 'regdate')) . ' ' . $lang->days, 'regdate'); $form_container->output_row($lang->reg_ip_matches, $lang->wildcard, $form->generate_text_box('conditions[regip]', $input['conditions']['regip'], array('id' => 'regip')), 'regip'); $form_container->output_row($lang->last_known_ip, $lang->wildcard, $form->generate_text_box('conditions[lastip]', $input['conditions']['lastip'], array('id' => 'lastip')), 'lastip'); $form_container->output_row($lang->posted_with_ip, $lang->wildcard, $form->generate_text_box('conditions[postip]', $input['conditions']['postip'], array('id' => 'postip')), 'postip'); $form_container->end(); // Custom profile fields go here $form_container = new FormContainer($lang->custom_profile_fields_match); // Fetch custom profile fields $query = $db->simple_select("profilefields", "*", "", array('order_by' => 'disporder')); $profile_fields = array(); while ($profile_field = $db->fetch_array($query)) { if ($profile_field['required'] == 1) { $profile_fields['required'][] = $profile_field; } else { $profile_fields['optional'][] = $profile_field; } } output_custom_profile_fields($profile_fields['required'], $input['profile_fields'], $form_container, $form, true); output_custom_profile_fields($profile_fields['optional'], $input['profile_fields'], $form_container, $form, true); $form_container->end(); // Autocompletion for usernames echo ' <link rel="stylesheet" href="../jscripts/select2/select2.css"> <script type="text/javascript" src="../jscripts/select2/select2.min.js?ver=1804"></script> <script type="text/javascript"> <!-- $("#username").select2({ placeholder: "' . $lang->search_for_a_user . '", minimumInputLength: 3, maximumSelectionSize: 3, multiple: false, ajax: { // instead of writing the function to execute the request we use Select2\'s convenient helper url: "../xmlhttp.php?action=get_users", dataType: \'json\', data: function (term, page) { return { query: term // search term }; }, results: function (data, page) { // parse the results into the format expected by Select2. // since we are using custom formatting functions we do not need to alter remote JSON data return {results: data}; } }, initSelection: function(element, callback) { var query = $(element).val(); if (query !== "") { $.ajax("../xmlhttp.php?action=get_users&getone=1", { data: { query: query }, dataType: "json" }).done(function(data) { callback(data); }); } } }); // --> </script>'; }
if ($mybb->input['action'] == "copy" && $mybb->input['vid']) { $vid = (int) $mybb->get_input("vid"); $variablequery = $db->simple_select("theme_variables", "*", "vid={$vid}"); $info = $db->fetch_array($variablequery); if (!$info['vid']) { flash_message("Invalid variable.", "error"); admin_redirect("index.php?module=style-theme_vars"); } $page->add_breadcrumb_item("Copy Variable"); $page->output_header("Theme Variable Manager"); if ($mybb->request_method == "post" && verify_post_check($mybb->input['my_post_key'])) { $info['tid'] = (int) $mybb->get_input("tid"); $info['vid'] = ""; $db->insert_query("theme_variables", $info); flash_message("The variable has been copied.", "success"); admin_redirect("index.php?module=style-theme_vars&tid=" . $info['tid']); } else { // We build a list of themes excluding the one it comes from. $themequery = $db->simple_select("themes", "tid,name", "tid != " . $info['tid']); while ($theme = $db->fetch_array($themequery)) { $themearray[$theme['tid']] = $theme['name']; } $form = new DefaultForm("index.php?module=style-theme_vars&action=copy&vid={$vid}", "post"); $form_container = new FormContainer("Copy Variable"); $form_container->output_row("Copy to which theme?", "", $form->generate_select_box("tid", $themearray)); $form_container->end(); $form->output_submit_wrapper(array($form->generate_submit_button("Copy"))); $form->end(); } } $page->output_footer();