".$form->generate_text_box('css_bits[background]', $properties['background'], array('id' => 'css_bits[background]', 'style' => 'width: 260px;'))."
".$form->generate_text_area('css_bits[extra]', $properties['extra'], array('id' => 'css_bits[extra]', 'style' => 'width: 98%;', 'rows' => '19'))."
", array('rowspan' => 8));
- $table->construct_row();
- $table->construct_cell("".$form->generate_text_box('css_bits[color]', $properties['color'], array('id' => 'css_bits[color]', 'style' => 'width: 260px;'))."
".$form->generate_text_box('css_bits[width]', $properties['width'], array('id' => 'css_bits[width]', 'style' => 'width: 260px;'))."
".$form->generate_text_box('css_bits[font_family]', $properties['font-family'], array('id' => 'css_bits[font_family]', 'style' => 'width: 260px;'))."
".$form->generate_text_box('css_bits[font_size]', $properties['font-size'], array('id' => 'css_bits[font_size]', 'style' => 'width: 260px;'))."
".$form->generate_text_box('css_bits[font_style]', $properties['font-style'], array('id' => 'css_bits[font_style]', 'style' => 'width: 260px;'))."
".$form->generate_text_box('css_bits[font_weight]', $properties['font-weight'], array('id' => 'css_bits[font_weight]', 'style' => 'width: 260px;'))."
".$form->generate_text_box('css_bits[text_decoration]', $properties['text-decoration'], array('id' => 'css_bits[text_decoration]', 'style' => 'width: 260px;'))."
";
- if($mybb->input['keywords'])
- {
- $default_class = '';
- $value = htmlspecialchars_uni($mybb->input['keywords']);
- }
- else
- {
- $default_class = "search_default";
- $value = $lang->search_for_themes;
- }
- echo $search->generate_text_box('keywords', $value, array('id' => 'search_keywords', 'class' => "{$default_class} field150 field_small"))."\n";
- echo "search}\" />\n";
- echo "\n";
- echo "
\n";
- echo $search->end();
-
- // Recommended themes = Default; Otherwise search results & pagination
- if($mybb->request_method == "post")
- {
- $table->output("
-
-EOF;
-
- $form->end();
-
- $page->output_footer();
-}
-
-// Shows the page where you can actually edit a particular selector or the whole stylesheet
-if($mybb->input['action'] == "edit_stylesheet" && (!isset($mybb->input['mode']) || $mybb->input['mode'] == "simple"))
-{
- // Fetch the theme we want to edit this stylesheet in
- $query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");
- $theme = $db->fetch_array($query);
-
- if(!$theme['tid'] || $theme['tid'] == 1)
- {
- flash_message($lang->error_invalid_theme, 'error');
- admin_redirect("index.php?module=style-themes");
- }
-
- $plugins->run_hooks("admin_style_themes_edit_stylesheet_simple");
-
- $parent_list = make_parent_theme_list($theme['tid']);
- $parent_list = implode(',', $parent_list);
- if(!$parent_list)
- {
- $parent_list = 1;
- }
-
- $query = $db->simple_select("themestylesheets", "*", "name='".$db->escape_string($mybb->input['file'])."' AND tid IN ({$parent_list})", array('order_by' => 'tid', 'order_dir' => 'desc', 'limit' => 1));
- $stylesheet = $db->fetch_array($query);
-
- // Does the theme not exist?
- if(!$stylesheet['sid'])
- {
- flash_message($lang->error_invalid_stylesheet, 'error');
- admin_redirect("index.php?module=style-themes");
- }
-
- if($mybb->request_method == "post")
- {
- $sid = $stylesheet['sid'];
-
- // Theme & stylesheet theme ID do not match, editing inherited - we copy to local theme
- if($theme['tid'] != $stylesheet['tid'])
- {
- $sid = copy_stylesheet_to_theme($stylesheet, $theme['tid']);
- }
-
- // Insert the modified CSS
- $new_stylesheet = $stylesheet['stylesheet'];
-
- if($mybb->input['serialized'] == 1)
- {
- $mybb->input['css_bits'] = my_unserialize($mybb->input['css_bits']);
- }
-
- $css_to_insert = '';
- foreach($mybb->input['css_bits'] as $field => $value)
- {
- if(!trim($value) || !trim($field))
- {
- continue;
- }
-
- if($field == "extra")
- {
- $css_to_insert .= $value."\n";
- }
- else
- {
- $field = str_replace("_", "-", $field);
- $css_to_insert .= "{$field}: {$value};\n";
- }
- }
-
- $new_stylesheet = insert_into_css($css_to_insert, $mybb->input['selector'], $new_stylesheet);
-
- // Now we have the new stylesheet, save it
- $updated_stylesheet = array(
- "cachefile" => $db->escape_string($stylesheet['name']),
- "stylesheet" => $db->escape_string(unfix_css_urls($new_stylesheet)),
- "lastmodified" => TIME_NOW
- );
- $db->update_query("themestylesheets", $updated_stylesheet, "sid='{$sid}'");
-
- // Cache the stylesheet to the file
- if(!cache_stylesheet($theme['tid'], $stylesheet['name'], $new_stylesheet))
- {
- $db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$sid}"), "sid='{$sid}'", 1);
- }
-
- // Update the CSS file list for this theme
- update_theme_stylesheet_list($theme['tid']);
-
- $plugins->run_hooks("admin_style_themes_edit_stylesheet_simple_commit");
-
- // Log admin action
- log_admin_action(htmlspecialchars_uni($theme['name']), $stylesheet['name']);
-
- if(!$mybb->input['ajax'])
- {
- flash_message($lang->success_stylesheet_updated, 'success');
-
- if($mybb->input['save_close'])
- {
- admin_redirect("index.php?module=style-themes&action=edit&tid={$theme['tid']}");
- }
- else
- {
- admin_redirect("index.php?module=style-themes&action=edit_stylesheet&tid={$theme['tid']}&file={$stylesheet['name']}");
- }
- }
- else
- {
- echo "1";
- exit;
- }
- }
-
- // Has the file on the file system been modified?
- if(resync_stylesheet($stylesheet))
- {
- // Need to refetch new stylesheet as it was modified
- $query = $db->simple_select("themestylesheets", "stylesheet", "sid='{$stylesheet['sid']}'");
- $stylesheet['stylesheet'] = $db->fetch_field($query, 'stylesheet');
- }
-
- $css_array = css_to_array($stylesheet['stylesheet']);
- $selector_list = get_selectors_as_options($css_array, $mybb->input['selector']);
-
- // Do we not have any selectors? Send em to the full edit page
- if(!$selector_list)
- {
- flash_message($lang->error_cannot_parse, 'error');
- admin_redirect("index.php?module=style-themes&action=edit_stylesheet&tid={$theme['tid']}&file=".htmlspecialchars_uni($stylesheet['name'])."&mode=advanced");
- exit;
- }
-
- // Fetch list of all of the stylesheets for this theme
- $stylesheets = fetch_theme_stylesheets($theme);
- $this_stylesheet = $stylesheets[$stylesheet['name']];
- unset($stylesheets);
-
- $page->extra_header .= "
- ";
-
- $page->add_breadcrumb_item(htmlspecialchars_uni($theme['name']), "index.php?module=style-themes&action=edit&tid={$mybb->input['tid']}");
- $page->add_breadcrumb_item("{$lang->editing} ".htmlspecialchars_uni($stylesheet['name']), "index.php?module=style-themes&action=edit_stylesheet&tid={$mybb->input['tid']}&file=".htmlspecialchars_uni($mybb->input['file'])."&mode=simple");
-
- $page->output_header("{$lang->themes} - {$lang->edit_stylesheets}");
-
- // If the stylesheet and theme do not match, we must be editing something that is inherited
- if($this_stylesheet['inherited'][$stylesheet['name']])
- {
- $query = $db->simple_select("themes", "name", "tid='{$stylesheet['tid']}'");
- $stylesheet_parent = htmlspecialchars_uni($db->fetch_field($query, 'name'));
-
- // Show inherited warning
- if($stylesheet['tid'] == 1)
- {
- $page->output_alert($lang->sprintf($lang->stylesheet_inherited_default, $stylesheet_parent), "ajax_alert");
- }
- else
- {
- $page->output_alert($lang->sprintf($lang->stylesheet_inherited, $stylesheet_parent), "ajax_alert");
- }
- }
-
- $sub_tabs['edit_stylesheet'] = array(
- 'title' => $lang->edit_stylesheet_simple_mode,
- 'link' => "index.php?module=style-themes&action=edit_stylesheet&tid={$mybb->input['tid']}&file=".htmlspecialchars_uni($mybb->input['file'])."&mode=simple",
- 'description' => $lang->edit_stylesheet_simple_mode_desc
- );
-
- $sub_tabs['edit_stylesheet_advanced'] = array(
- 'title' => $lang->edit_stylesheet_advanced_mode,
- 'link' => "index.php?module=style-themes&action=edit_stylesheet&tid={$mybb->input['tid']}&file=".htmlspecialchars_uni($mybb->input['file'])."&mode=advanced",
- );
-
- $page->output_nav_tabs($sub_tabs, 'edit_stylesheet');
-
- // Output the selection box
- $form = new Form("index.php", "get", "selector_form");
- echo $form->generate_hidden_field("module", "style/themes")."\n";
- echo $form->generate_hidden_field("action", "edit_stylesheet")."\n";
- echo $form->generate_hidden_field("tid", $mybb->input['tid'])."\n";
- echo $form->generate_hidden_field("file", htmlspecialchars_uni($mybb->input['file']))."\n";
-
- echo "{$lang->selector}: ".$form->generate_submit_button($lang->go)."
\n";
-
- $form->end();
-
- // Haven't chosen a selector to edit, show the first one from the stylesheet
- if(!$mybb->input['selector'])
- {
- reset($css_array);
- uasort($css_array, "css_selectors_sort_cmp");
- $selector = key($css_array);
- $editable_selector = $css_array[$selector];
- }
- // Show a specific selector
- else
- {
- $editable_selector = $css_array[$mybb->input['selector']];
- $selector = $mybb->input['selector'];
- }
-
- // Get the properties from this item
- $properties = parse_css_properties($editable_selector['values']);
-
- foreach(array('background', 'color', 'width', 'font-family', 'font-size', 'font-style', 'font-weight', 'text-decoration') as $_p)
- {
- if(!isset($properties[$_p]))
- {
- $properties[$_p] = '';
- }
- }
-
- $form = new Form("index.php?module=style-themes&action=edit_stylesheet", "post");
- echo $form->generate_hidden_field("tid", $mybb->input['tid'], array('id' => "tid"))."\n";
- echo $form->generate_hidden_field("file", htmlspecialchars_uni($mybb->input['file']), array('id' => "file"))."\n";
- echo $form->generate_hidden_field("selector", htmlspecialchars_uni($selector), array('id' => 'hidden_selector'))."\n";
-
- echo "";
- $table = new Table;
- $table->construct_cell("
".$form->generate_text_box('css_bits[background]', $properties['background'], array('id' => 'css_bits[background]', 'style' => 'width: 260px;'))."
{$lang->background}
", array('style' => 'width: 20%;'));
- $table->construct_cell("
{$lang->extra_css_atribs}".$form->generate_text_area('css_bits[extra]', $properties['extra'], array('id' => 'css_bits[extra]', 'style' => 'width: 98%;', 'rows' => '19'))."
", array('rowspan' => 8));
- $table->construct_row();
- $table->construct_cell("
".$form->generate_text_box('css_bits[color]', $properties['color'], array('id' => 'css_bits[color]', 'style' => 'width: 260px;'))."
{$lang->color}
", array('style' => 'width: 40%;'));
- $table->construct_row();
- $table->construct_cell("
".$form->generate_text_box('css_bits[width]', $properties['width'], array('id' => 'css_bits[width]', 'style' => 'width: 260px;'))."
{$lang->width}
", array('style' => 'width: 40%;'));
- $table->construct_row();
- $table->construct_cell("
".$form->generate_text_box('css_bits[font_family]', $properties['font-family'], array('id' => 'css_bits[font_family]', 'style' => 'width: 260px;'))."
{$lang->font_family}
", array('style' => 'width: 40%;'));
- $table->construct_row();
- $table->construct_cell("
".$form->generate_text_box('css_bits[font_size]', $properties['font-size'], array('id' => 'css_bits[font_size]', 'style' => 'width: 260px;'))."
{$lang->font_size}
", array('style' => 'width: 40%;'));
- $table->construct_row();
- $table->construct_cell("
".$form->generate_text_box('css_bits[font_style]', $properties['font-style'], array('id' => 'css_bits[font_style]', 'style' => 'width: 260px;'))."
{$lang->font_style}
", array('style' => 'width: 40%;'));
- $table->construct_row();
- $table->construct_cell("
".$form->generate_text_box('css_bits[font_weight]', $properties['font-weight'], array('id' => 'css_bits[font_weight]', 'style' => 'width: 260px;'))."
{$lang->font_weight}
", array('style' => 'width: 40%;'));
- $table->construct_row();
- $table->construct_cell("
".$form->generate_text_box('css_bits[text_decoration]', $properties['text-decoration'], array('id' => 'css_bits[text_decoration]', 'style' => 'width: 260px;'))."
{$lang->text_decoration}
", array('style' => 'width: 40%;'));
- $table->construct_row();
-
- $table->output(htmlspecialchars_uni($editable_selector['class_name'])."
");
-
- echo "
";
-
- $buttons[] = $form->generate_reset_button($lang->reset);
- $buttons[] = $form->generate_submit_button($lang->save_changes, array('id' => 'save', 'name' => 'save'));
- $buttons[] = $form->generate_submit_button($lang->save_changes_and_close, array('id' => 'save_close', 'name' => 'save_close'));
-
- $form->output_submit_wrapper($buttons);
-
- echo '';
- echo '';
-
- $form->end();
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "edit_stylesheet" && $mybb->input['mode'] == "advanced")
-{
- // Fetch the theme we want to edit this stylesheet in
- $query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");
- $theme = $db->fetch_array($query);
-
- if(!$theme['tid'] || $theme['tid'] == 1)
- {
- flash_message($lang->error_invalid_theme, 'error');
- admin_redirect("index.php?module=style-themes");
- }
-
- $plugins->run_hooks("admin_style_themes_edit_stylesheet_advanced");
-
- $parent_list = make_parent_theme_list($theme['tid']);
- $parent_list = implode(',', $parent_list);
- if(!$parent_list)
- {
- $parent_list = 1;
- }
-
- $query = $db->simple_select("themestylesheets", "*", "name='".$db->escape_string($mybb->input['file'])."' AND tid IN ({$parent_list})", array('order_by' => 'tid', 'order_dir' => 'desc', 'limit' => 1));
- $stylesheet = $db->fetch_array($query);
-
- // Does the theme not exist?
- if(!$stylesheet['sid'])
- {
- flash_message($lang->error_invalid_stylesheet, 'error');
- admin_redirect("index.php?module=style-themes");
- }
-
- if($mybb->request_method == "post")
- {
- $sid = $stylesheet['sid'];
-
- // Theme & stylesheet theme ID do not match, editing inherited - we copy to local theme
- if($theme['tid'] != $stylesheet['tid'])
- {
- $sid = copy_stylesheet_to_theme($stylesheet, $theme['tid']);
- }
-
- // Now we have the new stylesheet, save it
- $updated_stylesheet = array(
- "cachefile" => $db->escape_string($stylesheet['name']),
- "stylesheet" => $db->escape_string(unfix_css_urls($mybb->input['stylesheet'])),
- "lastmodified" => TIME_NOW
- );
- $db->update_query("themestylesheets", $updated_stylesheet, "sid='{$sid}'");
-
- // Cache the stylesheet to the file
- if(!cache_stylesheet($theme['tid'], $stylesheet['name'], $mybb->input['stylesheet']))
- {
- $db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$sid}"), "sid='{$sid}'", 1);
- }
-
- // Update the CSS file list for this theme
- update_theme_stylesheet_list($theme['tid']);
-
- $plugins->run_hooks("admin_style_themes_edit_stylesheet_advanced_commit");
-
- // Log admin action
- log_admin_action(htmlspecialchars_uni($theme['name']), $stylesheet['name']);
-
- flash_message($lang->success_stylesheet_updated, 'success');
-
- if(!$mybb->input['save_close'])
- {
- admin_redirect("index.php?module=style-themes&action=edit_stylesheet&file=".htmlspecialchars_uni($stylesheet['name'])."&tid={$theme['tid']}&mode=advanced");
- }
- else
- {
- admin_redirect("index.php?module=style-themes&action=edit&tid={$theme['tid']}");
- }
- }
-
- // Fetch list of all of the stylesheets for this theme
- $stylesheets = fetch_theme_stylesheets($theme);
- $this_stylesheet = $stylesheets[$stylesheet['name']];
- unset($stylesheets);
-
- if($admin_options['codepress'] != 0)
- {
- $page->extra_header .= '
-
-
-
-
-
-
-
-
-';
- }
-
- $page->add_breadcrumb_item(htmlspecialchars_uni($theme['name']), "index.php?module=style-themes&action=edit&tid={$mybb->input['tid']}");
- $page->add_breadcrumb_item("{$lang->editing} ".htmlspecialchars_uni($stylesheet['name']), "index.php?module=style-themes&action=edit_stylesheet&tid={$mybb->input['tid']}&file=".htmlspecialchars_uni($mybb->input['file'])."&mode=advanced");
-
- $page->output_header("{$lang->themes} - {$lang->edit_stylesheet_advanced_mode}");
-
- // If the stylesheet and theme do not match, we must be editing something that is inherited
- if($this_stylesheet['inherited'][$stylesheet['name']])
- {
- $query = $db->simple_select("themes", "name", "tid='{$stylesheet['tid']}'");
- $stylesheet_parent = htmlspecialchars_uni($db->fetch_field($query, 'name'));
-
- // Show inherited warning
- if($stylesheet['tid'] == 1)
- {
- $page->output_alert($lang->sprintf($lang->stylesheet_inherited_default, $stylesheet_parent));
- }
- else
- {
- $page->output_alert($lang->sprintf($lang->stylesheet_inherited, $stylesheet_parent));
- }
- }
-
- $sub_tabs['edit_stylesheet'] = array(
- 'title' => $lang->edit_stylesheet_simple_mode,
- 'link' => "index.php?module=style-themes&action=edit_stylesheet&tid={$mybb->input['tid']}&file=".htmlspecialchars_uni($mybb->input['file'])."&mode=simple"
- );
-
- $sub_tabs['edit_stylesheet_advanced'] = array(
- 'title' => $lang->edit_stylesheet_advanced_mode,
- 'link' => "index.php?module=style-themes&action=edit_stylesheet&tid={$mybb->input['tid']}&file=".htmlspecialchars_uni($mybb->input['file'])."&mode=advanced",
- 'description' => $lang->edit_stylesheet_advanced_mode_desc
- );
-
- $page->output_nav_tabs($sub_tabs, 'edit_stylesheet_advanced');
-
- // Has the file on the file system been modified?
- if(resync_stylesheet($stylesheet))
- {
- // Need to refetch new stylesheet as it was modified
- $query = $db->simple_select("themestylesheets", "stylesheet", "sid='{$stylesheet['sid']}'");
- $stylesheet['stylesheet'] = $db->fetch_field($query, 'stylesheet');
- }
-
- $form = new Form("index.php?module=style-themes&action=edit_stylesheet&mode=advanced", "post", "edit_stylesheet");
- echo $form->generate_hidden_field("tid", $mybb->input['tid'])."\n";
- echo $form->generate_hidden_field("file", htmlspecialchars_uni($mybb->input['file']))."\n";
-
- $table = new Table;
- $table->construct_cell($form->generate_text_area('stylesheet', $stylesheet['stylesheet'], array('id' => 'stylesheet', 'style' => 'width: 99%;', 'class' => '', 'rows' => '30')));
- $table->construct_row();
- $table->output($lang->full_stylesheet_for.' '.htmlspecialchars_uni($stylesheet['name']), 1, 'tfixed');
-
- $buttons[] = $form->generate_submit_button($lang->save_changes, array('id' => 'save', 'name' => 'save'));
- $buttons[] = $form->generate_submit_button($lang->save_changes_and_close, array('id' => 'save_close', 'name' => 'save_close'));
-
- $form->output_submit_wrapper($buttons);
-
- $form->end();
-
- if($admin_options['codepress'] != 0)
- {
- echo '';
- }
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "delete_stylesheet")
-{
- // Fetch the theme we want to edit this stylesheet in
- $query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");
- $theme = $db->fetch_array($query);
-
- if(!$theme['tid'] || $theme['tid'] == 1)
- {
- flash_message($lang->error_invalid_theme, 'error');
- admin_redirect("index.php?module=style-themes");
- }
-
- $plugins->run_hooks("admin_style_themes_delete_stylesheet");
-
- $parent_list = make_parent_theme_list($theme['tid']);
- $parent_list = implode(',', $parent_list);
- if(!$parent_list)
- {
- $parent_list = 1;
- }
-
- $query = $db->simple_select("themestylesheets", "*", "name='".$db->escape_string($mybb->input['file'])."' AND tid IN ({$parent_list})", array('order_by' => 'tid', 'order_dir' => 'desc', 'limit' => 1));
- $stylesheet = $db->fetch_array($query);
-
- // Does the theme not exist? or are we trying to delete the master?
- if(!$stylesheet['sid'] || $stylesheet['tid'] == 1)
- {
- flash_message($lang->error_invalid_stylesheet, 'error');
- admin_redirect("index.php?module=style-themes");
- }
-
- // User clicked no
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=style-themes");
- }
-
- if($mybb->request_method == "post")
- {
- $db->delete_query("themestylesheets", "sid='{$stylesheet['sid']}'", 1);
- @unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$stylesheet['cachefile']}");
-
- $filename_min = str_replace('.css', '.min.css', $stylesheet['cachefile']);
- @unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$filename_min}");
-
- // Update the CSS file list for this theme
- update_theme_stylesheet_list($theme['tid'], $theme, true);
-
- $plugins->run_hooks("admin_style_themes_delete_stylesheet_commit");
-
- // Log admin action
- log_admin_action($stylesheet['sid'], $stylesheet['name'], $theme['tid'], htmlspecialchars_uni($theme['name']));
-
- flash_message($lang->success_stylesheet_deleted, 'success');
- admin_redirect("index.php?module=style-themes&action=edit&tid={$theme['tid']}");
- }
- else
- {
- $page->output_confirm_action("index.php?module=style-themes&action=force&tid={$theme['tid']}", $lang->confirm_stylesheet_deletion);
- }
-}
-
-if($mybb->input['action'] == "add_stylesheet")
-{
- // Fetch the theme we want to edit this stylesheet in
- $query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");
- $theme = $db->fetch_array($query);
-
- if(!$theme['tid'] || $theme['tid'] == 1)
- {
- flash_message($lang->error_invalid_theme, 'error');
- admin_redirect("index.php?module=style-themes");
- }
-
- $plugins->run_hooks("admin_style_themes_add_stylesheet");
-
- // Fetch list of all of the stylesheets for this theme
- $stylesheets = fetch_theme_stylesheets($theme);
-
- if($mybb->request_method == "post")
- {
- // Remove special characters
- $mybb->input['name'] = preg_replace('#([^a-z0-9-_\.]+)#i', '', $mybb->input['name']);
- if(!$mybb->input['name'] || $mybb->input['name'] == ".css")
- {
- $errors[] = $lang->error_missing_stylesheet_name;
- }
-
- // Get 30 chars only because we don't want more than that
- $mybb->input['name'] = my_substr($mybb->input['name'], 0, 30);
- if(get_extension($mybb->input['name']) != "css")
- {
- // Does not end with '.css'
- $errors[] = $lang->sprintf($lang->error_missing_stylesheet_extension, $mybb->input['name']);
- }
-
- if(!$errors)
- {
- if($mybb->input['add_type'] == 1)
- {
- // Import from a current stylesheet
- $parent_list = make_parent_theme_list($theme['tid']);
- $parent_list = implode(',', $parent_list);
-
- $query = $db->simple_select("themestylesheets", "stylesheet", "name='".$db->escape_string($mybb->input['import'])."' AND tid IN ({$parent_list})", array('limit' => 1, 'order_by' => 'tid', 'order_dir' => 'desc'));
- $stylesheet = $db->fetch_field($query, "stylesheet");
- }
- else
- {
- // Custom stylesheet
- $stylesheet = $mybb->input['stylesheet'];
- }
-
- $attached = array();
-
- if($mybb->input['attach'] == 1)
- {
- // Our stylesheet is attached to custom pages in MyBB
- foreach($mybb->input as $id => $value)
- {
- $actions_list = "";
- $attached_to = "";
-
- if(strpos($id, 'attached_') !== false)
- {
- // We have a custom attached file
- $attached_id = (int)str_replace('attached_', '', $id);
- $attached_to = $value;
-
- if($mybb->input['action_'.$attached_id] == 1)
- {
- // We have custom actions for attached files
- $actions_list = $mybb->input['action_list_'.$attached_id];
- }
-
- if($actions_list)
- {
- $attached_to = $attached_to."?".$actions_list;
- }
-
- $attached[] = $attached_to;
- }
- }
- }
- else if($mybb->input['attach'] == 2)
- {
- if(!is_array($mybb->input['color']))
- {
- $errors[] = $lang->error_no_color_picked;
- }
- else
- {
- $attached = $mybb->input['color'];
- }
- }
-
- // Add Stylesheet
- $insert_array = array(
- 'name' => $db->escape_string($mybb->input['name']),
- 'tid' => $mybb->get_input('tid', MyBB::INPUT_INT),
- 'attachedto' => implode('|', array_map(array($db, "escape_string"), $attached)),
- 'stylesheet' => $db->escape_string($stylesheet),
- 'cachefile' => $db->escape_string(str_replace('/', '', $mybb->input['name'])),
- 'lastmodified' => TIME_NOW
- );
-
- $sid = $db->insert_query("themestylesheets", $insert_array);
-
- if(!cache_stylesheet($theme['tid'], str_replace('/', '', $mybb->input['name']), $stylesheet))
- {
- $db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$sid}"), "sid='{$sid}'", 1);
- }
-
- // Update the CSS file list for this theme
- update_theme_stylesheet_list($theme['tid'], $theme, true);
-
- $plugins->run_hooks("admin_style_themes_add_stylesheet_commit");
-
- // Log admin action
- log_admin_action($sid, $mybb->input['name'], $theme['tid'], htmlspecialchars_uni($theme['name']));
-
- flash_message($lang->success_stylesheet_added, 'success');
- admin_redirect("index.php?module=style-themes&action=edit_stylesheet&tid={$mybb->input['tid']}&sid={$sid}&file=".urlencode($mybb->input['name']));
- }
- }
-
- if($admin_options['codepress'] != 0)
- {
- $page->extra_header .= '
-
-
-
-
-
-
-
-
-';
- }
-
- $page->add_breadcrumb_item(htmlspecialchars_uni($theme['name']), "index.php?module=style-themes&action=edit&tid={$mybb->input['tid']}");
- $page->add_breadcrumb_item($lang->add_stylesheet);
- $properties = my_unserialize($theme['properties']);
-
- $page->output_header("{$lang->themes} - {$lang->add_stylesheet}");
-
- $sub_tabs['edit_stylesheets'] = array(
- 'title' => $lang->edit_stylesheets,
- 'link' => "index.php?module=style-themes&action=edit&tid={$mybb->input['tid']}"
- );
-
- $sub_tabs['add_stylesheet'] = array(
- 'title' => $lang->add_stylesheet,
- 'link' => "index.php?module=style-themes&action=add_stylesheet&tid={$mybb->input['tid']}",
- 'description' => $lang->add_stylesheet_desc
- );
-
- $sub_tabs['export_theme'] = array(
- 'title' => $lang->export_theme,
- 'link' => "index.php?module=style-themes&action=export&tid={$mybb->input['tid']}"
- );
-
- $sub_tabs['duplicate_theme'] = array(
- 'title' => $lang->duplicate_theme,
- 'link' => "index.php?module=style-themes&action=duplicate&tid={$mybb->input['tid']}",
- 'description' => $lang->duplicate_theme_desc
- );
-
- $page->output_nav_tabs($sub_tabs, 'add_stylesheet');
-
- if($errors)
- {
- $page->output_inline_error($errors);
-
- foreach($mybb->input as $name => $value)
- {
- if(strpos($name, "attached") !== false)
- {
- list(, $id) = explode('_', $name);
- $id = (int)$id;
-
- $mybb->input['applied_to'][$value] = array(0 => 'global');
-
- if($mybb->input['action_'.$id] == 1)
- {
- $mybb->input['applied_to'][$value] = explode(',', $mybb->input['action_list_'.$id]);
- }
- }
- }
-
- if($mybb->input['add_type'] == 1)
- {
- $add_checked[1] = "checked=\"checked\"";
- $add_checked[2] = "";
- }
- else
- {
- $add_checked[2] = "checked=\"checked\"";
- $add_checked[1] = "";
- }
- }
- else
- {
- $mybb->input['name'] = $stylesheet['name'];
- }
-
- $global_checked[1] = "checked=\"checked\"";
- $global_checked[2] = "";
- $global_checked[3] = "";
-
- $form = new Form("index.php?module=style-themes&action=add_stylesheet", "post", "add_stylesheet");
-
- echo $form->generate_hidden_field("tid", $mybb->input['tid'])."\n";
-
- $specific_files = "";
- $count = 0;
-
- if($mybb->input['attach'] == 1 && is_array($mybb->input['applied_to']) && (!isset($mybb->input['applied_to']['global']) || $mybb->input['applied_to']['global'][0] != "global"))
- {
- $check_actions = "";
-
- foreach($mybb->input['applied_to'] as $name => $actions)
- {
- $action_list = "";
- if($actions[0] != "global")
- {
- $action_list = implode(',', $actions);
- }
-
- if($actions[0] == "global")
- {
- $global_action_checked[1] = "checked=\"checked\"";
- $global_action_checked[2] = "";
- }
- else
- {
- $global_action_checked[2] = "checked=\"checked\"";
- $global_action_checked[1] = "";
- }
-
- $specific_file = "
-
-
- -
- {$lang->specific_actions_desc}
-
-
- | ".$form->generate_text_box('action_list_'.$count, $action_list, array('id' => 'action_list_'.$count, 'style' => 'width: 190px;'))." |
-
-
-
-
";
-
- $form_container = new FormContainer();
- $form_container->output_row("", "", "
style}/images/icons/cross.png\" alt=\"{$lang->delete}\" title=\"{$lang->delete}\" />{$lang->file} ".$form->generate_text_box("attached_{$count}", $name, array('id' => "attached_{$count}", 'style' => 'width: 200px;')), "attached_{$count}");
-
- $form_container->output_row("", "", $specific_file);
-
- $specific_files .= "
".$form_container->end(true)."
";
-
- $check_actions .= "\n\tcheckAction('action_{$count}');";
-
- ++$count;
- }
-
- if($check_actions)
- {
- $global_checked[3] = "";
- $global_checked[2] = "checked=\"checked\"";
- $global_checked[1] = "";
- }
- }
- else if($mybb->input['attach'] == 2)
- {
- // Colors
- $stylesheet['colors'] = array();
- if(is_array($properties['colors']))
- {
- // We might have colors here...
- foreach($mybb->input['color'] as $color)
- {
- // Verify this is a color for this theme
- if(array_key_exists($color, $properties['colors']))
- {
- $stylesheet['colors'][] = $color;
- }
- }
-
- if(!empty($stylesheet['colors']))
- {
- $global_checked[3] = "checked=\"checked\"";
- $global_checked[2] = "";
- $global_checked[1] = "";
- }
- }
- }
-
- $specific_files .= "
";
-
- // Colors
- $specific_colors = $specific_colors_option = '';
-
- if(is_array($properties['colors']))
- {
- $specific_colors = "
";
- $specific_colors_option = '
';
-
- $specific_color = "
- {$lang->colors_add_edit_desc}
-
- ".$form->generate_select_box('color[]', $properties['colors'], $stylesheet['colors'], array('multiple' => true, 'size' => "5\" style=\"width: 200px;"))."
- ";
-
- $form_container = new FormContainer();
- $form_container->output_row("", "", $specific_color);
- $specific_colors .= $form_container->end(true)."";
- }
-
- $actions = '
-
-
-
- '.$specific_files.'
- '.$specific_colors_option.'
- '.$specific_colors.'
-
- ';
-
- echo $form->generate_hidden_field("sid", $stylesheet['sid'])."
\n";
-
- $form_container = new FormContainer($lang->add_stylesheet_to.' '.htmlspecialchars_uni($theme['name']), 'tfixed');
- $form_container->output_row($lang->file_name, $lang->file_name_desc, $form->generate_text_box('name', $mybb->input['name'], array('id' => 'name', 'style' => 'width: 200px;')), 'name');
-
- $form_container->output_row($lang->attached_to, $lang->attached_to_desc, $actions);
-
- $sheetnames = array();
- foreach($stylesheets as $filename => $style)
- {
- $sheetnames[basename($filename)] = basename($filename);
- }
-
- $actions = "
-
- -
-
-
- | ".$form->generate_select_box('import', $sheetnames, $mybb->input['import'], array('id' => 'import'))." |
-
-
-
-
-
".$form->generate_text_area('stylesheet', $mybb->input['stylesheet'], array('id' => 'stylesheet', 'style' => 'width: 99%;', 'class' => '', 'rows' => '30'))."
-
";
-
- $form_container->output_row("", "", $actions);
-
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->save_stylesheet);
-
- $form->output_submit_wrapper($buttons);
-
- if($admin_options['codepress'] != 0)
- {
- echo '';
- }
-
- echo '';
- echo '';
- echo '';
-
- $form->end();
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "set_default")
-{
- if(!verify_post_check($mybb->input['my_post_key']))
- {
- flash_message($lang->invalid_post_verify_key2, 'error');
- admin_redirect("index.php?module=style-themes");
- }
-
- $query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");
- $theme = $db->fetch_array($query);
-
- // Does the theme not exist?
- if(!$theme['tid'] || $theme['tid'] == 1)
- {
- flash_message($lang->error_invalid_theme, 'error');
- admin_redirect("index.php?module=style-themes");
- }
-
- $plugins->run_hooks("admin_style_themes_set_default");
-
- $cache->update('default_theme', $theme);
-
- $db->update_query("themes", array('def' => 0));
- $db->update_query("themes", array('def' => 1), "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");
-
- $plugins->run_hooks("admin_style_themes_set_default_commit");
-
- // Log admin action
- log_admin_action($theme['tid'], htmlspecialchars_uni($theme['name']));
-
- flash_message($lang->success_theme_set_default, 'success');
- admin_redirect("index.php?module=style-themes");
-}
-
-if($mybb->input['action'] == "force")
-{
- $query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");
- $theme = $db->fetch_array($query);
-
- // Does the theme not exist?
- if(!$theme['tid'] || $theme['tid'] == 1)
- {
- flash_message($lang->error_invalid_theme, 'error');
- admin_redirect("index.php?module=style-themes");
- }
-
- $plugins->run_hooks("admin_style_themes_force");
-
- // User clicked no
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=style-themes");
- }
-
- if($mybb->request_method == "post")
- {
- $updated_users = array(
- "style" => $theme['tid']
- );
-
- $plugins->run_hooks("admin_style_themes_force_commit");
-
- $db->update_query("users", $updated_users);
-
- // Log admin action
- log_admin_action($theme['tid'], htmlspecialchars_uni($theme['name']));
-
- flash_message($lang->success_theme_forced, 'success');
- admin_redirect("index.php?module=style-themes");
- }
- else
- {
- $page->output_confirm_action("index.php?module=style-themes&action=force&tid={$theme['tid']}", $lang->confirm_theme_forced);
- }
-}
-
-if(!$mybb->input['action'])
-{
- $page->output_header($lang->themes);
-
- $plugins->run_hooks("admin_style_themes_start");
-
- $page->output_nav_tabs($sub_tabs, 'themes');
-
- $table = new Table;
- $table->construct_header($lang->theme);
- $table->construct_header($lang->num_users, array("class" => "align_center", "width" => 100));
- $table->construct_header($lang->controls, array("class" => "align_center", "width" => 150));
-
- build_theme_list();
-
- $table->output($lang->themes);
-
- $page->output_footer();
-}
diff --git a/html/forums/admin/modules/tools/adminlog.php b/html/forums/admin/modules/tools/adminlog.php
deleted file mode 100644
index ffd9374..0000000
--- a/html/forums/admin/modules/tools/adminlog.php
+++ /dev/null
@@ -1,609 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->admin_logs, "index.php?module=tools-adminlog");
-
-$sub_tabs['admin_logs'] = array(
- 'title' => $lang->admin_logs,
- 'link' => "index.php?module=tools-adminlog",
- 'description' => $lang->admin_logs_desc
-);
-$sub_tabs['prune_admin_logs'] = array(
- 'title' => $lang->prune_admin_logs,
- 'link' => "index.php?module=tools-adminlog&action=prune",
- 'description' => $lang->prune_admin_logs_desc
-);
-
-$plugins->run_hooks("admin_tools_adminlog_begin");
-
-if($mybb->input['action'] == 'prune')
-{
- if(!is_super_admin($mybb->user['uid']))
- {
- flash_message($lang->cannot_perform_action_super_admin_general, 'error');
- admin_redirect("index.php?module=tools-adminlog");
- }
-
- $plugins->run_hooks("admin_tools_adminlog_prune");
-
- if($mybb->request_method == 'post')
- {
- $is_today = false;
- $mybb->input['older_than'] = $mybb->get_input('older_than', MyBB::INPUT_INT);
- if($mybb->input['older_than'] <= 0)
- {
- $is_today = true;
- $mybb->input['older_than'] = 1;
- }
- $where = 'dateline < '.(TIME_NOW-($mybb->input['older_than']*86400));
-
- // Searching for entries by a particular user
- if($mybb->input['uid'])
- {
- $where .= " AND uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";
- }
-
- // Searching for entries in a specific module
- if($mybb->input['filter_module'])
- {
- $where .= " AND module='".$db->escape_string($mybb->input['filter_module'])."'";
- }
-
- $query = $db->delete_query("adminlog", $where);
- $num_deleted = $db->affected_rows();
-
- $plugins->run_hooks("admin_tools_adminlog_prune_commit");
-
- // Log admin action
- log_admin_action($mybb->input['older_than'], $mybb->input['uid'], $mybb->input['filter_module'], $num_deleted);
-
- $success = $lang->success_pruned_admin_logs;
- if($is_today == true && $num_deleted > 0)
- {
- $success .= ' '.$lang->note_logs_locked;
- }
- elseif($is_today == true && $num_deleted == 0)
- {
- flash_message($lang->note_logs_locked, 'error');
- admin_redirect("index.php?module=tools-adminlog");
- }
- flash_message($success, 'success');
- admin_redirect("index.php?module=tools-adminlog");
- }
- $page->add_breadcrumb_item($lang->prune_admin_logs, "index.php?module=tools-adminlog&action=prune");
- $page->output_header($lang->prune_admin_logs);
- $page->output_nav_tabs($sub_tabs, 'prune_admin_logs');
-
- // Fetch filter options
- $sortbysel[$mybb->input['sortby']] = 'selected="selected"';
- $ordersel[$mybb->input['order']] = 'selected="selected"';
-
- $user_options[''] = $lang->all_administrators;
- $user_options['0'] = '----------';
-
- $query = $db->query("
- SELECT DISTINCT l.uid, u.username
- FROM ".TABLE_PREFIX."adminlog l
- LEFT JOIN ".TABLE_PREFIX."users u ON (l.uid=u.uid)
- ORDER BY u.username ASC
- ");
- while($user = $db->fetch_array($query))
- {
- $user_options[$user['uid']] = htmlspecialchars_uni($user['username']);
- }
-
- $module_options = array();
- $module_options[''] = $lang->all_modules;
- $module_options['0'] = '----------';
- $query = $db->query("
- SELECT DISTINCT l.module
- FROM ".TABLE_PREFIX."adminlog l
- ORDER BY l.module ASC
- ");
- while($module = $db->fetch_array($query))
- {
- $module_options[$module['module']] = str_replace(' ', ' -> ', ucwords(str_replace('/', ' ', $module['module'])));
- }
-
- $form = new Form("index.php?module=tools-adminlog&action=prune", "post");
- $form_container = new FormContainer($lang->prune_administrator_logs);
- $form_container->output_row($lang->module, "", $form->generate_select_box('filter_module', $module_options, $mybb->input['filter_module'], array('id' => 'filter_module')), 'filter_module');
- $form_container->output_row($lang->administrator, "", $form->generate_select_box('uid', $user_options, $mybb->input['uid'], array('id' => 'uid')), 'uid');
- if(!$mybb->input['older_than'])
- {
- $mybb->input['older_than'] = '30';
- }
- $form_container->output_row($lang->date_range, "", $lang->older_than.$form->generate_numeric_field('older_than', $mybb->input['older_than'], array('id' => 'older_than', 'style' => 'width: 50px', 'min' => 0))." {$lang->days}", 'older_than');
- $form_container->end();
- $buttons[] = $form->generate_submit_button($lang->prune_administrator_logs);
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-
-if(!$mybb->input['action'])
-{
- $page->output_header($lang->admin_logs);
- $page->output_nav_tabs($sub_tabs, 'admin_logs');
-
- $perpage = $mybb->get_input('perpage', MyBB::INPUT_INT);
- if(!$perpage)
- {
- if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1)
- {
- $mybb->settings['threadsperpage'] = 20;
- }
-
- $perpage = $mybb->settings['threadsperpage'];
- }
-
- $where = '';
-
- $plugins->run_hooks("admin_tools_adminlog_start");
-
- // Searching for entries by a particular user
- if($mybb->input['uid'])
- {
- $where .= " AND l.uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";
- }
-
- // Searching for entries in a specific module
- if($mybb->input['filter_module'])
- {
- $where .= " AND module='".$db->escape_string($mybb->input['filter_module'])."'";
- }
-
- // Order?
- switch($mybb->input['sortby'])
- {
- case "username":
- $sortby = "u.username";
- break;
- default:
- $sortby = "l.dateline";
- }
- $order = $mybb->input['order'];
- if($order != 'asc')
- {
- $order = 'desc';
- }
-
- $query = $db->query("
- SELECT COUNT(l.dateline) AS count
- FROM ".TABLE_PREFIX."adminlog l
- LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=l.uid)
- WHERE 1=1 {$where}
- ");
- $rescount = $db->fetch_field($query, "count");
-
- // Figure out if we need to display multiple pages.
- if($mybb->input['page'] != "last")
- {
- $pagecnt = $mybb->get_input('page', MyBB::INPUT_INT);
- }
-
- $postcount = (int)$rescount;
- $pages = $postcount / $perpage;
- $pages = ceil($pages);
-
- if($mybb->input['page'] == "last")
- {
- $pagecnt = $pages;
- }
-
- if($pagecnt > $pages)
- {
- $pagecnt = 1;
- }
-
- if($pagecnt)
- {
- $start = ($pagecnt-1) * $perpage;
- }
- else
- {
- $start = 0;
- $pagecnt = 1;
- }
-
- $table = new Table;
- $table->construct_header($lang->username, array('width' => '10%'));
- $table->construct_header($lang->date, array('class' => 'align_center', 'width' => '15%'));
- $table->construct_header($lang->information, array('class' => 'align_center', 'width' => '65%'));
- $table->construct_header($lang->ipaddress, array('class' => 'align_center', 'width' => '10%'));
-
- $query = $db->query("
- SELECT l.*, u.username, u.usergroup, u.displaygroup
- FROM ".TABLE_PREFIX."adminlog l
- LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=l.uid)
- WHERE 1=1 {$where}
- ORDER BY {$sortby} {$order}
- LIMIT {$start}, {$perpage}
- ");
- while($logitem = $db->fetch_array($query))
- {
- $information = '';
- $trow = alt_trow();
- $logitem['username'] = htmlspecialchars_uni($logitem['username']);
- $username = format_name($logitem['username'], $logitem['usergroup'], $logitem['displaygroup']);
-
- $logitem['data'] = my_unserialize($logitem['data']);
- $logitem['profilelink'] = build_profile_link($username, $logitem['uid'], "_blank");
- $logitem['dateline'] = my_date('relative', $logitem['dateline']);
-
- // Get detailed information from meta
- $information = get_admin_log_action($logitem);
-
- $table->construct_cell($logitem['profilelink']);
- $table->construct_cell($logitem['dateline'], array('class' => 'align_center'));
- $table->construct_cell($information);
- $table->construct_cell(my_inet_ntop($db->unescape_binary($logitem['ipaddress'])), array('class' => 'align_center'));
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_adminlogs, array('colspan' => '4'));
- $table->construct_row();
- }
-
- $table->output($lang->admin_logs);
-
- // Do we need to construct the pagination?
- if($rescount > $perpage)
- {
- echo draw_admin_pagination($pagecnt, $perpage, $rescount, "index.php?module=tools-adminlog&perpage=$perpage&uid={$mybb->input['uid']}&fid={$mybb->input['fid']}&sortby={$mybb->input['sortby']}&order={$order}&filter_module=".htmlspecialchars_uni($mybb->input['filter_module']))."
";
- }
-
- // Fetch filter options
- $sortbysel[$mybb->input['sortby']] = 'selected="selected"';
- $ordersel[$mybb->input['order']] = 'selected="selected"';
-
- $user_options[''] = $lang->all_administrators;
- $user_options['0'] = '----------';
-
- $query = $db->query("
- SELECT DISTINCT l.uid, u.username
- FROM ".TABLE_PREFIX."adminlog l
- LEFT JOIN ".TABLE_PREFIX."users u ON (l.uid=u.uid)
- ORDER BY u.username ASC
- ");
- while($user = $db->fetch_array($query))
- {
- $user_options[$user['uid']] = htmlspecialchars_uni($user['username']);
- }
-
- $module_options = array();
- $module_options[''] = $lang->all_modules;
- $module_options['0'] = '----------';
- $query = $db->query("
- SELECT DISTINCT l.module
- FROM ".TABLE_PREFIX."adminlog l
- ORDER BY l.module ASC
- ");
- while($module = $db->fetch_array($query))
- {
- $module_options[$module['module']] = str_replace(' ', ' -> ', ucwords(str_replace('/', ' ', $module['module'])));
- }
-
- $sort_by = array(
- 'dateline' => $lang->date,
- 'username' => $lang->username
- );
-
- $order_array = array(
- 'asc' => $lang->asc,
- 'desc' => $lang->desc
- );
-
- $form = new Form("index.php?module=tools-adminlog", "post");
- $form_container = new FormContainer($lang->filter_administrator_logs);
- $form_container->output_row($lang->module, "", $form->generate_select_box('filter_module', $module_options, $mybb->input['filter_module'], array('id' => 'filter_module')), 'filter_module');
- $form_container->output_row($lang->administrator, "", $form->generate_select_box('uid', $user_options, $mybb->input['uid'], array('id' => 'uid')), 'uid');
- $form_container->output_row($lang->sort_by, "", $form->generate_select_box('sortby', $sort_by, $mybb->input['sortby'], array('id' => 'sortby'))." {$lang->in} ".$form->generate_select_box('order', $order_array, $order, array('id' => 'order'))." {$lang->order}", 'order');
- $form_container->output_row($lang->results_per_page, "", $form->generate_numeric_field('perpage', $perpage, array('id' => 'perpage', 'min' => 1)), 'perpage');
-
- $form_container->end();
- $buttons[] = $form->generate_submit_button($lang->filter_administrator_logs);
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-
-/**
- * Returns language-friendly string describing $logitem
- * @param array $logitem The log item (one row from mybb_adminlogs)
- * @return string The description
- */
-function get_admin_log_action($logitem)
-{
- global $lang, $plugins, $mybb;
-
- $logitem['module'] = str_replace('/', '-', $logitem['module']);
- list($module, $action) = explode('-', $logitem['module']);
- $lang_string = 'admin_log_'.$module.'_'.$action.'_'.$logitem['action'];
-
- // Specific page overrides
- switch($lang_string)
- {
- // == CONFIG ==
- case 'admin_log_config_banning_add': // Banning IP/Username/Email
- case 'admin_log_config_banning_delete': // Removing banned IP/username/emails
- switch($logitem['data'][2])
- {
- case 1:
- $lang_string = 'admin_log_config_banning_'.$logitem['action'].'_ip';
- break;
- case 2:
- $lang_string = 'admin_log_config_banning_'.$logitem['action'].'_username';
- break;
- case 3:
- $lang_string = 'admin_log_config_banning_'.$logitem['action'].'_email';
- break;
- }
- break;
-
- case 'admin_log_config_help_documents_add': // Help documents and sections
- case 'admin_log_config_help_documents_edit':
- case 'admin_log_config_help_documents_delete':
- $lang_string .= "_{$logitem['data'][2]}"; // adds _section or _document
- break;
-
- case 'admin_log_config_languages_edit': // Editing language variables
- $logitem['data'][1] = basename($logitem['data'][1]);
- if($logitem['data'][2] == 1)
- {
- $lang_string = 'admin_log_config_languages_edit_admin';
- }
- break;
-
- case 'admin_log_config_mycode_toggle_status': // Custom MyCode toggle activation
- if($logitem['data'][2] == 1)
- {
- $lang_string .= '_enabled';
- }
- else
- {
- $lang_string .= '_disabled';
- }
- break;
- case 'admin_log_config_plugins_activate': // Installing plugin
- if($logitem['data'][1])
- {
- $lang_string .= '_install';
- }
- break;
- case 'admin_log_config_plugins_deactivate': // Uninstalling plugin
- if($logitem['data'][1])
- {
- $lang_string .= '_uninstall';
- }
- break;
- // == FORUM ==
- case 'admin_log_forum_attachments_delete': // Deleting attachments
- if($logitem['data'][2])
- {
- $lang_string .= '_post';
- }
- break;
- case 'admin_log_forum_management_copy': // Forum copy
- if($logitem['data'][4])
- {
- $lang_string .= '_with_permissions';
- }
- break;
- case 'admin_log_forum_management_': // add mod, permissions, forum orders
- // first parameter already set with action
- $lang_string .= $logitem['data'][0];
- if($logitem['data'][0] == 'orders' && $logitem['data'][1])
- {
- $lang_string .= '_sub'; // updating forum orders in a subforum
- }
- break;
- case 'admin_log_forum_moderation_queue_': //moderation queue
- // first parameter already set with action
- $lang_string .= $logitem['data'][0];
- break;
- // == HOME ==
- case 'admin_log_home_preferences_': // 2FA
- $lang_string .= $logitem['data'][0]; // either "enabled" or "disabled"
- break;
- // == STYLE ==
- case 'admin_log_style_templates_delete_template': // deleting templates
- // global template set
- if($logitem['data'][2] == -1)
- {
- $lang_string .= '_global';
- }
- break;
- case 'admin_log_style_templates_edit_template': // editing templates
- // global template set
- if($logitem['data'][2] == -1)
- {
- $lang_string .= '_global';
- }
- break;
- // == TOOLS ==
- case 'admin_log_tools_adminlog_prune': // Admin Log Pruning
- if($logitem['data'][1] && !$logitem['data'][2])
- {
- $lang_string = 'admin_log_tools_adminlog_prune_user';
- }
- elseif($logitem['data'][2] && !$logitem['data'][1])
- {
- $lang_string = 'admin_log_tools_adminlog_prune_module';
- }
- elseif($logitem['data'][1] && $logitem['data'][2])
- {
- $lang_string = 'admin_log_tools_adminlog_prune_user_module';
- }
- break;
- case 'admin_log_tools_modlog_prune': // Moderator Log Pruning
- if($logitem['data'][1] && !$logitem['data'][2])
- {
- $lang_string = 'admin_log_tools_modlog_prune_user';
- }
- elseif($logitem['data'][2] && !$logitem['data'][1])
- {
- $lang_string = 'admin_log_tools_modlog_prune_forum';
- }
- elseif($logitem['data'][1] && $logitem['data'][2])
- {
- $lang_string = 'admin_log_tools_modlog_prune_user_forum';
- }
- break;
- case 'admin_log_tools_backupdb_backup': // Create backup
- if($logitem['data'][0] == 'download')
- {
- $lang_string = 'admin_log_tools_backupdb_backup_download';
- }
- $logitem['data'][1] = '...'.substr($logitem['data'][1], -20);
- break;
- case 'admin_log_tools_backupdb_dlbackup': // Download backup
- $logitem['data'][0] = '...'.substr($logitem['data'][0], -20);
- break;
- case 'admin_log_tools_backupdb_delete': // Delete backup
- $logitem['data'][0] = '...'.substr($logitem['data'][0], -20);
- break;
- case 'admin_log_tools_optimizedb_': // Optimize DB
- $logitem['data'][0] = @implode(', ', my_unserialize($logitem['data'][0]));
- break;
- case 'admin_log_tools_recount_rebuild_': // Recount and rebuild
- $detail_lang_string = $lang_string.$logitem['data'][0];
- if(isset($lang->$detail_lang_string))
- {
- $lang_string = $detail_lang_string;
- }
- break;
- case 'admin_log_tools_spamlog_prune': // Spam Log Pruning
- if($logitem['data'][1] && !$logitem['data'][2])
- {
- $lang_string = 'admin_log_tools_spamlog_prune_user';
- }
- elseif($logitem['data'][2] && !$logitem['data'][1])
- {
- $lang_string = 'admin_log_tools_spamlog_prune_email';
- }
- elseif($logitem['data'][1] && $logitem['data'][2])
- {
- $lang_string = 'admin_log_tools_spamlog_prune_user_email';
- }
- break;
- // == USERS ==
- case 'admin_log_user_admin_permissions_edit': // editing default/group/user admin permissions
- if($logitem['data'][0] > 0)
- {
- // User
- $lang_string .= '_user';
- }
- elseif($logitem['data'][0] < 0)
- {
- // Group
- $logitem['data'][0] = abs($logitem['data'][0]);
- $lang_string .= '_group';
- }
- break;
- case 'admin_log_user_admin_permissions_delete': // deleting group/user admin permissions
- if($logitem['data'][0] > 0)
- {
- // User
- $lang_string .= '_user';
- }
- elseif($logitem['data'][0] < 0)
- {
- // Group
- $logitem['data'][0] = abs($logitem['data'][0]);
- $lang_string .= '_group';
- }
- break;
- case 'admin_log_user_awaiting_activation_activate':
- if($logitem['data'][0] == 'deleted')
- {
- $lang_string .= '_deleted';
- }
- else
- {
- $lang_string .= '_activated';
- }
- break;
- case 'admin_log_user_banning_': // banning
- if($logitem['data'][2] == 0)
- {
- $lang_string = 'admin_log_user_banning_add_permanent';
- }
- else
- {
- $logitem['data'][2] = my_date($mybb->settings['dateformat'], $logitem['data'][2]);
- $lang_string = 'admin_log_user_banning_add_temporary';
- }
- break;
- case 'admin_log_user_groups_join_requests':
- if($logitem['data'][0] == 'approve')
- {
- $lang_string = 'admin_log_user_groups_join_requests_approve';
- }
- else
- {
- $lang_string = 'admin_log_user_groups_join_requests_deny';
- }
- break;
- case 'admin_log_user_users_inline_banned':
- if($logitem['data'][1] == 0)
- {
- $lang_string = 'admin_log_user_users_inline_banned_perm';
- }
- else
- {
- $logitem['data'][1] = my_date($mybb->settings['dateformat'], $logitem['data'][1]);
- $lang_string = 'admin_log_user_users_inline_banned_temp';
- }
- break;
- }
-
- $plugin_array = array('logitem' => &$logitem, 'lang_string' => &$lang_string);
- $plugins->run_hooks("admin_tools_get_admin_log_action", $plugin_array);
-
- if(isset($lang->$lang_string))
- {
- array_unshift($logitem['data'], $lang->$lang_string); // First parameter for sprintf is the format string
- $string = call_user_func_array(array($lang, 'sprintf'), $logitem['data']);
- if(!$string)
- {
- $string = $lang->$lang_string; // Fall back to the one in the language pack
- }
- }
- else
- {
- if(isset($logitem['data']['type']) && $logitem['data']['type'] == 'admin_locked_out')
- {
- $string = $lang->sprintf($lang->admin_log_admin_locked_out, (int) $logitem['data']['uid'], htmlspecialchars_uni($logitem['data']['username']));
- }
- else
- {
- // Build a default string
- $string = $logitem['module'].' - '.$logitem['action'];
- if(is_array($logitem['data']) && count($logitem['data']) > 0)
- {
- $string .= '('.implode(', ', $logitem['data']).')';
- }
- }
- }
- return $string;
-}
-
-
diff --git a/html/forums/admin/modules/tools/backupdb.php b/html/forums/admin/modules/tools/backupdb.php
deleted file mode 100644
index bcb09f6..0000000
--- a/html/forums/admin/modules/tools/backupdb.php
+++ /dev/null
@@ -1,483 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-/**
- * Allows us to refresh cache to prevent over flowing
- *
- * @param resource $fp
- * @param string $contents
- */
-function clear_overflow($fp, &$contents)
-{
- global $mybb;
-
- if($mybb->input['method'] == 'disk')
- {
- if($mybb->input['filetype'] == 'gzip')
- {
- gzwrite($fp, $contents);
- }
- else
- {
- fwrite($fp, $contents);
- }
- }
- else
- {
- if($mybb->input['filetype'] == "gzip")
- {
- echo gzencode($contents);
- }
- else
- {
- echo $contents;
- }
- }
-
- $contents = '';
-}
-
-$page->add_breadcrumb_item($lang->database_backups, "index.php?module=tools-backupdb");
-
-$plugins->run_hooks("admin_tools_backupdb_begin");
-
-if($mybb->input['action'] == "dlbackup")
-{
- if(empty($mybb->input['file']))
- {
- flash_message($lang->error_file_not_specified, 'error');
- admin_redirect("index.php?module=tools-backupdb");
- }
-
- $plugins->run_hooks("admin_tools_backupdb_dlbackup");
-
- $file = basename($mybb->input['file']);
- $ext = get_extension($file);
-
- if(file_exists(MYBB_ADMIN_DIR.'backups/'.$file) && filetype(MYBB_ADMIN_DIR.'backups/'.$file) == 'file' && ($ext == 'gz' || $ext == 'sql'))
- {
- $plugins->run_hooks("admin_tools_backupdb_dlbackup_commit");
-
- // Log admin action
- log_admin_action($file);
-
- header('Content-disposition: attachment; filename='.$file);
- header("Content-type: ".$ext);
- header("Content-length: ".filesize(MYBB_ADMIN_DIR.'backups/'.$file));
-
- $handle = fopen(MYBB_ADMIN_DIR.'backups/'.$file, 'rb');
- while(!feof($handle))
- {
- echo fread($handle, 8192);
- }
- fclose($handle);
- }
- else
- {
- flash_message($lang->error_invalid_backup, 'error');
- admin_redirect("index.php?module=tools-backupdb");
- }
-}
-
-if($mybb->input['action'] == "delete")
-{
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=tools-backupdb");
- }
-
- $file = basename($mybb->input['file']);
-
- if(!trim($mybb->input['file']) || !file_exists(MYBB_ADMIN_DIR.'backups/'.$file))
- {
- flash_message($lang->error_backup_doesnt_exist, 'error');
- admin_redirect("index.php?module=tools-backupdb");
- }
-
- $plugins->run_hooks("admin_tools_backupdb_delete");
-
- if($mybb->request_method == "post")
- {
- $delete = @unlink(MYBB_ADMIN_DIR.'backups/'.$file);
-
- if($delete)
- {
- $plugins->run_hooks("admin_tools_backupdb_delete_commit");
-
- // Log admin action
- log_admin_action($file);
-
- flash_message($lang->success_backup_deleted, 'success');
- admin_redirect("index.php?module=tools-backupdb");
- }
- else
- {
- flash_message($lang->error_backup_not_deleted, 'error');
- admin_redirect("index.php?module=tools-backupdb");
- }
- }
- else
- {
- $page->output_confirm_action("index.php?module=tools-backupdb&action=delete&file={$mybb->input['file']}", $lang->confirm_backup_deletion);
- }
-}
-
-if($mybb->input['action'] == "backup")
-{
- $plugins->run_hooks("admin_tools_backupdb_backup");
-
- if($mybb->request_method == "post")
- {
- if(!is_array($mybb->input['tables']))
- {
- flash_message($lang->error_tables_not_selected, 'error');
- admin_redirect("index.php?module=tools-backupdb&action=backup");
- }
-
- @set_time_limit(0);
-
- if($mybb->input['method'] == 'disk')
- {
- $file = MYBB_ADMIN_DIR.'backups/backup_'.date("_Ymd_His_").random_str(16);
-
- if($mybb->input['filetype'] == 'gzip')
- {
- if(!function_exists('gzopen')) // check zlib-ness
- {
- flash_message($lang->error_no_zlib, 'error');
- admin_redirect("index.php?module=tools-backupdb&action=backup");
- }
-
- $fp = gzopen($file.'.incomplete.sql.gz', 'w9');
- }
- else
- {
- $fp = fopen($file.'.incomplete.sql', 'w');
- }
- }
- else
- {
- $file = 'backup_'.substr(md5($mybb->user['uid'].TIME_NOW), 0, 10).random_str(54);
- if($mybb->input['filetype'] == 'gzip')
- {
- if(!function_exists('gzopen')) // check zlib-ness
- {
- flash_message($lang->error_no_zlib, 'error');
- admin_redirect("index.php?module=tools-backupdb&action=backup");
- }
-
- // Send headers for gzip file
- header('Content-Type: application/x-gzip');
- header('Content-Disposition: attachment; filename="'.$file.'.sql.gz"');
- }
- else
- {
- // Send standard headers for .sql
- header('Content-Type: text/x-sql');
- header('Content-Disposition: attachment; filename="'.$file.'.sql"');
- }
- }
- $db->set_table_prefix('');
-
- $time = date('dS F Y \a\t H:i', TIME_NOW);
- $header = "-- MyBB Database Backup\n-- Generated: {$time}\n-- -------------------------------------\n\n";
- $contents = $header;
- foreach($mybb->input['tables'] as $table)
- {
- if(!$db->table_exists($db->escape_string($table)))
- {
- continue;
- }
- if($mybb->input['analyzeoptimize'] == 1)
- {
- $db->optimize_table($table);
- $db->analyze_table($table);
- }
-
- $field_list = array();
- $fields_array = $db->show_fields_from($table);
- foreach($fields_array as $field)
- {
- $field_list[] = $field['Field'];
- }
-
- $fields = "`".implode("`,`", $field_list)."`";
- if($mybb->input['contents'] != 'data')
- {
- $structure = $db->show_create_table($table).";\n";
- $contents .= $structure;
- clear_overflow($fp, $contents);
- }
-
- if($mybb->input['contents'] != 'structure')
- {
- if($db->engine == 'mysqli')
- {
- $query = mysqli_query($db->read_link, "SELECT * FROM {$db->table_prefix}{$table}", MYSQLI_USE_RESULT);
- }
- else
- {
- $query = $db->simple_select($table);
- }
-
- while($row = $db->fetch_array($query))
- {
- $insert = "INSERT INTO {$table} ($fields) VALUES (";
- $comma = '';
- foreach($field_list as $field)
- {
- if(!isset($row[$field]) || is_null($row[$field]))
- {
- $insert .= $comma."NULL";
- }
- else if($db->engine == 'mysqli')
- {
- $insert .= $comma."'".mysqli_real_escape_string($db->read_link, $row[$field])."'";
- }
- else
- {
- $insert .= $comma."'".$db->escape_string($row[$field])."'";
- }
- $comma = ',';
- }
- $insert .= ");\n";
- $contents .= $insert;
- clear_overflow($fp, $contents);
- }
- $db->free_result($query);
- }
- }
-
- $db->set_table_prefix(TABLE_PREFIX);
-
- if($mybb->input['method'] == 'disk')
- {
- if($mybb->input['filetype'] == 'gzip')
- {
- gzwrite($fp, $contents);
- gzclose($fp);
- rename($file.'.incomplete.sql.gz', $file.'.sql.gz');
- }
- else
- {
- fwrite($fp, $contents);
- fclose($fp);
- rename($file.'.incomplete.sql', $file.'.sql');
- }
-
- if($mybb->input['filetype'] == 'gzip')
- {
- $ext = '.sql.gz';
- }
- else
- {
- $ext = '.sql';
- }
-
- $plugins->run_hooks("admin_tools_backupdb_backup_disk_commit");
-
- // Log admin action
- log_admin_action("disk", $file.$ext);
-
- $file_from_admindir = 'index.php?module=tools-backupdb&action=dlbackup&file='.basename($file).$ext;
- flash_message("{$lang->success_backup_created}{$lang->backup_saved_to}
{$file}{$ext} ({$lang->download})
", 'success');
- admin_redirect("index.php?module=tools-backupdb");
- }
- else
- {
- $plugins->run_hooks("admin_tools_backupdb_backup_download_commit");
-
- // Log admin action
- log_admin_action("download");
-
- if($mybb->input['filetype'] == 'gzip')
- {
- echo gzencode($contents);
- }
- else
- {
- echo $contents;
- }
- }
-
- exit;
- }
-
- $page->extra_header = " \n";
-
- $page->add_breadcrumb_item($lang->new_database_backup);
- $page->output_header($lang->new_database_backup);
-
- $sub_tabs['database_backup'] = array(
- 'title' => $lang->database_backups,
- 'link' => "index.php?module=tools-backupdb"
- );
-
- $sub_tabs['new_backup'] = array(
- 'title' => $lang->new_backup,
- 'link' => "index.php?module=tools-backupdb&action=backup",
- 'description' => $lang->new_backup_desc
- );
-
- $page->output_nav_tabs($sub_tabs, 'new_backup');
-
- // Check if file is writable, before allowing submission
- if(!is_writable(MYBB_ADMIN_DIR."/backups"))
- {
- $lang->update_button = '';
- $page->output_alert($lang->alert_not_writable);
- $cannot_write = true;
- }
-
- $table = new Table;
- $table->construct_header($lang->table_selection);
- $table->construct_header($lang->backup_options);
-
- $table_selects = array();
- $table_list = $db->list_tables($config['database']['database']);
- foreach($table_list as $id => $table_name)
- {
- $table_selects[$table_name] = $table_name;
- }
-
- $form = new Form("index.php?module=tools-backupdb&action=backup", "post", "table_selection", 0, "table_selection");
-
- $table->construct_cell("{$lang->table_select_desc}\n
\n{$lang->select_all}
\n{$lang->deselect_all}
\n{$lang->select_forum_tables}\n
\n".$form->generate_select_box("tables[]", $table_selects, false, array('multiple' => true, 'id' => 'table_select', 'size' => 20))."
", array('rowspan' => 5, 'width' => '50%', 'style' => 'border-bottom: 0px'));
- $table->construct_row();
-
- $table->construct_cell("{$lang->file_type}
\n{$lang->file_type_desc}
\n".$form->generate_radio_button("filetype", "gzip", $lang->gzip_compressed, array('checked' => 1))."
\n".$form->generate_radio_button("filetype", "plain", $lang->plain_text)."
", array('width' => '50%'));
- $table->construct_row();
- $table->construct_cell("{$lang->save_method}
\n{$lang->save_method_desc}
".$form->generate_radio_button("method", "disk", $lang->backup_directory)."
\n".$form->generate_radio_button("method", "download", $lang->download, array('checked' => 1))."
", array('width' => '50%'));
- $table->construct_row();
- $table->construct_cell("{$lang->backup_contents}
\n{$lang->backup_contents_desc}
".$form->generate_radio_button("contents", "both", $lang->structure_and_data, array('checked' => 1))."
\n".$form->generate_radio_button("contents", "structure", $lang->structure_only)."
\n".$form->generate_radio_button("contents", "data", $lang->data_only)."
", array('width' => '50%'));
- $table->construct_row();
- $table->construct_cell("{$lang->analyze_and_optimize}
\n{$lang->analyze_and_optimize_desc}
".$form->generate_yes_no_radio("analyzeoptimize")."
", array('width' => '50%'));
- $table->construct_row();
-
- $table->output($lang->new_database_backup);
-
- $buttons[] = $form->generate_submit_button($lang->perform_backup);
- $form->output_submit_wrapper($buttons);
-
- $form->end();
-
- $page->output_footer();
-}
-
-if(!$mybb->input['action'])
-{
- $page->add_breadcrumb_item($lang->backups);
- $page->output_header($lang->database_backups);
-
- $sub_tabs['database_backup'] = array(
- 'title' => $lang->database_backups,
- 'link' => "index.php?module=tools-backupdb",
- 'description' => $lang->database_backups_desc
- );
-
- $sub_tabs['new_backup'] = array(
- 'title' => $lang->new_backup,
- 'link' => "index.php?module=tools-backupdb&action=backup",
- );
-
- $plugins->run_hooks("admin_tools_backupdb_start");
-
- $page->output_nav_tabs($sub_tabs, 'database_backup');
-
- $backups = array();
- $dir = MYBB_ADMIN_DIR.'backups/';
- $handle = opendir($dir);
-
- if($handle !== false)
- {
- while(($file = readdir($handle)) !== false)
- {
- if(filetype(MYBB_ADMIN_DIR.'backups/'.$file) == 'file')
- {
- $ext = get_extension($file);
- if($ext == 'gz' || $ext == 'sql')
- {
- $backups[@filemtime(MYBB_ADMIN_DIR.'backups/'.$file)] = array(
- "file" => $file,
- "time" => @filemtime(MYBB_ADMIN_DIR.'backups/'.$file),
- "type" => $ext
- );
- }
- }
- }
- closedir($handle);
- }
-
- $count = count($backups);
- krsort($backups);
-
- $table = new Table;
- $table->construct_header($lang->backup_filename);
- $table->construct_header($lang->file_size, array("class" => "align_center"));
- $table->construct_header($lang->creation_date);
- $table->construct_header($lang->controls, array("class" => "align_center"));
-
- foreach($backups as $backup)
- {
- $time = "-";
- if($backup['time'])
- {
- $time = my_date('relative', $backup['time']);
- }
-
- $table->construct_cell("{$backup['file']}");
- $table->construct_cell(get_friendly_size(filesize(MYBB_ADMIN_DIR.'backups/'.$backup['file'])), array("class" => "align_center"));
- $table->construct_cell($time);
- $table->construct_cell("post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_backup_deletion}')\">{$lang->delete}", array("class" => "align_center"));
- $table->construct_row();
- }
-
- if($count == 0)
- {
- $table->construct_cell($lang->no_backups, array('colspan' => 4));
- $table->construct_row();
- }
-
- $table->output($lang->existing_database_backups);
- $page->output_footer();
-}
diff --git a/html/forums/admin/modules/tools/cache.php b/html/forums/admin/modules/tools/cache.php
deleted file mode 100644
index dd28f4a..0000000
--- a/html/forums/admin/modules/tools/cache.php
+++ /dev/null
@@ -1,276 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->cache_manager, "index.php?module=tools-cache");
-
-$plugins->run_hooks("admin_tools_cache_begin");
-
-if($mybb->input['action'] == 'view')
-{
- if(!trim($mybb->input['title']))
- {
- flash_message($lang->error_no_cache_specified, 'error');
- admin_redirect("index.php?module=tools-cache");
- }
-
- $plugins->run_hooks("admin_tools_cache_view");
-
- // Rebuilds forum settings
- if($mybb->input['title'] == 'settings')
- {
- $cachedsettings = (array)$mybb->settings;
- if(isset($cachedsettings['internal']))
- {
- unset($cachedsettings['internal']);
- }
-
- $cacheitem = array(
- 'title' => 'settings',
- 'cache' => my_serialize($cachedsettings)
- );
- }
- else
- {
- $query = $db->simple_select("datacache", "*", "title = '".$db->escape_string($mybb->input['title'])."'");
- $cacheitem = $db->fetch_array($query);
- }
-
- if(!$cacheitem)
- {
- flash_message($lang->error_incorrect_cache, 'error');
- admin_redirect("index.php?module=tools-cache");
- }
-
- $cachecontents = unserialize($cacheitem['cache']);
- if(empty($cachecontents))
- {
- $cachecontents = $lang->error_empty_cache;
- }
- ob_start();
- print_r($cachecontents);
- $cachecontents = htmlspecialchars_uni(ob_get_contents());
- ob_end_clean();
-
- $page->add_breadcrumb_item($lang->view);
- $page->output_header($lang->cache_manager);
-
- $table = new Table;
-
- $table->construct_cell("\n{$cachecontents}\n");
- $table->construct_row();
- $table->output($lang->cache." {$cacheitem['title']}");
-
- $page->output_footer();
-
-}
-
-if($mybb->input['action'] == "rebuild" || $mybb->input['action'] == "reload")
-{
- if(!verify_post_check($mybb->input['my_post_key']))
- {
- flash_message($lang->invalid_post_verify_key2, 'error');
- admin_redirect("index.php?module=tools-cache");
- }
-
- $plugins->run_hooks("admin_tools_cache_rebuild");
-
- // Rebuilds forum settings
- if($mybb->input['title'] == 'settings')
- {
- rebuild_settings();
-
- $plugins->run_hooks("admin_tools_cache_rebuild_commit");
-
- // Log admin action
- log_admin_action($mybb->input['title']);
-
- flash_message($lang->success_cache_reloaded, 'success');
- admin_redirect("index.php?module=tools-cache");
- }
-
- if(method_exists($cache, "update_{$mybb->input['title']}"))
- {
- $func = "update_{$mybb->input['title']}";
- $cache->$func();
-
- $plugins->run_hooks("admin_tools_cache_rebuild_commit");
-
- // Log admin action
- log_admin_action($mybb->input['title']);
-
- flash_message($lang->success_cache_rebuilt, 'success');
- admin_redirect("index.php?module=tools-cache");
- }
- elseif(method_exists($cache, "reload_{$mybb->input['title']}"))
- {
- $func = "reload_{$mybb->input['title']}";
- $cache->$func();
-
- $plugins->run_hooks("admin_tools_cache_rebuild_commit");
-
- // Log admin action
- log_admin_action($mybb->input['title']);
-
- flash_message($lang->success_cache_reloaded, 'success');
- admin_redirect("index.php?module=tools-cache");
- }
- elseif(function_exists("update_{$mybb->input['title']}"))
- {
- $func = "update_{$mybb->input['title']}";
- $func();
-
- $plugins->run_hooks("admin_tools_cache_rebuild_commit");
-
- // Log admin action
- log_admin_action($mybb->input['title']);
-
- flash_message($lang->success_cache_rebuilt, 'success');
- admin_redirect("index.php?module=tools-cache");
- }
- elseif(function_exists("reload_{$mybb->input['title']}"))
- {
- $func = "reload_{$mybb->input['title']}";
- $func();
-
- $plugins->run_hooks("admin_tools_cache_rebuild_commit");
-
- // Log admin action
- log_admin_action($mybb->input['title']);
-
- flash_message($lang->success_cache_reloaded, 'success');
- admin_redirect("index.php?module=tools-cache");
- }
- else
- {
- flash_message($lang->error_cannot_rebuild, 'error');
- admin_redirect("index.php?module=tools-cache");
- }
-}
-
-if($mybb->input['action'] == "rebuild_all")
-{
- if(!verify_post_check($mybb->input['my_post_key']))
- {
- flash_message($lang->invalid_post_verify_key2, 'error');
- admin_redirect("index.php?module=tools-cache");
- }
-
- $plugins->run_hooks("admin_tools_cache_rebuild_all");
-
- $query = $db->simple_select("datacache");
- while($cacheitem = $db->fetch_array($query))
- {
- if(method_exists($cache, "update_{$cacheitem['title']}"))
- {
- $func = "update_{$cacheitem['title']}";
- $cache->$func();
- }
- elseif(method_exists($cache, "reload_{$cacheitem['title']}"))
- {
- $func = "reload_{$cacheitem['title']}";
- $cache->$func();
- }
- elseif(function_exists("update_{$cacheitem['title']}"))
- {
- $func = "update_{$cacheitem['title']}";
- $func();
- }
- elseif(function_exists("reload_{$cacheitem['title']}"))
- {
- $func = "reload_{$cacheitem['title']}";
- $func();
- }
- }
-
- // Rebuilds forum settings
- rebuild_settings();
-
- $plugins->run_hooks("admin_tools_cache_rebuild_all_commit");
-
- // Log admin action
- log_admin_action();
-
- flash_message($lang->success_cache_reloaded, 'success');
- admin_redirect("index.php?module=tools-cache");
-}
-
-if(!$mybb->input['action'])
-{
- $page->output_header($lang->cache_manager);
-
- $sub_tabs['cache_manager'] = array(
- 'title' => $lang->cache_manager,
- 'link' => "index.php?module=tools-cache",
- 'description' => $lang->cache_manager_description
- );
-
- $plugins->run_hooks("admin_tools_cache_start");
-
- $page->output_nav_tabs($sub_tabs, 'cache_manager');
-
- $table = new Table;
- $table->construct_header($lang->name);
- $table->construct_header($lang->size, array("class" => "align_center", "width" => 100));
- $table->construct_header($lang->controls, array("class" => "align_center", "width" => 150));
-
- $query = $db->simple_select("datacache");
- while($cacheitem = $db->fetch_array($query))
- {
- $table->construct_cell("{$cacheitem['title']}");
- $table->construct_cell(get_friendly_size(strlen($cacheitem['cache'])), array("class" => "align_center"));
-
- if(method_exists($cache, "update_".$cacheitem['title']))
- {
- $table->construct_cell("post_code}\">".$lang->rebuild_cache."", array("class" => "align_center"));
- }
- elseif(method_exists($cache, "reload_".$cacheitem['title']))
- {
- $table->construct_cell("post_code}\">".$lang->reload_cache."", array("class" => "align_center"));
- }
- elseif(function_exists("update_".$cacheitem['title']))
- {
- $table->construct_cell("post_code}\">".$lang->rebuild_cache."", array("class" => "align_center"));
- }
- elseif(function_exists("reload_".$cacheitem['title']))
- {
- $table->construct_cell("post_code}\">".$lang->reload_cache."", array("class" => "align_center"));
- }
- else
- {
- $table->construct_cell("");
- }
-
- $table->construct_row();
- }
-
- // Rebuilds forum settings
- $cachedsettings = (array)$mybb->settings;
- if(isset($cachedsettings['internal']))
- {
- unset($cachedsettings['internal']);
- }
-
- $table->construct_cell("settings");
- $table->construct_cell(get_friendly_size(strlen(my_serialize($cachedsettings))), array("class" => "align_center"));
- $table->construct_cell("post_code}\">".$lang->reload_cache."", array("class" => "align_center"));
-
- $table->construct_row();
-
- $table->output("".$lang->cache_manager);
-
- $page->output_footer();
-}
-
diff --git a/html/forums/admin/modules/tools/file_verification.php b/html/forums/admin/modules/tools/file_verification.php
deleted file mode 100644
index 65304d3..0000000
--- a/html/forums/admin/modules/tools/file_verification.php
+++ /dev/null
@@ -1,137 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-@set_time_limit(0);
-
-$page->add_breadcrumb_item($lang->file_verification, "index.php?module=tools-file_verification");
-
-$plugins->run_hooks("admin_tools_file_verification_begin");
-
-if(!$mybb->input['action'])
-{
- $plugins->run_hooks("admin_tools_file_verification_check");
-
- if($mybb->request_method == "post")
- {
- // User clicked no
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=tools-system_health");
- }
-
- $page->add_breadcrumb_item($lang->checking, "index.php?module=tools-file_verification");
-
- $page->output_header($lang->file_verification." - ".$lang->checking);
-
- $file = explode("\n", fetch_remote_file("https://mybb.com/checksums/release_mybb_{$mybb->version_code}.txt"));
-
- if(strstr($file[0], "output_inline_error($lang->error_communication);
- $page->output_footer();
- exit;
- }
-
- // Parser-up our checksum file from the MyBB Server
- foreach($file as $line)
- {
- $parts = explode(" ", $line, 2);
- if(empty($parts[0]) || empty($parts[1]))
- {
- continue;
- }
-
- if(substr($parts[1], 0, 7) == "./admin")
- {
- $parts[1] = "./{$mybb->config['admin_dir']}".substr($parts[1], 7);
- }
-
- if(file_exists(MYBB_ROOT."forums.php") && !file_exists(MYBB_ROOT."portal.php"))
- {
- if(trim($parts[1]) == "./index.php")
- {
- $parts[1] = "./forums.php";
- }
- elseif($parts[1] == "./portal.php")
- {
- $parts[1] = "./index.php";
- }
- }
-
- if(!file_exists(MYBB_ROOT."inc/plugins/hello.php") && $parts[1] == "./inc/plugins/hello.php")
- {
- continue;
- }
-
- if(!is_dir(MYBB_ROOT."install/") && substr($parts[1], 0, 10) == "./install/")
- {
- continue;
- }
-
- $checksums[trim($parts[1])][] = $parts[0];
- }
-
- $bad_files = verify_files();
-
- $plugins->run_hooks("admin_tools_file_verification_check_commit_start");
-
- $table = new Table;
- $table->construct_header($lang->file);
- $table->construct_header($lang->status, array("class" => "align_center", "width" => 100));
-
- foreach($bad_files as $file)
- {
- switch($file['status'])
- {
- case "changed":
- $file['status'] = $lang->changed;
- $color = "#F22B48";
- break;
- case "missing":
- $file['status'] = $lang->missing;
- $color = "#5B5658";
- break;
- }
-
- $table->construct_cell("".htmlspecialchars_uni(substr($file['path'], 2))."");
-
- $table->construct_cell("{$file['status']}", array("class" => "align_center"));
- $table->construct_row();
- }
-
- $no_errors = false;
- if($table->num_rows() == 0)
- {
- $no_errors = true;
- $table->construct_cell($lang->no_corrupt_files_found, array('colspan' => 3));
- $table->construct_row();
- }
-
- if($no_errors)
- {
- $table->output($lang->file_verification.": ".$lang->no_problems_found);
- }
- else
- {
- $table->output($lang->file_verification.": ".$lang->found_problems);
- }
-
- $page->output_footer();
- exit;
- }
-
- $page->output_confirm_action("index.php?module=tools-file_verification", $lang->file_verification_message, $lang->file_verification);
-}
diff --git a/html/forums/admin/modules/tools/index.html b/html/forums/admin/modules/tools/index.html
deleted file mode 100644
index efd2f36..0000000
--- a/html/forums/admin/modules/tools/index.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/html/forums/admin/modules/tools/mailerrors.php b/html/forums/admin/modules/tools/mailerrors.php
deleted file mode 100644
index c10d9a3..0000000
--- a/html/forums/admin/modules/tools/mailerrors.php
+++ /dev/null
@@ -1,263 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->system_email_log, "index.php?module=tools-mailerrors");
-
-$plugins->run_hooks("admin_tools_mailerrors_begin");
-
-if($mybb->input['action'] == "prune" && $mybb->request_method == "post")
-{
- $plugins->run_hooks("admin_tools_mailerrors_prune");
-
- if($mybb->input['delete_all'])
- {
- $db->delete_query("mailerrors");
- $num_deleted = $db->affected_rows();
-
- $plugins->run_hooks("admin_tools_mailerrors_prune_delete_all_commit");
-
- // Log admin action
- log_admin_action($num_deleted);
-
- flash_message($lang->all_logs_deleted, 'success');
- admin_redirect("index.php?module=tools-mailerrors");
- }
- else if(is_array($mybb->input['log']))
- {
- $log_ids = implode(",", array_map("intval", $mybb->input['log']));
- if($log_ids)
- {
- $db->delete_query("mailerrors", "eid IN ({$log_ids})");
- $num_deleted = $db->affected_rows();
- }
-
- // Log admin action
- log_admin_action($num_deleted);
- }
-
- $plugins->run_hooks("admin_tools_mailerrors_prune_commit");
-
- flash_message($lang->selected_logs_deleted, 'success');
- admin_redirect("index.php?module=tools-mailerrors");
-}
-
-if($mybb->input['action'] == "view")
-{
- $query = $db->simple_select("mailerrors", "*", "eid='".$mybb->get_input('eid', MyBB::INPUT_INT)."'");
- $log = $db->fetch_array($query);
-
- if(!$log['eid'])
- {
- exit;
- }
-
- $plugins->run_hooks("admin_tools_mailerrors_view");
-
- $log['toaddress'] = htmlspecialchars_uni($log['toaddress']);
- $log['fromaddress'] = htmlspecialchars_uni($log['fromaddress']);
- $log['subject'] = htmlspecialchars_uni($log['subject']);
- $log['error'] = htmlspecialchars_uni($log['error']);
- $log['smtperror'] = htmlspecialchars_uni($log['smtpcode']);
- $log['dateline'] = date($mybb->settings['dateformat'], $log['dateline']).", ".date($mybb->settings['timeformat'], $log['dateline']);
- $log['message'] = nl2br(htmlspecialchars_uni($log['message']));
-
- ?>
-
-
-
-
- construct_cell($log['error'], array("colspan" => 2));
- $table->construct_row();
-
- if($log['smtpcode'])
- {
- $table->construct_cell($lang->smtp_code);
- $table->construct_cell($log['smtpcode']);
- $table->construct_row();
- }
-
- if($log['smtperror'])
- {
- $table->construct_cell($lang->smtp_server_response);
- $table->construct_cell($log['smtperror']);
- $table->construct_row();
- }
- $table->output($lang->error);
-
- $table = new Table();
-
- $table->construct_cell($lang->to.":");
- $table->construct_cell("
{$log['toaddress']}");
- $table->construct_row();
-
- $table->construct_cell($lang->from.":");
- $table->construct_cell("
{$log['fromaddress']}");
- $table->construct_row();
-
- $table->construct_cell($lang->subject.":");
- $table->construct_cell($log['subject']);
- $table->construct_row();
-
- $table->construct_cell($lang->date.":");
- $table->construct_cell($log['dateline']);
- $table->construct_row();
-
- $table->construct_cell($log['message'], array("colspan" => 2));
- $table->construct_row();
-
- $table->output($lang->email);
-
- ?>
-
-
- input['action'])
-{
- $per_page = 20;
-
- if($mybb->input['page'] && $mybb->input['page'] > 1)
- {
- $mybb->input['page'] = $mybb->get_input('page', MyBB::INPUT_INT);
- $start = ($mybb->input['page']*$per_page)-$per_page;
- }
- else
- {
- $mybb->input['page'] = 1;
- $start = 0;
- }
-
- $additional_criteria = array();
-
- $plugins->run_hooks("admin_tools_mailerrors_start");
-
- $page->output_header($lang->system_email_log);
-
- $sub_tabs['mailerrors'] = array(
- 'title' => $lang->system_email_log,
- 'link' => "index.php?module=tools-mailerrors",
- 'description' => $lang->system_email_log_desc
- );
-
- $page->output_nav_tabs($sub_tabs, 'mailerrors');
-
- $form = new Form("index.php?module=tools-mailerrors&action=prune", "post");
-
- // Begin criteria filtering
- if($mybb->input['subject'])
- {
- $additional_sql_criteria .= " AND subject LIKE '%".$db->escape_string_like($mybb->input['subject'])."%'";
- $additional_criteria[] = "subject=".htmlspecialchars_uni($mybb->input['subject']);
- $form->generate_hidden_field("subject", $mybb->input['subject']);
- }
-
- if($mybb->input['fromaddress'])
- {
- $additional_sql_criteria .= " AND fromaddress LIKE '%".$db->escape_string_like($mybb->input['fromaddress'])."%'";
- $additional_criteria[] = "fromaddress=".urlencode($mybb->input['fromaddress']);
- $form->generate_hidden_field("fromaddress", $mybb->input['fromaddress']);
- }
-
- if($mybb->input['toaddress'])
- {
- $additional_sql_criteria .= " AND toaddress LIKE '%".$db->escape_string_like($mybb->input['toaddress'])."%'";
- $additional_criteria[] = "toaddress=".urlencode($mybb->input['toaddress']);
- $form->generate_hidden_field("toaddress", $mybb->input['toaddress']);
- }
-
- if($mybb->input['error'])
- {
- $additional_sql_criteria .= " AND error LIKE '%".$db->escape_string_like($mybb->input['error'])."%'";
- $additional_criteria[] = "error=".urlencode($mybb->input['error']);
- $form->generate_hidden_field("error", $mybb->input['error']);
- }
-
- if($additional_criteria)
- {
- $additional_criteria = "&".implode("&", $additional_criteria);
- }
- else
- {
- $additional_criteria = '';
- }
-
- $table = new Table;
- $table->construct_header($form->generate_check_box("allbox", 1, '', array('class' => 'checkall')));
- $table->construct_header($lang->subject);
- $table->construct_header($lang->to, array("class" => "align_center", "width" => "20%"));
- $table->construct_header($lang->error_message, array("class" => "align_center", "width" => "30%"));
- $table->construct_header($lang->date_sent, array("class" => "align_center", "width" => "20%"));
-
- $query = $db->simple_select('mailerrors', '*', "1=1 $additional_sql_criteria", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit_start' => $start, 'limit' => $per_page));
-
- while($log = $db->fetch_array($query))
- {
- $log['subject'] = htmlspecialchars_uni($log['subject']);
- $log['toemail'] = htmlspecialchars_uni($log['toemail']);
- $log['error'] = htmlspecialchars_uni($log['error']);
- $log['dateline'] = date($mybb->settings['dateformat'], $log['dateline']).", ".date($mybb->settings['timeformat'], $log['dateline']);
-
- $table->construct_cell($form->generate_check_box("log[{$log['eid']}]", $log['eid'], ''));
- $table->construct_cell("{$log['subject']}");
- $find_from = "";
- $table->construct_cell("{$find_from}{$log['toaddress']}
");
- $table->construct_cell($log['error']);
- $table->construct_cell($log['dateline'], array("class" => "align_center"));
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_logs, array("colspan" => 5));
- $table->construct_row();
- $table->output($lang->system_email_log);
- }
- else
- {
- $table->output($lang->system_email_log);
- $buttons[] = $form->generate_submit_button($lang->delete_selected, array('onclick' => "return confirm('{$lang->confirm_delete_logs}');"));
- $buttons[] = $form->generate_submit_button($lang->delete_all, array('name' => 'delete_all', 'onclick' => "return confirm('{$lang->confirm_delete_all_logs}');"));
- $form->output_submit_wrapper($buttons);
- }
-
- $form->end();
-
- $query = $db->simple_select("mailerrors l", "COUNT(eid) AS logs", "1=1 {$additional_sql_criteria}");
- $total_rows = $db->fetch_field($query, "logs");
-
- echo "
".draw_admin_pagination($mybb->input['page'], $per_page, $total_rows, "index.php?module=tools-mailerrors&page={page}{$additional_criteria}");
-
- $form = new Form("index.php?module=tools-mailerrors", "post");
- $form_container = new FormContainer($lang->filter_system_email_log);
- $form_container->output_row($lang->subject_contains, "", $form->generate_text_box('subject', $mybb->input['subject'], array('id' => 'subject')), 'subject');
- $form_container->output_row($lang->error_message_contains, "", $form->generate_text_box('error', $mybb->input['error'], array('id' => 'error')), 'error');
- $form_container->output_row($lang->to_address_contains, "", $form->generate_text_box('toaddress', $mybb->input['toaddress'], array('id' => 'toaddress')), 'toaddress');
- $form_container->output_row($lang->from_address_contains, "", $form->generate_text_box('fromaddress', $mybb->input['fromaddress'], array('id' => 'fromaddress')), 'fromaddress');
-
- $form_container->end();
- $buttons = array();
- $buttons[] = $form->generate_submit_button($lang->filter_system_email_log);
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
diff --git a/html/forums/admin/modules/tools/maillogs.php b/html/forums/admin/modules/tools/maillogs.php
deleted file mode 100644
index be8f4f9..0000000
--- a/html/forums/admin/modules/tools/maillogs.php
+++ /dev/null
@@ -1,450 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->user_email_log, "index.php?module=tools-maillogs");
-
-$plugins->run_hooks("admin_tools_maillogs_begin");
-
-if($mybb->input['action'] == "prune" && $mybb->request_method == "post")
-{
- $plugins->run_hooks("admin_tools_maillogs_prune");
-
- if($mybb->input['delete_all'])
- {
- $db->delete_query("maillogs");
- $num_deleted = $db->affected_rows();
-
- $plugins->run_hooks("admin_tools_maillogs_prune_delete_all_commit");
-
- // Log admin action
- log_admin_action($num_deleted);
-
- flash_message($lang->all_logs_deleted, 'success');
- admin_redirect("index.php?module=tools-maillogs");
- }
- else if(is_array($mybb->input['log']))
- {
- $log_ids = implode(",", array_map("intval", $mybb->input['log']));
- if($log_ids)
- {
- $db->delete_query("maillogs", "mid IN ({$log_ids})");
- $num_deleted = $db->affected_rows();
- }
-
- // Log admin action
- log_admin_action($num_deleted);
- }
-
- $plugins->run_hooks("admin_tools_maillogs_prune_commit");
-
- flash_message($lang->selected_logs_deleted, 'success');
- admin_redirect("index.php?module=tools-maillogs");
-}
-
-if($mybb->input['action'] == "view")
-{
- $query = $db->simple_select("maillogs", "*", "mid='".$mybb->get_input('mid', MyBB::INPUT_INT)."'");
- $log = $db->fetch_array($query);
-
- if(!$log['mid'])
- {
- exit;
- }
-
- $plugins->run_hooks("admin_tools_maillogs_view");
-
- $log['toemail'] = htmlspecialchars_uni($log['toemail']);
- $log['fromemail'] = htmlspecialchars_uni($log['fromemail']);
- $log['subject'] = htmlspecialchars_uni($log['subject']);
- $log['dateline'] = date($mybb->settings['dateformat'], $log['dateline']).", ".date($mybb->settings['timeformat'], $log['dateline']);
- if($mybb->settings['mail_logging'] == 1)
- {
- $log['message'] = $lang->na;
- }
- else
- {
- $log['message'] = nl2br(htmlspecialchars_uni($log['message']));
- }
-
- ?>
-
-
-
- construct_cell($lang->to.":");
- $table->construct_cell("
{$log['toemail']}");
- $table->construct_row();
-
- $table->construct_cell($lang->from.":");
- $table->construct_cell("
{$log['fromemail']}");
- $table->construct_row();
-
- $table->construct_cell($lang->ip_address.":");
- $table->construct_cell(my_inet_ntop($db->unescape_binary($log['ipaddress'])));
- $table->construct_row();
-
- $table->construct_cell($lang->subject.":");
- $table->construct_cell($log['subject']);
- $table->construct_row();
-
- $table->construct_cell($lang->date.":");
- $table->construct_cell($log['dateline']);
- $table->construct_row();
-
- $table->construct_cell($log['message'], array("colspan" => 2));
- $table->construct_row();
-
- $table->output($lang->user_email_log_viewer);
-
- ?>
-
-
- input['action'])
-{
- if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1)
- {
- $mybb->settings['threadsperpage'] = 20;
- }
-
- $per_page = $mybb->settings['threadsperpage'];
-
- if(!$per_page)
- {
- $per_page = 20;
- }
-
- if($mybb->input['page'] && $mybb->input['page'] > 1)
- {
- $mybb->input['page'] = $mybb->get_input('page', MyBB::INPUT_INT);
- $start = ($mybb->input['page']*$per_page)-$per_page;
- }
- else
- {
- $mybb->input['page'] = 1;
- $start = 0;
- }
-
- $additional_criteria = array();
-
- $plugins->run_hooks("admin_tools_maillogs_start");
-
- // Filter form was submitted - play around with the values
- if($mybb->request_method == "post")
- {
- if($mybb->input['from_type'] == "user")
- {
- $mybb->input['fromname'] = $mybb->input['from_value'];
- }
- else if($mybb->input['from_type'] == "email")
- {
- $mybb->input['fromemail'] = $mybb->input['from_value'];
- }
-
- if($mybb->input['to_type'] == "user")
- {
- $mybb->input['toname'] = $mybb->input['to_value'];
- }
- else if($mybb->input['to_type'] == "email")
- {
- $mybb->input['toemail'] = $mybb->input['to_value'];
- }
- }
-
- $touid = $mybb->get_input('touid', MyBB::INPUT_INT);
- $toname = $db->escape_string($mybb->input['toname']);
- $toemail = $db->escape_string_like($mybb->input['toemail']);
-
- $fromuid = $mybb->get_input('fromuid', MyBB::INPUT_INT);
- $fromemail = $db->escape_string_like($mybb->input['fromemail']);
-
- $subject = $db->escape_string_like($mybb->input['subject']);
-
- // Begin criteria filtering
- if($mybb->input['subject'])
- {
- $additional_sql_criteria .= " AND l.subject LIKE '%{$subject}%'";
- $additional_criteria[] = "subject=".urlencode($mybb->input['subject']);
- }
-
- if($mybb->input['fromuid'])
- {
- $query = $db->simple_select("users", "uid, username", "uid = '{$fromuid}'");
- $user = $db->fetch_array($query);
- $from_filter = $user['username'];
-
- $additional_sql_criteria .= " AND l.fromuid = '{$fromuid}'";
- $additional_criteria[] = "fromuid={$fromuid}";
- }
- else if($mybb->input['fromname'])
- {
- $user = get_user_by_username($mybb->input['fromname'], array('fields' => 'uid, username'));
- $from_filter = $user['username'];
-
- if(!$user['uid'])
- {
- flash_message($lang->error_invalid_user, 'error');
- admin_redirect("index.php?module=tools-maillogs");
- }
-
- $additional_sql_criteria .= "AND l.fromuid = '{$user['uid']}'";
- $additional_criteria[] = "fromuid={$user['uid']}";
- }
-
- if($mybb->input['fromemail'])
- {
- $additional_sql_criteria .= " AND l.fromemail LIKE '%{$fromemail}%'";
- $additional_criteria[] = "fromemail=".urlencode($mybb->input['fromemail']);
- $from_filter = $mybb->input['fromemail'];
- }
-
- if($mybb->input['touid'])
- {
- $query = $db->simple_select("users", "uid, username", "uid = '{$touid}'");
- $user = $db->fetch_array($query);
- $to_filter = $user['username'];
-
- $additional_sql_criteria .= " AND l.touid = '{$touid}'";
- $additional_criteria[] = "touid={$touid}";
- }
- else if($mybb->input['toname'])
- {
- $user = get_user_by_username($toname, array('fields' => 'username'));
- $to_filter = $user['username'];
-
- if(!$user['uid'])
- {
- flash_message($lang->error_invalid_user, 'error');
- admin_redirect("index.php?module=tools-maillogs");
- }
-
- $additional_sql_criteria .= "AND l.touid='{$user['uid']}'";
- $additional_criteria[] = "touid={$user['uid']}";
- }
-
- if($mybb->input['toemail'])
- {
- $additional_sql_criteria .= " AND l.toemail LIKE '%{$toemail}%'";
- $additional_criteria[] = "toemail=".urlencode($mybb->input['toemail']);
- $to_filter = $mybb->input['toemail'];
- }
-
- if(!empty($additional_criteria))
- {
- $additional_criteria = "&".implode("&", $additional_criteria);
- }
- else
- {
- $additional_criteria = '';
- }
-
- $page->output_header($lang->user_email_log);
-
- $sub_tabs['maillogs'] = array(
- 'title' => $lang->user_email_log,
- 'link' => "index.php?module=tools-maillogs",
- 'description' => $lang->user_email_log_desc
- );
-
- $page->output_nav_tabs($sub_tabs, 'maillogs');
-
- $form = new Form("index.php?module=tools-maillogs&action=prune", "post");
-
- $table = new Table;
- $table->construct_header($form->generate_check_box("allbox", 1, '', array('class' => 'checkall')));
- $table->construct_header($lang->subject, array("colspan" => 2));
- $table->construct_header($lang->from, array("class" => "align_center", "width" => "20%"));
- $table->construct_header($lang->to, array("class" => "align_center", "width" => "20%"));
- $table->construct_header($lang->date_sent, array("class" => "align_center", "width" => "20%"));
- $table->construct_header($lang->ip_address, array("class" => "align_center", 'width' => '10%'));
-
- $query = $db->query("
- SELECT l.*, r.username AS to_username, f.username AS from_username, t.subject AS thread_subject
- FROM ".TABLE_PREFIX."maillogs l
- LEFT JOIN ".TABLE_PREFIX."users r ON (r.uid=l.touid)
- LEFT JOIN ".TABLE_PREFIX."users f ON (f.uid=l.fromuid)
- LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=l.tid)
- WHERE 1=1 {$additional_sql_criteria}
- ORDER BY l.dateline DESC
- LIMIT {$start}, {$per_page}
- ");
- while($log = $db->fetch_array($query))
- {
- $table->construct_cell($form->generate_check_box("log[{$log['mid']}]", $log['mid'], ''), array("width" => 1));
- $log['subject'] = htmlspecialchars_uni($log['subject']);
- $log['dateline'] = date($mybb->settings['dateformat'], $log['dateline']).", ".date($mybb->settings['timeformat'], $log['dateline']);
-
- if($log['type'] == 2)
- {
- if($log['thread_subject'])
- {
- $log['thread_subject'] = htmlspecialchars_uni($log['thread_subject']);
- $thread_link = "".$log['thread_subject']."";
- }
- else
- {
- $thread_link = $lang->deleted;
- }
- $table->construct_cell("
style}/images/icons/maillogs_thread.png\" title=\"{$lang->sent_using_send_thread_feature}\" alt=\"\" />", array("width" => 1));
- $table->construct_cell("{$log['subject']}
{$lang->thread} {$thread_link}");
-
- if($log['fromuid'] > 0)
- {
- $find_from = "";
- }
-
- if(!$log['from_username'] && $log['fromuid'] > 0)
- {
- $table->construct_cell("{$find_from}{$lang->deleted_user}
");
- }
- elseif($log['fromuid'] == 0)
- {
- $log['fromemail'] = htmlspecialchars_uni($log['fromemail']);
- $table->construct_cell("{$find_from}{$log['fromemail']}
");
- }
- else
- {
- $table->construct_cell("{$find_from}");
- }
-
- $log['toemail'] = htmlspecialchars_uni($log['toemail']);
- $table->construct_cell($log['toemail']);
- }
- elseif($log['type'] == 1)
- {
- $table->construct_cell("
style}/images/icons/maillogs_user.png\" title=\"{$lang->email_sent_to_user}\" alt=\"\" />", array("width" => 1));
- $table->construct_cell("{$log['subject']}");
-
- if($log['fromuid'] > 0)
- {
- $find_from = "";
- }
-
- if(!$log['from_username'] && $log['fromuid'] > 0)
- {
- $table->construct_cell("{$find_from}{$lang->deleted_user}
");
- }
- elseif($log['fromuid'] == 0)
- {
- $log['fromemail'] = htmlspecialchars_uni($log['fromemail']);
- $table->construct_cell("{$find_from}{$log['fromemail']}
");
- }
- else
- {
- $table->construct_cell("{$find_from}");
- }
-
- $find_to = "";
- if(!$log['to_username'])
- {
- $table->construct_cell("{$find_to}{$lang->deleted_user}
");
- }
- else
- {
- $table->construct_cell("{$find_to}");
- }
- }
- elseif($log['type'] == 3)
- {
- $table->construct_cell("
style}/images/icons/maillogs_contact.png\" title=\"{$lang->email_sent_using_contact_form}\" alt=\"\" />", array("width" => 1));
- $table->construct_cell("{$log['subject']}");
-
- if($log['fromuid'] > 0)
- {
- $find_from = "";
- }
-
- if(!$log['from_username'] && $log['fromuid'] > 0)
- {
- $table->construct_cell("{$find_from}{$lang->deleted_user}
");
- }
- elseif($log['fromuid'] == 0)
- {
- $log['fromemail'] = htmlspecialchars_uni($log['fromemail']);
- $table->construct_cell("{$find_from}{$log['fromemail']}
");
- }
- else
- {
- $table->construct_cell("{$find_from}");
- }
-
- $log['toemail'] = htmlspecialchars_uni($log['toemail']);
- $table->construct_cell($log['toemail']);
- }
-
- $table->construct_cell($log['dateline'], array("class" => "align_center"));
- $table->construct_cell(my_inet_ntop($db->unescape_binary($log['ipaddress'])), array("class" => "align_center"));
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_logs, array("colspan" => "7"));
- $table->construct_row();
- $table->output($lang->user_email_log);
- }
- else
- {
- $table->output($lang->user_email_log);
- $buttons[] = $form->generate_submit_button($lang->delete_selected, array('onclick' => "return confirm('{$lang->confirm_delete_logs}');"));
- $buttons[] = $form->generate_submit_button($lang->delete_all, array('name' => 'delete_all', 'onclick' => "return confirm('{$lang->confirm_delete_all_logs}');"));
- $form->output_submit_wrapper($buttons);
- }
-
- $form->end();
-
- $query = $db->simple_select("maillogs l", "COUNT(l.mid) as logs", "1=1 {$additional_sql_criteria}");
- $total_rows = $db->fetch_field($query, "logs");
-
- echo "
".draw_admin_pagination($mybb->input['page'], $per_page, $total_rows, "index.php?module=tools-maillogs&page={page}{$additional_criteria}");
-
- $form = new Form("index.php?module=tools-maillogs", "post");
- $form_container = new FormContainer($lang->filter_user_email_log);
- $user_email = array(
- "user" => $lang->username_is,
- "email" => $lang->email_contains
- );
- $form_container->output_row($lang->subject_contains, "", $form->generate_text_box('subject', $mybb->input['subject'], array('id' => 'subject')), 'subject');
- if($from_username)
- {
- $from_type = "user";
- }
- else if($mybb->input['fromemail'])
- {
- $from_type = "email";
- }
- $form_container->output_row($lang->from, "", $form->generate_select_box('from_type', $user_email, $from_type)." ".$form->generate_text_box('from_value', htmlspecialchars_uni($from_filter), array('id' => 'from_value')), 'from_value');
- if($to_username)
- {
- $to_type = "user";
- }
- else if($mybb->input['toemail'])
- {
- $to_type = "email";
- }
- $form_container->output_row($lang->to, "", $form->generate_select_box('to_type', $user_email, $to_type)." ".$form->generate_text_box('to_value', htmlspecialchars_uni($to_filter), array('id' => 'to_value')), 'to_value');
- $form_container->end();
- $buttons = array();
- $buttons[] = $form->generate_submit_button($lang->filter_user_email_log);
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
diff --git a/html/forums/admin/modules/tools/modlog.php b/html/forums/admin/modules/tools/modlog.php
deleted file mode 100644
index 096fbcb..0000000
--- a/html/forums/admin/modules/tools/modlog.php
+++ /dev/null
@@ -1,341 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->mod_logs, "index.php?module=tools-modlog");
-
-$sub_tabs['mod_logs'] = array(
- 'title' => $lang->mod_logs,
- 'link' => "index.php?module=tools-modlog",
- 'description' => $lang->mod_logs_desc
-);
-$sub_tabs['prune_mod_logs'] = array(
- 'title' => $lang->prune_mod_logs,
- 'link' => "index.php?module=tools-modlog&action=prune",
- 'description' => $lang->prune_mod_logs_desc
-);
-
-$plugins->run_hooks("admin_tools_modlog_begin");
-
-if($mybb->input['action'] == 'prune')
-{
- $plugins->run_hooks("admin_tools_modlog_prune");
-
- if($mybb->request_method == 'post')
- {
- $is_today = false;
- $mybb->input['older_than'] = $mybb->get_input('older_than', MyBB::INPUT_INT);
- if($mybb->input['older_than'] <= 0)
- {
- $is_today = true;
- $mybb->input['older_than'] = 1;
- }
- $where = 'dateline < '.(TIME_NOW-($mybb->input['older_than']*86400));
-
- // Searching for entries by a particular user
- if($mybb->input['uid'])
- {
- $where .= " AND uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";
- }
-
- // Searching for entries in a specific module
- if($mybb->input['fid'] > 0)
- {
- $where .= " AND fid='".$db->escape_string($mybb->input['fid'])."'";
- }
- else
- {
- $mybb->input['fid'] = 0;
- }
-
- $db->delete_query("moderatorlog", $where);
- $num_deleted = $db->affected_rows();
-
- $plugins->run_hooks("admin_tools_modlog_prune_commit");
-
- if(!is_array($forum_cache))
- {
- $forum_cache = cache_forums();
- }
-
- // Log admin action
- log_admin_action($mybb->input['older_than'], $mybb->input['uid'], $mybb->input['fid'], $num_deleted, $forum_cache[$mybb->input['fid']]['name']);
-
- $success = $lang->success_pruned_mod_logs;
- if($is_today == true && $num_deleted > 0)
- {
- $success .= ' '.$lang->note_logs_locked;
- }
- elseif($is_today == true && $num_deleted == 0)
- {
- flash_message($lang->note_logs_locked, 'error');
- admin_redirect("index.php?module=tools-modlog");
- }
- flash_message($success, 'success');
- admin_redirect("index.php?module=tools-modlog");
- }
- $page->add_breadcrumb_item($lang->prune_mod_logs, "index.php?module=tools-modlog&action=prune");
- $page->output_header($lang->prune_mod_logs);
- $page->output_nav_tabs($sub_tabs, 'prune_mod_logs');
-
- // Fetch filter options
- $sortbysel[$mybb->input['sortby']] = 'selected="selected"';
- $ordersel[$mybb->input['order']] = 'selected="selected"';
-
- $user_options[''] = $lang->all_moderators;
- $user_options['0'] = '----------';
-
- $query = $db->query("
- SELECT DISTINCT l.uid, u.username
- FROM ".TABLE_PREFIX."moderatorlog l
- LEFT JOIN ".TABLE_PREFIX."users u ON (l.uid=u.uid)
- ORDER BY u.username ASC
- ");
- while($user = $db->fetch_array($query))
- {
- $user_options[$user['uid']] = htmlspecialchars_uni($user['username']);
- }
-
- $form = new Form("index.php?module=tools-modlog&action=prune", "post");
- $form_container = new FormContainer($lang->prune_moderator_logs);
- $form_container->output_row($lang->forum, "", $form->generate_forum_select('fid', $mybb->input['fid'], array('id' => 'fid', 'main_option' => $lang->all_forums)), 'fid');
- $form_container->output_row($lang->forum_moderator, "", $form->generate_select_box('uid', $user_options, $mybb->input['uid'], array('id' => 'uid')), 'uid');
- if(!$mybb->input['older_than'])
- {
- $mybb->input['older_than'] = '30';
- }
- $form_container->output_row($lang->date_range, "", $lang->older_than.$form->generate_numeric_field('older_than', $mybb->input['older_than'], array('id' => 'older_than', 'style' => 'width: 50px', 'min' => 0)).' '.$lang->days, 'older_than');
- $form_container->end();
- $buttons[] = $form->generate_submit_button($lang->prune_moderator_logs);
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-
-if(!$mybb->input['action'])
-{
- $plugins->run_hooks("admin_tools_modlog_start");
-
- $page->output_header($lang->mod_logs);
-
- $page->output_nav_tabs($sub_tabs, 'mod_logs');
-
- $perpage = $mybb->get_input('perpage', MyBB::INPUT_INT);
- if(!$perpage)
- {
- if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1)
- {
- $mybb->settings['threadsperpage'] = 20;
- }
-
- $perpage = $mybb->settings['threadsperpage'];
- }
-
- $where = 'WHERE 1=1';
-
- // Searching for entries by a particular user
- if($mybb->input['uid'])
- {
- $where .= " AND l.uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";
- }
-
- // Searching for entries in a specific forum
- if($mybb->input['fid'] > 0)
- {
- $where .= " AND l.fid='".$mybb->get_input('fid', MyBB::INPUT_INT)."'";
- }
-
- // Order?
- switch($mybb->input['sortby'])
- {
- case "username":
- $sortby = "u.username";
- break;
- case "forum":
- $sortby = "f.name";
- break;
- case "thread":
- $sortby = "t.subject";
- break;
- default:
- $sortby = "l.dateline";
- }
- $order = $mybb->input['order'];
- if($order != "asc")
- {
- $order = "desc";
- }
-
- $query = $db->query("
- SELECT COUNT(l.dateline) AS count
- FROM ".TABLE_PREFIX."moderatorlog l
- {$where}
- ");
- $rescount = $db->fetch_field($query, "count");
-
- // Figure out if we need to display multiple pages.
- if($mybb->input['page'] != "last")
- {
- $pagecnt = $mybb->get_input('page', MyBB::INPUT_INT);
- }
-
- $postcount = (int)$rescount;
- $pages = $postcount / $perpage;
- $pages = ceil($pages);
-
- if($mybb->input['page'] == "last")
- {
- $pagecnt = $pages;
- }
-
- if($pagecnt > $pages)
- {
- $pagecnt = 1;
- }
-
- if($pagecnt)
- {
- $start = ($pagecnt-1) * $perpage;
- }
- else
- {
- $start = 0;
- $pagecnt = 1;
- }
-
- $table = new Table;
- $table->construct_header($lang->username, array('width' => '10%'));
- $table->construct_header($lang->date, array("class" => "align_center", 'width' => '15%'));
- $table->construct_header($lang->action, array("class" => "align_center", 'width' => '35%'));
- $table->construct_header($lang->information, array("class" => "align_center", 'width' => '30%'));
- $table->construct_header($lang->ipaddress, array("class" => "align_center", 'width' => '10%'));
-
- $query = $db->query("
- SELECT l.*, u.username, u.usergroup, u.displaygroup, t.subject AS tsubject, f.name AS fname, p.subject AS psubject
- FROM ".TABLE_PREFIX."moderatorlog l
- LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=l.uid)
- LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=l.tid)
- LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=l.fid)
- LEFT JOIN ".TABLE_PREFIX."posts p ON (p.pid=l.pid)
- {$where}
- ORDER BY {$sortby} {$order}
- LIMIT {$start}, {$perpage}
- ");
- while($logitem = $db->fetch_array($query))
- {
- $information = '';
- $logitem['action'] = htmlspecialchars_uni($logitem['action']);
- $logitem['dateline'] = my_date('relative', $logitem['dateline']);
- $trow = alt_trow();
- $username = format_name(htmlspecialchars_uni($logitem['username']), $logitem['usergroup'], $logitem['displaygroup']);
- $logitem['profilelink'] = build_profile_link($username, $logitem['uid'], "_blank");
- if($logitem['tsubject'])
- {
- $information = "{$lang->thread} ".htmlspecialchars_uni($logitem['tsubject'])."
";
- }
- if($logitem['fname'])
- {
- $information .= "{$lang->forum} ".htmlspecialchars_uni($logitem['fname'])."
";
- }
- if($logitem['psubject'])
- {
- $information .= "{$lang->post} ".htmlspecialchars_uni($logitem['psubject'])."";
- }
-
- if(!$logitem['tsubject'] || !$logitem['fname'] || !$logitem['psubject'])
- {
- $data = my_unserialize($logitem['data']);
- if($data['uid'])
- {
- $information = "{$lang->user_info} ".htmlspecialchars_uni($data['username'])."";
- }
- if($data['aid'])
- {
- $information = "{$lang->announcement} ".htmlspecialchars_uni($data['subject'])."";
- }
- }
-
- $table->construct_cell($logitem['profilelink']);
- $table->construct_cell($logitem['dateline'], array("class" => "align_center"));
- $table->construct_cell($logitem['action'], array("class" => "align_center"));
- $table->construct_cell($information);
- $table->construct_cell(my_inet_ntop($db->unescape_binary($logitem['ipaddress'])), array("class" => "align_center"));
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_modlogs, array("colspan" => "5"));
- $table->construct_row();
- }
-
- $table->output($lang->mod_logs);
-
- // Do we need to construct the pagination?
- if($rescount > $perpage)
- {
- echo draw_admin_pagination($pagecnt, $perpage, $rescount, "index.php?module=tools-modlog&perpage=$perpage&uid={$mybb->input['uid']}&fid={$mybb->input['fid']}&sortby={$mybb->input['sortby']}&order={$order}")."
";
- }
-
- // Fetch filter options
- $sortbysel[$mybb->input['sortby']] = "selected=\"selected\"";
- $ordersel[$mybb->input['order']] = "selected=\"selected\"";
-
- $user_options[''] = $lang->all_moderators;
- $user_options['0'] = '----------';
-
- $query = $db->query("
- SELECT DISTINCT l.uid, u.username
- FROM ".TABLE_PREFIX."moderatorlog l
- LEFT JOIN ".TABLE_PREFIX."users u ON (l.uid=u.uid)
- ORDER BY u.username ASC
- ");
- while($user = $db->fetch_array($query))
- {
- $selected = '';
- if($mybb->input['uid'] == $user['uid'])
- {
- $selected = "selected=\"selected\"";
- }
- $user_options[$user['uid']] = htmlspecialchars_uni($user['username']);
- }
-
- $sort_by = array(
- 'dateline' => $lang->date,
- 'username' => $lang->username,
- 'forum' => $lang->forum_name,
- 'thread' => $lang->thread_subject
- );
-
- $order_array = array(
- 'asc' => $lang->asc,
- 'desc' => $lang->desc
- );
-
- $form = new Form("index.php?module=tools-modlog", "post");
- $form_container = new FormContainer($lang->filter_moderator_logs);
- $form_container->output_row($lang->forum, "", $form->generate_forum_select('fid', $mybb->input['fid'], array('id' => 'fid', 'main_option' => $lang->all_forums)), 'fid');
- $form_container->output_row($lang->forum_moderator, "", $form->generate_select_box('uid', $user_options, $mybb->input['uid'], array('id' => 'uid')), 'uid');
- $form_container->output_row($lang->sort_by, "", $form->generate_select_box('sortby', $sort_by, $mybb->input['sortby'], array('id' => 'sortby'))." {$lang->in} ".$form->generate_select_box('order', $order_array, $order, array('id' => 'order'))." {$lang->order}", 'order');
- $form_container->output_row($lang->results_per_page, "", $form->generate_numeric_field('perpage', $perpage, array('id' => 'perpage', 'min' => 1)), 'perpage');
-
- $form_container->end();
- $buttons[] = $form->generate_submit_button($lang->filter_moderator_logs);
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
diff --git a/html/forums/admin/modules/tools/module_meta.php b/html/forums/admin/modules/tools/module_meta.php
deleted file mode 100644
index 11e2455..0000000
--- a/html/forums/admin/modules/tools/module_meta.php
+++ /dev/null
@@ -1,133 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-/**
- * @return bool true
- */
-function tools_meta()
-{
- global $page, $lang, $plugins;
-
- $sub_menu = array();
- $sub_menu['10'] = array("id" => "system_health", "title" => $lang->system_health, "link" => "index.php?module=tools-system_health");
- $sub_menu['20'] = array("id" => "cache", "title" => $lang->cache_manager, "link" => "index.php?module=tools-cache");
- $sub_menu['30'] = array("id" => "tasks", "title" => $lang->task_manager, "link" => "index.php?module=tools-tasks");
- $sub_menu['40'] = array("id" => "recount_rebuild", "title" => $lang->recount_and_rebuild, "link" => "index.php?module=tools-recount_rebuild");
- $sub_menu['50'] = array("id" => "php_info", "title" => $lang->view_php_info, "link" => "index.php?module=tools-php_info");
- $sub_menu['60'] = array("id" => "backupdb", "title" => $lang->database_backups, "link" => "index.php?module=tools-backupdb");
- $sub_menu['70'] = array("id" => "optimizedb", "title" => $lang->optimize_database, "link" => "index.php?module=tools-optimizedb");
- $sub_menu['80'] = array("id" => "file_verification", "title" => $lang->file_verification, "link" => "index.php?module=tools-file_verification");
-
- $sub_menu = $plugins->run_hooks("admin_tools_menu", $sub_menu);
-
- $page->add_menu_item($lang->tools_and_maintenance, "tools", "index.php?module=tools", 50, $sub_menu);
-
- return true;
-}
-
-/**
- * @param string $action
- *
- * @return string
- */
-function tools_action_handler($action)
-{
- global $page, $lang, $plugins;
-
- $page->active_module = "tools";
-
- $actions = array(
- 'php_info' => array('active' => 'php_info', 'file' => 'php_info.php'),
- 'tasks' => array('active' => 'tasks', 'file' => 'tasks.php'),
- 'backupdb' => array('active' => 'backupdb', 'file' => 'backupdb.php'),
- 'optimizedb' => array('active' => 'optimizedb', 'file' => 'optimizedb.php'),
- 'cache' => array('active' => 'cache', 'file' => 'cache.php'),
- 'recount_rebuild' => array('active' => 'recount_rebuild', 'file' => 'recount_rebuild.php'),
- 'maillogs' => array('active' => 'maillogs', 'file' => 'maillogs.php'),
- 'mailerrors' => array('active' => 'mailerrors', 'file' => 'mailerrors.php'),
- 'adminlog' => array('active' => 'adminlog', 'file' => 'adminlog.php'),
- 'modlog' => array('active' => 'modlog', 'file' => 'modlog.php'),
- 'warninglog' => array('active' => 'warninglog', 'file' => 'warninglog.php'),
- 'spamlog' => array('active' => 'spamlog', 'file' => 'spamlog.php'),
- 'system_health' => array('active' => 'system_health', 'file' => 'system_health.php'),
- 'file_verification' => array('active' => 'file_verification', 'file' => 'file_verification.php'),
- 'statistics' => array('active' => 'statistics', 'file' => 'statistics.php'),
- );
-
- $actions = $plugins->run_hooks("admin_tools_action_handler", $actions);
-
- $sub_menu = array();
- $sub_menu['10'] = array("id" => "adminlog", "title" => $lang->administrator_log, "link" => "index.php?module=tools-adminlog");
- $sub_menu['20'] = array("id" => "modlog", "title" => $lang->moderator_log, "link" => "index.php?module=tools-modlog");
- $sub_menu['30'] = array("id" => "maillogs", "title" => $lang->user_email_log, "link" => "index.php?module=tools-maillogs");
- $sub_menu['40'] = array("id" => "mailerrors", "title" => $lang->system_mail_log, "link" => "index.php?module=tools-mailerrors");
- $sub_menu['50'] = array("id" => "warninglog", "title" => $lang->user_warning_log, "link" => "index.php?module=tools-warninglog");
- $sub_menu['60'] = array("id" => "spamlog", "title" => $lang->spam_log, "link" => "index.php?module=tools-spamlog");
- $sub_menu['70'] = array("id" => "statistics", "title" => $lang->statistics, "link" => "index.php?module=tools-statistics");
-
- $sub_menu = $plugins->run_hooks("admin_tools_menu_logs", $sub_menu);
-
- if(!isset($actions[$action]))
- {
- $page->active_action = "system_health";
- }
-
- $sidebar = new SidebarItem($lang->logs);
- $sidebar->add_menu_items($sub_menu, $actions[$action]['active']);
-
- $page->sidebar .= $sidebar->get_markup();
-
- if(isset($actions[$action]))
- {
- $page->active_action = $actions[$action]['active'];
- return $actions[$action]['file'];
- }
- else
- {
- return "system_health.php";
- }
-}
-
-/**
- * @return array
- */
-function tools_admin_permissions()
-{
- global $lang, $plugins;
-
- $admin_permissions = array(
- "system_health" => $lang->can_access_system_health,
- "cache" => $lang->can_manage_cache,
- "tasks" => $lang->can_manage_tasks,
- "backupdb" => $lang->can_manage_db_backup,
- "optimizedb" => $lang->can_optimize_db,
- "recount_rebuild" => $lang->can_recount_and_rebuild,
- "adminlog" => $lang->can_manage_admin_logs,
- "modlog" => $lang->can_manage_mod_logs,
- "maillogs" => $lang->can_manage_user_mail_log,
- "mailerrors" => $lang->can_manage_system_mail_log,
- "warninglog" => $lang->can_manage_user_warning_log,
- "spamlog" => $lang->can_manage_spam_log,
- "php_info" => $lang->can_view_php_info,
- "file_verification" => $lang->can_manage_file_verification,
- "statistics" => $lang->can_view_statistics,
- );
-
- $admin_permissions = $plugins->run_hooks("admin_tools_permissions", $admin_permissions);
-
- return array("name" => $lang->tools_and_maintenance, "permissions" => $admin_permissions, "disporder" => 50);
-}
-
diff --git a/html/forums/admin/modules/tools/optimizedb.php b/html/forums/admin/modules/tools/optimizedb.php
deleted file mode 100644
index b7c7c98..0000000
--- a/html/forums/admin/modules/tools/optimizedb.php
+++ /dev/null
@@ -1,112 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->optimize_database, "index.php?module=tools-optimizedb");
-
-$plugins->run_hooks("admin_tools_optimizedb_begin");
-
-if(!$mybb->input['action'])
-{
- $plugins->run_hooks("admin_tools_optimizedb_start");
-
- if($mybb->request_method == "post")
- {
- if(!is_array($mybb->input['tables']))
- {
- flash_message($lang->error_no_tables_selected, 'error');
- admin_redirect("index.php?module=tools-optimizedb");
- }
-
- @set_time_limit(0);
-
- $db->set_table_prefix('');
-
- foreach($mybb->input['tables'] as $table)
- {
- if($db->table_exists($db->escape_string($table)))
- {
- $db->optimize_table($table);
- $db->analyze_table($table);
- }
- }
-
- $db->set_table_prefix(TABLE_PREFIX);
-
- $plugins->run_hooks("admin_tools_optimizedb_start_begin");
-
- // Log admin action
- log_admin_action(my_serialize($mybb->input['tables']));
-
- flash_message($lang->success_tables_optimized, 'success');
- admin_redirect("index.php?module=tools-optimizedb");
- }
-
- $page->extra_header = " \n";
-
- $page->output_header($lang->optimize_database);
-
- $table = new Table;
- $table->construct_header($lang->table_selection);
-
- $table_selects = array();
- $table_list = $db->list_tables($config['database']['database']);
- foreach($table_list as $id => $table_name)
- {
- $table_selects[$table_name] = $table_name;
- }
-
- $form = new Form("index.php?module=tools-optimizedb", "post", "table_selection", 0, "table_selection");
-
- $table->construct_cell("{$lang->tables_select_desc}\n
\n{$lang->select_all}
\n{$lang->deselect_all}
\n{$lang->select_forum_tables}\n
\n".$form->generate_select_box("tables[]", $table_selects, false, array('multiple' => true, 'id' => 'table_select', 'size' => 20))."
", array('rowspan' => 5, 'width' => '50%'));
- $table->construct_row();
-
- $table->output($lang->optimize_database);
-
- $buttons[] = $form->generate_submit_button($lang->optimize_selected_tables);
- $form->output_submit_wrapper($buttons);
-
- $form->end();
-
- $page->output_footer();
-}
-
diff --git a/html/forums/admin/modules/tools/php_info.php b/html/forums/admin/modules/tools/php_info.php
deleted file mode 100644
index 48a8e61..0000000
--- a/html/forums/admin/modules/tools/php_info.php
+++ /dev/null
@@ -1,42 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-if($mybb->input['action'] == 'phpinfo')
-{
- $plugins->run_hooks("admin_tools_php_info_phpinfo");
-
- // Log admin action
- log_admin_action();
-
- phpinfo();
- exit;
-}
-
-$page->add_breadcrumb_item($lang->php_info, "index.php?module=tools-php_info");
-
-$plugins->run_hooks("admin_tools_php_info_begin");
-
-if(!$mybb->input['action'])
-{
- $plugins->run_hooks("admin_tools_php_info_start");
-
- $page->output_header($lang->php_info);
-
- echo "";
-
- $page->output_footer();
-}
-
diff --git a/html/forums/admin/modules/tools/recount_rebuild.php b/html/forums/admin/modules/tools/recount_rebuild.php
deleted file mode 100644
index 56998db..0000000
--- a/html/forums/admin/modules/tools/recount_rebuild.php
+++ /dev/null
@@ -1,764 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->recount_rebuild, "index.php?module=tools-recount_rebuild");
-
-$plugins->run_hooks("admin_tools_recount_rebuild");
-
-/**
- * Rebuild forum counters
- */
-function acp_rebuild_forum_counters()
-{
- global $db, $mybb, $lang;
-
- $query = $db->simple_select("forums", "COUNT(*) as num_forums");
- $num_forums = $db->fetch_field($query, 'num_forums');
-
- $page = $mybb->get_input('page', MyBB::INPUT_INT);
- $per_page = $mybb->get_input('forumcounters', MyBB::INPUT_INT);
- if($per_page <= 0)
- {
- $per_page = 50;
- }
- $start = ($page-1) * $per_page;
- $end = $start + $per_page;
-
- $query = $db->simple_select("forums", "fid", '', array('order_by' => 'fid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
- while($forum = $db->fetch_array($query))
- {
- $update['parentlist'] = make_parent_list($forum['fid']);
- $db->update_query("forums", $update, "fid='{$forum['fid']}'");
- rebuild_forum_counters($forum['fid']);
- }
-
- check_proceed($num_forums, $end, ++$page, $per_page, "forumcounters", "do_rebuildforumcounters", $lang->success_rebuilt_forum_counters);
-}
-
-/**
- * Rebuild thread counters
- */
-function acp_rebuild_thread_counters()
-{
- global $db, $mybb, $lang;
-
- $query = $db->simple_select("threads", "COUNT(*) as num_threads");
- $num_threads = $db->fetch_field($query, 'num_threads');
-
- $page = $mybb->get_input('page', MyBB::INPUT_INT);
- $per_page = $mybb->get_input('threadcounters', MyBB::INPUT_INT);
- if($per_page <= 0)
- {
- $per_page = 500;
- }
- $start = ($page-1) * $per_page;
- $end = $start + $per_page;
-
- $query = $db->simple_select("threads", "tid", '', array('order_by' => 'tid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
- while($thread = $db->fetch_array($query))
- {
- rebuild_thread_counters($thread['tid']);
- }
-
- check_proceed($num_threads, $end, ++$page, $per_page, "threadcounters", "do_rebuildthreadcounters", $lang->success_rebuilt_thread_counters);
-}
-
-/**
- * Rebuild poll counters
- */
-function acp_rebuild_poll_counters()
-{
- global $db, $mybb, $lang;
-
- $query = $db->simple_select("polls", "COUNT(*) as num_polls");
- $num_polls = $db->fetch_field($query, 'num_polls');
-
- $page = $mybb->get_input('page', MyBB::INPUT_INT);
- $per_page = $mybb->get_input('pollcounters', MyBB::INPUT_INT);
- if($per_page <= 0)
- {
- $per_page = 500;
- }
- $start = ($page-1) * $per_page;
- $end = $start + $per_page;
-
- $query = $db->simple_select("polls", "pid", '', array('order_by' => 'pid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
- while($poll = $db->fetch_array($query))
- {
- rebuild_poll_counters($poll['pid']);
- }
-
- check_proceed($num_polls, $end, ++$page, $per_page, "pollcounters", "do_rebuildpollcounters", $lang->success_rebuilt_poll_counters);
-}
-
-/**
- * Recount user posts
- */
-function acp_recount_user_posts()
-{
- global $db, $mybb, $lang;
-
- $query = $db->simple_select("users", "COUNT(uid) as num_users");
- $num_users = $db->fetch_field($query, 'num_users');
-
- $page = $mybb->get_input('page', MyBB::INPUT_INT);
- $per_page = $mybb->get_input('userposts', MyBB::INPUT_INT);
- if($per_page <= 0)
- {
- $per_page = 500;
- }
- $start = ($page-1) * $per_page;
- $end = $start + $per_page;
-
- $query = $db->simple_select("forums", "fid", "usepostcounts = 0");
- while($forum = $db->fetch_array($query))
- {
- $fids[] = $forum['fid'];
- }
- if(is_array($fids))
- {
- $fids = implode(',', $fids);
- }
- if($fids)
- {
- $fids = " AND p.fid NOT IN($fids)";
- }
- else
- {
- $fids = "";
- }
-
- $query = $db->simple_select("users", "uid", '', array('order_by' => 'uid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
- while($user = $db->fetch_array($query))
- {
- $query2 = $db->query("
- SELECT COUNT(p.pid) AS post_count
- FROM ".TABLE_PREFIX."posts p
- LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
- WHERE p.uid='{$user['uid']}' AND t.visible > 0 AND p.visible > 0{$fids}
- ");
- $num_posts = $db->fetch_field($query2, "post_count");
-
- $db->update_query("users", array("postnum" => (int)$num_posts), "uid='{$user['uid']}'");
- }
-
- check_proceed($num_users, $end, ++$page, $per_page, "userposts", "do_recountuserposts", $lang->success_rebuilt_user_post_counters);
-}
-
-/**
- * Recount user threads
- */
-function acp_recount_user_threads()
-{
- global $db, $mybb, $lang;
-
- $query = $db->simple_select("users", "COUNT(uid) as num_users");
- $num_users = $db->fetch_field($query, 'num_users');
-
- $page = $mybb->get_input('page', MyBB::INPUT_INT);
- $per_page = $mybb->get_input('userthreads', MyBB::INPUT_INT);
- if($per_page <= 0)
- {
- $per_page = 500;
- }
- $start = ($page-1) * $per_page;
- $end = $start + $per_page;
-
- $query = $db->simple_select("forums", "fid", "usethreadcounts = 0");
- while($forum = $db->fetch_array($query))
- {
- $fids[] = $forum['fid'];
- }
- if(is_array($fids))
- {
- $fids = implode(',', $fids);
- }
- if($fids)
- {
- $fids = " AND t.fid NOT IN($fids)";
- }
- else
- {
- $fids = "";
- }
-
- $query = $db->simple_select("users", "uid", '', array('order_by' => 'uid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
- while($user = $db->fetch_array($query))
- {
- $query2 = $db->query("
- SELECT COUNT(t.tid) AS thread_count
- FROM ".TABLE_PREFIX."threads t
- WHERE t.uid='{$user['uid']}' AND t.visible > 0 AND t.closed NOT LIKE 'moved|%'{$fids}
- ");
- $num_threads = $db->fetch_field($query2, "thread_count");
-
- $db->update_query("users", array("threadnum" => (int)$num_threads), "uid='{$user['uid']}'");
- }
-
- check_proceed($num_users, $end, ++$page, $per_page, "userthreads", "do_recountuserthreads", $lang->success_rebuilt_user_thread_counters);
-}
-
-/**
- * Recount reputation values
- */
-function acp_recount_reputation()
-{
- global $db, $mybb, $lang;
-
- $query = $db->simple_select("users", "COUNT(uid) as num_users");
- $num_users = $db->fetch_field($query, 'num_users');
-
- $page = $mybb->get_input('page', MyBB::INPUT_INT);
- $per_page = $mybb->get_input('reputation', MyBB::INPUT_INT);
- if($per_page <= 0)
- {
- $per_page = 500;
- }
- $start = ($page-1) * $per_page;
- $end = $start + $per_page;
-
- $query = $db->simple_select("users", "uid", '', array('order_by' => 'uid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
- while($user = $db->fetch_array($query))
- {
- $query2 = $db->query("
- SELECT SUM(reputation) as total_rep
- FROM ".TABLE_PREFIX."reputation
- WHERE `uid`='{$user['uid']}'
- ");
- $total_rep = $db->fetch_field($query2, "total_rep");
-
- $db->update_query("users", array("reputation" => (int)$total_rep), "uid='{$user['uid']}'");
- }
-
- check_proceed($num_users, $end, ++$page, $per_page, "reputation", "do_recountreputation", $lang->success_rebuilt_reputation);
-}
-
-/**
- * Recount warnings for users
- */
-function acp_recount_warning()
-{
- global $db, $mybb, $lang;
-
- $query = $db->simple_select("users", "COUNT(uid) as num_users");
- $num_users = $db->fetch_field($query, 'num_users');
-
- $page = $mybb->get_input('page', MyBB::INPUT_INT);
- $per_page = $mybb->get_input('warning', MyBB::INPUT_INT);
- if($per_page <= 0)
- {
- $per_page = 500;
- }
- $start = ($page-1) * $per_page;
- $end = $start + $per_page;
-
- $query = $db->simple_select("users", "uid", '', array('order_by' => 'uid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
- while($user = $db->fetch_array($query))
- {
- $query2 = $db->query("
- SELECT SUM(points) as warn_lev
- FROM ".TABLE_PREFIX."warnings
- WHERE uid='{$user['uid']}' AND expired='0'
- ");
- $warn_lev = $db->fetch_field($query2, "warn_lev");
-
- $db->update_query("users", array("warningpoints" => (int)$warn_lev), "uid='{$user['uid']}'");
- }
-
- check_proceed($num_users, $end, ++$page, $per_page, "warning", "do_recountwarning", $lang->success_rebuilt_warning);
-}
-
-/**
- * Recount private messages (total and unread) for users
- */
-function acp_recount_private_messages()
-{
- global $db, $mybb, $lang;
-
- $query = $db->simple_select("users", "COUNT(uid) as num_users");
- $num_users = $db->fetch_field($query, 'num_users');
-
- $page = $mybb->get_input('page', MyBB::INPUT_INT);
- $per_page = $mybb->get_input('privatemessages', MyBB::INPUT_INT);
- if($per_page <= 0)
- {
- $per_page = 500;
- }
- $start = ($page-1) * $per_page;
- $end = $start + $per_page;
-
- require_once MYBB_ROOT."inc/functions_user.php";
-
- $query = $db->simple_select("users", "uid", '', array('order_by' => 'uid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
- while($user = $db->fetch_array($query))
- {
- update_pm_count($user['uid']);
- }
-
- check_proceed($num_users, $end, ++$page, $per_page, "privatemessages", "do_recountprivatemessages", $lang->success_rebuilt_private_messages);
-}
-
-/**
- * Recount referrals for users
- */
-function acp_recount_referrals()
-{
- global $db, $mybb, $lang;
-
- $query = $db->simple_select("users", "COUNT(uid) as num_users");
- $num_users = $db->fetch_field($query, 'num_users');
-
- $page = $mybb->get_input('page', MyBB::INPUT_INT);
- $per_page = $mybb->get_input('referral', MyBB::INPUT_INT);
- $start = ($page-1) * $per_page;
- $end = $start + $per_page;
-
- $query = $db->simple_select("users", "uid", '', array('order_by' => 'uid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
- while($user = $db->fetch_array($query))
- {
- $query2 = $db->query("
- SELECT COUNT(uid) as num_referrers
- FROM ".TABLE_PREFIX."users
- WHERE referrer='{$user['uid']}'
- ");
- $num_referrers = $db->fetch_field($query2, "num_referrers");
-
- $db->update_query("users", array("referrals" => (int)$num_referrers), "uid='{$user['uid']}'");
- }
-
- check_proceed($num_users, $end, ++$page, $per_page, "referral", "do_recountreferral", $lang->success_rebuilt_referral);
-}
-
-/**
- * Recount thread ratings
- */
-function acp_recount_thread_ratings()
-{
- global $db, $mybb, $lang;
-
- $query = $db->simple_select("threads", "COUNT(*) as num_threads");
- $num_threads = $db->fetch_field($query, 'num_threads');
-
- $page = $mybb->get_input('page', MyBB::INPUT_INT);
- $per_page = $mybb->get_input('threadrating', MyBB::INPUT_INT);
- if($per_page <= 0)
- {
- $per_page = 500;
- }
- $start = ($page-1) * $per_page;
- $end = $start + $per_page;
-
- $query = $db->simple_select("threads", "tid", '', array('order_by' => 'tid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
- while($thread = $db->fetch_array($query))
- {
- $query2 = $db->query("
- SELECT COUNT(tid) as num_ratings, SUM(rating) as total_rating
- FROM ".TABLE_PREFIX."threadratings
- WHERE tid='{$thread['tid']}'
- ");
- $recount = $db->fetch_array($query2);
-
- $db->update_query("threads", array("numratings" => (int)$recount['num_ratings'], "totalratings" => (int)$recount['total_rating']), "tid='{$thread['tid']}'");
- }
-
- check_proceed($num_threads, $end, ++$page, $per_page, "threadrating", "do_recountthreadrating", $lang->success_rebuilt_thread_ratings);
-}
-
-/**
- * Rebuild thumbnails for attachments
- */
-function acp_rebuild_attachment_thumbnails()
-{
- global $db, $mybb, $lang;
-
- $query = $db->simple_select("attachments", "COUNT(aid) as num_attachments");
- $num_attachments = $db->fetch_field($query, 'num_attachments');
-
- $page = $mybb->get_input('page', MyBB::INPUT_INT);
- $per_page = $mybb->get_input('attachmentthumbs', MyBB::INPUT_INT);
- if($per_page <= 0)
- {
- $per_page = 20;
- }
- $start = ($page-1) * $per_page;
- $end = $start + $per_page;
-
- $uploadspath = $mybb->settings['uploadspath'];
- if(my_substr($uploadspath, 0, 1) == '.')
- {
- $uploadspath = MYBB_ROOT . $mybb->settings['uploadspath'];
- }
-
- require_once MYBB_ROOT."inc/functions_image.php";
-
- $query = $db->simple_select("attachments", "*", '', array('order_by' => 'aid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
- while($attachment = $db->fetch_array($query))
- {
- $ext = my_strtolower(my_substr(strrchr($attachment['filename'], "."), 1));
- if($ext == "gif" || $ext == "png" || $ext == "jpg" || $ext == "jpeg" || $ext == "jpe")
- {
- $thumbname = str_replace(".attach", "_thumb.$ext", $attachment['attachname']);
- $thumbnail = generate_thumbnail($uploadspath."/".$attachment['attachname'], $uploadspath, $thumbname, $mybb->settings['attachthumbh'], $mybb->settings['attachthumbw']);
- if($thumbnail['code'] == 4)
- {
- $thumbnail['filename'] = "SMALL";
- }
- $db->update_query("attachments", array("thumbnail" => $thumbnail['filename']), "aid='{$attachment['aid']}'");
- }
- }
-
- check_proceed($num_attachments, $end, ++$page, $per_page, "attachmentthumbs", "do_rebuildattachmentthumbs", $lang->success_rebuilt_attachment_thumbnails);
-}
-
-/**
- * @param int $current
- * @param int $finish
- * @param int $next_page
- * @param int $per_page
- * @param string $name
- * @param string $name2
- * @param string $message
- */
-function check_proceed($current, $finish, $next_page, $per_page, $name, $name2, $message)
-{
- global $page, $lang;
-
- if($finish >= $current)
- {
- flash_message($message, 'success');
- admin_redirect("index.php?module=tools-recount_rebuild");
- }
- else
- {
- $page->output_header();
-
- $form = new Form("index.php?module=tools-recount_rebuild", 'post');
-
- echo $form->generate_hidden_field("page", $next_page);
- echo $form->generate_hidden_field($name, $per_page);
- echo $form->generate_hidden_field($name2, $lang->go);
- echo "\n";
- echo "
{$lang->confirm_proceed_rebuild}
\n";
- echo "
\n";
- echo "";
- echo "
\n";
- echo $form->generate_submit_button($lang->proceed, array('class' => 'button_yes', 'id' => 'proceed_button'));
- echo "
\n";
- echo "
\n";
-
- $form->end();
-
- $page->output_footer();
- exit;
- }
-}
-
-if(!$mybb->input['action'])
-{
- $plugins->run_hooks("admin_tools_recount_rebuild_start");
-
- if($mybb->request_method == "post")
- {
- require_once MYBB_ROOT."inc/functions_rebuild.php";
-
- if(!isset($mybb->input['page']) || $mybb->get_input('page', MyBB::INPUT_INT) < 1)
- {
- $mybb->input['page'] = 1;
- }
-
- if(isset($mybb->input['do_rebuildforumcounters']))
- {
- $plugins->run_hooks("admin_tools_recount_rebuild_forum_counters");
-
- if($mybb->input['page'] == 1)
- {
- // Log admin action
- log_admin_action("forum");
- }
- if(!$mybb->get_input('forumcounters', MyBB::INPUT_INT))
- {
- $mybb->input['forumcounters'] = 50;
- }
-
- acp_rebuild_forum_counters();
- }
- elseif(isset($mybb->input['do_rebuildthreadcounters']))
- {
- $plugins->run_hooks("admin_tools_recount_rebuild_thread_counters");
-
- if($mybb->input['page'] == 1)
- {
- // Log admin action
- log_admin_action("thread");
- }
- if(!$mybb->get_input('threadcounters', MyBB::INPUT_INT))
- {
- $mybb->input['threadcounters'] = 500;
- }
-
- acp_rebuild_thread_counters();
- }
- elseif(isset($mybb->input['do_recountuserposts']))
- {
- $plugins->run_hooks("admin_tools_recount_rebuild_user_posts");
-
- if($mybb->input['page'] == 1)
- {
- // Log admin action
- log_admin_action("userposts");
- }
- if(!$mybb->get_input('userposts', MyBB::INPUT_INT))
- {
- $mybb->input['userposts'] = 500;
- }
-
- acp_recount_user_posts();
- }
- elseif(isset($mybb->input['do_recountuserthreads']))
- {
- $plugins->run_hooks("admin_tools_recount_rebuild_user_threads");
-
- if($mybb->input['page'] == 1)
- {
- // Log admin action
- log_admin_action("userthreads");
- }
- if(!$mybb->get_input('userthreads', MyBB::INPUT_INT))
- {
- $mybb->input['userthreads'] = 500;
- }
-
- acp_recount_user_threads();
- }
- elseif(isset($mybb->input['do_rebuildattachmentthumbs']))
- {
- $plugins->run_hooks("admin_tools_recount_rebuild_attachment_thumbs");
-
- if($mybb->input['page'] == 1)
- {
- // Log admin action
- log_admin_action("attachmentthumbs");
- }
-
- if(!$mybb->get_input('attachmentthumbs', MyBB::INPUT_INT))
- {
- $mybb->input['attachmentthumbs'] = 500;
- }
-
- acp_rebuild_attachment_thumbnails();
- }
- elseif(isset($mybb->input['do_recountreputation']))
- {
- $plugins->run_hooks("admin_tools_recount_recount_reputation");
-
- if($mybb->input['page'] == 1)
- {
- // Log admin action
- log_admin_action("reputation");
- }
-
- if(!$mybb->get_input('reputation', MyBB::INPUT_INT))
- {
- $mybb->input['reputation'] = 500;
- }
-
- acp_recount_reputation();
- }
- elseif(isset($mybb->input['do_recountwarning']))
- {
- $plugins->run_hooks("admin_tools_recount_recount_warning");
-
- if($mybb->input['page'] == 1)
- {
- // Log admin action
- log_admin_action("warning");
- }
-
- if(!$mybb->get_input('warning', MyBB::INPUT_INT))
- {
- $mybb->input['warning'] = 500;
- }
-
- acp_recount_warning();
- }
- elseif(isset($mybb->input['do_recountprivatemessages']))
- {
- $plugins->run_hooks("admin_tools_recount_recount_private_messages");
-
- if($mybb->input['page'] == 1)
- {
- // Log admin action
- log_admin_action("privatemessages");
- }
-
- if(!$mybb->get_input('privatemessages', MyBB::INPUT_INT))
- {
- $mybb->input['privatemessages'] = 500;
- }
-
- acp_recount_private_messages();
- }
- elseif(isset($mybb->input['do_recountreferral']))
- {
- $plugins->run_hooks("admin_tools_recount_recount_referral");
-
- if($mybb->input['page'] == 1)
- {
- // Log admin action
- log_admin_action("referral");
- }
-
- if(!$mybb->get_input('referral', MyBB::INPUT_INT))
- {
- $mybb->input['referral'] = 500;
- }
-
- acp_recount_referrals();
- }
- elseif(isset($mybb->input['do_recountthreadrating']))
- {
- $plugins->run_hooks("admin_tools_recount_recount_thread_ratings");
-
- if($mybb->input['page'] == 1)
- {
- // Log admin action
- log_admin_action("threadrating");
- }
-
- if(!$mybb->get_input('threadrating', MyBB::INPUT_INT))
- {
- $mybb->input['threadrating'] = 500;
- }
-
- acp_recount_thread_ratings();
- }
- elseif(isset($mybb->input['do_rebuildpollcounters']))
- {
- $plugins->run_hooks("admin_tools_recount_rebuild_poll_counters");
-
- if($mybb->input['page'] == 1)
- {
- // Log admin action
- log_admin_action("poll");
- }
-
- if(!$mybb->get_input('pollcounters', MyBB::INPUT_INT))
- {
- $mybb->input['pollcounters'] = 500;
- }
-
- acp_rebuild_poll_counters();
- }
- else
- {
- $plugins->run_hooks("admin_tools_recount_rebuild_stats");
-
- $cache->update_stats();
-
- // Log admin action
- log_admin_action("stats");
-
- flash_message($lang->success_rebuilt_forum_stats, 'success');
- admin_redirect("index.php?module=tools-recount_rebuild");
- }
- }
-
- $page->output_header($lang->recount_rebuild);
-
- $sub_tabs['recount_rebuild'] = array(
- 'title' => $lang->recount_rebuild,
- 'link' => "index.php?module=tools-recount_rebuild",
- 'description' => $lang->recount_rebuild_desc
- );
-
- $page->output_nav_tabs($sub_tabs, 'recount_rebuild');
-
- $form = new Form("index.php?module=tools-recount_rebuild", "post");
-
- $form_container = new FormContainer($lang->recount_rebuild);
- $form_container->output_row_header($lang->name);
- $form_container->output_row_header($lang->data_per_page, array('width' => 50));
- $form_container->output_row_header(" ");
-
- $form_container->output_cell("{$lang->rebuild_forum_counters_desc}
");
- $form_container->output_cell($form->generate_numeric_field("forumcounters", 50, array('style' => 'width: 150px;', 'min' => 0)));
- $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_rebuildforumcounters")));
- $form_container->construct_row();
-
- $form_container->output_cell("{$lang->rebuild_thread_counters_desc}
");
- $form_container->output_cell($form->generate_numeric_field("threadcounters", 500, array('style' => 'width: 150px;', 'min' => 0)));
- $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_rebuildthreadcounters")));
- $form_container->construct_row();
-
- $form_container->output_cell("{$lang->rebuild_poll_counters_desc}
");
- $form_container->output_cell($form->generate_numeric_field("pollcounters", 500, array('style' => 'width: 150px;', 'min' => 0)));
- $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_rebuildpollcounters")));
- $form_container->construct_row();
-
- $form_container->output_cell("{$lang->recount_user_posts_desc}
");
- $form_container->output_cell($form->generate_numeric_field("userposts", 500, array('style' => 'width: 150px;', 'min' => 0)));
- $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountuserposts")));
- $form_container->construct_row();
-
- $form_container->output_cell("{$lang->recount_user_threads_desc}
");
- $form_container->output_cell($form->generate_numeric_field("userthreads", 500, array('style' => 'width: 150px;', 'min' => 0)));
- $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountuserthreads")));
- $form_container->construct_row();
-
- $form_container->output_cell("{$lang->rebuild_attachment_thumbs_desc}
");
- $form_container->output_cell($form->generate_numeric_field("attachmentthumbs", 20, array('style' => 'width: 150px;', 'min' => 0)));
- $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_rebuildattachmentthumbs")));
- $form_container->construct_row();
-
- $form_container->output_cell("{$lang->recount_stats_desc}
");
- $form_container->output_cell($lang->na);
- $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountstats")));
- $form_container->construct_row();
-
- $form_container->output_cell("{$lang->recount_reputation_desc}
");
- $form_container->output_cell($form->generate_numeric_field("reputation", 500, array('style' => 'width: 150px;', 'min' => 0)));
- $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountreputation")));
- $form_container->construct_row();
-
- $form_container->output_cell("{$lang->recount_warning_desc}
");
- $form_container->output_cell($form->generate_numeric_field("warning", 500, array('style' => 'width: 150px;', 'min' => 0)));
- $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountwarning")));
- $form_container->construct_row();
-
- $form_container->output_cell("{$lang->recount_private_messages_desc}
");
- $form_container->output_cell($form->generate_numeric_field("privatemessages", 500, array('style' => 'width: 150px;', 'min' => 0)));
- $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountprivatemessages")));
- $form_container->construct_row();
-
- $form_container->output_cell("{$lang->recount_referrals_desc}
");
- $form_container->output_cell($form->generate_numeric_field("referral", 500, array('style' => 'width: 150px;', 'min' => 0)));
- $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountreferral")));
- $form_container->construct_row();
-
- $form_container->output_cell("{$lang->recount_thread_ratings_desc}
");
- $form_container->output_cell($form->generate_numeric_field("threadrating", 500, array('style' => 'width: 150px;', 'min' => 0)));
- $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountthreadrating")));
- $form_container->construct_row();
-
- $plugins->run_hooks("admin_tools_recount_rebuild_output_list");
-
- $form_container->end();
-
- $form->end();
-
- $page->output_footer();
-}
-
diff --git a/html/forums/admin/modules/tools/spamlog.php b/html/forums/admin/modules/tools/spamlog.php
deleted file mode 100644
index a34dc9c..0000000
--- a/html/forums/admin/modules/tools/spamlog.php
+++ /dev/null
@@ -1,296 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->spam_logs, "index.php?module=tools-spamlog");
-
-$sub_tabs['spam_logs'] = array(
- 'title' => $lang->spam_logs,
- 'link' => "index.php?module=tools-spamlog",
- 'description' => $lang->spam_logs_desc
-);
-$sub_tabs['prune_spam_logs'] = array(
- 'title' => $lang->prune_spam_logs,
- 'link' => "index.php?module=tools-spamlog&action=prune",
- 'description' => $lang->prune_spam_logs_desc
-);
-
-$plugins->run_hooks("admin_tools_spamlog_begin");
-
-if($mybb->input['action'] == 'prune')
-{
- if(!is_super_admin($mybb->user['uid']))
- {
- flash_message($lang->cannot_perform_action_super_admin_general, 'error');
- admin_redirect("index.php?module=tools-spamlog");
- }
-
- $plugins->run_hooks("admin_tools_spamlog_prune");
-
- if($mybb->request_method == 'post')
- {
- $is_today = false;
- $mybb->input['older_than'] = $mybb->get_input('older_than', MyBB::INPUT_INT);
- if($mybb->input['older_than'] <= 0)
- {
- $is_today = true;
- $mybb->input['older_than'] = 1;
- }
- $where = 'dateline < '.(TIME_NOW-($mybb->input['older_than']*86400));
-
- // Searching for entries in a specific module
- if($mybb->input['filter_username'])
- {
- $where .= " AND username='".$db->escape_string($mybb->input['filter_username'])."'";
- }
-
- // Searching for entries in a specific module
- if($mybb->input['filter_email'])
- {
- $where .= " AND email='".$db->escape_string($mybb->input['filter_email'])."'";
- }
-
- $query = $db->delete_query("spamlog", $where);
- $num_deleted = $db->affected_rows();
-
- $plugins->run_hooks("admin_tools_spamlog_prune_commit");
-
- // Log admin action
- log_admin_action($mybb->input['older_than'], $mybb->input['filter_username'], $mybb->input['filter_email'], $num_deleted);
-
- $success = $lang->success_pruned_spam_logs;
- if($is_today == true && $num_deleted > 0)
- {
- $success .= ' '.$lang->note_logs_locked;
- }
- elseif($is_today == true && $num_deleted == 0)
- {
- flash_message($lang->note_logs_locked, 'error');
- admin_redirect('index.php?module=tools-spamlog');
- }
- flash_message($success, 'success');
- admin_redirect('index.php?module=tools-spamlog');
- }
- $page->add_breadcrumb_item($lang->prune_spam_logs, 'index.php?module=tools-spamlog&action=prune');
- $page->output_header($lang->prune_spam_logs);
- $page->output_nav_tabs($sub_tabs, 'prune_spam_logs');
-
- // Fetch filter options
- $sortbysel[$mybb->input['sortby']] = 'selected="selected"';
- $ordersel[$mybb->input['order']] = 'selected="selected"';
-
- $form = new Form("index.php?module=tools-spamlog&action=prune", "post");
- $form_container = new FormContainer($lang->prune_spam_logs);
- $form_container->output_row($lang->spam_username, "", $form->generate_text_box('filter_username', $mybb->input['filter_username'], array('id' => 'filter_username')), 'filter_username');
- $form_container->output_row($lang->spam_email, "", $form->generate_text_box('filter_email', $mybb->input['filter_email'], array('id' => 'filter_email')), 'filter_email');
- if(!$mybb->input['older_than'])
- {
- $mybb->input['older_than'] = '30';
- }
- $form_container->output_row($lang->date_range, "", $lang->older_than.$form->generate_numeric_field('older_than', $mybb->input['older_than'], array('id' => 'older_than', 'style' => 'width: 50px', 'min' => 0))." {$lang->days}", 'older_than');
- $form_container->end();
- $buttons[] = $form->generate_submit_button($lang->prune_spam_logs);
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-
-if(!$mybb->input['action'])
-{
- $plugins->run_hooks("admin_tools_spamlog_start");
-
- $page->output_header($lang->spam_logs);
-
- $page->output_nav_tabs($sub_tabs, 'spam_logs');
-
- $perpage = $mybb->get_input('perpage', MyBB::INPUT_INT);
- if(!$perpage)
- {
- $perpage = 20;
- }
-
- $where = '1=1';
-
- $additional_criteria = array();
-
- // Searching for entries witha specific username
- if($mybb->input['username'])
- {
- $where .= " AND username='".$db->escape_string($mybb->input['username'])."'";
- $additional_criteria[] = "username=".urlencode($mybb->input['username']);
- }
-
- // Searching for entries with a specific email
- if($mybb->input['email'])
- {
- $where .= " AND email='".$db->escape_string($mybb->input['email'])."'";
- $additional_criteria[] = "email=".urlencode($mybb->input['email']);
- }
-
- // Searching for entries with a specific IP
- if($mybb->input['ipaddress'] > 0)
- {
- $where .= " AND ipaddress=".$db->escape_binary(my_inet_pton($mybb->input['ipaddress']));
- $additional_criteria[] = "ipaddress=".urlencode($mybb->input['ipaddress']);
- }
-
- if($additional_criteria)
- {
- $additional_criteria = "&".implode("&", $additional_criteria);
- }
- else
- {
- $additional_criteria = '';
- }
-
- // Order?
- switch($mybb->input['sortby'])
- {
- case "username":
- $sortby = "username";
- break;
- case "email":
- $sortby = "email";
- break;
- case "ipaddress":
- $sortby = "ipaddress";
- break;
- default:
- $sortby = "dateline";
- }
- $order = $mybb->input['order'];
- if($order != "asc")
- {
- $order = "desc";
- }
-
- $query = $db->simple_select("spamlog", "COUNT(sid) AS count", $where);
- $rescount = $db->fetch_field($query, "count");
-
- // Figure out if we need to display multiple pages.
- if($mybb->input['page'] != "last")
- {
- $pagecnt = $mybb->get_input('page', MyBB::INPUT_INT);
- }
-
- $logcount = (int)$rescount;
- $pages = $logcount / $perpage;
- $pages = ceil($pages);
-
- if($mybb->input['page'] == "last")
- {
- $pagecnt = $pages;
- }
-
- if($pagecnt > $pages)
- {
- $pagecnt = 1;
- }
-
- if($pagecnt)
- {
- $start = ($pagecnt-1) * $perpage;
- }
- else
- {
- $start = 0;
- $pagecnt = 1;
- }
-
- $table = new Table;
- $table->construct_header($lang->spam_username, array('width' => '20%'));
- $table->construct_header($lang->spam_email, array("class" => "align_center", 'width' => '20%'));
- $table->construct_header($lang->spam_ip, array("class" => "align_center", 'width' => '20%'));
- $table->construct_header($lang->spam_date, array("class" => "align_center", 'width' => '20%'));
- $table->construct_header($lang->spam_confidence, array("class" => "align_center", 'width' => '20%'));
-
- $query = $db->simple_select("spamlog", "*", $where, array('order_by' => $sortby, 'order_dir' => $order, 'limit_start' => $start, 'limit' => $perpage));
- while($row = $db->fetch_array($query))
- {
- $username = htmlspecialchars_uni($row['username']);
- $email = htmlspecialchars_uni($row['email']);
- $ip_address = my_inet_ntop($db->unescape_binary($row['ipaddress']));
-
- $dateline = '';
- if($row['dateline'] > 0)
- {
- $dateline = my_date('relative', $row['dateline']);
- }
-
- $confidence = '0%';
- $data = @my_unserialize($row['data']);
- if(is_array($data) && !empty($data))
- {
- if(isset($data['confidence']))
- {
- $confidence = (double)$data['confidence'].'%';
- }
- }
-
- $search_sfs = "";
-
- $table->construct_cell($username);
- $table->construct_cell($email);
- $table->construct_cell("{$search_sfs}{$ip_address}
");
- $table->construct_cell($dateline);
- $table->construct_cell($confidence);
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_spam_logs, array("colspan" => "5"));
- $table->construct_row();
- }
-
- $table->output($lang->spam_logs);
-
- // Do we need to construct the pagination?
- if($rescount > $perpage)
- {
- echo draw_admin_pagination($pagecnt, $perpage, $rescount, "index.php?module=tools-spamlog&perpage={$perpage}{$additional_criteria}&sortby={$mybb->input['sortby']}&order={$order}")."
";
- }
-
- // Fetch filter options
- $sortbysel[$mybb->input['sortby']] = "selected=\"selected\"";
- $ordersel[$mybb->input['order']] = "selected=\"selected\"";
-
- $sort_by = array(
- 'dateline' => $lang->spam_date,
- 'username' => $lang->spam_username,
- 'email' => $lang->spam_email,
- 'ipaddress' => $lang->spam_ip,
- );
-
- $order_array = array(
- 'asc' => $lang->asc,
- 'desc' => $lang->desc
- );
-
- $form = new Form("index.php?module=tools-spamlog", "post");
- $form_container = new FormContainer($lang->filter_spam_logs);
- $form_container->output_row($lang->spam_username, "", $form->generate_text_box('username', htmlspecialchars_uni($mybb->get_input('username')), array('id' => 'username')), 'suername');
- $form_container->output_row($lang->spam_email, "", $form->generate_text_box('email', $mybb->input['email'], array('id' => 'email')), 'email');
- $form_container->output_row($lang->spam_ip, "", $form->generate_text_box('ipaddress', $mybb->input['ipaddress'], array('id' => 'ipaddress')), 'ipaddress');
- $form_container->output_row($lang->sort_by, "", $form->generate_select_box('sortby', $sort_by, $mybb->input['sortby'], array('id' => 'sortby'))." {$lang->in} ".$form->generate_select_box('order', $order_array, $order, array('id' => 'order'))." {$lang->order}", 'order');
- $form_container->output_row($lang->results_per_page, "", $form->generate_numeric_field('perpage', $perpage, array('id' => 'perpage', 'min' => 1)), 'perpage');
-
- $form_container->end();
- $buttons[] = $form->generate_submit_button($lang->filter_spam_logs);
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
diff --git a/html/forums/admin/modules/tools/statistics.php b/html/forums/admin/modules/tools/statistics.php
deleted file mode 100644
index 75d5af9..0000000
--- a/html/forums/admin/modules/tools/statistics.php
+++ /dev/null
@@ -1,282 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-if($mybb->input['action'] == "do_graph")
-{
- $range = array(
- 'start' => $mybb->get_input('start', MyBB::INPUT_INT),
- 'end' => $mybb->get_input('end', MyBB::INPUT_INT)
- );
- create_graph($mybb->input['type'], $range);
- die;
-}
-
-$page->add_breadcrumb_item($lang->statistics, "index.php?module=tools-statistics");
-
-$sub_tabs['overall_statistics'] = array(
- 'title' => $lang->overall_statistics,
- 'link' => "index.php?module=tools-statistics",
- 'description' => $lang->overall_statistics_desc
-);
-
-$plugins->run_hooks("admin_tools_statistics_begin");
-
-if(!$mybb->input['action'])
-{
- $query = $db->simple_select("stats", "COUNT(*) as total");
- if($db->fetch_field($query, "total") == 0)
- {
- flash_message($lang->error_no_statistics_available_yet, 'error');
- admin_redirect("index.php?module=tools");
- }
-
- $per_page = 20;
-
- $plugins->run_hooks("admin_tools_statistics_overall_begin");
-
- // Do we have date range criteria?
- if($mybb->input['from_year'])
- {
- $start_dateline = mktime(0, 0, 0, $mybb->get_input('from_month', MyBB::INPUT_INT), $mybb->get_input('from_day', MyBB::INPUT_INT), $mybb->get_input('from_year', MyBB::INPUT_INT));
- $end_dateline = mktime(23, 59, 59, $mybb->get_input('to_month', MyBB::INPUT_INT), $mybb->get_input('to_day', MyBB::INPUT_INT), $mybb->get_input('to_year', MyBB::INPUT_INT));
- $range = "&start={$start_dateline}&end={$end_dateline}";
- }
-
- // Otherwise default to the last 30 days
- if(!$mybb->input['from_year'] || $start_dateline > TIME_NOW || $end_dateline > mktime(23, 59, 59))
- {
- $start_dateline = TIME_NOW-(60*60*24*30);
- $end_dateline = TIME_NOW;
-
- list($mybb->input['from_day'], $mybb->input['from_month'], $mybb->input['from_year']) = explode('-', date('j-n-Y', $start_dateline));
- list($mybb->input['to_day'], $mybb->input['to_month'], $mybb->input['to_year']) = explode('-', date('j-n-Y', $end_dateline));
-
- $range = "&start={$start_dateline}&end={$end_dateline}";
- }
-
- $last_dateline = 0;
-
- if($mybb->input['page'] && $mybb->input['page'] > 1)
- {
- $mybb->input['page'] = $mybb->get_input('page', MyBB::INPUT_INT);
- $start = ($mybb->input['page']*$per_page)-$per_page;
- }
- else
- {
- $mybb->input['page'] = 1;
- $start = 0;
- }
-
- $query = $db->simple_select("stats", "*", "dateline >= '".(int)$start_dateline."' AND dateline <= '".(int)$end_dateline."'", array('order_by' => 'dateline', 'order_dir' => 'asc'));
-
- $stats = array();
- while($stat = $db->fetch_array($query))
- {
- if($last_dateline)
- {
- $stat['change_users'] = ($stat['numusers'] - $stats[$last_dateline]['numusers']);
- $stat['change_threads'] = ($stat['numthreads'] - $stats[$last_dateline]['numthreads']);
- $stat['change_posts'] = ($stat['numposts'] - $stats[$last_dateline]['numposts']);
- }
-
- $stats[$stat['dateline']] = $stat;
-
- $last_dateline = $stat['dateline'];
- }
-
- if(empty($stats))
- {
- flash_message($lang->error_no_results_found_for_criteria, 'error');
- admin_redirect("index.php?module=tools");
- }
-
- krsort($stats, SORT_NUMERIC);
-
- $page->add_breadcrumb_item($lang->overall_statistics, "index.php?module=tools-statistics");
-
- $page->output_header($lang->statistics." - ".$lang->overall_statistics);
-
- $page->output_nav_tabs($sub_tabs, 'overall_statistics');
-
- // Date range fields
- $form = new Form("index.php?module=tools-statistics", "post", "overall");
- echo "\n";
- $form->end();
-
- echo "\n";
-
- echo "\n";
-
- echo "\n";
-
- $total_rows = count($stats);
-
- $table = new Table;
- $table->construct_header($lang->date);
- $table->construct_header($lang->users);
- $table->construct_header($lang->threads);
- $table->construct_header($lang->posts);
- $query = $db->simple_select("stats", "*", "dateline >= '".(int)$start_dateline."' AND dateline <= '".(int)$end_dateline."'", array('order_by' => 'dateline', 'order_dir' => 'desc', 'limit_start' => $start, 'limit' => $per_page));
- while($stat = $db->fetch_array($query))
- {
- $table->construct_cell("".date($mybb->settings['dateformat'], $stat['dateline'])."");
- $table->construct_cell(my_number_format($stat['numusers'])." ".generate_growth_string($stats[$stat['dateline']]['change_users'])."");
- $table->construct_cell(my_number_format($stat['numthreads'])." ".generate_growth_string($stats[$stat['dateline']]['change_threads'])."");
- $table->construct_cell(my_number_format($stat['numposts'])." ".generate_growth_string($stats[$stat['dateline']]['change_posts'])."");
- $table->construct_row();
- }
- $table->output($lang->overall_statistics);
-
- $url_range = "&from_month=".$mybb->get_input('from_month', MyBB::INPUT_INT)."&from_day=".$mybb->get_input('from_day', MyBB::INPUT_INT)."&from_year=".$mybb->get_input('from_year', MyBB::INPUT_INT);
- $url_range .= "&to_month=".$mybb->get_input('to_month', MyBB::INPUT_INT)."&to_day=".$mybb->get_input('to_day', MyBB::INPUT_INT)."&to_year=".$mybb->get_input('to_year', MyBB::INPUT_INT);
-
- echo draw_admin_pagination($mybb->input['page'], $per_page, $total_rows, "index.php?module=tools-statistics{$url_range}&page={page}");
-
- $page->output_footer();
-}
-
-/**
- * @param int $number
- *
- * @return string
- */
-function generate_growth_string($number)
-{
- global $lang, $cp_style;
-
- if($number === null)
- {
- return "";
- }
-
- $number = (int)$number;
- $friendly_number = my_number_format(abs($number));
-
- if($number > 0)
- {
- $growth_string = "(
increase}\" title=\"{$lang->increase}\" style=\"vertical-align: middle; margin-top: -2px;\" /> {$friendly_number})";
- }
- elseif($number == 0)
- {
- $growth_string = "(
no_change}\" title=\"{$lang->no_change}\" style=\"vertical-align: middle; margin-top: -2px;\" /> {$friendly_number})";
- }
- else
- {
- $growth_string = "(
decrease}\" title=\"{$lang->decrease}\" style=\"vertical-align: middle; margin-top: -2px;\" /> {$friendly_number})";
- }
-
- return $growth_string;
-}
-
-/**
- * @param string $type users, threads, posts
- * @param array $range
- */
-function create_graph($type, $range=null)
-{
- global $db;
-
- // Do we have date range criteria?
- if($range['end'] || $range['start'])
- {
- $start = (int)$range['start'];
- $end = (int)$range['end'];
- }
- // Otherwise default to the last 30 days
- else
- {
- $start = TIME_NOW-(60*60*24*30);
- $end = TIME_NOW;
- }
-
- $allowed_types = array('users', 'threads', 'posts');
- if(!in_array($type, $allowed_types))
- {
- die;
- }
-
- require_once MYBB_ROOT.'inc/class_graph.php';
-
- $points = $stats = $datelines = array();
- if($start == 0)
- {
- $query = $db->simple_select("stats", "dateline,num{$type}", "dateline <= '".(int)$end."'", array('order_by' => 'dateline', 'order_dir' => 'desc', 'limit' => 2));
- while($stat = $db->fetch_array($query))
- {
- $stats[] = $stat['num'.$type];
- $datelines[] = $stat['dateline'];
- $x_labels[] = date("m/j", $stat['dateline']);
- }
- $points[$datelines[0]] = 0;
- $points[$datelines[1]] = $stats[0]-$stats[1];
- ksort($points, SORT_NUMERIC);
- }
- elseif($end == 0)
- {
- $query = $db->simple_select("stats", "dateline,num{$type}", "dateline >= '".(int)$start."'", array('order_by' => 'dateline', 'order_dir' => 'asc', 'limit' => 2));
- while($stat = $db->fetch_array($query))
- {
- $stats[] = $stat['num'.$type];
- $datelines[] = $stat['dateline'];
- $x_labels[] = date("m/j", $stat['dateline']);
- }
- $points[$datelines[0]] = 0;
- $points[$datelines[1]] = $stats[1]-$stats[0];
- ksort($points, SORT_NUMERIC);
- }
- else
- {
- $query = $db->simple_select("stats", "dateline,num{$type}", "dateline >= '".(int)$start."' AND dateline <= '".(int)$end."'", array('order_by' => 'dateline', 'order_dir' => 'asc'));
- while($stat = $db->fetch_array($query))
- {
- $points[$stat['dateline']] = $stat['num'.$type];
- $datelines[] = $stat['dateline'];
- $x_labels[] = date("m/j", $stat['dateline']);
- }
- }
-
- sort($datelines, SORT_NUMERIC);
-
- // Find our year(s) label
- $start_year = date('Y', $datelines[0]);
- $last_year = date('Y', $datelines[count($datelines)-1]);
- if(($last_year - $start_year) == 0)
- {
- $bottom_label = $start_year;
- }
- else
- {
- $bottom_label = $start_year." - ".$last_year;
- }
-
- // Create the graph outline
- $graph = new Graph();
- $graph->add_points(array_values($points));
- $graph->add_x_labels($x_labels);
- $graph->set_bottom_label($bottom_label);
- $graph->render();
- $graph->output();
-}
diff --git a/html/forums/admin/modules/tools/system_health.php b/html/forums/admin/modules/tools/system_health.php
deleted file mode 100644
index 120e336..0000000
--- a/html/forums/admin/modules/tools/system_health.php
+++ /dev/null
@@ -1,981 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->system_health, "index.php?module=tools-system_health");
-
-$sub_tabs['system_health'] = array(
- 'title' => $lang->system_health,
- 'link' => "index.php?module=tools-system_health",
- 'description' => $lang->system_health_desc
-);
-
-$sub_tabs['utf8_conversion'] = array(
- 'title' => $lang->utf8_conversion,
- 'link' => "index.php?module=tools-system_health&action=utf8_conversion",
- 'description' => $lang->utf8_conversion_desc2
-);
-
-$sub_tabs['template_check'] = array(
- 'title' => $lang->check_templates,
- 'link' => "index.php?module=tools-system_health&action=check_templates",
- 'description' => $lang->check_templates_desc
-);
-
-$plugins->run_hooks("admin_tools_system_health_begin");
-
-if($mybb->input['action'] == "do_check_templates" && $mybb->request_method == "post")
-{
- $query = $db->simple_select("templates", "*", "", array("order_by" => "sid, title", "order_dir" => "ASC"));
-
- if(!$db->num_rows($query))
- {
- flash_message($lang->error_invalid_input, 'error');
- admin_redirect("index.php?module=tools-system_health");
- }
-
- $plugins->run_hooks("admin_tools_system_health_template_do_check_start");
-
- $t_cache = array();
- while($template = $db->fetch_array($query))
- {
- if(check_template($template['template']) == true)
- {
- $t_cache[$template['sid']][] = $template;
- }
- }
-
- if(empty($t_cache))
- {
- flash_message($lang->success_templates_checked, 'success');
- admin_redirect("index.php?module=tools-system_health");
- }
-
- $plugins->run_hooks("admin_tools_system_health_template_do_check");
-
- $page->add_breadcrumb_item($lang->check_templates);
- $page->output_header($lang->check_templates);
-
- $page->output_nav_tabs($sub_tabs, 'template_check');
- $page->output_inline_error(array($lang->check_templates_info_desc));
-
- $templatesets = array(
- -2 => array(
- "title" => "MyBB Master Templates"
- )
- );
- $query = $db->simple_select("templatesets", "*");
- while($set = $db->fetch_array($query))
- {
- $templatesets[$set['sid']] = $set;
- }
-
- $count = 0;
- foreach($t_cache as $sid => $templates)
- {
- if(!$done_set[$sid])
- {
- $table = new Table();
- $table->construct_header($templatesets[$sid]['title'], array("colspan" => 2));
-
- $done_set[$sid] = 1;
- ++$count;
- }
-
- if($sid == -2)
- {
- // Some cheeky clown has altered the master templates!
- $table->construct_cell($lang->error_master_templates_altered, array("colspan" => 2));
- $table->construct_row();
- }
-
- foreach($templates as $template)
- {
- if($sid == -2)
- {
- $table->construct_cell($template['title'], array('colspan' => 2));
- }
- else
- {
- $popup = new PopupMenu("template_{$template['tid']}", $lang->options);
- $popup->add_item($lang->full_edit, "index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&sid={$sid}");
-
- $table->construct_cell("{$template['title']}", array('width' => '80%'));
- $table->construct_cell($popup->fetch(), array("class" => "align_center"));
- }
-
- $table->construct_row();
- }
-
- if($done_set[$sid] && !$done_output[$sid])
- {
- $done_output[$sid] = 1;
- if($count == 1)
- {
- $table->output($lang->check_templates);
- }
- else
- {
- $table->output();
- }
- }
- }
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "check_templates")
-{
- $page->add_breadcrumb_item($lang->check_templates);
- $page->output_header($lang->check_templates);
-
- $plugins->run_hooks("admin_tools_system_health_template_check");
-
- $page->output_nav_tabs($sub_tabs, 'template_check');
-
- if($errors)
- {
- $page->output_inline_error($errors);
- }
-
- $form = new Form("index.php?module=tools-system_health", "post", "check_set");
- echo $form->generate_hidden_field("action", "do_check_templates");
-
- $form_container = new FormContainer($lang->check_templates);
- $form_container->output_row($lang->check_templates_title, "", $lang->check_templates_info);
- $form_container->end();
-
- $buttons = array();
- $buttons[] = $form->generate_submit_button($lang->proceed);
-
- $form->output_submit_wrapper($buttons);
-
- $form->end();
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "utf8_conversion")
-{
- if($db->type == "sqlite" || $db->type == "pgsql")
- {
- flash_message($lang->error_not_supported, 'error');
- admin_redirect("index.php?module=tools-system_health");
- }
-
- $plugins->run_hooks("admin_tools_system_health_utf8_conversion");
-
- if($mybb->request_method == "post" || ($mybb->input['do'] == "all" && !empty($mybb->input['table'])))
- {
- if(!empty($mybb->input['mb4']) && version_compare($db->get_version(), '5.5.3', '<'))
- {
- flash_message($lang->error_utf8mb4_version, 'error');
- admin_redirect("index.php?module=tools-system_health&action=utf8_conversion");
- }
- @set_time_limit(0);
-
- $old_table_prefix = $db->table_prefix;
- $db->set_table_prefix('');
-
- if(!$db->table_exists($db->escape_string($mybb->input['table'])))
- {
- $db->set_table_prefix($old_table_prefix);
- flash_message($lang->error_invalid_table, 'error');
- admin_redirect("index.php?module=tools-system_health&action=utf8_conversion");
- }
-
- $db->set_table_prefix($old_table_prefix);
-
- $page->add_breadcrumb_item($lang->utf8_conversion, "index.php?module=tools-system_health&action=utf8_conversion");
-
- $page->output_header($lang->system_health." - ".$lang->utf8_conversion);
-
- $sub_tabs['system_health'] = array(
- 'title' => $lang->system_health,
- 'link' => "index.php?module=tools-system_health",
- 'description' => $lang->system_health_desc
- );
-
- $sub_tabs['utf8_conversion'] = array(
- 'title' => $lang->utf8_conversion,
- 'link' => "index.php?module=tools-system_health&action=utf8_conversion",
- 'description' => $lang->utf8_conversion_desc2
- );
-
- $page->output_nav_tabs($sub_tabs, 'utf8_conversion');
-
- $old_table_prefix = $db->table_prefix;
- $db->set_table_prefix('');
-
- $table = new Table;
-
- $table1 = $db->show_create_table($db->escape_string($mybb->input['table']));
- preg_match("#CHARSET=([a-zA-Z0-9_]+)\s?#i", $table1, $matches);
- $charset = $matches[1];
-
- if(!empty($mybb->input['mb4']))
- {
- $table->construct_cell("".$lang->sprintf($lang->converting_to_utf8mb4, $mybb->input['table'], $charset)."");
- }
- else
- {
- $table->construct_cell("".$lang->sprintf($lang->converting_to_utf8, $mybb->input['table'], $charset)."");
- }
- $table->construct_row();
-
- $table->construct_cell($lang->please_wait);
- $table->construct_row();
-
- $table->output($converting_table." {$mybb->input['table']}");
-
- $db->set_table_prefix($old_table_prefix);
-
- $page->output_footer(false);
-
- $old_table_prefix = $db->table_prefix;
- $db->set_table_prefix('');
-
- flush();
-
- $types = array(
- 'text' => 'blob',
- 'mediumtext' => 'mediumblob',
- 'longtext' => 'longblob',
- 'char' => 'varbinary',
- 'varchar' => 'varbinary',
- 'tinytext' => 'tinyblob'
- );
-
- $blob_types = array( 'blob', 'tinyblob', 'mediumblog', 'longblob', 'text', 'tinytext', 'mediumtext', 'longtext' );
-
- // Get next table in list
- $convert_to_binary = '';
- $convert_to_utf8 = '';
- $comma = '';
-
- if(!empty($mybb->input['mb4']))
- {
- $character_set = 'utf8mb4';
- $collation = 'utf8mb4_general_ci';
- }
- else
- {
- $character_set = 'utf8';
- $collation = 'utf8_general_ci';
- }
-
- // Set table default charset
- $db->write_query("ALTER TABLE {$mybb->input['table']} DEFAULT CHARACTER SET {$character_set} COLLATE {$collation}");
-
- // Fetch any fulltext keys
- if($db->supports_fulltext($mybb->input['table']))
- {
- $table_structure = $db->show_create_table($mybb->input['table']);
- switch($db->type)
- {
- case "mysql":
- case "mysqli":
- preg_match_all("#FULLTEXT KEY `?([a-zA-Z0-9_]+)`? \(([a-zA-Z0-9_`,']+)\)#i", $table_structure, $matches);
- if(is_array($matches))
- {
- foreach($matches[0] as $key => $matched)
- {
- $db->write_query("ALTER TABLE {$mybb->input['table']} DROP INDEX {$matches[1][$key]}");
- $fulltext_to_create[$matches[1][$key]] = $matches[2][$key];
- }
- }
- }
- }
-
- // Find out which columns need converting and build SQL statements
- $query = $db->query("SHOW FULL COLUMNS FROM {$mybb->input['table']}");
- while($column = $db->fetch_array($query))
- {
- list($type) = explode('(', $column['Type']);
- if(array_key_exists($type, $types))
- {
- // Build the actual strings for converting the columns
- $names = "CHANGE `{$column['Field']}` `{$column['Field']}` ";
-
- if(($db->type == 'mysql' || $db->type == 'mysqli') && in_array($type, $blob_types))
- {
- if($column['Null'] == 'YES')
- {
- $attributes = 'NULL';
- }
- else
- {
- $attributes = 'NOT NULL';
- }
- }
- else
- {
- $attributes = " DEFAULT ";
- if($column['Default'] == 'NULL')
- {
- $attributes .= "NULL ";
- }
- else
- {
- $attributes .= "'".$db->escape_string($column['Default'])."' ";
-
- if($column['Null'] == 'YES')
- {
- $attributes .= 'NULL';
- }
- else
- {
- $attributes .= 'NOT NULL';
- }
- }
- }
-
- $convert_to_binary .= $comma.$names.preg_replace('/'.$type.'/i', $types[$type], $column['Type']).' '.$attributes;
- $convert_to_utf8 .= "{$comma}{$names}{$column['Type']} CHARACTER SET {$character_set} COLLATE {$collation} {$attributes}";
-
- $comma = ',';
- }
- }
-
- if(!empty($convert_to_binary))
- {
- // This converts the columns to UTF-8 while also doing the same for data
- $db->write_query("ALTER TABLE {$mybb->input['table']} {$convert_to_binary}");
- $db->write_query("ALTER TABLE {$mybb->input['table']} {$convert_to_utf8}");
- }
-
- // Any fulltext indexes to recreate?
- if(is_array($fulltext_to_create))
- {
- foreach($fulltext_to_create as $name => $fields)
- {
- $db->create_fulltext_index($mybb->input['table'], $fields, $name);
- }
- }
-
- $db->set_table_prefix($old_table_prefix);
-
- $plugins->run_hooks("admin_tools_system_health_utf8_conversion_commit");
-
- // Log admin action
- log_admin_action($mybb->input['table']);
-
- flash_message($lang->sprintf($lang->success_table_converted, $mybb->input['table']), 'success');
-
- if($mybb->input['do'] == "all")
- {
- $old_table_prefix = $db->table_prefix;
- $db->set_table_prefix('');
-
- $tables = $db->list_tables($mybb->config['database']['database']);
- foreach($tables as $key => $tablename)
- {
- if(substr($tablename, 0, strlen(TABLE_PREFIX)) == TABLE_PREFIX)
- {
- $table = $db->show_create_table($tablename);
- preg_match("#CHARSET=([a-zA-Z0-9_]+)\s?#i", $table, $matches);
- if(empty($mybb->input['mb4']) && (fetch_iconv_encoding($matches[1]) == 'utf-8' || $matches[1] == 'utf8mb4') && $mybb->input['table'] != $tablename)
- {
- continue;
- }
- elseif(!empty($mybb->input['mb4']) && fetch_iconv_encoding($matches[1]) != 'utf-8' && $mybb->input['table'] != $tablename)
- {
- continue;
- }
-
- $mybb_tables[$key] = $tablename;
- }
- }
-
- asort($mybb_tables);
- reset($mybb_tables);
-
- $is_next = false;
- $nexttable = "";
-
- foreach($mybb_tables as $key => $tablename)
- {
- if($is_next == true)
- {
- $nexttable = $tablename;
- break;
- }
- else if($mybb->input['table'] == $tablename)
- {
- $is_next = true;
- }
- }
-
- $db->set_table_prefix($old_table_prefix);
-
- if($nexttable)
- {
- $nexttable = $db->escape_string($nexttable);
- $mb4 = '';
- if(!empty($mybb->input['mb4']))
- {
- $mb4 = "&mb4=1";
- }
- admin_redirect("index.php?module=tools-system_health&action=utf8_conversion&do=all&table={$nexttable}{$mb4}");
- exit;
- }
- }
-
- admin_redirect("index.php?module=tools-system_health&action=utf8_conversion");
-
- exit;
- }
-
- if($mybb->input['table'] || $mybb->input['do'] == "all")
- {
- if(!empty($mybb->input['mb4']) && version_compare($db->get_version(), '5.5.3', '<'))
- {
- flash_message($lang->error_utf8mb4_version, 'error');
- admin_redirect("index.php?module=tools-system_health&action=utf8_conversion");
- }
-
- $old_table_prefix = $db->table_prefix;
- $db->set_table_prefix('');
-
- if($mybb->input['do'] != "all" && !$db->table_exists($db->escape_string($mybb->input['table'])))
- {
- $db->set_table_prefix($old_table_prefix);
- flash_message($lang->error_invalid_table, 'error');
- admin_redirect("index.php?module=tools-system_health&action=utf8_conversion");
- }
-
- if($mybb->input['do'] == "all")
- {
- $tables = $db->list_tables($mybb->config['database']['database']);
- foreach($tables as $key => $tablename)
- {
- if(substr($tablename, 0, strlen(TABLE_PREFIX)) == TABLE_PREFIX)
- {
- $table = $db->show_create_table($tablename);
- preg_match("#CHARSET=([a-zA-Z0-9_]+)\s?#i", $table, $matches);
- if(empty($mybb->input['mb4']) && (fetch_iconv_encoding($matches[1]) == 'utf-8' || $matches[1] == 'utf8mb4'))
- {
- continue;
- }
- elseif(!empty($mybb->input['mb4']) && fetch_iconv_encoding($matches[1]) != 'utf-8')
- {
- continue;
- }
- $mybb_tables[$key] = $tablename;
- }
- }
-
- if(is_array($mybb_tables))
- {
- asort($mybb_tables);
- reset($mybb_tables);
- $nexttable = current($mybb_tables);
- $table = $db->show_create_table($db->escape_string($nexttable));
- $mybb->input['table'] = $nexttable;
- }
- else
- {
- $db->set_table_prefix($old_table_prefix);
- flash_message($lang->success_all_tables_already_converted, 'success');
- admin_redirect("index.php?module=tools-system_health");
- }
- }
- else
- {
- $table = $db->show_create_table($db->escape_string($mybb->input['table']));
- }
-
- $page->add_breadcrumb_item($lang->utf8_conversion, "index.php?module=tools-system_health&action=utf8_conversion");
-
- $db->set_table_prefix($old_table_prefix);
-
- $page->output_header($lang->system_health." - ".$lang->utf8_conversion);
-
- $sub_tabs['system_health'] = array(
- 'title' => $lang->system_health,
- 'link' => "index.php?module=tools-system_health",
- 'description' => $lang->system_health_desc
- );
-
- $sub_tabs['utf8_conversion'] = array(
- 'title' => $lang->utf8_conversion,
- 'link' => "index.php?module=tools-system_health&action=utf8_conversion",
- 'description' => $lang->utf8_conversion_desc2
- );
-
- $page->output_nav_tabs($sub_tabs, 'utf8_conversion');
-
- $old_table_prefix = $db->table_prefix;
- $db->set_table_prefix('');
-
- preg_match("#CHARSET=([a-zA-Z0-9_]+)\s?#i", $table, $matches);
- $charset = $matches[1];
-
- $mb4 = '';
- if(!empty($mybb->input['mb4']))
- {
- $mb4 = "&mb4=1";
- }
-
- $form = new Form("index.php?module=tools-system_health&action=utf8_conversion{$mb4}", "post", "utf8_conversion");
- echo $form->generate_hidden_field("table", $mybb->input['table']);
-
- if($mybb->input['do'] == "all")
- {
- echo $form->generate_hidden_field("do", "all");
- }
-
- $table = new Table;
-
- if(!empty($mybb->input['mb4']))
- {
- $table->construct_cell("".$lang->sprintf($lang->convert_all_to_utf8mb4, $charset)."");
- $lang->notice_process_long_time .= "
{$lang->notice_mb4_warning}";
- }
- else
- {
- if($mybb->input['do'] == "all")
- {
- $table->construct_cell("".$lang->sprintf($lang->convert_all_to_utf, $charset)."");
- }
- else
- {
- $table->construct_cell("".$lang->sprintf($lang->convert_to_utf8, $mybb->input['table'], $charset)."");
- }
- }
-
- $table->construct_row();
-
- $table->construct_cell($lang->notice_process_long_time);
- $table->construct_row();
-
- if($mybb->input['do'] == "all")
- {
- $table->output($lang->convert_tables);
- $buttons[] = $form->generate_submit_button($lang->convert_database_tables);
- }
- else
- {
- $table->output($lang->convert_table.": {$mybb->input['table']}");
- $buttons[] = $form->generate_submit_button($lang->convert_database_table);
- }
-
- $form->output_submit_wrapper($buttons);
-
- $form->end();
-
- $db->set_table_prefix($old_table_prefix);
-
- $page->output_footer();
-
- exit;
- }
-
- if(!$mybb->config['database']['encoding'])
- {
- flash_message($lang->error_db_encoding_not_set, 'error');
- admin_redirect("index.php?module=tools-system_health");
- }
-
- $tables = $db->list_tables($mybb->config['database']['database']);
-
- $old_table_prefix = $db->table_prefix;
- $db->set_table_prefix('');
-
- $encodings = array();
-
- foreach($tables as $key => $tablename)
- {
- if(substr($tablename, 0, strlen($old_table_prefix)) == $old_table_prefix)
- {
- $table = $db->show_create_table($tablename);
- preg_match("#CHARSET=([a-zA-Z0-9_]+)\s?#i", $table, $matches);
- $encodings[$key] = fetch_iconv_encoding($matches[1]);
- $mybb_tables[$key] = $tablename;
- }
- }
-
- $db->set_table_prefix($old_table_prefix);
-
- $page->add_breadcrumb_item($lang->utf8_conversion, "index.php?module=tools-system_health&action=utf8_conversion");
-
- $page->output_header($lang->system_health." - ".$lang->utf8_conversion);
-
- $page->output_nav_tabs($sub_tabs, 'utf8_conversion');
-
- asort($mybb_tables);
-
- $unique = array_unique($encodings);
-
- $convert_utf8 = $convert_utf8mb4 = false;
- foreach($unique as $encoding)
- {
- if($encoding == 'utf-8')
- {
- $convert_utf8mb4 = true;
- }
- elseif($encoding != 'utf8mb4')
- {
- $convert_utf8 = true;
- }
- }
-
- if(count($unique) > 1)
- {
- $page->output_error("{$lang->warning_multiple_encodings}
");
- }
-
- if(in_array('utf8mb4', $unique) && $mybb->config['database']['encoding'] != 'utf8mb4')
- {
- $page->output_error("{$lang->warning_utf8mb4_config}
");
- }
-
- $table = new Table;
- $table->construct_header($lang->table);
- $table->construct_header($lang->status_utf8, array("class" => "align_center"));
- $table->construct_header($lang->status_utf8mb4, array("class" => "align_center"));
-
- $all_utf8 = $all_utf8mb4 = '-';
- if($convert_utf8)
- {
- $all_utf8 = "{$lang->convert_all}";
- }
- if($convert_utf8mb4)
- {
- $all_utf8mb4 = "{$lang->convert_all}";
- }
- $table->construct_cell("{$lang->all_tables}");
- $table->construct_cell($all_utf8, array("class" => "align_center", 'width' => '15%'));
- $table->construct_cell($all_utf8mb4, array("class" => "align_center", 'width' => '25%'));
- $table->construct_row();
-
- $db_version = $db->get_version();
-
- foreach($mybb_tables as $key => $tablename)
- {
- if($encodings[$key] != 'utf-8' && $encodings[$key] != 'utf8mb4')
- {
- $status = "style}/images/icons/cross.png) no-repeat; padding-left: 20px;\">{$lang->convert_now}";
- }
- else
- {
- $status = "
style}/images/icons/tick.png\" alt=\"{$lang->ok}\" />";
- }
- if(version_compare($db_version, '5.5.3', '<'))
- {
- $utf8mb4 = $lang->not_available;
- }
- elseif($encodings[$key] == 'utf8mb4')
- {
- $utf8mb4 = "
style}/images/icons/tick.png\" alt=\"{$lang->ok}\" />";
- }
- elseif($encodings[$key] == 'utf-8')
- {
- $utf8mb4 = "style}/images/icons/cross.png) no-repeat; padding-left: 20px;\">{$lang->convert_now}";
- }
- else
- {
- $utf8mb4 = "-";
- }
- $table->construct_cell("{$tablename}");
- $table->construct_cell($status, array("class" => "align_center", 'width' => '15%'));
- $table->construct_cell($utf8mb4, array("class" => "align_center", 'width' => '25%'));
- $table->construct_row();
- }
-
- $table->output("{$lang->utf8_conversion}
");
-
- $page->output_footer();
-}
-
-if(!$mybb->input['action'])
-{
- $page->output_header($lang->system_health);
-
- $plugins->run_hooks("admin_tools_system_health_start");
-
- $page->output_nav_tabs($sub_tabs, 'system_health');
-
- $table = new Table;
- $table->construct_header($lang->totals, array("colspan" => 2));
- $table->construct_header($lang->attachments, array("colspan" => 2));
-
- $query = $db->simple_select("attachments", "COUNT(*) AS numattachs, SUM(filesize) as spaceused, SUM(downloads*filesize) as bandwidthused", "visible='1' AND pid > '0'");
- $attachs = $db->fetch_array($query);
-
- $table->construct_cell("{$lang->total_database_size}", array('width' => '25%'));
- $table->construct_cell(get_friendly_size($db->fetch_size()), array('width' => '25%'));
- $table->construct_cell("{$lang->attachment_space_used}", array('width' => '200'));
- $table->construct_cell(get_friendly_size((int)$attachs['spaceused']), array('width' => '200'));
- $table->construct_row();
-
- if($attachs['spaceused'] > 0)
- {
- $attach_average_size = round($attachs['spaceused']/$attachs['numattachs']);
- $bandwidth_average_usage = round($attachs['bandwidthused']);
- }
- else
- {
- $attach_average_size = 0;
- $bandwidth_average_usage = 0;
- }
-
- $table->construct_cell("{$lang->total_cache_size}", array('width' => '25%'));
- $table->construct_cell(get_friendly_size($cache->size_of()), array('width' => '25%'));
- $table->construct_cell("{$lang->estimated_attachment_bandwidth_usage}", array('width' => '25%'));
- $table->construct_cell(get_friendly_size($bandwidth_average_usage), array('width' => '25%'));
- $table->construct_row();
-
-
- $table->construct_cell("{$lang->max_upload_post_size}", array('width' => '200'));
- $table->construct_cell(@ini_get('upload_max_filesize').' / '.@ini_get('post_max_size'), array('width' => '200'));
- $table->construct_cell("{$lang->average_attachment_size}", array('width' => '25%'));
- $table->construct_cell(get_friendly_size($attach_average_size), array('width' => '25%'));
- $table->construct_row();
-
- $table->output($lang->stats);
-
- $table->construct_header($lang->task);
- $table->construct_header($lang->run_time, array("width" => 200, "class" => "align_center"));
-
- $task_cache = $cache->read("tasks");
- $nextrun = $task_cache['nextrun'];
-
- $query = $db->simple_select("tasks", "*", "nextrun >= '{$nextrun}' AND enabled='1'", array("order_by" => "nextrun", "order_dir" => "asc", 'limit' => 3));
- while($task = $db->fetch_array($query))
- {
- $task['title'] = htmlspecialchars_uni($task['title']);
- $next_run = date($mybb->settings['dateformat'], $task['nextrun']).", ".date($mybb->settings['timeformat'], $task['nextrun']);
- $table->construct_cell("{$task['title']}");
- $table->construct_cell($next_run, array("class" => "align_center"));
-
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_tasks, array('colspan' => 2));
- $table->construct_row();
- }
-
- $table->output($lang->next_3_tasks);
-
- if(isset($mybb->admin['permissions']['tools']['backupdb']) && $mybb->admin['permissions']['tools']['backupdb'] == 1)
- {
- $backups = array();
- $dir = MYBB_ADMIN_DIR.'backups/';
- $handle = opendir($dir);
- while(($file = readdir($handle)) !== false)
- {
- if(filetype(MYBB_ADMIN_DIR.'backups/'.$file) == 'file')
- {
- $ext = get_extension($file);
- if($ext == 'gz' || $ext == 'sql')
- {
- $backups[@filemtime(MYBB_ADMIN_DIR.'backups/'.$file)] = array(
- "file" => $file,
- "time" => @filemtime(MYBB_ADMIN_DIR.'backups/'.$file),
- "type" => $ext
- );
- }
- }
- }
-
- $count = count($backups);
- krsort($backups);
-
- $table = new Table;
- $table->construct_header($lang->name);
- $table->construct_header($lang->backup_time, array("width" => 200, "class" => "align_center"));
-
- $backupscnt = 0;
- foreach($backups as $backup)
- {
- ++$backupscnt;
-
- if($backupscnt == 4)
- {
- break;
- }
-
- $time = "-";
- if($backup['time'])
- {
- $time = my_date('relative', $backup['time']);
- }
-
- $table->construct_cell("{$backup['file']}");
- $table->construct_cell($time, array("class" => "align_center"));
- $table->construct_row();
- }
-
- if($count == 0)
- {
- $table->construct_cell($lang->no_backups, array('colspan' => 2));
- $table->construct_row();
- }
-
- $table->output($lang->existing_db_backups);
- }
-
- if(is_writable(MYBB_ROOT.'inc/settings.php'))
- {
- $message_settings = "{$lang->writable}";
- }
- else
- {
- $message_settings = "{$lang->not_writable}
{$lang->please_chmod_777}";
- ++$errors;
- }
-
- if(is_writable(MYBB_ROOT.'inc/config.php'))
- {
- $message_config = "{$lang->writable}";
- }
- else
- {
- $message_config = "{$lang->not_writable}
{$lang->please_chmod_777}";
- ++$errors;
- }
-
- $uploadspath = $mybb->settings['uploadspath'];
- if(my_substr($uploadspath, 0, 1) == '.')
- {
- $uploadspath = MYBB_ROOT . $mybb->settings['uploadspath'];
- }
- if(is_writable($uploadspath))
- {
- $message_upload = "{$lang->writable}";
- }
- else
- {
- $message_upload = "{$lang->not_writable}
{$lang->please_chmod_777}";
- ++$errors;
- }
-
- $avataruploadpath = $mybb->settings['avataruploadpath'];
- if(my_substr($avataruploadpath, 0, 1) == '.')
- {
- $avataruploadpath = MYBB_ROOT . $mybb->settings['avataruploadpath'];
- }
- if(is_writable($avataruploadpath))
- {
- $message_avatar = "{$lang->writable}";
- }
- else
- {
- $message_avatar = "{$lang->not_writable}
{$lang->please_chmod_777}";
- ++$errors;
- }
-
- if(is_writable(MYBB_ROOT.'inc/languages/'))
- {
- $message_language = "{$lang->writable}";
- }
- else
- {
- $message_language = "{$lang->not_writable}
{$lang->please_chmod_777}";
- ++$errors;
- }
-
- if(is_writable(MYBB_ROOT.$config['admin_dir'].'/backups/'))
- {
- $message_backup = "{$lang->writable}";
- }
- else
- {
- $message_backup = "{$lang->not_writable}
{$lang->please_chmod_777}";
- ++$errors;
- }
-
- if(is_writable(MYBB_ROOT.'/cache/'))
- {
- $message_cache = "{$lang->writable}";
- }
- else
- {
- $message_cache = "{$lang->not_writable}
{$lang->please_chmod_777}";
- ++$errors;
- }
-
- if(is_writable(MYBB_ROOT.'/cache/themes/'))
- {
- $message_themes = "{$lang->writable}";
- }
- else
- {
- $message_themes = "{$lang->not_writable}
{$lang->please_chmod_777}";
- ++$errors;
- }
-
- if($errors)
- {
- $page->output_error("{$errors} {$lang->error_chmod} {$lang->chmod_info} MyBB Docs.
");
- }
- else
- {
- $page->output_success("{$lang->success_chmod}
");
- }
-
- $table = new Table;
- $table->construct_header($lang->file);
- $table->construct_header($lang->location, array("colspan" => 2, 'width' => 250));
-
- $table->construct_cell("{$lang->config_file}");
- $table->construct_cell("./inc/config.php");
- $table->construct_cell($message_config);
- $table->construct_row();
-
- $table->construct_cell("{$lang->settings_file}");
- $table->construct_cell("./inc/settings.php");
- $table->construct_cell($message_settings);
- $table->construct_row();
-
- $table->construct_cell("{$lang->file_upload_dir}");
- $table->construct_cell($mybb->settings['uploadspath']);
- $table->construct_cell($message_upload);
- $table->construct_row();
-
- $table->construct_cell("{$lang->avatar_upload_dir}");
- $table->construct_cell($mybb->settings['avataruploadpath']);
- $table->construct_cell($message_avatar);
- $table->construct_row();
-
- $table->construct_cell("{$lang->language_files}");
- $table->construct_cell("./inc/languages");
- $table->construct_cell($message_language);
- $table->construct_row();
-
- $table->construct_cell("{$lang->backup_dir}");
- $table->construct_cell('./'.$config['admin_dir'].'/backups');
- $table->construct_cell($message_backup);
- $table->construct_row();
-
- $table->construct_cell("{$lang->cache_dir}");
- $table->construct_cell('./cache');
- $table->construct_cell($message_cache);
- $table->construct_row();
-
- $table->construct_cell("{$lang->themes_dir}");
- $table->construct_cell('./cache/themes');
- $table->construct_cell($message_themes);
- $table->construct_row();
-
- $plugins->run_hooks("admin_tools_system_health_output_chmod_list");
-
- $table->output($lang->chmod_files_and_dirs);
-
- $page->output_footer();
-}
diff --git a/html/forums/admin/modules/tools/tasks.php b/html/forums/admin/modules/tools/tasks.php
deleted file mode 100644
index 930326a..0000000
--- a/html/forums/admin/modules/tools/tasks.php
+++ /dev/null
@@ -1,770 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-require_once MYBB_ROOT."/inc/functions_task.php";
-
-$page->add_breadcrumb_item($lang->task_manager, "index.php?module=tools-tasks");
-
-$plugins->run_hooks("admin_tools_tasks_begin");
-
-/**
- * Validates a string or array of values
- *
- * @param string|array $value Comma-separated list or array of values
- * @param int $min Minimum value
- * @param int $max Maximum value
- * @param string $return_type Set "string" to return in a comma-separated list, or "array" to return in an array
- * @return string|array String or array of valid values OR false if string/array is invalid
- */
-function check_time_values($value, $min, $max, $return_type)
-{
- // If the values aren't in an array form, make them into an array
- if(!is_array($value))
- {
- // Empty value == *
- if($value === '')
- {
- return ($return_type == 'string') ? '*' : array('*');
- }
- $implode = 1;
- $value = explode(',', $value);
- }
- // If * is in the array, always return with * because it overrides all
- if(in_array('*', $value))
- {
- return ($return_type == 'string') ? '*' : array('*');
- }
- // Validate each value in array
- foreach($value as $time)
- {
- if($time < $min || $time > $max)
- {
- return false;
- }
- }
- // Return based on return type
- if($return_type == 'string')
- {
- $value = implode(',', $value);
- }
- return $value;
-}
-
-if($mybb->input['action'] == "add")
-{
- $plugins->run_hooks("admin_tools_tasks_add");
-
- if($mybb->request_method == "post")
- {
- if(!trim($mybb->input['title']))
- {
- $errors[] = $lang->error_missing_title;
- }
-
- if(!trim($mybb->input['description']))
- {
- $errors[] = $lang->error_missing_description;
- }
-
- if(!file_exists(MYBB_ROOT."inc/tasks/".$mybb->input['file'].".php"))
- {
- $errors[] = $lang->error_invalid_task_file;
- }
-
- $mybb->input['minute'] = check_time_values($mybb->input['minute'], 0, 59, 'string');
- if($mybb->input['minute'] === false)
- {
- $errors[] = $lang->error_invalid_minute;
- }
-
- $mybb->input['hour'] = check_time_values($mybb->input['hour'], 0, 59, 'string');
- if($mybb->input['hour'] === false)
- {
- $errors[] = $lang->error_invalid_hour;
- }
-
- if($mybb->input['day'] != "*" && $mybb->input['day'] != '')
- {
- $mybb->input['day'] = check_time_values($mybb->input['day'], 1, 31, 'string');
- if($mybb->input['day'] === false)
- {
- $errors[] = $lang->error_invalid_day;
- }
- $mybb->input['weekday'] = array('*');
- }
- else
- {
- $mybb->input['weekday'] = check_time_values($mybb->input['weekday'], 0, 6, 'array');
- if($mybb->input['weekday'] === false)
- {
- $errors[] = $lang->error_invalid_weekday;
- }
- $mybb->input['day'] = '*';
- }
-
- $mybb->input['month'] = check_time_values($mybb->input['month'], 1, 12, 'array');
- if($mybb->input['month'] === false)
- {
- $errors[] = $lang->error_invalid_month;
- }
-
- if(!$errors)
- {
- $new_task = array(
- "title" => $db->escape_string($mybb->input['title']),
- "description" => $db->escape_string($mybb->input['description']),
- "file" => $db->escape_string($mybb->input['file']),
- "minute" => $db->escape_string($mybb->input['minute']),
- "hour" => $db->escape_string($mybb->input['hour']),
- "day" => $db->escape_string($mybb->input['day']),
- "month" => $db->escape_string(implode(',', $mybb->input['month'])),
- "weekday" => $db->escape_string(implode(',', $mybb->input['weekday'])),
- "enabled" => $mybb->get_input('enabled', MyBB::INPUT_INT),
- "logging" => $mybb->get_input('logging', MyBB::INPUT_INT)
- );
-
- $new_task['nextrun'] = fetch_next_run($new_task);
- $tid = $db->insert_query("tasks", $new_task);
-
- $plugins->run_hooks("admin_tools_tasks_add_commit");
-
- $cache->update_tasks();
-
- // Log admin action
- log_admin_action($tid, htmlspecialchars_uni($mybb->input['title']));
-
- flash_message($lang->success_task_created, 'success');
- admin_redirect("index.php?module=tools-tasks");
- }
- }
- $page->add_breadcrumb_item($lang->add_new_task);
- $page->output_header($lang->scheduled_tasks." - ".$lang->add_new_task);
-
-
- $sub_tabs['scheduled_tasks'] = array(
- 'title' => $lang->scheduled_tasks,
- 'link' => "index.php?module=tools-tasks"
- );
-
- $sub_tabs['add_task'] = array(
- 'title' => $lang->add_new_task,
- 'link' => "index.php?module=tools-tasks&action=add",
- 'description' => $lang->add_new_task_desc
- );
-
- $sub_tabs['task_logs'] = array(
- 'title' => $lang->view_task_logs,
- 'link' => "index.php?module=tools-tasks&action=logs"
- );
-
- $page->output_nav_tabs($sub_tabs, 'add_task');
- $form = new Form("index.php?module=tools-tasks&action=add", "post", "add");
- if($errors)
- {
- $page->output_inline_error($errors);
- }
- else
- {
- $mybb->input['minute'] = '*';
- $mybb->input['hour'] = '*';
- $mybb->input['day'] = '*';
- $mybb->input['weekday'] = '*';
- $mybb->input['month'] = '*';
- }
- $form_container = new FormContainer($lang->add_new_task);
- $form_container->output_row($lang->title." *", "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
- $form_container->output_row($lang->short_description." *", "", $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description');
-
- $task_list = array();
- $task_files = scandir(MYBB_ROOT."inc/tasks/");
- foreach($task_files as $task_file)
- {
- if(is_file(MYBB_ROOT."inc/tasks/{$task_file}") && get_extension($task_file) == "php")
- {
- $file_id = preg_replace("#\.".get_extension($task_file)."$#i", "$1", $task_file);
- $task_list[$file_id] = $task_file;
- }
- }
- $form_container->output_row($lang->task_file." *", $lang->task_file_desc, $form->generate_select_box("file", $task_list, $mybb->input['file'], array('id' => 'file')), 'file');
- $form_container->output_row($lang->time_minutes, $lang->time_minutes_desc, $form->generate_text_box('minute', $mybb->input['minute'], array('id' => 'minute')), 'minute');
- $form_container->output_row($lang->time_hours, $lang->time_hours_desc, $form->generate_text_box('hour', $mybb->input['hour'], array('id' => 'hour')), 'hour');
- $form_container->output_row($lang->time_days_of_month, $lang->time_days_of_month_desc, $form->generate_text_box('day', $mybb->input['day'], array('id' => 'day')), 'day');
-
- $options = array(
- "*" => $lang->every_weekday,
- "0" => $lang->sunday,
- "1" => $lang->monday,
- "2" => $lang->tuesday,
- "3" => $lang->wednesday,
- "4" => $lang->thursday,
- "5" => $lang->friday,
- "6" => $lang->saturday
- );
- $form_container->output_row($lang->time_weekdays, $lang->time_weekdays_desc, $form->generate_select_box('weekday[]', $options, $mybb->input['weekday'], array('id' => 'weekday', 'multiple' => true, 'size' => 8)), 'weekday');
-
- $options = array(
- "*" => $lang->every_month,
- "1" => $lang->january,
- "2" => $lang->february,
- "3" => $lang->march,
- "4" => $lang->april,
- "5" => $lang->may,
- "6" => $lang->june,
- "7" => $lang->july,
- "8" => $lang->august,
- "9" => $lang->september,
- "10" => $lang->october,
- "11" => $lang->november,
- "12" => $lang->december
- );
- $form_container->output_row($lang->time_months, $lang->time_months_desc, $form->generate_select_box('month[]', $options, $mybb->input['month'], array('id' => 'month', 'multiple' => true, 'size' => 13)), 'month');
-
- $form_container->output_row($lang->enable_logging." *", "", $form->generate_yes_no_radio("logging", $mybb->input['logging'], true));
-
- $form_container->output_row($lang->enabled." *", "", $form->generate_yes_no_radio("enabled", $mybb->input['enabled'], true));
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->save_task);
-
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "edit")
-{
- $query = $db->simple_select("tasks", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");
- $task = $db->fetch_array($query);
-
- // Does the task not exist?
- if(!$task['tid'])
- {
- flash_message($lang->error_invalid_task, 'error');
- admin_redirect("index.php?module=tools-tasks");
- }
-
- $plugins->run_hooks("admin_tools_tasks_edit");
-
- if($mybb->request_method == "post")
- {
- if(!trim($mybb->input['title']))
- {
- $errors[] = $lang->error_missing_title;
- }
-
- if(!trim($mybb->input['description']))
- {
- $errors[] = $lang->error_missing_description;
- }
-
- if(!file_exists(MYBB_ROOT."inc/tasks/".$mybb->input['file'].".php"))
- {
- $errors[] = $lang->error_invalid_task_file;
- }
-
- $mybb->input['minute'] = check_time_values($mybb->input['minute'], 0, 59, 'string');
- if($mybb->input['minute'] === false)
- {
- $errors[] = $lang->error_invalid_minute;
- }
-
- $mybb->input['hour'] = check_time_values($mybb->input['hour'], 0, 59, 'string');
- if($mybb->input['hour'] === false)
- {
- $errors[] = $lang->error_invalid_hour;
- }
-
- if($mybb->input['day'] != "*" && $mybb->input['day'] != '')
- {
- $mybb->input['day'] = check_time_values($mybb->input['day'], 1, 31, 'string');
- if($mybb->input['day'] === false)
- {
- $errors[] = $lang->error_invalid_day;
- }
- $mybb->input['weekday'] = array('*');
- }
- else
- {
- $mybb->input['weekday'] = check_time_values($mybb->input['weekday'], 0, 6, 'array');
- if($mybb->input['weekday'] === false)
- {
- $errors[] = $lang->error_invalid_weekday;
- }
- $mybb->input['day'] = '*';
- }
-
- $mybb->input['month'] = check_time_values($mybb->input['month'], 1, 12, 'array');
- if($mybb->input['month'] === false)
- {
- $errors[] = $lang->error_invalid_month;
- }
-
- if(!$errors)
- {
- $enable_confirmation = false;
- // Check if we need to ask the user to confirm turning on the task
- if(($task['file'] == "backupdb" || $task['file'] == "checktables") && $task['enabled'] == 0 && $mybb->input['enabled'] == 1)
- {
- $mybb->input['enabled'] = 0;
- $enable_confirmation = true;
- }
-
- $updated_task = array(
- "title" => $db->escape_string($mybb->input['title']),
- "description" => $db->escape_string($mybb->input['description']),
- "file" => $db->escape_string($mybb->input['file']),
- "minute" => $db->escape_string($mybb->input['minute']),
- "hour" => $db->escape_string($mybb->input['hour']),
- "day" => $db->escape_string($mybb->input['day']),
- "month" => $db->escape_string(implode(',', $mybb->input['month'])),
- "weekday" => $db->escape_string(implode(',', $mybb->input['weekday'])),
- "enabled" => $mybb->get_input('enabled', MyBB::INPUT_INT),
- "logging" => $mybb->get_input('logging', MyBB::INPUT_INT)
- );
-
- $updated_task['nextrun'] = fetch_next_run($updated_task);
-
- $plugins->run_hooks("admin_tools_tasks_edit_commit");
-
- $db->update_query("tasks", $updated_task, "tid='{$task['tid']}'");
-
- $cache->update_tasks();
-
- // Log admin action
- log_admin_action($task['tid'], htmlspecialchars_uni($mybb->input['title']));
-
- flash_message($lang->success_task_updated, 'success');
-
- if($enable_confirmation == true)
- {
- admin_redirect("index.php?module=tools-tasks&action=enable&tid={$task['tid']}&my_post_key={$mybb->post_code}");
- }
- else
- {
- admin_redirect("index.php?module=tools-tasks");
- }
- }
- }
-
- $page->add_breadcrumb_item($lang->edit_task);
- $page->output_header($lang->scheduled_tasks." - ".$lang->edit_task);
-
- $sub_tabs['edit_task'] = array(
- 'title' => $lang->edit_task,
- 'description' => $lang->edit_task_desc,
- 'link' => "index.php?module=tools-tasks&action=edit&tid={$task['tid']}"
- );
-
- $page->output_nav_tabs($sub_tabs, 'edit_task');
-
- $form = new Form("index.php?module=tools-tasks&action=edit", "post");
-
- if($errors)
- {
- $page->output_inline_error($errors);
- $task_data = $mybb->input;
- }
- else
- {
- $task_data = $task;
- $task_data['weekday'] = explode(',', $task['weekday']);
- $task_data['month'] = explode(',', $task['month']);
- }
-
- $form_container = new FormContainer($lang->edit_task);
- echo $form->generate_hidden_field("tid", $task['tid']);
- $form_container->output_row($lang->title." *", "", $form->generate_text_box('title', $task_data['title'], array('id' => 'title')), 'title');
- $form_container->output_row($lang->short_description." *", "", $form->generate_text_box('description', $task_data['description'], array('id' => 'description')), 'description');
-
- $task_list = array();
- $task_files = scandir(MYBB_ROOT."inc/tasks/");
- foreach($task_files as $task_file)
- {
- if(is_file(MYBB_ROOT."inc/tasks/{$task_file}") && get_extension($task_file) == "php")
- {
- $file_id = preg_replace("#\.".get_extension($task_file)."$#i", "$1", $task_file);
- $task_list[$file_id] = $task_file;
- }
- }
- $form_container->output_row($lang->task." *", $lang->task_file_desc, $form->generate_select_box("file", $task_list, $task_data['file'], array('id' => 'file')), 'file');
- $form_container->output_row($lang->time_minutes, $lang->time_minutes_desc, $form->generate_text_box('minute', $task_data['minute'], array('id' => 'minute')), 'minute');
- $form_container->output_row($lang->time_hours, $lang->time_hours_desc, $form->generate_text_box('hour', $task_data['hour'], array('id' => 'hour')), 'hour');
- $form_container->output_row($lang->time_days_of_month, $lang->time_days_of_month_desc, $form->generate_text_box('day', $task_data['day'], array('id' => 'day')), 'day');
-
- $options = array(
- "*" => $lang->every_weekday,
- "0" => $lang->sunday,
- "1" => $lang->monday,
- "2" => $lang->tuesday,
- "3" => $lang->wednesday,
- "4" => $lang->thursday,
- "5" => $lang->friday,
- "6" => $lang->saturday
- );
- $form_container->output_row($lang->time_weekdays, $lang->time_weekdays_desc, $form->generate_select_box('weekday[]', $options, $task_data['weekday'], array('id' => 'weekday', 'multiple' => true)), 'weekday');
-
- $options = array(
- "*" => $lang->every_month,
- "1" => $lang->january,
- "2" => $lang->february,
- "3" => $lang->march,
- "4" => $lang->april,
- "5" => $lang->may,
- "6" => $lang->june,
- "7" => $lang->july,
- "8" => $lang->august,
- "9" => $lang->september,
- "10" => $lang->october,
- "11" => $lang->november,
- "12" => $lang->december
- );
- $form_container->output_row($lang->time_months, $lang->time_months_desc, $form->generate_select_box('month[]', $options, $task_data['month'], array('id' => 'month', 'multiple' => true)), 'month');
-
- $form_container->output_row($lang->enable_logging." *", "", $form->generate_yes_no_radio("logging", $task_data['logging'], true));
-
- $form_container->output_row($lang->enabled." *", "", $form->generate_yes_no_radio("enabled", $task_data['enabled'], true));
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->save_task);
-
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "delete")
-{
- $query = $db->simple_select("tasks", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");
- $task = $db->fetch_array($query);
-
- // Does the task not exist?
- if(!$task['tid'])
- {
- flash_message($lang->error_invalid_task, 'error');
- admin_redirect("index.php?module=tools-tasks");
- }
-
- // User clicked no
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=tools-tasks");
- }
-
- $plugins->run_hooks("admin_tools_tasks_delete");
-
- if($mybb->request_method == "post")
- {
- // Delete the task & any associated task log entries
- $db->delete_query("tasks", "tid='{$task['tid']}'");
- $db->delete_query("tasklog", "tid='{$task['tid']}'");
-
- // Fetch next task run
-
- $plugins->run_hooks("admin_tools_tasks_delete_commit");
-
- $cache->update_tasks();
-
- // Log admin action
- log_admin_action($task['tid'], htmlspecialchars_uni($task['title']));
-
- flash_message($lang->success_task_deleted, 'success');
- admin_redirect("index.php?module=tools-tasks");
- }
- else
- {
- $page->output_confirm_action("index.php?module=tools-tasks&action=delete&tid={$task['tid']}", $lang->confirm_task_deletion);
- }
-}
-
-if($mybb->input['action'] == "enable" || $mybb->input['action'] == "disable")
-{
- if(!verify_post_check($mybb->input['my_post_key']))
- {
- flash_message($lang->invalid_post_verify_key2, 'error');
- admin_redirect("index.php?module=tools-tasks");
- }
-
- $query = $db->simple_select("tasks", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");
- $task = $db->fetch_array($query);
-
- // Does the task not exist?
- if(!$task['tid'])
- {
- flash_message($lang->error_invalid_task, 'error');
- admin_redirect("index.php?module=tools-tasks");
- }
-
- if($mybb->input['action'] == "enable")
- {
- $plugins->run_hooks("admin_tools_tasks_enable");
- }
- else
- {
- $plugins->run_hooks("admin_tools_tasks_disable");
- }
-
- if($mybb->input['action'] == "enable")
- {
- if($task['file'] == "backupdb" || $task['file'] == "checktables")
- {
- // User clicked no
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=tools-tasks");
- }
-
- if($mybb->request_method == "post")
- {
- $nextrun = fetch_next_run($task);
- $db->update_query("tasks", array("nextrun" => $nextrun, "enabled" => 1), "tid='{$task['tid']}'");
-
- $plugins->run_hooks("admin_tools_tasks_enable_commit");
-
- $cache->update_tasks();
-
- // Log admin action
- log_admin_action($task['tid'], htmlspecialchars_uni($task['title']), $mybb->input['action']);
-
- flash_message($lang->success_task_enabled, 'success');
- admin_redirect("index.php?module=tools-tasks");
- }
- else
- {
- $page->output_confirm_action("index.php?module=tools-tasks&action=enable&tid={$task['tid']}", $lang->confirm_task_enable);
- }
- }
- else
- {
- $nextrun = fetch_next_run($task);
- $db->update_query("tasks", array("nextrun" => $nextrun, "enabled" => 1), "tid='{$task['tid']}'");
-
- $plugins->run_hooks("admin_tools_tasks_enable_commit");
-
- $cache->update_tasks();
-
- // Log admin action
- log_admin_action($task['tid'], htmlspecialchars_uni($task['title']), $mybb->input['action']);
-
- flash_message($lang->success_task_enabled, 'success');
- admin_redirect("index.php?module=tools-tasks");
- }
- }
- else
- {
- $db->update_query("tasks", array("enabled" => 0), "tid='{$task['tid']}'");
-
- $plugins->run_hooks("admin_tools_tasks_disable_commit");
-
- $cache->update_tasks();
-
- // Log admin action
- log_admin_action($task['tid'], htmlspecialchars_uni($task['title']), htmlspecialchars_uni($mybb->input['action']));
-
- flash_message($lang->success_task_disabled, 'success');
- admin_redirect("index.php?module=tools-tasks");
- }
-}
-
-if($mybb->input['action'] == "run")
-{
- if(!verify_post_check($mybb->input['my_post_key']))
- {
- flash_message($lang->invalid_post_verify_key2, 'error');
- admin_redirect("index.php?module=tools-tasks");
- }
-
- ignore_user_abort(true);
- @set_time_limit(0);
-
- $plugins->run_hooks("admin_tools_tasks_run");
-
- $query = $db->simple_select("tasks", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");
- $task = $db->fetch_array($query);
-
- // Does the task not exist?
- if(!$task['tid'])
- {
- flash_message($lang->error_invalid_task, 'error');
- admin_redirect("index.php?module=tools-tasks");
- }
-
- run_task($task['tid']);
-
- $plugins->run_hooks("admin_tools_tasks_run_commit");
-
- // Log admin action
- log_admin_action($task['tid'], htmlspecialchars_uni($task['title']));
-
- flash_message($lang->success_task_run, 'success');
- admin_redirect("index.php?module=tools-tasks");
-}
-
-if($mybb->input['action'] == "logs")
-{
- $plugins->run_hooks("admin_tools_tasks_logs");
-
- $page->output_header($lang->task_logs);
-
- $sub_tabs['scheduled_tasks'] = array(
- 'title' => $lang->scheduled_tasks,
- 'link' => "index.php?module=tools-tasks"
- );
-
- $sub_tabs['add_task'] = array(
- 'title' => $lang->add_new_task,
- 'link' => "index.php?module=tools-tasks&action=add"
- );
-
- $sub_tabs['task_logs'] = array(
- 'title' => $lang->view_task_logs,
- 'link' => "index.php?module=tools-tasks&action=logs",
- 'description' => $lang->view_task_logs_desc
- );
-
- $page->output_nav_tabs($sub_tabs, 'task_logs');
-
- $table = new Table;
- $table->construct_header($lang->task);
- $table->construct_header($lang->date, array("class" => "align_center", "width" => 200));
- $table->construct_header($lang->data, array("width" => "60%"));
-
- $query = $db->simple_select("tasklog", "COUNT(*) AS log_count");
- $log_count = $db->fetch_field($query, "log_count");
-
- $start = 0;
- $per_page = 50;
- $current_page = 1;
-
- if($mybb->input['page'] > 0)
- {
- $current_page = $mybb->get_input('page', MyBB::INPUT_INT);
- $start = ($current_page-1)*$per_page;
- $pages = $log_count / $per_page;
- $pages = ceil($pages);
- if($current_page > $pages)
- {
- $start = 0;
- $current_page = 1;
- }
- }
-
- $pagination = draw_admin_pagination($current_page, $per_page, $log_count, "index.php?module=tools-tasks&action=logs&page={page}");
-
- $query = $db->query("
- SELECT l.*, t.title
- FROM ".TABLE_PREFIX."tasklog l
- LEFT JOIN ".TABLE_PREFIX."tasks t ON (t.tid=l.tid)
- ORDER BY l.dateline DESC
- LIMIT {$start}, {$per_page}
- ");
- while($log_entry = $db->fetch_array($query))
- {
- $log_entry['title'] = htmlspecialchars_uni($log_entry['title']);
- $log_entry['data'] = htmlspecialchars_uni($log_entry['data']);
-
- $date = my_date('relative', $log_entry['dateline']);
- $table->construct_cell("{$log_entry['title']}");
- $table->construct_cell($date, array("class" => "align_center"));
- $table->construct_cell($log_entry['data']);
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_task_logs, array("colspan" => "3"));
- $table->construct_row();
- }
-
- $table->output($lang->task_logs);
- echo $pagination;
-
- $page->output_footer();
-}
-
-if(!$mybb->input['action'])
-{
- $page->output_header($lang->task_manager);
-
- $sub_tabs['scheduled_tasks'] = array(
- 'title' => $lang->scheduled_tasks,
- 'link' => "index.php?module=tools-tasks",
- 'description' => $lang->scheduled_tasks_desc
- );
-
- $sub_tabs['add_task'] = array(
- 'title' => $lang->add_new_task,
- 'link' => "index.php?module=tools-tasks&action=add"
- );
-
- $sub_tabs['task_logs'] = array(
- 'title' => $lang->view_task_logs,
- 'link' => "index.php?module=tools-tasks&action=logs"
- );
-
- $plugins->run_hooks("admin_tools_tasks_start");
-
- $page->output_nav_tabs($sub_tabs, 'scheduled_tasks');
-
- $table = new Table;
- $table->construct_header($lang->task);
- $table->construct_header($lang->next_run, array("class" => "align_center", "width" => 200));
- $table->construct_header($lang->controls, array("class" => "align_center", "width" => 150));
-
- $query = $db->simple_select("tasks", "*", "", array("order_by" => "title", "order_dir" => "asc"));
- while($task = $db->fetch_array($query))
- {
- $task['title'] = htmlspecialchars_uni($task['title']);
- $task['description'] = htmlspecialchars_uni($task['description']);
- $next_run = date($mybb->settings['dateformat'], $task['nextrun']).", ".date($mybb->settings['timeformat'], $task['nextrun']);
- if($task['enabled'] == 1)
- {
- $icon = "
style}/images/icons/bullet_on.png\" alt=\"({$lang->alt_enabled})\" title=\"{$lang->alt_enabled}\" style=\"vertical-align: middle;\" /> ";
- }
- else
- {
- $icon = "
style}/images/icons/bullet_off.png\" alt=\"({$lang->alt_disabled})\" title=\"{$lang->alt_disabled}\" style=\"vertical-align: middle;\" /> ";
- }
- $table->construct_cell("");
- $table->construct_cell($next_run, array("class" => "align_center"));
-
- $popup = new PopupMenu("task_{$task['tid']}", $lang->options);
- $popup->add_item($lang->edit_task, "index.php?module=tools-tasks&action=edit&tid={$task['tid']}");
- if($task['enabled'] == 1)
- {
- $popup->add_item($lang->run_task, "index.php?module=tools-tasks&action=run&tid={$task['tid']}&my_post_key={$mybb->post_code}");
- $popup->add_item($lang->disable_task, "index.php?module=tools-tasks&action=disable&tid={$task['tid']}&my_post_key={$mybb->post_code}");
- }
- else
- {
- $popup->add_item($lang->enable_task, "index.php?module=tools-tasks&action=enable&tid={$task['tid']}&my_post_key={$mybb->post_code}");
- }
- $popup->add_item($lang->delete_task, "index.php?module=tools-tasks&action=delete&tid={$task['tid']}&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_task_deletion}')");
- $table->construct_cell($popup->fetch(), array("class" => "align_center"));
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_tasks, array('colspan' => 3));
- $table->construct_row();
- }
-
- $table->output($lang->scheduled_tasks);
-
- $page->output_footer();
-}
diff --git a/html/forums/admin/modules/tools/warninglog.php b/html/forums/admin/modules/tools/warninglog.php
deleted file mode 100644
index 903255a..0000000
--- a/html/forums/admin/modules/tools/warninglog.php
+++ /dev/null
@@ -1,480 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->warning_logs, "index.php?module=tools-warninglog");
-
-$plugins->run_hooks("admin_tools_warninglog_begin");
-
-// Revoke a warning
-if($mybb->input['action'] == "do_revoke" && $mybb->request_method == "post")
-{
- $query = $db->simple_select("warnings", "*", "wid='".$mybb->get_input('wid', MyBB::INPUT_INT)."'");
- $warning = $db->fetch_array($query);
-
- if(!$warning['wid'])
- {
- flash_message($lang->error_invalid_warning, 'error');
- admin_redirect("index.php?module=tools-warninglog");
- }
- else if($warning['daterevoked'])
- {
- flash_message($lang->error_already_revoked, 'error');
- admin_redirect("index.php?module=tools-warninglog&action=view&wid={$warning['wid']}");
- }
-
- $user = get_user($warning['uid']);
-
- $plugins->run_hooks("admin_tools_warninglog_do_revoke");
-
- if(!trim($mybb->input['reason']))
- {
- $warn_errors[] = $lang->error_no_revoke_reason;
- $mybb->input['action'] = "view";
- }
- else
- {
- // Warning is still active, lower users point count
- if($warning['expired'] != 1)
- {
- $new_warning_points = $user['warningpoints']-$warning['points'];
- if($new_warning_points < 0)
- {
- $new_warning_points = 0;
- }
-
- // Update user
- $updated_user = array(
- "warningpoints" => $new_warning_points
- );
- }
-
- // Update warning
- $updated_warning = array(
- "expired" => 1,
- "daterevoked" => TIME_NOW,
- "revokedby" => $mybb->user['uid'],
- "revokereason" => $db->escape_string($mybb->input['reason'])
- );
-
- $plugins->run_hooks("admin_tools_warninglog_do_revoke_commit");
-
- if($warning['expired'] != 1)
- {
- $db->update_query("users", $updated_user, "uid='{$warning['uid']}'");
- }
-
- $db->update_query("warnings", $updated_warning, "wid='{$warning['wid']}'");
-
- flash_message($lang->redirect_warning_revoked, 'success');
- admin_redirect("index.php?module=tools-warninglog&action=view&wid={$warning['wid']}");
- }
-}
-
-// Detailed view of a warning
-if($mybb->input['action'] == "view")
-{
- $query = $db->query("
- SELECT w.*, t.title AS type_title, u.username, p.subject AS post_subject
- FROM ".TABLE_PREFIX."warnings w
- LEFT JOIN ".TABLE_PREFIX."warningtypes t ON (t.tid=w.tid)
- LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=w.issuedby)
- LEFT JOIN ".TABLE_PREFIX."posts p ON (p.pid=w.pid)
- WHERE w.wid='".$mybb->get_input('wid', MyBB::INPUT_INT)."'
- ");
- $warning = $db->fetch_array($query);
-
- if(!$warning['wid'])
- {
- flash_message($lang->error_invalid_warning, 'error');
- admin_redirect("index.php?module=tools-warninglog");
- }
-
- $user = get_user((int)$warning['uid']);
-
- $plugins->run_hooks("admin_tools_warninglog_view");
-
- $page->add_breadcrumb_item($lang->warning_details, "index.php?module=tools-warninglog&action=view&wid={$warning['wid']}");
-
- $page->output_header($lang->warning_details);
-
- $user_link = build_profile_link(htmlspecialchars_uni($user['username']), $user['uid'], "_blank");
-
- if(is_array($warn_errors))
- {
- $page->output_inline_error($warn_errors);
- $mybb->input['reason'] = htmlspecialchars_uni($mybb->input['reason']);
- }
-
- $table = new Table;
-
- $post_link = "";
- if($warning['post_subject'])
- {
- if(!is_object($parser))
- {
- require_once MYBB_ROOT."inc/class_parser.php";
- $parser = new postParser;
- }
-
- $warning['post_subject'] = $parser->parse_badwords($warning['post_subject']);
- $warning['post_subject'] = htmlspecialchars_uni($warning['post_subject']);
- $post_link = get_post_link($warning['pid']);
- $table->construct_cell("{$lang->warned_user}
{$user_link}");
- $table->construct_cell("{$lang->post}
settings['bburl']}/{$post_link}\" target=\"_blank\">{$warning['post_subject']}");
- $table->construct_row();
- }
- else
- {
- $table->construct_cell("{$lang->warned_user}
{$user_link}", array('colspan' => 2));
- $table->construct_row();
- }
-
- $issuedby = build_profile_link(htmlspecialchars_uni($warning['username']), $warning['issuedby'], "_blank");
- $notes = nl2br(htmlspecialchars_uni($warning['notes']));
-
- $date_issued = my_date('relative', $warning['dateline']);
- if($warning['type_title'])
- {
- $warning_type = $warning['type_title'];
- }
- else
- {
- $warning_type = $warning['title'];
- }
- $warning_type = htmlspecialchars_uni($warning_type);
- if($warning['points'] > 0)
- {
- $warning['points'] = "+{$warning['points']}";
- }
-
- $points = $lang->sprintf($lang->warning_points, $warning['points']);
- if($warning['expired'] != 1)
- {
- if($warning['expires'] == 0)
- {
- $expires = $lang->never;
- }
- else
- {
- $expires = my_date('relative', $warning['expires']);
- }
- $status = $lang->warning_active;
- }
- else
- {
- if($warning['daterevoked'])
- {
- $expires = $status = $lang->warning_revoked;
- }
- else if($warning['expires'])
- {
- $expires = $status = $lang->already_expired;
- }
- }
-
- $table->construct_cell("{$lang->warning}
{$warning_type} {$points}", array('width' => '50%'));
- $table->construct_cell("{$lang->date_issued}
{$date_issued}", array('width' => '50%'));
- $table->construct_row();
-
- $table->construct_cell("{$lang->issued_by}
{$issuedby}", array('width' => '50%'));
- $table->construct_cell("{$lang->expires}
{$expires}", array('width' => '50%'));
- $table->construct_row();
-
- $table->construct_cell("{$lang->warning_note}
{$notes}", array('colspan' => 2));
- $table->construct_row();
-
- $table->output("{$status}
".$lang->warning_details);
-
- if(!$warning['daterevoked'])
- {
- $form = new Form("index.php?module=tools-warninglog", "post");
- $form_container = new FormContainer($lang->revoke_warning);
- echo $form->generate_hidden_field('action', 'do_revoke');
- echo $form->generate_hidden_field('wid', $warning['wid']);
- $form_container->output_row("", $lang->revoke_warning_desc, $form->generate_text_area('reason', $mybb->input['reason'], array('id' => 'reason')), 'reason');
-
- $form_container->end();
- $buttons[] = $form->generate_submit_button($lang->revoke_warning);
- $form->output_submit_wrapper($buttons);
- $form->end();
- }
- else
- {
- $date_revoked = my_date('relative', $warning['daterevoked']);
- $revoked_user = get_user($warning['revokedby']);
- $revoked_by = build_profile_link(htmlspecialchars_uni($revoked_user['username']), $revoked_user['uid'], "_blank");
- $revoke_reason = nl2br(htmlspecialchars_uni($warning['revokereason']));
-
- $revoke_table = new Table;
- $revoke_table->construct_cell("{$lang->revoked_by}
{$revoked_by}", array('width' => '50%'));
- $revoke_table->construct_cell("{$lang->date_revoked}
{$date_revoked}", array('width' => '50%'));
- $revoke_table->construct_row();
-
- $revoke_table->construct_cell("{$lang->reason}
{$revoke_reason}", array('colspan' => 2));
- $revoke_table->construct_row();
-
- $revoke_table->output($lang->warning_is_revoked);
- }
-
- $page->output_footer();
-}
-
-if(!$mybb->input['action'])
-{
- $plugins->run_hooks("admin_tools_warninglog_start");
-
- $page->output_header($lang->warning_logs);
-
- $sub_tabs['warning_logs'] = array(
- 'title' => $lang->warning_logs,
- 'link' => "index.php?module=tools-warninglog",
- 'description' => $lang->warning_logs_desc
- );
-
- $page->output_nav_tabs($sub_tabs, 'warning_logs');
-
- // Filter options
- $where_sql = '';
- if(!empty($mybb->input['filter']['username']))
- {
- $search_user = get_user_by_username($mybb->input['filter']['username']);
-
- $mybb->input['filter']['uid'] = (int)$search_user['uid'];
- $mybb->input['filter']['uid'] = $db->fetch_field($query, "uid");
- }
- if($mybb->input['filter']['uid'])
- {
- $search['uid'] = (int)$mybb->input['filter']['uid'];
- $where_sql .= " AND w.uid='{$search['uid']}'";
- if(!isset($mybb->input['search']['username']))
- {
- $user = get_user($mybb->input['search']['uid']);
- $mybb->input['search']['username'] = $user['username'];
- }
- }
- if(!empty($mybb->input['filter']['mod_username']))
- {
- $mod_user = get_user_by_username($mybb->input['filter']['mod_username']);
-
- $mybb->input['filter']['mod_uid'] = (int)$mod_user['uid'];
- }
- if($mybb->input['filter']['mod_uid'])
- {
- $search['mod_uid'] = (int)$mybb->input['filter']['mod_uid'];
- $where_sql .= " AND w.issuedby='{$search['mod_uid']}'";
- if(!isset($mybb->input['search']['mod_username']))
- {
- $mod_user = get_user($mybb->input['search']['uid']);
- $mybb->input['search']['mod_username'] = $mod_user['username'];
- }
- }
- if($mybb->input['filter']['reason'])
- {
- $search['reason'] = $db->escape_string_like($mybb->input['filter']['reason']);
- $where_sql .= " AND (w.notes LIKE '%{$search['reason']}%' OR t.title LIKE '%{$search['reason']}%' OR w.title LIKE '%{$search['reason']}%')";
- }
- $sortbysel = array();
- switch($mybb->input['filter']['sortby'])
- {
- case "username":
- $sortby = "u.username";
- $sortbysel['username'] = ' selected="selected"';
- break;
- case "expires":
- $sortby = "w.expires";
- $sortbysel['expires'] = ' selected="selected"';
- break;
- case "issuedby":
- $sortby = "i.username";
- $sortbysel['issuedby'] = ' selected="selected"';
- break;
- default: // "dateline"
- $sortby = "w.dateline";
- $sortbysel['dateline'] = ' selected="selected"';
- }
- $order = $mybb->input['filter']['order'];
- $ordersel = array();
- if($order != "asc")
- {
- $order = "desc";
- $ordersel['desc'] = ' selected="selected"';
- }
- else
- {
- $ordersel['asc'] = ' selected="selected"';
- }
-
- // Expire any warnings past their expiration date
- require_once MYBB_ROOT.'inc/datahandlers/warnings.php';
- $warningshandler = new WarningsHandler('update');
-
- $warningshandler->expire_warnings();
-
- // Pagination stuff
- $sql = "
- SELECT COUNT(wid) as count
- FROM
- ".TABLE_PREFIX."warnings w
- LEFT JOIN ".TABLE_PREFIX."warningtypes t ON (w.tid=t.tid)
- WHERE 1=1
- {$where_sql}
- ";
- $query = $db->query($sql);
- $total_warnings = $db->fetch_field($query, 'count');
- $view_page = 1;
- if(isset($mybb->input['page']) && $mybb->get_input('page', MyBB::INPUT_INT) > 0)
- {
- $view_page = $mybb->get_input('page', MyBB::INPUT_INT);
- }
- $per_page = 20;
- if(isset($mybb->input['filter']['per_page']) && (int)$mybb->input['filter']['per_page'] > 0)
- {
- $per_page = (int)$mybb->input['filter']['per_page'];
- }
- $start = ($view_page-1) * $per_page;
- // Build the base URL for pagination links
- $url = 'index.php?module=tools-warninglog';
- if(is_array($mybb->input['filter']) && count($mybb->input['filter']))
- {
- foreach($mybb->input['filter'] as $field => $value)
- {
- $value = urlencode($value);
- $url .= "&filter[{$field}]={$value}";
- }
- }
-
- // The actual query
- $sql = "
- SELECT
- w.wid, w.title as custom_title, w.points, w.dateline, w.issuedby, w.expires, w.expired, w.daterevoked, w.revokedby,
- t.title,
- u.uid, u.username, u.usergroup, u.displaygroup,
- i.uid as mod_uid, i.username as mod_username, i.usergroup as mod_usergroup, i.displaygroup as mod_displaygroup
- FROM ".TABLE_PREFIX."warnings w
- LEFT JOIN ".TABLE_PREFIX."users u on (w.uid=u.uid)
- LEFT JOIN ".TABLE_PREFIX."warningtypes t ON (w.tid=t.tid)
- LEFT JOIN ".TABLE_PREFIX."users i ON (i.uid=w.issuedby)
- WHERE 1=1
- {$where_sql}
- ORDER BY {$sortby} {$order}
- LIMIT {$start}, {$per_page}
- ";
- $query = $db->query($sql);
-
-
- $table = new Table;
- $table->construct_header($lang->warned_user, array('width' => '15%'));
- $table->construct_header($lang->warning, array("class" => "align_center", 'width' => '25%'));
- $table->construct_header($lang->date_issued, array("class" => "align_center", 'width' => '20%'));
- $table->construct_header($lang->expires, array("class" => "align_center", 'width' => '20%'));
- $table->construct_header($lang->issued_by, array("class" => "align_center", 'width' => '15%'));
- $table->construct_header($lang->options, array("class" => "align_center", 'width' => '5%'));
-
- while($row = $db->fetch_array($query))
- {
- if(!$row['username'])
- {
- $row['username'] = $lang->guest;
- }
-
- $trow = alt_trow();
- $username = format_name(htmlspecialchars_uni($row['username']), $row['usergroup'], $row['displaygroup']);
- if(!$row['uid'])
- {
- $username_link = $username;
- }
- else
- {
- $username_link = build_profile_link($username, $row['uid'], "_blank");
- }
- $mod_username = format_name(htmlspecialchars_uni($row['mod_username']), $row['mod_usergroup'], $row['mod_displaygroup']);
- $mod_username_link = build_profile_link($mod_username, $row['mod_uid'], "_blank");
- $issued_date = my_date('relative', $row['dateline']);
- $revoked_text = '';
- if($row['daterevoked'] > 0)
- {
- $revoked_date = my_date('relative', $row['daterevoked']);
- $revoked_text = "
{$lang->revoked} {$revoked_date}";
- }
- if($row['expires'] > 0)
- {
- $expire_date = my_date('relative', $row['expires']);
- }
- else
- {
- $expire_date = $lang->never;
- }
- $title = $row['title'];
- if(empty($row['title']))
- {
- $title = $row['custom_title'];
- }
- $title = htmlspecialchars_uni($title);
- if($row['points'] > 0)
- {
- $points = '+'.$row['points'];
- }
-
- $table->construct_cell($username_link);
- $table->construct_cell("{$title} ({$points})");
- $table->construct_cell($issued_date, array("class" => "align_center"));
- $table->construct_cell($expire_date.$revoked_text, array("class" => "align_center"));
- $table->construct_cell($mod_username_link);
- $table->construct_cell("{$lang->view}", array("class" => "align_center"));
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_warning_logs, array("colspan" => "6"));
- $table->construct_row();
- }
-
- $table->output($lang->warning_logs);
-
- // Do we need to construct the pagination?
- if($total_warnings > $per_page)
- {
- echo draw_admin_pagination($view_page, $per_page, $total_warnings, $url)."
";
- }
-
- $sort_by = array(
- 'expires' => $lang->expiry_date,
- 'dateline' => $lang->issued_date,
- 'username' => $lang->warned_user,
- 'issuedby' => $lang->issued_by
- );
-
- $order_array = array(
- 'asc' => $lang->asc,
- 'desc' => $lang->desc
- );
-
- $form = new Form("index.php?module=tools-warninglog", "post");
- $form_container = new FormContainer($lang->filter_warning_logs);
- $form_container->output_row($lang->filter_warned_user, "", $form->generate_text_box('filter[username]', $mybb->input['filter']['username'], array('id' => 'filter_username')), 'filter_username');
- $form_container->output_row($lang->filter_issued_by, "", $form->generate_text_box('filter[mod_username]', $mybb->input['filter']['mod_username'], array('id' => 'filter_mod_username')), 'filter_mod_username');
- $form_container->output_row($lang->filter_reason, "", $form->generate_text_box('filter[reason]', $mybb->input['filter']['reason'], array('id' => 'filter_reason')), 'filter_reason');
- $form_container->output_row($lang->sort_by, "", $form->generate_select_box('filter[sortby]', $sort_by, $mybb->input['filter']['sortby'], array('id' => 'filter_sortby'))." {$lang->in} ".$form->generate_select_box('filter[order]', $order_array, $order, array('id' => 'filter_order'))." {$lang->order}", 'filter_order');
- $form_container->output_row($lang->results_per_page, "", $form->generate_numeric_field('filter[per_page]', $per_page, array('id' => 'filter_per_page', 'min' => 1)), 'filter_per_page');
-
- $form_container->end();
- $buttons[] = $form->generate_submit_button($lang->filter_warning_logs);
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
diff --git a/html/forums/admin/modules/user/admin_permissions.php b/html/forums/admin/modules/user/admin_permissions.php
deleted file mode 100644
index a7c5380..0000000
--- a/html/forums/admin/modules/user/admin_permissions.php
+++ /dev/null
@@ -1,534 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->admin_permissions, "index.php?module=user-admin_permissions");
-
-if(($mybb->input['action'] == "edit" && $mybb->input['uid'] == 0) || $mybb->input['action'] == "group" || !$mybb->input['action'])
-{
- $sub_tabs['user_permissions'] = array(
- 'title' => $lang->user_permissions,
- 'link' => "index.php?module=user-admin_permissions",
- 'description' => $lang->user_permissions_desc
- );
-
- $sub_tabs['group_permissions'] = array(
- 'title' => $lang->group_permissions,
- 'link' => "index.php?module=user-admin_permissions&action=group",
- 'description' => $lang->group_permissions_desc
- );
-
- $sub_tabs['default_permissions'] = array(
- 'title' => $lang->default_permissions,
- 'link' => "index.php?module=user-admin_permissions&action=edit&uid=0",
- 'description' => $lang->default_permissions_desc
- );
-}
-
-$uid = $mybb->get_input('uid', MyBB::INPUT_INT);
-
-$plugins->run_hooks("admin_user_admin_permissions_begin");
-
-if($mybb->input['action'] == "delete")
-{
- if(is_super_admin($uid))
- {
- flash_message($lang->error_super_admin, 'error');
- admin_redirect("index.php?module=user-admin_permissions");
- }
-
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=user-admin_permissions");
- }
-
- if(!trim($mybb->input['uid']))
- {
- flash_message($lang->error_delete_no_uid, 'error');
- admin_redirect("index.php?module=user-admin_permissions");
- }
-
- $query = $db->simple_select("adminoptions", "COUNT(uid) as adminoptions", "uid = '{$mybb->input['uid']}'");
- if($db->fetch_field($query, 'adminoptions') == 0)
- {
- flash_message($lang->error_delete_invalid_uid, 'error');
- admin_redirect("index.php?module=user-admin_permissions");
- }
-
- $plugins->run_hooks("admin_user_admin_permissions_delete");
-
- if($mybb->request_method == "post")
- {
- $newperms = array(
- "permissions" => ''
- );
-
- $plugins->run_hooks("admin_user_admin_permissions_delete_commit");
-
- $db->update_query("adminoptions", $newperms, "uid = '{$uid}'");
-
- // Log admin action
- if($uid < 0)
- {
- $gid = abs($uid);
- $query = $db->simple_select("usergroups", "title", "gid='{$gid}'");
- $group = $db->fetch_array($query);
- log_admin_action($uid, $group['title']);
-
- }
- elseif($uid == 0)
- {
- // Default
- log_admin_action(0, $lang->default);
- }
- else
- {
- $user = get_user($uid);
- log_admin_action($uid, $user['username']);
- }
-
- flash_message($lang->success_perms_deleted, 'success');
- admin_redirect("index.php?module=user-admin_permissions");
- }
- else
- {
- $page->output_confirm_action("index.php?module=user-admin_permissions&action=delete&uid={$mybb->input['uid']}", $lang->confirm_perms_deletion);
- }
-}
-
-if($mybb->input['action'] == "edit")
-{
- if(is_super_admin($uid))
- {
- flash_message($lang->error_super_admin, 'error');
- admin_redirect("index.php?module=user-admin_permissions");
- }
-
- $plugins->run_hooks("admin_user_admin_permissions_edit");
-
- if($mybb->request_method == "post")
- {
- foreach($mybb->input['permissions'] as $module => $actions)
- {
- $no_access = 0;
- foreach($actions as $action => $access)
- {
- if($access == 0)
- {
- ++$no_access;
- }
- }
- // User can't access any actions in this module - just disallow it completely
- if($no_access == count($actions))
- {
- unset($mybb->input['permissions'][$module]);
- }
- }
-
- // Does an options row exist for this admin already?
- $query = $db->simple_select("adminoptions", "COUNT(uid) AS existing_options", "uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'");
- $existing_options = $db->fetch_field($query, "existing_options");
- if($existing_options > 0)
- {
- $db->update_query("adminoptions", array('permissions' => $db->escape_string(my_serialize($mybb->input['permissions']))), "uid = '".$mybb->get_input('uid', MyBB::INPUT_INT)."'");
- }
- else
- {
- $insert_array = array(
- "uid" => $mybb->get_input('uid', MyBB::INPUT_INT),
- "permissions" => $db->escape_string(my_serialize($mybb->input['permissions'])),
- "notes" => '',
- "defaultviews" => ''
- );
- $db->insert_query("adminoptions", $insert_array);
- }
-
- $plugins->run_hooks("admin_user_admin_permissions_edit_commit");
-
- // Log admin action
- if($uid > 0)
- {
- // Users
- $user = get_user($uid);
- log_admin_action($uid, $user['username']);
- }
- elseif($uid < 0)
- {
- // Groups
- $gid = abs($uid);
- $query = $db->simple_select("usergroups", "title", "gid='{$gid}'");
- $group = $db->fetch_array($query);
- log_admin_action($uid, $group['title']);
- }
- else
- {
- // Default
- log_admin_action(0);
- }
-
- flash_message($lang->admin_permissions_updated, 'success');
- admin_redirect("index.php?module=user-admin_permissions");
- }
-
- if($uid > 0)
- {
- switch($db->type)
- {
- case "pgsql":
- case "sqlite":
- $query = $db->query("
- SELECT u.uid, u.username, g.cancp, g.gid
- FROM ".TABLE_PREFIX."users u
- LEFT JOIN ".TABLE_PREFIX."usergroups g ON (((','|| u.additionalgroups|| ',' LIKE '%,'|| g.gid|| ',%') OR u.usergroup = g.gid))
- WHERE u.uid='$uid'
- AND g.cancp=1
- LIMIT 1
- ");
- break;
- default:
- $query = $db->query("
- SELECT u.uid, u.username, g.cancp, g.gid
- FROM ".TABLE_PREFIX."users u
- LEFT JOIN ".TABLE_PREFIX."usergroups g ON (((CONCAT(',', u.additionalgroups, ',') LIKE CONCAT('%,', g.gid, ',%')) OR u.usergroup = g.gid))
- WHERE u.uid='$uid'
- AND g.cancp=1
- LIMIT 1
- ");
- }
-
- $admin = $db->fetch_array($query);
- $permission_data = get_admin_permissions($uid, $admin['gid']);
- $title = htmlspecialchars_uni($admin['username']);
- $page->add_breadcrumb_item($lang->user_permissions, "index.php?module=user-admin_permissions");
- }
- elseif($uid < 0)
- {
- $gid = abs($uid);
- $query = $db->simple_select("usergroups", "title", "gid='$gid'");
- $group = $db->fetch_array($query);
- $permission_data = get_admin_permissions("", $gid);
- $title = $group['title'];
- $page->add_breadcrumb_item($lang->group_permissions, "index.php?module=user-admin_permissions&action=group");
- }
- else
- {
- $query = $db->simple_select("adminoptions", "permissions", "uid='0'");
- $permission_data = my_unserialize($db->fetch_field($query, "permissions"));
- $page->add_breadcrumb_item($lang->default_permissions);
- $title = $lang->default;
- }
-
- if($uid != 0)
- {
- $page->add_breadcrumb_item($lang->edit_permissions.": {$title}");
- }
-
- $page->output_header($lang->edit_permissions);
-
- if($uid != 0)
- {
- $sub_tabs['edit_permissions'] = array(
- 'title' => $lang->edit_permissions,
- 'link' => "index.php?module=user-admin_permissions&action=edit&uid={$uid}",
- 'description' => $lang->edit_permissions_desc
- );
-
- $page->output_nav_tabs($sub_tabs, 'edit_permissions');
- }
-
- $form = new Form("index.php?module=user-admin_permissions&action=edit", "post", "edit");
-
- echo $form->generate_hidden_field("uid", $uid);
-
- // Fetch all of the modules we have
- $modules_dir = MYBB_ADMIN_DIR."modules";
- $dir = opendir($modules_dir);
- $modules = array();
- while(($module = readdir($dir)) !== false)
- {
- if(is_dir($modules_dir."/".$module) && !in_array($module, array(".", "..")) && file_exists($modules_dir."/".$module."/module_meta.php"))
- {
- require_once $modules_dir."/".$module."/module_meta.php";
- $meta_function = $module."_admin_permissions";
-
- // Module has no permissions, skip it
- if(function_exists($meta_function) && is_array($meta_function()))
- {
- $permission_modules[$module] = $meta_function();
- $modules[$permission_modules[$module]['disporder']][] = $module;
- }
- }
- }
- closedir($dir);
-
- ksort($modules);
- foreach($modules as $disp_order => $mod)
- {
- if(!is_array($mod))
- {
- continue;
- }
-
- foreach($mod as $module)
- {
- $module_tabs[$module] = $permission_modules[$module]['name'];
- }
- }
- $page->output_tab_control($module_tabs);
-
- foreach($permission_modules as $key => $module)
- {
- echo "\n";
- $form_container = new FormContainer("{$module['name']}");
- foreach($module['permissions'] as $action => $title)
- {
- $form_container->output_row($title, "", $form->generate_yes_no_radio('permissions['.$key.']['.$action.']', (int)$permission_data[$key][$action], array('yes' => 1, 'no' => 0)), 'permissions['.$key.']['.$action.']');
- }
- $form_container->end();
- echo "
\n";
- }
-
- $buttons[] = $form->generate_submit_button($lang->update_permissions);
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "group")
-{
- $plugins->run_hooks("admin_user_admin_permissions_group");
-
- $page->add_breadcrumb_item($lang->group_permissions);
- $page->output_header($lang->group_permissions);
-
- $page->output_nav_tabs($sub_tabs, 'group_permissions');
-
- $table = new Table;
- $table->construct_header($lang->group);
- $table->construct_header($lang->controls, array("class" => "align_center", "width" => 150));
-
- // Get usergroups with ACP access
- $query = $db->query("
- SELECT g.title, g.cancp, a.permissions, g.gid
- FROM ".TABLE_PREFIX."usergroups g
- LEFT JOIN ".TABLE_PREFIX."adminoptions a ON (a.uid = -g.gid)
- WHERE g.cancp = 1
- ORDER BY g.title ASC
- ");
- while($group = $db->fetch_array($query))
- {
- if($group['permissions'] != "")
- {
- $perm_type = "group";
- }
- else
- {
- $perm_type = "default";
- }
- $uid = -$group['gid'];
- $table->construct_cell("
style}/images/icons/{$perm_type}.png\" title=\"{$lang->permissions_type_group}\" alt=\"{$perm_type}\" />
");
-
- if($group['permissions'] != "")
- {
- $popup = new PopupMenu("groupperm_{$uid}", $lang->options);
- $popup->add_item($lang->edit_permissions, "index.php?module=user-admin_permissions&action=edit&uid={$uid}");
-
- // Check permissions for Revoke
- $popup->add_item($lang->revoke_permissions, "index.php?module=user-admin_permissions&action=delete&uid={$uid}&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, 'Are you sure you wish to revoke this group\'s permissions?')");
- $table->construct_cell($popup->fetch(), array("class" => "align_center"));
- }
- else
- {
- $table->construct_cell("{$lang->set_permissions}", array("class" => "align_center"));
- }
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_group_perms, array("colspan" => "3"));
- $table->construct_row();
- }
-
- $table->output($lang->group_permissions);
-
- echo <<
-
-LEGEND;
-
- $page->output_footer();
-}
-
-if(!$mybb->input['action'])
-{
- $plugins->run_hooks("admin_user_admin_permissions_start");
-
- $page->add_breadcrumb_item($lang->user_permissions);
- $page->output_header($lang->user_permissions);
-
- $page->output_nav_tabs($sub_tabs, 'user_permissions');
-
- $table = new Table;
- $table->construct_header($lang->user);
- $table->construct_header($lang->last_active, array("class" => "align_center", "width" => 200));
- $table->construct_header($lang->controls, array("class" => "align_center", "width" => 150));
-
- // Get usergroups with ACP access
- $usergroups = array();
- $query = $db->simple_select("usergroups", "*", "cancp = 1");
- while($usergroup = $db->fetch_array($query))
- {
- $usergroups[$usergroup['gid']] = $usergroup;
- }
-
- if(!empty($usergroups))
- {
- // Get users whose primary or secondary usergroup has ACP access
- $comma = $primary_group_list = $secondary_group_list = '';
- foreach($usergroups as $gid => $group_info)
- {
- $primary_group_list .= $comma.$gid;
- switch($db->type)
- {
- case "pgsql":
- case "sqlite":
- $secondary_group_list .= " OR ','|| u.additionalgroups||',' LIKE '%,{$gid},%'";
- break;
- default:
- $secondary_group_list .= " OR CONCAT(',', u.additionalgroups,',') LIKE '%,{$gid},%'";
- }
-
- $comma = ',';
- }
-
- $group_list = implode(',', array_keys($usergroups));
- $secondary_groups = ','.$group_list.',';
-
- // Get usergroups with ACP access
- $query = $db->query("
- SELECT g.title, g.cancp, a.permissions, g.gid
- FROM ".TABLE_PREFIX."usergroups g
- LEFT JOIN ".TABLE_PREFIX."adminoptions a ON (a.uid = -g.gid)
- WHERE g.cancp = 1
- ORDER BY g.title ASC
- ");
- while($group = $db->fetch_array($query))
- {
- $group_permissions[$group['gid']] = $group['permissions'];
- }
-
- $query = $db->query("
- SELECT u.uid, u.username, u.lastactive, u.usergroup, u.additionalgroups, a.permissions
- FROM ".TABLE_PREFIX."users u
- LEFT JOIN ".TABLE_PREFIX."adminoptions a ON (a.uid=u.uid)
- WHERE u.usergroup IN ({$primary_group_list}) {$secondary_group_list}
- ORDER BY u.username ASC
- ");
- while($admin = $db->fetch_array($query))
- {
- if($admin['permissions'] != "")
- {
- $perm_type = "user";
- }
- else
- {
- $groups = explode(",", $admin['additionalgroups'].",".$admin['usergroup']);
- foreach($groups as $group)
- {
- if($group == "") continue;
- if($group_permissions[$group] != "")
- {
- $perm_type = "group";
- break;
- }
- }
-
- if(!$group_permissions)
- {
- $perm_type = "default";
- }
- }
-
- $usergroup_list = array();
-
- // Build a list of group memberships that have access to the Admin CP
- // Primary usergroup?
- if($usergroups[$admin['usergroup']]['cancp'] == 1)
- {
- $usergroup_list[] = "".$usergroups[$admin['usergroup']]['title']."";
- }
-
- // Secondary usergroups?
- $additional_groups = explode(',', $admin['additionalgroups']);
- if(is_array($additional_groups))
- {
- foreach($additional_groups as $gid)
- {
- if($usergroups[$gid]['cancp'] == 1)
- {
- $usergroup_list[] = $usergroups[$gid]['title'];
- }
- }
- }
- $usergroup_list = implode($lang->comma, $usergroup_list);
-
- $username = htmlspecialchars_uni($admin['username']);
- $table->construct_cell("
style}/images/icons/{$perm_type}.png\" title=\"{$lang->perms_type_user}\" alt=\"{$perm_type}\" />
");
-
- $table->construct_cell(my_date('relative', $admin['lastactive']), array("class" => "align_center"));
-
- $popup = new PopupMenu("adminperm_{$admin['uid']}", $lang->options);
- if(!is_super_admin($admin['uid']))
- {
- if($admin['permissions'] != "")
- {
- $popup->add_item($lang->edit_permissions, "index.php?module=user-admin_permissions&action=edit&uid={$admin['uid']}");
- $popup->add_item($lang->revoke_permissions, "index.php?module=user-admin_permissions&action=delete&uid={$admin['uid']}&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_perms_deletion2}')");
- }
- else
- {
- $popup->add_item($lang->set_permissions, "index.php?module=user-admin_permissions&action=edit&uid={$admin['uid']}");
- }
- }
- $popup->add_item($lang->view_log, "index.php?module=tools-adminlog&uid={$admin['uid']}");
- $table->construct_cell($popup->fetch(), array("class" => "align_center"));
- $table->construct_row();
- }
- }
-
- if(empty($usergroups) || $table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_user_perms, array("colspan" => "3"));
- $table->construct_row();
- }
-
- $table->output($lang->user_permissions);
-
- echo <<
-
-LEGEND;
- $page->output_footer();
-}
-
diff --git a/html/forums/admin/modules/user/awaiting_activation.php b/html/forums/admin/modules/user/awaiting_activation.php
deleted file mode 100644
index 5432042..0000000
--- a/html/forums/admin/modules/user/awaiting_activation.php
+++ /dev/null
@@ -1,213 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->awaiting_activation, "index.php?module=user-awaiting_activation");
-
-$sub_tabs['awaiting_activation'] = array(
- 'title' => $lang->awaiting_activation,
- 'link' => "index.php?module=user-awaiting_activation",
- 'description' => $lang->awaiting_activation_desc
-);
-
-$plugins->run_hooks("admin_user_awaiting_activation_begin");
-
-if($mybb->input['action'] == "activate" && $mybb->request_method == "post")
-{
- $plugins->run_hooks("admin_user_awaiting_activation_activate");
-
- $mybb->input['user'] = array_map('intval', $mybb->input['user']);
- $user_ids = implode(", ", $mybb->input['user']);
-
- if(empty($user_ids))
- {
- flash_message($lang->no_users_selected, 'error');
- admin_redirect("index.php?module=user-awaiting_activation");
- }
-
- $num_activated = $num_deleted = 0;
- $users_to_delete = array();
- if($mybb->input['delete']) // Delete selected user(s)
- {
- require_once MYBB_ROOT.'inc/datahandlers/user.php';
- $userhandler = new UserDataHandler('delete');
-
- $query = $db->simple_select("users", "uid, usergroup", "uid IN ({$user_ids})");
- while($user = $db->fetch_array($query))
- {
- if($user['usergroup'] == 5)
- {
- ++$num_deleted;
- $users_to_delete[] = (int)$user['uid'];
- }
- }
-
- if(!empty($users_to_delete))
- {
- $userhandler->delete_user($users_to_delete, 1);
- }
-
- $plugins->run_hooks("admin_user_awaiting_activation_activate_delete_commit");
-
- // Log admin action
- log_admin_action('deleted', $num_deleted);
-
- flash_message($lang->success_users_deleted, 'success');
- admin_redirect("index.php?module=user-awaiting_activation");
- }
- else // Activate selected user(s)
- {
- $query = $db->simple_select("users", "uid, username, email, usergroup, coppauser", "uid IN ({$user_ids})");
- while($user = $db->fetch_array($query))
- {
- ++$num_activated;
- if($user['coppauser'])
- {
- $updated_user = array(
- "coppauser" => 0
- );
- }
- else
- {
- $db->delete_query("awaitingactivation", "uid='{$user['uid']}'");
- }
-
- // Move out of awaiting activation if they're in it.
- if($user['usergroup'] == 5)
- {
- $updated_user['usergroup'] = 2;
- }
-
- $db->update_query("users", $updated_user, "uid='{$user['uid']}'");
-
- $message = $lang->sprintf($lang->email_adminactivateaccount, $user['username'], $mybb->settings['bbname'], $mybb->settings['bburl']); my_mail($user['email'], $lang->sprintf($lang->emailsubject_activateaccount, $mybb->settings['bbname']), $message);
- }
-
- $cache->update_awaitingactivation();
-
- $plugins->run_hooks("admin_user_awaiting_activation_activate_commit");
-
- // Log admin action
- log_admin_action('activated', $num_activated);
-
- flash_message($lang->success_users_activated, 'success');
- admin_redirect("index.php?module=user-awaiting_activation");
- }
-}
-
-if(!$mybb->input['action'])
-{
- $plugins->run_hooks("admin_user_awaiting_activation_start");
-
- $per_page = 20;
-
- if($mybb->input['page'] && $mybb->input['page'] > 1)
- {
- $mybb->input['page'] = $mybb->get_input('page', MyBB::INPUT_INT);
- $start = ($mybb->input['page']*$per_page)-$per_page;
- }
- else
- {
- $mybb->input['page'] = 1;
- $start = 0;
- }
-
- $page->output_header($lang->manage_awaiting_activation);
-
- $page->output_nav_tabs($sub_tabs, 'awaiting_activation');
-
- $form = new Form("index.php?module=user-awaiting_activation&action=activate", "post");
-
- $table = new Table;
- $table->construct_header($form->generate_check_box("allbox", 1, '', array('class' => 'checkall')));
- $table->construct_header($lang->username, array('width' => '20%'));
- $table->construct_header($lang->registered, array('width' => '15%', 'class' => 'align_center'));
- $table->construct_header($lang->last_active, array('width' => '15%', 'class' => 'align_center'));
- $table->construct_header($lang->email, array('width' => '15%', 'class' => 'align_center'));
- $table->construct_header($lang->ipaddress, array('width' => '10%', 'class' => 'align_center'));
- $table->construct_header($lang->type, array('class' => 'align_center'));
-
- $query = $db->query("
- SELECT u.uid, u.username, u.regdate, u.regip, u.lastactive, u.email, u.coppauser, a.type AS reg_type, a.validated
- FROM ".TABLE_PREFIX."users u
- LEFT JOIN ".TABLE_PREFIX."awaitingactivation a ON (a.uid=u.uid)
- WHERE u.usergroup='5'
- ORDER BY u.regdate DESC
- LIMIT {$start}, {$per_page}
- ");
- while($user = $db->fetch_array($query))
- {
- $trow = alt_trow();
- $user['username'] = htmlspecialchars_uni($user['username']);
- $user['profilelink'] = build_profile_link($user['username'], $user['uid'], "_blank");
- $user['email'] = htmlspecialchars_uni($user['email']);
- $user['regdate'] = my_date('relative', $user['regdate']);
- $user['lastactive'] = my_date('relative', $user['lastactive']);
-
- if($user['reg_type'] == 'r' || $user['reg_type'] == 'b' && $user['validated'] == 0)
- {
- $user['type'] = $lang->email_activation;
- }
- elseif($user['coppauser'] == 1)
- {
- $user['type'] = $lang->admin_activation_coppa;
- }
- else
- {
- $user['type'] = $lang->administrator_activation;
- }
-
- if(empty($user['regip']))
- {
- $user['regip'] = $lang->na;
- }
- else
- {
- $user['regip'] = my_inet_ntop($db->unescape_binary($user['regip']));
- }
-
- $table->construct_cell($form->generate_check_box("user[{$user['uid']}]", $user['uid'], ''));
- $table->construct_cell($user['profilelink']);
- $table->construct_cell($user['regdate'], array("class" => "align_center"));
- $table->construct_cell($user['lastactive'], array("class" => "align_center"));
- $table->construct_cell($user['email'], array("class" => "align_center"));
- $table->construct_cell($user['regip'], array("class" => "align_center"));
- $table->construct_cell($user['type'], array("class" => "align_center"));
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_users_awaiting_activation, array('colspan' => 7));
- $table->construct_row();
- $table->output($lang->manage_awaiting_activation);
- }
- else
- {
- $table->output($lang->manage_awaiting_activation);
- $buttons[] = $form->generate_submit_button($lang->activate_users, array('onclick' => "return confirm('{$lang->confirm_activate_users}');"));
- $buttons[] = $form->generate_submit_button($lang->delete_users, array('name' => 'delete', 'onclick' => "return confirm('{$lang->confirm_delete_users}');"));
- $form->output_submit_wrapper($buttons);
- }
-
- $form->end();
-
- $query = $db->simple_select("users", "COUNT(uid) AS users", "usergroup='5'");
- $total_rows = $db->fetch_field($query, "users");
-
- echo "
".draw_admin_pagination($mybb->input['page'], $per_page, $total_rows, "index.php?module=user-awaiting_activation&page={page}");
-
- $page->output_footer();
-}
diff --git a/html/forums/admin/modules/user/banning.php b/html/forums/admin/modules/user/banning.php
deleted file mode 100644
index 4d8e9d1..0000000
--- a/html/forums/admin/modules/user/banning.php
+++ /dev/null
@@ -1,606 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->banning, "index.php?module=user-banning");
-
-
-$sub_tabs['ips'] = array(
- 'title' => $lang->banned_ips,
- 'link' => "index.php?module=config-banning",
-);
-
-$sub_tabs['bans'] = array(
- 'title' => $lang->banned_accounts,
- 'link' => "index.php?module=user-banning",
- 'description' => $lang->banned_accounts_desc
-);
-
-$sub_tabs['usernames'] = array(
- 'title' => $lang->disallowed_usernames,
- 'link' => "index.php?module=config-banning&type=usernames",
-);
-
-$sub_tabs['emails'] = array(
- 'title' => $lang->disallowed_email_addresses,
- 'link' => "index.php?module=config-banning&type=emails",
-);
-
-// Fetch banned groups
-$query = $db->simple_select("usergroups", "gid,title", "isbannedgroup=1", array('order_by' => 'title'));
-while($group = $db->fetch_array($query))
-{
- $banned_groups[$group['gid']] = $group['title'];
-}
-
-// Fetch ban times
-$ban_times = fetch_ban_times();
-
-$plugins->run_hooks("admin_user_banning_begin");
-
-if($mybb->input['action'] == "prune")
-{
- // User clicked no
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=user-banning");
- }
-
- $query = $db->simple_select("banned", "*", "uid='{$mybb->input['uid']}'");
- $ban = $db->fetch_array($query);
-
- if(!$ban['uid'])
- {
- flash_message($lang->error_invalid_ban, 'error');
- admin_redirect("index.php?module=user-banning");
- }
-
- $user = get_user($ban['uid']);
-
- if(is_super_admin($user['uid']) && ($mybb->user['uid'] != $user['uid'] && !is_super_admin($mybb->user['uid'])))
- {
- flash_message($lang->cannot_perform_action_super_admin_general, 'error');
- admin_redirect("index.php?module=user-banning");
- }
-
- $plugins->run_hooks("admin_user_banning_prune");
-
- if($mybb->request_method == "post")
- {
- require_once MYBB_ROOT."inc/class_moderation.php";
- $moderation = new Moderation();
-
- $query = $db->simple_select("threads", "tid", "uid='{$user['uid']}'");
- while($thread = $db->fetch_array($query))
- {
- $moderation->delete_thread($thread['tid']);
- }
-
- $query = $db->simple_select("posts", "pid", "uid='{$user['uid']}'");
- while($post = $db->fetch_array($query))
- {
- $moderation->delete_post($post['pid']);
- }
-
- $plugins->run_hooks("admin_user_banning_prune_commit");
-
- $cache->update_reportedcontent();
-
- // Log admin action
- log_admin_action($user['uid'], htmlspecialchars_uni($user['username']));
-
- flash_message($lang->success_pruned, 'success');
- admin_redirect("index.php?module=user-banning");
- }
- else
- {
- $page->output_confirm_action("index.php?module=user-banning&action=prune&uid={$user['uid']}", $lang->confirm_prune);
- }
-}
-
-if($mybb->input['action'] == "lift")
-{
- // User clicked no
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=user-banning");
- }
-
- $query = $db->simple_select("banned", "*", "uid='{$mybb->input['uid']}'");
- $ban = $db->fetch_array($query);
-
- if(!$ban['uid'])
- {
- flash_message($lang->error_invalid_ban, 'error');
- admin_redirect("index.php?module=user-banning");
- }
-
- $user = get_user($ban['uid']);
-
- if(is_super_admin($user['uid']) && ($mybb->user['uid'] != $user['uid'] && !is_super_admin($mybb->user['uid'])))
- {
- flash_message($lang->cannot_perform_action_super_admin_general, 'error');
- admin_redirect("index.php?module=user-banning");
- }
-
- $plugins->run_hooks("admin_user_banning_lift");
-
- if($mybb->request_method == "post")
- {
- $updated_group = array(
- 'usergroup' => $ban['oldgroup'],
- 'additionalgroups' => $ban['oldadditionalgroups'],
- 'displaygroup' => $ban['olddisplaygroup']
- );
- $db->delete_query("banned", "uid='{$ban['uid']}'");
-
- $plugins->run_hooks("admin_user_banning_lift_commit");
-
- $db->update_query("users", $updated_group, "uid='{$ban['uid']}'");
-
- $cache->update_banned();
- $cache->update_moderators();
-
- // Log admin action
- log_admin_action($ban['uid'], htmlspecialchars_uni($user['username']));
-
- flash_message($lang->success_ban_lifted, 'success');
- admin_redirect("index.php?module=user-banning");
- }
- else
- {
- $page->output_confirm_action("index.php?module=user-banning&action=lift&uid={$ban['uid']}", $lang->confirm_lift_ban);
- }
-}
-
-if($mybb->input['action'] == "edit")
-{
- $query = $db->simple_select("banned", "*", "uid='{$mybb->input['uid']}'");
- $ban = $db->fetch_array($query);
-
- $user = get_user($ban['uid']);
-
- if(!$ban['uid'])
- {
- flash_message($lang->error_invalid_ban, 'error');
- admin_redirect("index.php?module=user-banning");
- }
-
- $plugins->run_hooks("admin_user_banning_edit");
-
- if($mybb->request_method == "post")
- {
- if(!$ban['uid'])
- {
- $errors[] = $lang->error_invalid_username;
- }
- // Is the user we're trying to ban a super admin and we're not?
- else if(is_super_admin($ban['uid']) && !is_super_admin($ban['uid']))
- {
- $errors[] = $lang->error_no_perm_to_ban;
- }
-
- if($ban['uid'] == $mybb->user['uid'])
- {
- $errors[] = $lang->error_ban_self;
- }
-
- // No errors? Update
- if(!$errors)
- {
- // Ban the user
- if($mybb->input['bantime'] == '---')
- {
- $lifted = 0;
- }
- else
- {
- $lifted = ban_date2timestamp($mybb->input['bantime'], $ban['dateline']);
- }
-
- $reason = my_substr($mybb->input['reason'], 0, 255);
-
- if(count($banned_groups) == 1)
- {
- $group = array_keys($banned_groups);
- $mybb->input['usergroup'] = $group[0];
- }
-
- $update_array = array(
- 'gid' => $mybb->get_input('usergroup', MyBB::INPUT_INT),
- 'dateline' => TIME_NOW,
- 'bantime' => $db->escape_string($mybb->input['bantime']),
- 'lifted' => $db->escape_string($lifted),
- 'reason' => $db->escape_string($reason)
- );
-
- $db->update_query('banned', $update_array, "uid='{$ban['uid']}'");
-
- // Move the user to the banned group
- $update_array = array(
- 'usergroup' => $mybb->get_input('usergroup', MyBB::INPUT_INT),
- 'displaygroup' => 0,
- 'additionalgroups' => '',
- );
- $db->update_query('users', $update_array, "uid = {$ban['uid']}");
-
- $plugins->run_hooks("admin_user_banning_edit_commit");
-
- $cache->update_banned();
-
- // Log admin action
- log_admin_action($ban['uid'], htmlspecialchars_uni($user['username']));
-
- flash_message($lang->success_ban_updated, 'success');
- admin_redirect("index.php?module=user-banning");
- }
- }
- $page->add_breadcrumb_item($lang->edit_ban);
- $page->output_header($lang->edit_ban);
-
- $sub_tabs = array();
- $sub_tabs['edit'] = array(
- 'title' => $lang->edit_ban,
- 'description' => $lang->edit_ban_desc
- );
- $page->output_nav_tabs($sub_tabs, "edit");
-
- $form = new Form("index.php?module=user-banning&action=edit&uid={$ban['uid']}", "post");
- if($errors)
- {
- $page->output_inline_error($errors);
- }
- else
- {
- $mybb->input = array_merge($mybb->input, $ban);
- }
-
- $form_container = new FormContainer($lang->edit_ban);
- $form_container->output_row($lang->ban_username, "", htmlspecialchars_uni($user['username']));
- $form_container->output_row($lang->ban_reason, "", $form->generate_text_area('reason', $mybb->input['reason'], array('id' => 'reason', 'maxlength' => '255')), 'reason');
- if(count($banned_groups) > 1)
- {
- $form_container->output_row($lang->ban_group, $lang->ban_group_desc, $form->generate_select_box('usergroup', $banned_groups, $mybb->input['usergroup'], array('id' => 'usergroup')), 'usergroup');
- }
-
- if($mybb->input['bantime'] == 'perm' || $mybb->input['bantime'] == '' || $mybb->input['lifted'] == 'perm' ||$mybb->input['lifted'] == '')
- {
- $mybb->input['bantime'] = '---';
- $mybb->input['lifted'] = '---';
- }
-
- foreach($ban_times as $time => $period)
- {
- if($time != '---')
- {
- $friendly_time = my_date("D, jS M Y @ {$mybb->settings['timeformat']}", ban_date2timestamp($time));
- $period = "{$period} ({$friendly_time})";
- }
- $length_list[$time] = $period;
- }
- $form_container->output_row($lang->ban_time, "", $form->generate_select_box('bantime', $length_list, $mybb->input['bantime'], array('id' => 'bantime')), 'bantime');
-
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->update_ban);
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-
-if(!$mybb->input['action'])
-{
- $where_sql_full = $where_sql = '';
-
- $plugins->run_hooks("admin_user_banning_start");
-
- if($mybb->request_method == "post")
- {
- $options = array(
- 'fields' => array('username', 'usergroup', 'additionalgroups', 'displaygroup')
- );
-
- $user = get_user_by_username($mybb->input['username'], $options);
-
- // Are we searching a user?
- if(isset($mybb->input['search']))
- {
- $where_sql = 'uid=\''.(int)$user['uid'].'\'';
- $where_sql_full = 'WHERE b.uid=\''.(int)$user['uid'].'\'';
- }
- else
- {
- if(!$user['uid'])
- {
- $errors[] = $lang->error_invalid_username;
- }
- // Is the user we're trying to ban a super admin and we're not?
- else if(is_super_admin($user['uid']) && !is_super_admin($mybb->user['uid']))
- {
- $errors[] = $lang->error_no_perm_to_ban;
- }
- else
- {
- $query = $db->simple_select("banned", "uid", "uid='{$user['uid']}'");
- if($db->fetch_field($query, "uid"))
- {
- $errors[] = $lang->error_already_banned;
- }
-
- // Get PRIMARY usergroup information
- $usergroups = $cache->read("usergroups");
- if(!empty($usergroups[$user['usergroup']]) && $usergroups[$user['usergroup']]['isbannedgroup'] == 1)
- {
- $errors[] = $lang->error_already_banned;
- }
- }
-
- if($user['uid'] == $mybb->user['uid'])
- {
- $errors[] = $lang->error_ban_self;
- }
-
- // No errors? Insert
- if(!$errors)
- {
- // Ban the user
- if($mybb->input['bantime'] == '---')
- {
- $lifted = 0;
- }
- else
- {
- $lifted = ban_date2timestamp($mybb->input['bantime']);
- }
-
- $reason = my_substr($mybb->input['reason'], 0, 255);
-
- if(count($banned_groups) == 1)
- {
- $group = array_keys($banned_groups);
- $mybb->input['usergroup'] = $group[0];
- }
-
- $insert_array = array(
- 'uid' => $user['uid'],
- 'gid' => $mybb->get_input('usergroup', MyBB::INPUT_INT),
- 'oldgroup' => $user['usergroup'],
- 'oldadditionalgroups' => $user['additionalgroups'],
- 'olddisplaygroup' => $user['displaygroup'],
- 'admin' => (int)$mybb->user['uid'],
- 'dateline' => TIME_NOW,
- 'bantime' => $db->escape_string($mybb->input['bantime']),
- 'lifted' => $db->escape_string($lifted),
- 'reason' => $db->escape_string($reason)
- );
- $db->insert_query('banned', $insert_array);
-
- // Move the user to the banned group
- $update_array = array(
- 'usergroup' => $mybb->get_input('usergroup', MyBB::INPUT_INT),
- 'displaygroup' => 0,
- 'additionalgroups' => '',
- );
-
- $db->delete_query("forumsubscriptions", "uid = '{$user['uid']}'");
- $db->delete_query("threadsubscriptions", "uid = '{$user['uid']}'");
-
- $plugins->run_hooks("admin_user_banning_start_commit");
-
- $db->update_query('users', $update_array, "uid = '{$user['uid']}'");
-
- $cache->update_banned();
-
- // Log admin action
- log_admin_action($user['uid'], htmlspecialchars_uni($user['username']), $lifted);
-
- flash_message($lang->success_banned, 'success');
- admin_redirect("index.php?module=user-banning");
- }
- }
- }
-
- $page->output_header($lang->banned_accounts);
-
- $page->output_nav_tabs($sub_tabs, "bans");
-
- $query = $db->simple_select("banned", "COUNT(*) AS ban_count", $where_sql);
- $ban_count = $db->fetch_field($query, "ban_count");
-
- $per_page = 20;
-
- if($mybb->input['page'] > 0)
- {
- $current_page = $mybb->get_input('page', MyBB::INPUT_INT);
- $start = ($current_page-1)*$per_page;
- $pages = $ban_count / $per_page;
- $pages = ceil($pages);
- if($current_page > $pages)
- {
- $start = 0;
- $current_page = 1;
- }
- }
- else
- {
- $start = 0;
- $current_page = 1;
- }
-
- $pagination = draw_admin_pagination($current_page, $per_page, $ban_count, "index.php?module=user-banning&page={page}");
-
- $table = new Table;
- $table->construct_header($lang->user);
- $table->construct_header($lang->ban_lifts_on, array("class" => "align_center", "width" => 150));
- $table->construct_header($lang->time_left, array("class" => "align_center", "width" => 150));
- $table->construct_header($lang->controls, array("class" => "align_center", "colspan" => 2, "width" => 200));
- $table->construct_header($lang->moderation, array("class" => "align_center", "colspan" => 1, "width" => 200));
-
- // Fetch bans
- $query = $db->query("
- SELECT b.*, a.username AS adminuser, u.username
- FROM ".TABLE_PREFIX."banned b
- LEFT JOIN ".TABLE_PREFIX."users u ON (b.uid=u.uid)
- LEFT JOIN ".TABLE_PREFIX."users a ON (b.admin=a.uid)
- {$where_sql_full}
- ORDER BY dateline DESC
- LIMIT {$start}, {$per_page}
- ");
-
- // Get the banned users
- while($ban = $db->fetch_array($query))
- {
- $profile_link = build_profile_link(htmlspecialchars_uni($ban['username']), $ban['uid'], "_blank");
- $ban_date = my_date($mybb->settings['dateformat'], $ban['dateline']);
- if($ban['lifted'] == 'perm' || $ban['lifted'] == '' || $ban['bantime'] == 'perm' || $ban['bantime'] == '---')
- {
- $ban_period = $lang->permenantly;
- $time_remaining = $lifts_on = $lang->na;
- }
- else
- {
- $ban_period = $lang->for." ".$ban_times[$ban['bantime']];
-
- $remaining = $ban['lifted']-TIME_NOW;
- $time_remaining = nice_time($remaining, array('short' => 1, 'seconds' => false))."";
-
- if($remaining < 3600)
- {
- $time_remaining = "{$time_remaining}";
- }
- else if($remaining < 86400)
- {
- $time_remaining = "{$time_remaining}";
- }
- else if($remaining < 604800)
- {
- $time_remaining = "{$time_remaining}";
- }
-
- $lifts_on = my_date($mybb->settings['dateformat'], $ban['lifted']);
- }
-
- if(!$ban['adminuser'])
- {
- if($ban['admin'] == 0)
- {
- $ban['adminuser'] = $lang->mybb_engine;
- }
- else
- {
- $ban['adminuser'] = $ban['admin'];
- }
- }
-
- $table->construct_cell($lang->sprintf($lang->bannedby_x_on_x, $profile_link, htmlspecialchars_uni($ban['adminuser']), $ban_date, $ban_period));
- $table->construct_cell($lifts_on, array("class" => "align_center"));
- $table->construct_cell($time_remaining, array("class" => "align_center"));
- $table->construct_cell("{$lang->edit}", array("class" => "align_center"));
- $table->construct_cell("post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_lift_ban}');\">{$lang->lift}", array("class" => "align_center"));
- $table->construct_cell("post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_prune}');\">{$lang->prune_threads_and_posts}", array("class" => "align_center"));
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_banned_users, array("colspan" => "6"));
- $table->construct_row();
- }
- $table->output($lang->banned_accounts);
- echo $pagination;
-
- $form = new Form("index.php?module=user-banning", "post");
- if($errors)
- {
- $page->output_inline_error($errors);
- }
-
- if($mybb->input['uid'] && !$mybb->input['username'])
- {
- $user = get_user($mybb->input['uid']);
- $mybb->input['username'] = $user['username'];
- }
-
- $form_container = new FormContainer($lang->ban_a_user);
- $form_container->output_row($lang->ban_username, $lang->autocomplete_enabled, $form->generate_text_box('username', $mybb->input['username'], array('id' => 'username')), 'username');
- $form_container->output_row($lang->ban_reason, "", $form->generate_text_area('reason', $mybb->input['reason'], array('id' => 'reason', 'maxlength' => '255')), 'reason');
- if(count($banned_groups) > 1)
- {
- $form_container->output_row($lang->ban_group, $lang->add_ban_group_desc, $form->generate_select_box('usergroup', $banned_groups, $mybb->input['usergroup'], array('id' => 'usergroup')), 'usergroup');
- }
- foreach($ban_times as $time => $period)
- {
- if($time != "---")
- {
- $friendly_time = my_date("D, jS M Y @ {$mybb->settings['timeformat']}", ban_date2timestamp($time));
- $period = "{$period} ({$friendly_time})";
- }
- $length_list[$time] = $period;
- }
- $form_container->output_row($lang->ban_time, "", $form->generate_select_box('bantime', $length_list, $mybb->input['bantime'], array('id' => 'bantime')), 'bantime');
-
- $form_container->end();
-
- // Autocompletion for usernames
- echo '
-
-
- ';
-
- $buttons[] = $form->generate_submit_button($lang->ban_user);
- $buttons[] = $form->generate_submit_button($lang->search_for_a_user, array('name' => 'search'));
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
diff --git a/html/forums/admin/modules/user/group_promotions.php b/html/forums/admin/modules/user/group_promotions.php
deleted file mode 100644
index ca150e2..0000000
--- a/html/forums/admin/modules/user/group_promotions.php
+++ /dev/null
@@ -1,769 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->user_group_promotions, "index.php?module=user-group_promotions");
-
-$sub_tabs['usergroup_promotions'] = array(
- 'title' => $lang->user_group_promotions,
- 'link' => "index.php?module=user-group_promotions",
- 'description' => $lang->user_group_promotions_desc
-);
-
-$sub_tabs['add_promotion'] = array(
- 'title' => $lang->add_new_promotion,
- 'link' => "index.php?module=user-group_promotions&action=add",
- 'description' => $lang->add_new_promotion_desc
-);
-
-$sub_tabs['promotion_logs'] = array(
- 'title' => $lang->view_promotion_logs,
- 'link' => "index.php?module=user-group_promotions&action=logs",
- 'description' => $lang->view_promotion_logs_desc
-);
-
-$plugins->run_hooks("admin_user_group_promotions_begin");
-
-if($mybb->input['action'] == "disable")
-{
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=user-group_promotions");
- }
-
- if(!trim($mybb->input['pid']))
- {
- flash_message($lang->error_no_promo_id, 'error');
- admin_redirect("index.php?module=user-group_promotions");
- }
-
- $query = $db->simple_select("promotions", "*", "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'");
- $promotion = $db->fetch_array($query);
-
- if(!$promotion['pid'])
- {
- flash_message($lang->error_invalid_promo_id, 'error');
- admin_redirect("index.php?module=user-group_promotions");
- }
-
- $plugins->run_hooks("admin_user_group_promotions_disable");
-
- if($mybb->request_method == "post")
- {
- $update_promotion = array(
- "enabled" => 0
- );
-
- $plugins->run_hooks("admin_user_group_promotions_disable_commit");
-
- $db->update_query("promotions", $update_promotion, "pid = '{$promotion['pid']}'");
-
- // Log admin action
- log_admin_action($promotion['pid'], $promotion['title']);
-
- flash_message($lang->success_promo_disabled, 'success');
- admin_redirect("index.php?module=user-group_promotions");
- }
- else
- {
- $page->output_confirm_action("index.php?module=user-group_promotions&action=disable&pid={$promotion['pid']}", $lang->confirm_promo_disable);
- }
-}
-
-if($mybb->input['action'] == "delete")
-{
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=user-group_promotions");
- }
-
- if(!trim($mybb->input['pid']))
- {
- flash_message($lang->error_no_promo_id, 'error');
- admin_redirect("index.php?module=user-group_promotions");
- }
-
- $query = $db->simple_select("promotions", "*", "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'");
- $promotion = $db->fetch_array($query);
-
- if(!$promotion['pid'])
- {
- flash_message($lang->error_invalid_promo_id, 'error');
- admin_redirect("index.php?module=user-group_promotions");
- }
-
- $plugins->run_hooks("admin_user_group_promotions_delete");
-
- if($mybb->request_method == "post")
- {
- $db->delete_query("promotions", "pid = '{$promotion['pid']}'");
-
- $plugins->run_hooks("admin_user_group_promotions_delete_commit");
-
- // Log admin action
- log_admin_action($promotion['pid'], $promotion['title']);
-
- flash_message($lang->success_promo_deleted, 'success');
- admin_redirect("index.php?module=user-group_promotions");
- }
- else
- {
- $page->output_confirm_action("index.php?module=user-group_promotions&action=delete&pid={$mybb->input['pid']}", $lang->confirm_promo_deletion);
- }
-}
-
-if($mybb->input['action'] == "enable")
-{
- if(!verify_post_check($mybb->input['my_post_key']))
- {
- flash_message($lang->invalid_post_verify_key2, 'error');
- admin_redirect("index.php?module=user-group_promotions");
- }
-
- if(!trim($mybb->input['pid']))
- {
- flash_message($lang->error_no_promo_id, 'error');
- admin_redirect("index.php?module=user-group_promotions");
- }
-
- $query = $db->simple_select("promotions", "*", "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'");
- $promotion = $db->fetch_array($query);
-
- if(!$promotion['pid'])
- {
- flash_message($lang->error_invalid_promo_id, 'error');
- admin_redirect("index.php?module=user-group_promotions");
- }
-
- $plugins->run_hooks("admin_user_group_promotions_enable");
-
- $update_promotion = array(
- "enabled" => 1
- );
-
- $plugins->run_hooks("admin_user_group_promotions_enable_commit");
-
- $db->update_query("promotions", $update_promotion, "pid = '{$promotion['pid']}'");
-
- // Log admin action
- log_admin_action($promotion['pid'], $promotion['title']);
-
- flash_message($lang->success_promo_enabled, 'success');
- admin_redirect("index.php?module=user-group_promotions");
-}
-
-if($mybb->input['action'] == "edit")
-{
- if(!trim($mybb->input['pid']))
- {
- flash_message($lang->error_no_promo_id, 'error');
- admin_redirect("index.php?module=user-group_promotions");
- }
-
- $query = $db->simple_select("promotions", "*", "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'");
- $promotion = $db->fetch_array($query);
-
- if(!$promotion)
- {
- flash_message($lang->error_invalid_promo_id, 'error');
- admin_redirect("index.php?module=user-group_promotions");
- }
-
- $plugins->run_hooks("admin_user_group_promotions_edit");
-
- if($mybb->request_method == "post")
- {
- if(!trim($mybb->input['title']))
- {
- $errors[] = $lang->error_no_title;
- }
-
- if(!trim($mybb->input['description']))
- {
- $errors[] = $lang->error_no_desc;
- }
-
- if(empty($mybb->input['requirements']))
- {
- $errors[] = $lang->error_no_requirements;
- }
-
- if(empty($mybb->input['originalusergroup']))
- {
- $errors[] = $lang->error_no_orig_usergroup;
- }
-
- if(!trim($mybb->input['newusergroup']))
- {
- $errors[] = $lang->error_no_new_usergroup;
- }
-
- if(!trim($mybb->input['usergroupchangetype']))
- {
- $errors[] = $lang->error_no_usergroup_change_type;
- }
-
- if(!$errors)
- {
- if(in_array('*', $mybb->input['originalusergroup']))
- {
- $mybb->input['originalusergroup'] = '*';
- }
- else
- {
- $mybb->input['originalusergroup'] = implode(',', array_map('intval', $mybb->input['originalusergroup']));
- }
-
- $allowed_operators = array('>', '>=', '=', '<=', '<');
- $operator_fields = array('posttype', 'threadtype', 'reputationtype', 'referralstype', 'warningstype');
-
- foreach($operator_fields as $field)
- {
- if(!in_array($mybb->get_input($field), $allowed_operators))
- {
- $mybb->input[$field] = '=';
- }
- }
-
- $allowed_times = array('hours', 'days', 'weeks', 'months', 'years');
- $time_fields = array('timeregisteredtype', 'timeonlinetype');
-
- foreach($time_fields as $field)
- {
- if(!in_array($mybb->get_input($field), $allowed_times))
- {
- $mybb->input[$field] = 'days';
- }
- }
-
- $update_promotion = array(
- "title" => $db->escape_string($mybb->input['title']),
- "description" => $db->escape_string($mybb->input['description']),
- "posts" => $mybb->get_input('postcount', MyBB::INPUT_INT),
- "posttype" => $db->escape_string($mybb->input['posttype']),
- "threads" => $mybb->get_input('threadcount', MyBB::INPUT_INT),
- "threadtype" => $db->escape_string($mybb->input['threadtype']),
- "registered" => $mybb->get_input('timeregistered', MyBB::INPUT_INT),
- "registeredtype" => $db->escape_string($mybb->input['timeregisteredtype']),
- "online" => $mybb->get_input('timeonline', MyBB::INPUT_INT),
- "onlinetype" => $db->escape_string($mybb->input['timeonlinetype']),
- "reputations" => $mybb->get_input('reputationcount', MyBB::INPUT_INT),
- "reputationtype" => $db->escape_string($mybb->input['reputationtype']),
- "referrals" => $mybb->get_input('referrals', MyBB::INPUT_INT),
- "referralstype" => $db->escape_string($mybb->input['referralstype']),
- "warnings" => $mybb->get_input('warnings', MyBB::INPUT_INT),
- "warningstype" => $db->escape_string($mybb->input['warningstype']),
- "requirements" => $db->escape_string(implode(",", $mybb->input['requirements'])),
- "originalusergroup" => $db->escape_string($mybb->input['originalusergroup']),
- "newusergroup" => $mybb->get_input('newusergroup', MyBB::INPUT_INT),
- "usergrouptype" => $db->escape_string($mybb->input['usergroupchangetype']),
- "enabled" => $mybb->get_input('enabled', MyBB::INPUT_INT),
- "logging" => $mybb->get_input('logging', MyBB::INPUT_INT)
- );
-
- $plugins->run_hooks("admin_user_group_promotions_edit_commit");
-
- $db->update_query("promotions", $update_promotion, "pid = '{$promotion['pid']}'");
-
- // Log admin action
- log_admin_action($promotion['pid'], $mybb->input['title']);
-
- flash_message($lang->success_promo_updated, 'success');
- admin_redirect("index.php?module=user-group_promotions");
- }
- }
-
- $page->add_breadcrumb_item($lang->edit_promotion);
- $page->output_header($lang->user_group_promotions." - ".$lang->edit_promotion);
-
- $sub_tabs = array();
- $sub_tabs['edit_promotion'] = array(
- 'title' => $lang->edit_promotion,
- 'link' => "index.php?module=user-group_promotions&action=edit",
- 'description' => $lang->edit_promotion_desc
- );
-
- $page->output_nav_tabs($sub_tabs, 'edit_promotion');
- $form = new Form("index.php?module=user-group_promotions&action=edit", "post", "edit");
- echo $form->generate_hidden_field("pid", $promotion['pid']);
- if($errors)
- {
- $page->output_inline_error($errors);
- }
- else
- {
- $mybb->input['title'] = $promotion['title'];
- $mybb->input['description'] = $promotion['description'];
- $mybb->input['requirements'] = explode(',', $promotion['requirements']);
- $mybb->input['reputationcount'] = $promotion['reputations'];
- $mybb->input['reputationtype'] = $promotion['reputationtype'];
- $mybb->input['postcount'] = $promotion['posts'];
- $mybb->input['posttype'] = $promotion['posttype'];
- $mybb->input['threadcount'] = $promotion['threads'];
- $mybb->input['threadtype'] = $promotion['threadtype'];
- $mybb->input['referrals'] = $promotion['referrals'];
- $mybb->input['referralstype'] = $promotion['referralstype'];
- $mybb->input['warnings'] = $promotion['warnings'];
- $mybb->input['warningstype'] = $promotion['warningstype'];
- $mybb->input['timeregistered'] = $promotion['registered'];
- $mybb->input['timeregisteredtype'] = $promotion['registeredtype'];
- $mybb->input['timeonline'] = $promotion['online'];
- $mybb->input['timeonlinetype'] = $promotion['onlinetype'];
- $mybb->input['originalusergroup'] = explode(',', $promotion['originalusergroup']);
- $mybb->input['usergroupchangetype'] = $promotion['usergrouptype'];
- $mybb->input['newusergroup'] = $promotion['newusergroup'];
- $mybb->input['enabled'] = $promotion['enabled'];
- $mybb->input['logging'] = $promotion['logging'];
- }
-
- $form_container = new FormContainer($lang->edit_promotion);
- $form_container->output_row($lang->title." *", "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
- $form_container->output_row($lang->short_desc." *", "", $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description');
-
- $options = array(
- "postcount" => $lang->post_count,
- "threadcount" => $lang->thread_count,
- "reputation" => $lang->reputation,
- "referrals" => $lang->referrals,
- "warnings" => $lang->warning_points,
- "timeregistered" => $lang->time_registered,
- "timeonline" => $lang->time_online
- );
-
- $form_container->output_row($lang->promo_requirements." *", $lang->promo_requirements_desc, $form->generate_select_box('requirements[]', $options, $mybb->input['requirements'], array('id' => 'requirements', 'multiple' => true, 'size' => 5)), 'requirements');
-
- $options_type = array(
- ">" => $lang->greater_than,
- ">=" => $lang->greater_than_or_equal_to,
- "=" => $lang->equal_to,
- "<=" => $lang->less_than_or_equal_to,
- "<" => $lang->less_than
- );
-
- $form_container->output_row($lang->post_count, $lang->post_count_desc, $form->generate_numeric_field('postcount', $mybb->input['postcount'], array('id' => 'postcount', 'min' => 0))." ".$form->generate_select_box("posttype", $options_type, $mybb->input['posttype'], array('id' => 'posttype')), 'postcount');
-
- $form_container->output_row($lang->thread_count, $lang->thread_count_desc, $form->generate_numeric_field('threadcount', $mybb->input['threadcount'], array('id' => 'threadcount', 'min' => 0))." ".$form->generate_select_box("threadtype", $options_type, $mybb->input['threadtype'], array('id' => 'threadtype')), 'threadcount');
-
- $form_container->output_row($lang->reputation_count, $lang->reputation_count_desc, $form->generate_numeric_field('reputationcount', $mybb->input['reputationcount'], array('id' => 'reputationcount', 'min' => 0))." ".$form->generate_select_box("reputationtype", $options_type, $mybb->input['reputationtype'], array('id' => 'reputationtype')), 'reputationcount');
-
- $options = array(
- "hours" => $lang->hours,
- "days" => $lang->days,
- "weeks" => $lang->weeks,
- "months" => $lang->months,
- "years" => $lang->years
- );
-
- $form_container->output_row($lang->referral_count, $lang->referral_count_desc, $form->generate_numeric_field('referrals', $mybb->input['referrals'], array('id' => 'referrals', 'min' => 0))." ".$form->generate_select_box("referralstype", $options_type, $mybb->input['referralstype'], array('id' => 'referralstype')), 'referrals');
-
- $form_container->output_row($lang->warning_points, $lang->warning_points_desc, $form->generate_numeric_field('warnings', $mybb->input['warnings'], array('id' => 'warnings', 'min' => 0))." ".$form->generate_select_box("warningstype", $options_type, $mybb->input['warningstype'], array('id' => 'warningstype')), 'warnings');
-
- $form_container->output_row($lang->time_registered, $lang->time_registered_desc, $form->generate_numeric_field('timeregistered', $mybb->input['timeregistered'], array('id' => 'timeregistered', 'min' => 0))." ".$form->generate_select_box("timeregisteredtype", $options, $mybb->input['timeregisteredtype'], array('id' => 'timeregisteredtype')), 'timeregistered');
-
- $form_container->output_row($lang->time_online, $lang->time_online_desc, $form->generate_numeric_field('timeonline', $mybb->input['timeonline'], array('id' => 'timeonline', 'min' => 0))." ".$form->generate_select_box("timeonlinetype", $options, $mybb->input['timeonlinetype'], array('id' => 'timeonlinetype')), 'timeonline');
-
- $options = array();
-
- $query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
- while($usergroup = $db->fetch_array($query))
- {
- $options[(int)$usergroup['gid']] = $usergroup['title'];
- }
-
- $form_container->output_row($lang->orig_user_group." *", $lang->orig_user_group_desc, $form->generate_select_box('originalusergroup[]', $options, $mybb->input['originalusergroup'], array('id' => 'originalusergroup', 'multiple' => true, 'size' => 5)), 'originalusergroup');
-
- unset($options['*']); // Remove the all usergroups option
- $form_container->output_row($lang->new_user_group." *", $lang->new_user_group_desc, $form->generate_select_box('newusergroup', $options, $mybb->input['newusergroup'], array('id' => 'newusergroup')), 'newusergroup');
-
- $options = array(
- 'primary' => $lang->primary_user_group,
- 'secondary' => $lang->secondary_user_group
- );
-
- $form_container->output_row($lang->user_group_change_type." *", $lang->user_group_change_type_desc, $form->generate_select_box('usergroupchangetype', $options, $mybb->input['usergroupchangetype'], array('id' => 'usergroupchangetype')), 'usergroupchangetype');
-
- $form_container->output_row($lang->enabled." *", "", $form->generate_yes_no_radio("enabled", $mybb->input['enabled'], true));
-
- $form_container->output_row($lang->enable_logging." *", "", $form->generate_yes_no_radio("logging", $mybb->input['logging'], true));
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->update_promotion);
-
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "add")
-{
- $plugins->run_hooks("admin_user_group_promotions_add");
-
- if($mybb->request_method == "post")
- {
- if(!trim($mybb->input['title']))
- {
- $errors[] = $lang->error_no_title;
- }
-
- if(!trim($mybb->input['description']))
- {
- $errors[] = $lang->error_no_desc;
- }
-
- if(empty($mybb->input['requirements']))
- {
- $errors[] = $lang->error_no_requirements;
- }
-
- if(empty($mybb->input['originalusergroup']))
- {
- $errors[] = $lang->error_no_orig_usergroup;
- }
-
- if(!trim($mybb->input['newusergroup']))
- {
- $errors[] = $lang->error_no_new_usergroup;
- }
-
- if(!trim($mybb->input['usergroupchangetype']))
- {
- $errors[] = $lang->error_no_usergroup_change_type;
- }
-
- if(!$errors)
- {
- if(in_array('*', $mybb->input['originalusergroup']))
- {
- $mybb->input['originalusergroup'] = '*';
- }
- else
- {
- $mybb->input['originalusergroup'] = implode(',', array_map('intval', $mybb->input['originalusergroup']));
- }
-
- $allowed_operators = array('>', '>=', '=', '<=', '<');
- $operator_fields = array('posttype', 'threadtype', 'reputationtype', 'referralstype', 'warningstype');
-
- foreach($operator_fields as $field)
- {
- if(!in_array($mybb->get_input($field), $allowed_operators))
- {
- $mybb->input[$field] = '=';
- }
- }
-
- $allowed_times = array('hours', 'days', 'weeks', 'months', 'years');
- $time_fields = array('timeregisteredtype', 'timeonlinetype');
-
- foreach($time_fields as $field)
- {
- if(!in_array($mybb->get_input($field), $allowed_times))
- {
- $mybb->input[$field] = 'days';
- }
- }
-
- $new_promotion = array(
- "title" => $db->escape_string($mybb->input['title']),
- "description" => $db->escape_string($mybb->input['description']),
- "posts" => $mybb->get_input('postcount', MyBB::INPUT_INT),
- "posttype" => $db->escape_string($mybb->input['posttype']),
- "threads" => $mybb->get_input('threadcount', MyBB::INPUT_INT),
- "threadtype" => $db->escape_string($mybb->input['threadtype']),
- "registered" => $mybb->get_input('timeregistered', MyBB::INPUT_INT),
- "registeredtype" => $db->escape_string($mybb->input['timeregisteredtype']),
- "online" => $mybb->get_input('timeonline', MyBB::INPUT_INT),
- "onlinetype" => $db->escape_string($mybb->input['timeonlinetype']),
- "reputations" => $mybb->get_input('reputationcount', MyBB::INPUT_INT),
- "reputationtype" => $db->escape_string($mybb->input['reputationtype']),
- "referrals" => $mybb->get_input('referrals', MyBB::INPUT_INT),
- "referralstype" => $db->escape_string($mybb->input['referralstype']),
- "warnings" => $mybb->get_input('warnings', MyBB::INPUT_INT),
- "warningstype" => $db->escape_string($mybb->input['warningstype']),
- "requirements" => $db->escape_string(implode(",", $mybb->input['requirements'])),
- "originalusergroup" => $db->escape_string($mybb->input['originalusergroup']),
- "usergrouptype" => $db->escape_string($mybb->input['usergroupchangetype']),
- "newusergroup" => $mybb->get_input('newusergroup', MyBB::INPUT_INT),
- "enabled" => $mybb->get_input('enabled', MyBB::INPUT_INT),
- "logging" => $mybb->get_input('logging', MyBB::INPUT_INT)
- );
-
- $pid = $db->insert_query("promotions", $new_promotion);
-
- $plugins->run_hooks("admin_user_group_promotions_add_commit");
-
- // Log admin action
- log_admin_action($pid, $mybb->input['title']);
-
- flash_message($lang->success_promo_added, 'success');
- admin_redirect("index.php?module=user-group_promotions");
- }
- }
- $page->add_breadcrumb_item($lang->add_new_promotion);
- $page->output_header($lang->user_group_promotions." - ".$lang->add_new_promotion);
-
- $sub_tabs['usergroup_promotions'] = array(
- 'title' => $lang->user_group_promotions,
- 'link' => "index.php?module=user-group_promotions"
- );
-
- $sub_tabs['add_promotion'] = array(
- 'title' => $lang->add_new_promotion,
- 'link' => "index.php?module=user-group_promotions&action=add",
- 'description' => $lang->add_new_promotion_desc
- );
-
- $sub_tabs['promotion_logs'] = array(
- 'title' => $lang->view_promotion_logs,
- 'link' => "index.php?module=user-group_promotions&action=logs"
- );
-
- $page->output_nav_tabs($sub_tabs, 'add_promotion');
- $form = new Form("index.php?module=user-group_promotions&action=add", "post", "add");
- if($errors)
- {
- $page->output_inline_error($errors);
- }
- else
- {
- $mybb->input['reputationcount'] = '0';
- $mybb->input['referrals'] = '0';
- $mybb->input['warnings'] = '0';
- $mybb->input['postcount'] = '0';
- $mybb->input['threadcount'] = '0';
- $mybb->input['timeregistered'] = '0';
- $mybb->input['timeregisteredtype'] = 'days';
- $mybb->input['timeonline'] = '0';
- $mybb->input['timeonlinetype'] = 'days';
- $mybb->input['originalusergroup'] = '*';
- $mybb->input['newusergroup'] = '2';
- $mybb->input['enabled'] = '1';
- $mybb->input['logging'] = '1';
- }
- $form_container = new FormContainer($lang->add_new_promotion);
- $form_container->output_row($lang->title." *", "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
- $form_container->output_row($lang->short_desc." *", "", $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description');
-
- $options = array(
- "postcount" => $lang->post_count,
- "threadcount" => $lang->thread_count,
- "reputation" => $lang->reputation,
- "referrals" => $lang->referrals,
- "warnings" => $lang->warning_points,
- "timeregistered" => $lang->time_registered,
- "timeonline" => $lang->time_online
- );
-
- $form_container->output_row($lang->promo_requirements." *", $lang->promo_requirements_desc, $form->generate_select_box('requirements[]', $options, $mybb->input['requirements'], array('id' => 'requirements', 'multiple' => true, 'size' => 5)), 'requirements');
-
- $options_type = array(
- ">" => $lang->greater_than,
- ">=" => $lang->greater_than_or_equal_to,
- "=" => $lang->equal_to,
- "<=" => $lang->less_than_or_equal_to,
- "<" => $lang->less_than
- );
-
- $form_container->output_row($lang->post_count, $lang->post_count_desc, $form->generate_numeric_field('postcount', $mybb->input['postcount'], array('id' => 'postcount', 'min' => 0))." ".$form->generate_select_box("posttype", $options_type, $mybb->input['posttype'], array('id' => 'posttype')), 'postcount');
-
- $form_container->output_row($lang->thread_count, $lang->thread_count_desc, $form->generate_numeric_field('threadcount', $mybb->input['threadcount'], array('id' => 'threadcount', 'min' => 0))." ".$form->generate_select_box("threadtype", $options_type, $mybb->input['threadtype'], array('id' => 'threadtype')), 'threadcount');
-
- $form_container->output_row($lang->reputation_count, $lang->reputation_count_desc, $form->generate_numeric_field('reputationcount', $mybb->input['reputationcount'], array('id' => 'reputationcount', 'min' => 0))." ".$form->generate_select_box("reputationtype", $options_type, $mybb->input['reputationtype'], array('id' => 'reputationtype')), 'reputationcount');
-
- $options = array(
- "hours" => $lang->hours,
- "days" => $lang->days,
- "weeks" => $lang->weeks,
- "months" => $lang->months,
- "years" => $lang->years
- );
-
- $form_container->output_row($lang->referral_count, $lang->referral_count_desc, $form->generate_numeric_field('referrals', $mybb->input['referrals'], array('id' => 'referrals', 'min' => 0))." ".$form->generate_select_box("referralstype", $options_type, $mybb->input['referralstype'], array('id' => 'referralstype')), 'referrals');
-
- $form_container->output_row($lang->warning_points, $lang->warning_points_desc, $form->generate_numeric_field('warnings', $mybb->input['warnings'], array('id' => 'warnings', 'min' => 0))." ".$form->generate_select_box("warningstype", $options_type, $mybb->input['warningstype'], array('id' => 'warningstype')), 'warnings');
-
- $form_container->output_row($lang->time_registered, $lang->time_registered_desc, $form->generate_numeric_field('timeregistered', $mybb->input['timeregistered'], array('id' => 'timeregistered', 'min' => 0))." ".$form->generate_select_box("timeregisteredtype", $options, $mybb->input['timeregisteredtype'], array('id' => 'timeregisteredtype')), 'timeregistered');
-
- $form_container->output_row($lang->time_online, $lang->time_online_desc, $form->generate_numeric_field('timeonline', $mybb->input['timeonline'], array('id' => 'timeonline', 'min' => 0))." ".$form->generate_select_box("timeonlinetype", $options, $mybb->input['timeonlinetype'], array('id' => 'timeonlinetype')), 'timeonline');
- $options = array();
-
- $query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
- while($usergroup = $db->fetch_array($query))
- {
- $options[(int)$usergroup['gid']] = $usergroup['title'];
- }
-
- $form_container->output_row($lang->orig_user_group." *", $lang->orig_user_group_desc, $form->generate_select_box('originalusergroup[]', $options, $mybb->input['originalusergroup'], array('id' => 'originalusergroup', 'multiple' => true, 'size' => 5)), 'originalusergroup');
-
- unset($options['*']);
- $form_container->output_row($lang->new_user_group." *", $lang->new_user_group_desc, $form->generate_select_box('newusergroup', $options, $mybb->input['newusergroup'], array('id' => 'newusergroup')), 'newusergroup');
-
- $options = array(
- 'primary' => $lang->primary_user_group,
- 'secondary' => $lang->secondary_user_group
- );
-
- $form_container->output_row($lang->user_group_change_type." *", $lang->user_group_change_type_desc, $form->generate_select_box('usergroupchangetype', $options, $mybb->input['usergroupchangetype'], array('id' => 'usergroupchangetype')), 'usergroupchangetype');
-
- $form_container->output_row($lang->enabled." *", "", $form->generate_yes_no_radio("enabled", $mybb->input['enabled'], true));
-
- $form_container->output_row($lang->enable_logging." *", "", $form->generate_yes_no_radio("logging", $mybb->input['logging'], true));
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->update_promotion);
-
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "logs")
-{
- $plugins->run_hooks("admin_user_group_promotions_logs");
-
- if($mybb->get_input('page', MyBB::INPUT_INT) > 1)
- {
- $mybb->input['page'] = $mybb->get_input('page', MyBB::INPUT_INT);
- $start = ($mybb->input['page']*20)-20;
- }
- else
- {
- $mybb->input['page'] = 1;
- $start = 0;
- }
-
- $page->add_breadcrumb_item($lang->promotion_logs);
- $page->output_header($lang->user_group_promotions." - ".$lang->promotion_logs);
-
- $page->output_nav_tabs($sub_tabs, 'promotion_logs');
-
- $table = new Table;
- $table->construct_header($lang->promoted_user, array("class" => "align_center", "width" => '20%'));
- $table->construct_header($lang->user_group_change_type, array("class" => "align_center", "width" => '20%'));
- $table->construct_header($lang->orig_user_group, array("class" => "align_center", "width" => '20%'));
- $table->construct_header($lang->new_user_group, array("class" => "align_center", "width" => '20%'));
- $table->construct_header($lang->time_promoted, array("class" => "align_center", "width" => '20%'));
-
- $query = $db->query("
- SELECT pl.*,u.username
- FROM ".TABLE_PREFIX."promotionlogs pl
- LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=pl.uid)
- ORDER BY dateline DESC
- LIMIT {$start}, 20
- ");
- while($log = $db->fetch_array($query))
- {
- $log['username'] = "".htmlspecialchars_uni($log['username'])."";
-
- if($log['type'] == "secondary" || (!empty($log['oldusergroup']) && strstr(",", $log['oldusergroup'])))
- {
- $log['oldusergroup'] = "".$lang->multiple_usergroups."";
- $log['newusergroup'] = htmlspecialchars_uni($groupscache[$log['newusergroup']]['title']);
- }
- else
- {
- $log['oldusergroup'] = htmlspecialchars_uni($groupscache[$log['oldusergroup']]['title']);
- $log['newusergroup'] = htmlspecialchars_uni($groupscache[$log['newusergroup']]['title']);
- }
-
- if($log['type'] == "secondary")
- {
- $log['type'] = $lang->secondary;
- }
- else
- {
- $log['type'] = $lang->primary;
- }
-
- $log['dateline'] = date($mybb->settings['dateformat'], $log['dateline']).", ".date($mybb->settings['timeformat'], $log['dateline']);
- $table->construct_cell($log['username']);
- $table->construct_cell($log['type'], array('style' => 'text-align: center;'));
- $table->construct_cell($log['oldusergroup'], array('style' => 'text-align: center;'));
- $table->construct_cell($log['newusergroup'], array('style' => 'text-align: center;'));
- $table->construct_cell($log['dateline'], array('style' => 'text-align: center;'));
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_promotion_logs, array("colspan" => "5"));
- $table->construct_row();
- }
-
- $table->output($lang->promotion_logs);
-
- $query = $db->simple_select("promotionlogs", "COUNT(plid) as promotionlogs");
- $total_rows = $db->fetch_field($query, "promotionlogs");
-
- echo "
".draw_admin_pagination($mybb->input['page'], "20", $total_rows, "index.php?module=user-group_promotions&action=logs&page={page}");
-
- $page->output_footer();
-}
-
-if(!$mybb->input['action'])
-{
- $plugins->run_hooks("admin_user_group_promotions_start");
-
- $page->output_header($lang->promotion_manager);
-
- $page->output_nav_tabs($sub_tabs, 'usergroup_promotions');
-
- $table = new Table;
- $table->construct_header($lang->promotion);
- $table->construct_header($lang->controls, array("class" => "align_center", "width" => 150));
-
- $query = $db->simple_select("promotions", "*", "", array("order_by" => "title", "order_dir" => "asc"));
- while($promotion = $db->fetch_array($query))
- {
- $promotion['title'] = htmlspecialchars_uni($promotion['title']);
- $promotion['description'] = htmlspecialchars_uni($promotion['description']);
- if($promotion['enabled'] == 1)
- {
- $icon = "
style}/images/icons/bullet_on.png\" alt=\"({$lang->alt_enabled})\" title=\"{$lang->alt_enabled}\" style=\"vertical-align: middle;\" /> ";
- }
- else
- {
- $icon = "
style}/images/icons/bullet_off.png\" alt=\"({$lang->alt_disabled})\" title=\"{$lang->alt_disabled}\" style=\"vertical-align: middle;\" /> ";
- }
-
- $table->construct_cell("");
-
- $popup = new PopupMenu("promotion_{$promotion['pid']}", $lang->options);
- $popup->add_item($lang->edit_promotion, "index.php?module=user-group_promotions&action=edit&pid={$promotion['pid']}");
- if($promotion['enabled'] == 1)
- {
- $popup->add_item($lang->disable_promotion, "index.php?module=user-group_promotions&action=disable&pid={$promotion['pid']}&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_promo_disable}')");
- }
- else
- {
- $popup->add_item($lang->enable_promotion, "index.php?module=user-group_promotions&action=enable&pid={$promotion['pid']}&my_post_key={$mybb->post_code}");
- }
- $popup->add_item($lang->delete_promotion, "index.php?module=user-group_promotions&action=delete&pid={$promotion['pid']}&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_promo_deletion}')");
- $table->construct_cell($popup->fetch(), array("class" => "align_center"));
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_promotions_set, array("colspan" => "2"));
- $table->construct_row();
- }
-
- $table->output($lang->user_group_promotions);
-
- $page->output_footer();
-}
diff --git a/html/forums/admin/modules/user/groups.php b/html/forums/admin/modules/user/groups.php
deleted file mode 100644
index 1e57f62..0000000
--- a/html/forums/admin/modules/user/groups.php
+++ /dev/null
@@ -1,1546 +0,0 @@
- 0,
- "canview" => 1,
- "canviewthreads" => 1,
- "canviewprofiles" => 1,
- "candlattachments" => 1,
- "canviewboardclosed" => 1,
- "canpostthreads" => 1,
- "canpostreplys" => 1,
- "canpostattachments" => 1,
- "canratethreads" => 1,
- "modposts" => 0,
- "modthreads" => 0,
- "modattachments" => 0,
- "mod_edit_posts" => 0,
- "caneditposts" => 1,
- "candeleteposts" => 1,
- "candeletethreads" => 1,
- "caneditattachments" => 1,
- "canviewdeletionnotice" => 1,
- "canpostpolls" => 1,
- "canvotepolls" => 1,
- "canundovotes" => 0,
- "canusepms" => 1,
- "cansendpms" => 1,
- "cantrackpms" => 1,
- "candenypmreceipts" => 1,
- "pmquota" => 100,
- "maxpmrecipients" => 5,
- "cansendemail" => 1,
- "cansendemailoverride" => 0,
- "maxemails" => 4,
- "emailfloodtime" => 5,
- "canviewmemberlist" => 1,
- "canviewcalendar" => 1,
- "canaddevents" => 1,
- "canbypasseventmod" => 0,
- "canmoderateevents" => 0,
- "canviewonline" => 1,
- "canviewwolinvis" => 0,
- "canviewonlineips" => 0,
- "cancp" => 0,
- "issupermod" => 0,
- "cansearch" => 1,
- "canusercp" => 1,
- "canuploadavatars" => 1,
- "canratemembers" => 1,
- "canchangename" => 0,
- "canbereported" => 0,
- "canchangewebsite" => 1,
- "showforumteam" => 0,
- "usereputationsystem" => 1,
- "cangivereputations" => 1,
- "candeletereputations" => 1,
- "reputationpower" => 1,
- "maxreputationsday" => 5,
- "maxreputationsperuser" => 0,
- "maxreputationsperthread" => 0,
- "candisplaygroup" => 0,
- "attachquota" => 5000,
- "cancustomtitle" => 0,
- "canwarnusers" => 0,
- "canreceivewarnings" => 1,
- "maxwarningsday" => 0,
- "canmodcp" => 0,
- "showinbirthdaylist" => 0,
- "canoverridepm" => 0,
- "canusesig" => 0,
- "canusesigxposts" => 0,
- "signofollow" => 0,
- "edittimelimit" => 0,
- "maxposts" => 0,
- "showmemberlist" => 1,
- "canmanageannounce" => 0,
- "canmanagemodqueue" => 0,
- "canmanagereportedcontent" => 0,
- "canviewmodlogs" => 0,
- "caneditprofiles" => 0,
- "canbanusers" => 0,
- "canviewwarnlogs" => 0,
- "canuseipsearch" => 0
-);
-
-// Disallow direct access to this file for security reasons
-if(!defined("IN_MYBB"))
-{
- die("Direct initialization of this file is not allowed.
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->user_groups, "index.php?module=user-groups");
-
-if($mybb->input['action'] == "add" || !$mybb->input['action'])
-{
- $sub_tabs['manage_groups'] = array(
- 'title' => $lang->manage_user_groups,
- 'link' => "index.php?module=user-groups",
- 'description' => $lang->manage_user_groups_desc
- );
- $sub_tabs['add_group'] = array(
- 'title' => $lang->add_user_group,
- 'link' => "index.php?module=user-groups&action=add",
- 'description' => $lang->add_user_group_desc
- );
-}
-
-$plugins->run_hooks("admin_user_groups_begin");
-
-if($mybb->input['action'] == "approve_join_request")
-{
- $query = $db->simple_select("joinrequests", "*", "rid='".$mybb->input['rid']."'");
- $request = $db->fetch_array($query);
-
- if(!$request['rid'])
- {
- flash_message($lang->error_invalid_join_request, 'error');
- admin_redirect("index.php?module=user-groups");
- }
-
- if(!verify_post_check($mybb->input['my_post_key']))
- {
- flash_message($lang->invalid_post_verify_key2, 'error');
- admin_redirect("index.php?module=user-groups&action=join_requests&gid={$request['gid']}");
- }
-
- $plugins->run_hooks("admin_user_groups_approve_join_request");
-
- // Add the user to the group
- join_usergroup($request['uid'], $request['gid']);
-
- // Delete the join request
- $db->delete_query("joinrequests", "rid='{$request['rid']}'");
-
- $plugins->run_hooks("admin_user_groups_approve_join_request_commit");
-
- flash_message($lang->success_join_request_approved, "success");
- admin_redirect("index.php?module=user-groups&action=join_requests&gid={$request['gid']}");
-}
-
-if($mybb->input['action'] == "deny_join_request")
-{
- $query = $db->simple_select("joinrequests", "*", "rid='".$mybb->input['rid']."'");
- $request = $db->fetch_array($query);
-
- if(!$request['rid'])
- {
- flash_message($lang->error_invalid_join_request, 'error');
- admin_redirect("index.php?module=user-groups");
- }
-
- if(!verify_post_check($mybb->input['my_post_key']))
- {
- flash_message($lang->invalid_post_verify_key2, 'error');
- admin_redirect("index.php?module=user-groups&action=join_requests&gid={$request['gid']}");
- }
-
- $plugins->run_hooks("admin_user_groups_deny_join_request");
-
- // Delete the join request
- $db->delete_query("joinrequests", "rid='{$request['rid']}'");
-
- $plugins->run_hooks("admin_user_groups_deny_join_request_commit");
-
- flash_message($lang->success_join_request_denied, "success");
- admin_redirect("index.php?module=user-groups&action=join_requests&gid={$request['gid']}");
-}
-
-if($mybb->input['action'] == "join_requests")
-{
- $query = $db->simple_select("usergroups", "*", "gid='".$mybb->get_input('gid', MyBB::INPUT_INT)."'");
- $group = $db->fetch_array($query);
-
- if(!$group['gid'] || $group['type'] != 4)
- {
- flash_message($lang->error_invalid_user_group, 'error');
- admin_redirect("index.php?module=user-groups");
- }
-
- $plugins->run_hooks("admin_user_groups_join_requests_start");
-
- if($mybb->request_method == "post" && is_array($mybb->input['users']))
- {
- $uid_in = implode(",", array_map('intval', $mybb->input['users']));
-
- if(isset($mybb->input['approve']))
- {
- foreach($mybb->input['users'] as $uid)
- {
- $uid = (int)$uid;
- join_usergroup($uid, $group['gid']);
- }
- // Log admin action
- log_admin_action("approve", htmlspecialchars_uni($group['title']), $group['gid']);
- $message = $lang->success_selected_requests_approved;
- }
- else
- {
- // Log admin action
- log_admin_action("deny", htmlspecialchars_uni($group['title']), $group['gid']);
- $message = $lang->success_selected_requests_denied;
- }
-
- $plugins->run_hooks("admin_user_groups_join_requests_commit");
-
- // Go through and delete the join requests from the database
- $db->delete_query("joinrequests", "uid IN ({$uid_in}) AND gid='{$group['gid']}'");
-
- $plugins->run_hooks("admin_user_groups_join_requests_commit_end");
-
- flash_message($message, 'success');
- admin_redirect("index.php?module=user-groups&action=join_requests&gid={$group['gid']}");
- }
-
- $page->add_breadcrumb_item($lang->join_requests_for.' '.htmlspecialchars_uni($group['title']));
- $page->output_header($lang->join_requests_for.' '.htmlspecialchars_uni($group['title']));
-
- $sub_tabs = array();
- $sub_tabs['join_requests'] = array(
- 'title' => $lang->group_join_requests,
- 'link' => "index.php?module=user-groups&action=join_requests&gid={$group['gid']}",
- 'description' => $lang->group_join_requests_desc
- );
-
- $page->output_nav_tabs($sub_tabs, 'join_requests');
-
- $query = $db->simple_select("joinrequests", "COUNT(*) AS num_requests", "gid='{$group['gid']}'");
- $num_requests = $db->fetch_field($query, "num_requests");
-
- $per_page = 20;
-
- if($mybb->input['page'] > 0)
- {
- $current_page = $mybb->get_input('page', MyBB::INPUT_INT);
- $start = ($current_page-1)*$per_page;
- $pages = $num_requests / $per_page;
- $pages = ceil($pages);
- if($current_page > $pages)
- {
- $start = 0;
- $current_page = 1;
- }
- }
- else
- {
- $start = 0;
- $current_page = 1;
- }
-
- // Do we need to construct the pagination?
- $pagination = '';
- if($num_requests > $per_page)
- {
- $pagination = draw_admin_pagination($page, $per_page, $num_requests, "index.php?module=user-groups&action=join_requests&gid={$group['gid']}");
- echo $pagination;
- }
-
- $form = new Form("index.php?module=user-groups&action=join_requests&gid={$group['gid']}", "post");
- $table = new Table;
- $table->construct_header($form->generate_check_box("checkall", 1, "", array('class' => 'checkall')), array('width' => 1));
- $table->construct_header($lang->users);
- $table->construct_header($lang->reason);
- $table->construct_header($lang->date_requested, array("class" => 'align_center', "width" => 200));
- $table->construct_header($lang->controls, array("class" => "align_center", "width" => 200));
-
- $query = $db->query("
- SELECT j.*, u.username
- FROM ".TABLE_PREFIX."joinrequests j
- INNER JOIN ".TABLE_PREFIX."users u ON (u.uid=j.uid)
- WHERE j.gid='{$group['gid']}'
- ORDER BY dateline ASC
- LIMIT {$start}, {$per_page}
- ");
-
- while($request = $db->fetch_array($query))
- {
- $table->construct_cell($form->generate_check_box("users[]", $request['uid'], ""));
- $table->construct_cell("".build_profile_link(htmlspecialchars_uni($request['username']), $request['uid'], "_blank")."");
- $table->construct_cell(htmlspecialchars_uni($request['reason']));
- $table->construct_cell(my_date('relative', $request['dateline']), array('class' => 'align_center'));
-
- $popup = new PopupMenu("join_{$request['rid']}", $lang->options);
- $popup->add_item($lang->approve, "index.php?module=user-groups&action=approve_join_request&rid={$request['rid']}&my_post_key={$mybb->post_code}");
- $popup->add_item($lang->deny, "index.php?module=user-groups&action=deny_join_request&rid={$request['rid']}&my_post_key={$mybb->post_code}");
-
- $table->construct_cell($popup->fetch(), array('class' => "align_center"));
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_join_requests, array("colspan" => 6));
- $table->construct_row();
- }
-
- $table->output($lang->join_requests_for.' '.htmlspecialchars_uni($group['title']));
- echo $pagination;
-
- $buttons[] = $form->generate_submit_button($lang->approve_selected_requests, array('name' => 'approve'));
- $buttons[] = $form->generate_submit_button($lang->deny_selected_requests, array('name' => 'deny'));
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-if($mybb->input['action'] == "add_leader" && $mybb->request_method == "post")
-{
- $query = $db->simple_select("usergroups", "*", "gid='".$mybb->get_input('gid', MyBB::INPUT_INT)."'");
- $group = $db->fetch_array($query);
-
- if(!$group['gid'])
- {
- flash_message($lang->error_invalid_user_group, 'error');
- admin_redirect("index.php?module=user-group");
- }
-
- $plugins->run_hooks("admin_user_groups_add_leader");
-
- $user = get_user_by_username($mybb->input['username'], array('fields' => 'username'));
- if(!$user['uid'])
- {
- $errors[] = $lang->error_invalid_username;
- }
- else
- {
- // Is this user already a leader of this group?
- $query = $db->simple_select("groupleaders", "uid", "uid='{$user['uid']}' AND gid='{$group['gid']}'");
- $existing_leader = $db->fetch_field($query, "uid");
- if($existing_leader)
- {
- $errors[] = $lang->error_already_leader;
- }
- }
-
- // No errors, insert
- if(!$errors)
- {
- $new_leader = array(
- "gid" => $group['gid'],
- "uid" => $user['uid'],
- "canmanagemembers" => $mybb->get_input('canmanagemembers', MyBB::INPUT_INT),
- "canmanagerequests" => $mybb->get_input('canmanagerequests', MyBB::INPUT_INT),
- "caninvitemembers" => $mybb->get_input('caninvitemembers', MyBB::INPUT_INT)
- );
-
- $makeleadermember = $mybb->get_input('makeleadermember', MyBB::INPUT_INT);
- if($makeleadermember == 1)
- {
- join_usergroup($user['uid'], $group['gid']);
- }
-
- $plugins->run_hooks("admin_user_groups_add_leader_commit");
-
- $db->insert_query("groupleaders", $new_leader);
-
- $cache->update_groupleaders();
-
- // Log admin action
- log_admin_action($user['uid'], htmlspecialchars_uni($user['username']), $group['gid'], htmlspecialchars_uni($group['title']));
-
- $username = htmlspecialchars_uni($user['username']);
- flash_message("{$username} ".$lang->success_user_made_leader, 'success');
- admin_redirect("index.php?module=user-groups&action=leaders&gid={$group['gid']}");
- }
- else
- {
- // Errors, show leaders page
- $mybb->input['action'] = "leaders";
- }
-}
-
-// Show a listing of group leaders
-if($mybb->input['action'] == "leaders")
-{
- $query = $db->simple_select("usergroups", "*", "gid='".$mybb->get_input('gid', MyBB::INPUT_INT)."'");
- $group = $db->fetch_array($query);
-
- if(!$group['gid'])
- {
- flash_message($lang->error_invalid_user_group, 'error');
- admin_redirect("index.php?module=user-groups");
- }
-
- $plugins->run_hooks("admin_user_groups_leaders");
-
- $page->add_breadcrumb_item($lang->group_leaders_for.' '.htmlspecialchars_uni($group['title']));
- $page->output_header($lang->group_leaders_for.' '.htmlspecialchars_uni($group['title']));
-
- $sub_tabs = array();
- $sub_tabs['group_leaders'] = array(
- 'title' => $lang->manage_group_leaders,
- 'link' => "index.php?module=user-groups&action=leaders&gid={$group['gid']}",
- 'description' => $lang->manage_group_leaders_desc
- );
-
- $page->output_nav_tabs($sub_tabs, 'group_leaders');
-
- $table = new Table;
- $table->construct_header($lang->user);
- $table->construct_header($lang->can_manage_members, array("class" => 'align_center', "width" => 200));
- $table->construct_header($lang->can_manage_join_requests, array("class" => 'align_center', "width" => 200));
- $table->construct_header($lang->can_invite_members, array("class" => 'align_center', "width" => 200));
- $table->construct_header($lang->controls, array("class" => "align_center", "colspan" => 2, "width" => 200));
-
- $query = $db->query("
- SELECT g.*, u.username
- FROM ".TABLE_PREFIX."groupleaders g
- INNER JOIN ".TABLE_PREFIX."users u ON (u.uid=g.uid)
- WHERE g.gid='{$group['gid']}'
- ORDER BY u.username ASC
- ");
- while($leader = $db->fetch_array($query))
- {
- $leader['username'] = htmlspecialchars_uni($leader['username']);
- if($leader['canmanagemembers'])
- {
- $canmanagemembers = $lang->yes;
- }
- else
- {
- $canmanagemembers = $lang->no;
- }
-
- if($leader['canmanagerequests'])
- {
- $canmanagerequests = $lang->yes;
- }
- else
- {
- $canmanagerequests = $lang->no;
- }
-
- if($leader['caninvitemembers'])
- {
- $caninvitemembers = $lang->yes;
- }
- else
- {
- $caninvitemembers = $lang->no;
- }
-
- $table->construct_cell("".build_profile_link($leader['username'], $leader['uid'], "_blank")."");
- $table->construct_cell($canmanagemembers, array("class" => "align_center"));
- $table->construct_cell($canmanagerequests, array("class" => "align_center"));
- $table->construct_cell($caninvitemembers, array("class" => "align_center"));
- $table->construct_cell("{$lang->edit}", array("width" => 100, "class" => "align_center"));
- $table->construct_cell("post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_group_leader_deletion}')\">{$lang->delete}", array("width" => 100, "class" => "align_center"));
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_assigned_leaders, array("colspan" => 5));
- $table->construct_row();
- }
-
- $table->output($lang->group_leaders_for.' '.htmlspecialchars_uni($group['title']));
-
- $form = new Form("index.php?module=user-groups&action=add_leader&gid={$group['gid']}", "post");
-
- if($errors)
- {
- $page->output_inline_error($errors);
- }
- else
- {
- $mybb->input = array_merge($mybb->input, array(
- "canmanagemembers" => 1,
- "canmanagerequests" => 1,
- "caninvitemembers" => 1,
- "makeleadermember" => 0
- )
- );
- }
-
- $form_container = new FormContainer($lang->add_group_leader.' '.htmlspecialchars_uni($group['title']));
- $form_container->output_row($lang->username." *", "", $form->generate_text_box('username', htmlspecialchars_uni($mybb->get_input('username')), array('id' => 'username')), 'username');
- $form_container->output_row($lang->can_manage_group_members, $lang->can_manage_group_members_desc, $form->generate_yes_no_radio('canmanagemembers', $mybb->input['canmanagemembers']));
- $form_container->output_row($lang->can_manage_group_join_requests, $lang->can_manage_group_join_requests_desc, $form->generate_yes_no_radio('canmanagerequests', $mybb->input['canmanagerequests']));
- $form_container->output_row($lang->can_invite_group_members, $lang->can_invite_group_members_desc, $form->generate_yes_no_radio('caninvitemembers', $mybb->input['caninvitemembers']));
- $form_container->output_row($lang->make_user_member, $lang->make_user_member_desc, $form->generate_yes_no_radio('makeleadermember', $mybb->input['makeleadermember']));
- $form_container->end();
-
- // Autocompletion for usernames
- echo '
-
-
- ';
-
- $buttons[] = $form->generate_submit_button($lang->save_group_leader);
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "delete_leader")
-{
- $query = $db->query("
- SELECT l.*, u.username
- FROM ".TABLE_PREFIX."groupleaders l
- INNER JOIN ".TABLE_PREFIX."users u ON (u.uid=l.uid)
- WHERE l.lid='".$mybb->get_input('lid', MyBB::INPUT_INT)."'");
- $leader = $db->fetch_array($query);
-
- if(!$leader['lid'])
- {
- flash_message($lang->error_invalid_group_leader, 'error');
- admin_redirect("index.php?module=user-groups");
- }
-
- $query = $db->simple_select("usergroups", "*", "gid='{$leader['gid']}'");
- $group = $db->fetch_array($query);
-
- // User clicked no
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=user-groups");
- }
-
- $plugins->run_hooks("admin_user_groups_delete_leader");
-
- if($mybb->request_method == "post")
- {
- $plugins->run_hooks("admin_user_groups_delete_leader_commit");
-
- // Delete the leader
- $db->delete_query("groupleaders", "lid='{$leader['lid']}'");
-
- $plugins->run_hooks("admin_user_groups_delete_leader_commit_end");
-
- $cache->update_groupleaders();
-
- // Log admin action
- log_admin_action($leader['uid'], htmlspecialchars_uni($leader['username']), $group['gid'], htmlspecialchars_uni($group['title']));
-
- flash_message($lang->success_group_leader_deleted, 'success');
- admin_redirect("index.php?module=user-groups&action=leaders&gid={$group['gid']}");
- }
- else
- {
- $page->output_confirm_action("index.php?module=user-groups&action=delete_leader&lid={$leader['lid']}", $lang->confirm_group_leader_deletion);
- }
-}
-
-if($mybb->input['action'] == "edit_leader")
-{
- $query = $db->query("
- SELECT l.*, u.username
- FROM ".TABLE_PREFIX."groupleaders l
- INNER JOIN ".TABLE_PREFIX."users u ON (u.uid=l.uid)
- WHERE l.lid='".$mybb->get_input('lid', MyBB::INPUT_INT)."'
- ");
- $leader = $db->fetch_array($query);
-
- if(!$leader['lid'])
- {
- flash_message($lang->error_invalid_group_leader, 'error');
- admin_redirect("index.php?module=user-groups");
- }
-
- $query = $db->simple_select("usergroups", "*", "gid='{$leader['gid']}'");
- $group = $db->fetch_array($query);
-
- $plugins->run_hooks("admin_user_groups_edit_leader");
-
- if($mybb->request_method == "post")
- {
- $updated_leader = array(
- "canmanagemembers" => $mybb->get_input('canmanagemembers', MyBB::INPUT_INT),
- "canmanagerequests" => $mybb->get_input('canmanagerequests', MyBB::INPUT_INT),
- "caninvitemembers" => $mybb->get_input('caninvitemembers', MyBB::INPUT_INT)
- );
-
- $plugins->run_hooks("admin_user_groups_edit_leader_commit");
-
- $db->update_query("groupleaders", $updated_leader, "lid={$leader['lid']}");
-
- $cache->update_groupleaders();
-
- // Log admin action
- log_admin_action($leader['uid'], htmlspecialchars_uni($leader['username']), $group['gid'], htmlspecialchars_uni($group['title']));
-
- flash_message($lang->success_group_leader_updated, 'success');
- admin_redirect("index.php?module=user-groups&action=leaders&gid={$group['gid']}");
- }
-
- if(!$errors)
- {
- $mybb->input = array_merge($mybb->input, $leader);
- }
-
- $page->add_breadcrumb_item($lang->group_leaders_for.' '.htmlspecialchars_uni($group['title']), "index.php?module=user-groups&action=leaders&gid={$group['gid']}");
- $leader['username'] = htmlspecialchars_uni($leader['username']);
- $page->add_breadcrumb_item($lang->edit_leader." {$leader['username']}");
-
- $page->output_header($lang->edit_group_leader);
-
- $sub_tabs = array();
- $sub_tabs['group_leaders'] = array(
- 'title' => $lang->edit_group_leader,
- 'link' => "index.php?module=user-groups&action=edit_leader&lid={$leader['lid']}",
- 'description' => $lang->edit_group_leader_desc
- );
-
- $page->output_nav_tabs($sub_tabs, 'group_leaders');
-
- $form = new Form("index.php?module=user-groups&action=edit_leader&lid={$leader['lid']}", "post");
-
- $form_container = new FormContainer($lang->edit_group_leader);
- $form_container->output_row($lang->username." *", "", $leader['username']);
-
- $form_container->output_row($lang->can_manage_group_members, $lang->can_manage_group_members_desc, $form->generate_yes_no_radio('canmanagemembers', $mybb->input['canmanagemembers']));
- $form_container->output_row($lang->can_manage_group_join_requests, $lang->can_manage_group_join_requests_desc, $form->generate_yes_no_radio('canmanagerequests', $mybb->input['canmanagerequests']));
- $form_container->output_row($lang->can_invite_group_members, $lang->can_invite_group_members_desc, $form->generate_yes_no_radio('caninvitemembers', $mybb->input['caninvitemembers']));
- $buttons[] = $form->generate_submit_button($lang->save_group_leader);
-
- $form_container->end();
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "add")
-{
- $plugins->run_hooks("admin_user_groups_add");
-
- if($mybb->request_method == "post")
- {
- if(!trim($mybb->input['title']))
- {
- $errors[] = $lang->error_missing_title;
- }
-
- if(my_strpos($mybb->input['namestyle'], "{username}") === false)
- {
- $errors[] = $lang->error_missing_namestyle_username;
- }
-
- if(!$errors)
- {
- if($mybb->input['stars'] < 1)
- {
- $mybb->input['stars'] = 0;
- }
-
- if(!$mybb->input['starimage'])
- {
- $mybb->input['starimage'] = "images/star.png";
- }
-
- $new_usergroup = array(
- "type" => 2,
- "title" => $db->escape_string($mybb->input['title']),
- "description" => $db->escape_string($mybb->input['description']),
- "namestyle" => $db->escape_string($mybb->input['namestyle']),
- "usertitle" => $db->escape_string($mybb->input['usertitle']),
- "stars" => $mybb->get_input('stars', MyBB::INPUT_INT),
- "starimage" => $db->escape_string($mybb->input['starimage']),
- "disporder" => 0
- );
-
- // Set default permissions
- if($mybb->input['copyfrom'] == 0)
- {
- $new_usergroup = array_merge($new_usergroup, $usergroup_permissions);
- }
- // Copying permissions from another group
- else
- {
- $query = $db->simple_select("usergroups", "*", "gid='".$mybb->get_input('copyfrom', MyBB::INPUT_INT)."'");
- $existing_usergroup = $db->fetch_array($query);
- foreach(array_keys($usergroup_permissions) as $field)
- {
- $new_usergroup[$field] = $existing_usergroup[$field];
- }
- }
-
- $plugins->run_hooks("admin_user_groups_add_commit");
-
- $gid = $db->insert_query("usergroups", $new_usergroup);
-
- $plugins->run_hooks("admin_user_groups_add_commit_end");
-
- // Are we copying permissions? If so, copy all forum permissions too
- if($mybb->input['copyfrom'] > 0)
- {
- $query = $db->simple_select("forumpermissions", "*", "gid='".$mybb->get_input('copyfrom', MyBB::INPUT_INT)."'");
- while($forum_permission = $db->fetch_array($query))
- {
- unset($forum_permission['pid']);
- $forum_permission['gid'] = $gid;
- $db->insert_query("forumpermissions", $forum_permission);
- }
- }
-
- // Update the caches
- $cache->update_usergroups();
- $cache->update_forumpermissions();
-
- // Log admin action
- log_admin_action($gid, htmlspecialchars_uni($mybb->input['title']));
-
- flash_message($lang->success_group_created, 'success');
- admin_redirect("index.php?module=user-groups&action=edit&gid={$gid}");
- }
- }
-
- $page->add_breadcrumb_item($lang->add_user_group);
- $page->output_header($lang->add_user_group);
-
- $page->output_nav_tabs($sub_tabs, 'add_group');
- $form = new Form("index.php?module=user-groups&action=add", "post");
-
- if($errors)
- {
- $page->output_inline_error($errors);
- }
- else
- {
- $mybb->input = array_merge($mybb->input, array(
- "namestyle" => "{username}"
- )
- );
- }
-
- $form_container = new FormContainer($lang->add_user_group);
- $form_container->output_row($lang->title." *", "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
- $form_container->output_row($lang->short_description, "", $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description');
- $form_container->output_row($lang->username_style, $lang->username_style_desc, $form->generate_text_box('namestyle', $mybb->input['namestyle'], array('id' => 'namestyle')), 'namestyle');
- $form_container->output_row($lang->user_title, $lang->user_title_desc, $form->generate_text_box('usertitle', $mybb->input['usertitle'], array('id' => 'usertitle')), 'usertitle');
-
- $options[0] = $lang->do_not_copy_permissions;
- $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->copy_permissions_from, $lang->copy_permissions_from_desc, $form->generate_select_box('copyfrom', $options, $mybb->input['copyfrom'], array('id' => 'copyfrom')), 'copyfrom');
-
- $form_container->end();
- $buttons[] = $form->generate_submit_button($lang->save_user_group);
- $form->output_submit_wrapper($buttons);
-
- $form->end();
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "edit")
-{
- $query = $db->simple_select("usergroups", "*", "gid='".$mybb->get_input('gid', MyBB::INPUT_INT)."'");
- $usergroup = $db->fetch_array($query);
-
- if(!$usergroup['gid'])
- {
- flash_message($lang->error_invalid_user_group, 'error');
- admin_redirect("index.php?module=user-group");
- }
- else
- {
- if(preg_match("#<((m[^a])|(b[^diloru>])|(s[^aemptu>]))(\s*[^>]*)>#si", $mybb->input['namestyle']))
- {
- $errors[] = $lang->error_disallowed_namestyle_username;
- $mybb->input['namestyle'] = $usergroup['namestyle'];
- }
- }
-
- $plugins->run_hooks("admin_user_groups_edit");
-
- if($mybb->request_method == "post")
- {
- if(!trim($mybb->input['title']))
- {
- $errors[] = $lang->error_missing_title;
- }
-
- if(my_strpos($mybb->input['namestyle'], "{username}") === false)
- {
- $errors[] = $lang->error_missing_namestyle_username;
- }
-
- if($mybb->input['moderate'] == 1 && $mybb->input['invite'] == 1)
- {
- $errors[] = $lang->error_cannot_have_both_types;
- }
-
- if(!$errors)
- {
- if($mybb->input['joinable'] == 1)
- {
- if($mybb->input['moderate'] == 1)
- {
- $mybb->input['type'] = "4";
- }
- elseif($mybb->input['invite'] == 1)
- {
- $mybb->input['type'] = "5";
- }
- else
- {
- $mybb->input['type'] = "3";
- }
- }
- else
- {
- $mybb->input['type'] = "2";
- }
-
- if($usergroup['type'] == 1)
- {
- $mybb->input['type'] = 1;
- }
-
- if($mybb->input['stars'] < 1)
- {
- $mybb->input['stars'] = 0;
- }
-
- $updated_group = array(
- "type" => $mybb->get_input('type', MyBB::INPUT_INT),
- "title" => $db->escape_string($mybb->input['title']),
- "description" => $db->escape_string($mybb->input['description']),
- "namestyle" => $db->escape_string($mybb->input['namestyle']),
- "usertitle" => $db->escape_string($mybb->input['usertitle']),
- "stars" => $mybb->get_input('stars', MyBB::INPUT_INT),
- "starimage" => $db->escape_string($mybb->input['starimage']),
- "image" => $db->escape_string($mybb->input['image']),
- "isbannedgroup" => $mybb->get_input('isbannedgroup', MyBB::INPUT_INT),
- "canview" => $mybb->get_input('canview', MyBB::INPUT_INT),
- "canviewthreads" => $mybb->get_input('canviewthreads', MyBB::INPUT_INT),
- "canviewprofiles" => $mybb->get_input('canviewprofiles', MyBB::INPUT_INT),
- "candlattachments" => $mybb->get_input('candlattachments', MyBB::INPUT_INT),
- "canviewboardclosed" => $mybb->get_input('canviewboardclosed', MyBB::INPUT_INT),
- "canpostthreads" => $mybb->get_input('canpostthreads', MyBB::INPUT_INT),
- "canpostreplys" => $mybb->get_input('canpostreplys', MyBB::INPUT_INT),
- "canpostattachments" => $mybb->get_input('canpostattachments', MyBB::INPUT_INT),
- "canratethreads" => $mybb->get_input('canratethreads', MyBB::INPUT_INT),
- "modposts" => $mybb->get_input('modposts', MyBB::INPUT_INT),
- "modthreads" => $mybb->get_input('modthreads', MyBB::INPUT_INT),
- "mod_edit_posts" => $mybb->get_input('mod_edit_posts', MyBB::INPUT_INT),
- "modattachments" => $mybb->get_input('modattachments', MyBB::INPUT_INT),
- "caneditposts" => $mybb->get_input('caneditposts', MyBB::INPUT_INT),
- "candeleteposts" => $mybb->get_input('candeleteposts', MyBB::INPUT_INT),
- "candeletethreads" => $mybb->get_input('candeletethreads', MyBB::INPUT_INT),
- "caneditattachments" => $mybb->get_input('caneditattachments', MyBB::INPUT_INT),
- "canviewdeletionnotice" => $mybb->get_input('canviewdeletionnotice', MyBB::INPUT_INT),
- "canpostpolls" => $mybb->get_input('canpostpolls', MyBB::INPUT_INT),
- "canvotepolls" => $mybb->get_input('canvotepolls', MyBB::INPUT_INT),
- "canundovotes" => $mybb->get_input('canundovotes', MyBB::INPUT_INT),
- "canusepms" => $mybb->get_input('canusepms', MyBB::INPUT_INT),
- "cansendpms" => $mybb->get_input('cansendpms', MyBB::INPUT_INT),
- "cantrackpms" => $mybb->get_input('cantrackpms', MyBB::INPUT_INT),
- "candenypmreceipts" => $mybb->get_input('candenypmreceipts', MyBB::INPUT_INT),
- "pmquota" => $mybb->get_input('pmquota', MyBB::INPUT_INT),
- "maxpmrecipients" => $mybb->get_input('maxpmrecipients', MyBB::INPUT_INT),
- "cansendemail" => $mybb->get_input('cansendemail', MyBB::INPUT_INT),
- "cansendemailoverride" => $mybb->get_input('cansendemailoverride', MyBB::INPUT_INT),
- "maxemails" => $mybb->get_input('maxemails', MyBB::INPUT_INT),
- "emailfloodtime" => $mybb->get_input('emailfloodtime', MyBB::INPUT_INT),
- "canviewmemberlist" => $mybb->get_input('canviewmemberlist', MyBB::INPUT_INT),
- "canviewcalendar" => $mybb->get_input('canviewcalendar', MyBB::INPUT_INT),
- "canaddevents" => $mybb->get_input('canaddevents', MyBB::INPUT_INT),
- "canbypasseventmod" => $mybb->get_input('canbypasseventmod', MyBB::INPUT_INT),
- "canmoderateevents" => $mybb->get_input('canmoderateevents', MyBB::INPUT_INT),
- "canviewonline" => $mybb->get_input('canviewonline', MyBB::INPUT_INT),
- "canviewwolinvis" => $mybb->get_input('canviewwolinvis', MyBB::INPUT_INT),
- "canviewonlineips" => $mybb->get_input('canviewonlineips', MyBB::INPUT_INT),
- "cancp" => $mybb->get_input('cancp', MyBB::INPUT_INT),
- "issupermod" => $mybb->get_input('issupermod', MyBB::INPUT_INT),
- "cansearch" => $mybb->get_input('cansearch', MyBB::INPUT_INT),
- "canusercp" => $mybb->get_input('canusercp', MyBB::INPUT_INT),
- "canuploadavatars" => $mybb->get_input('canuploadavatars', MyBB::INPUT_INT),
- "canchangename" => $mybb->get_input('canchangename', MyBB::INPUT_INT),
- "canbereported" => $mybb->get_input('canbereported', MyBB::INPUT_INT),
- "canchangewebsite" => $mybb->get_input('canchangewebsite', MyBB::INPUT_INT),
- "showforumteam" => $mybb->get_input('showforumteam', MyBB::INPUT_INT),
- "usereputationsystem" => $mybb->get_input('usereputationsystem', MyBB::INPUT_INT),
- "cangivereputations" => $mybb->get_input('cangivereputations', MyBB::INPUT_INT),
- "candeletereputations" => $mybb->get_input('candeletereputations', MyBB::INPUT_INT),
- "reputationpower" => $mybb->get_input('reputationpower', MyBB::INPUT_INT),
- "maxreputationsday" => $mybb->get_input('maxreputationsday', MyBB::INPUT_INT),
- "maxreputationsperuser" => $mybb->get_input('maxreputationsperuser', MyBB::INPUT_INT),
- "maxreputationsperthread" => $mybb->get_input('maxreputationsperthread', MyBB::INPUT_INT),
- "attachquota" => $mybb->get_input('attachquota', MyBB::INPUT_INT),
- "cancustomtitle" => $mybb->get_input('cancustomtitle', MyBB::INPUT_INT),
- "canwarnusers" => $mybb->get_input('canwarnusers', MyBB::INPUT_INT),
- "canreceivewarnings" =>$mybb->get_input('canreceivewarnings', MyBB::INPUT_INT),
- "maxwarningsday" => $mybb->get_input('maxwarningsday', MyBB::INPUT_INT),
- "canmodcp" => $mybb->get_input('canmodcp', MyBB::INPUT_INT),
- "showinbirthdaylist" => $mybb->get_input('showinbirthdaylist', MyBB::INPUT_INT),
- "canoverridepm" => $mybb->get_input('canoverridepm', MyBB::INPUT_INT),
- "canusesig" => $mybb->get_input('canusesig', MyBB::INPUT_INT),
- "canusesigxposts" => $mybb->get_input('canusesigxposts', MyBB::INPUT_INT),
- "signofollow" => $mybb->get_input('signofollow', MyBB::INPUT_INT),
- "edittimelimit" => $mybb->get_input('edittimelimit', MyBB::INPUT_INT),
- "maxposts" => $mybb->get_input('maxposts', MyBB::INPUT_INT),
- "showmemberlist" => $mybb->get_input('showmemberlist', MyBB::INPUT_INT),
- "canmanageannounce" => $mybb->get_input('canmanageannounce', MyBB::INPUT_INT),
- "canmanagemodqueue" => $mybb->get_input('canmanagemodqueue', MyBB::INPUT_INT),
- "canmanagereportedcontent" => $mybb->get_input('canmanagereportedcontent', MyBB::INPUT_INT),
- "canviewmodlogs" => $mybb->get_input('canviewmodlogs', MyBB::INPUT_INT),
- "caneditprofiles" => $mybb->get_input('caneditprofiles', MyBB::INPUT_INT),
- "canbanusers" => $mybb->get_input('canbanusers', MyBB::INPUT_INT),
- "canviewwarnlogs" => $mybb->get_input('canviewwarnlogs', MyBB::INPUT_INT),
- "canuseipsearch" => $mybb->get_input('canuseipsearch', MyBB::INPUT_INT)
- );
-
- // Only update the candisplaygroup setting if not a default user group
- if($usergroup['type'] != 1)
- {
- $updated_group['candisplaygroup'] = $mybb->get_input('candisplaygroup', MyBB::INPUT_INT);
- }
-
- $plugins->run_hooks("admin_user_groups_edit_commit");
-
- $db->update_query("usergroups", $updated_group, "gid='{$usergroup['gid']}'");
-
- // Update the caches
- $cache->update_usergroups();
- $cache->update_forumpermissions();
-
- // Log admin action
- log_admin_action($usergroup['gid'], htmlspecialchars_uni($mybb->input['title']));
-
- flash_message($lang->success_group_updated, 'success');
- admin_redirect("index.php?module=user-groups");
- }
- }
-
- $page->add_breadcrumb_item($lang->edit_user_group);
- $page->output_header($lang->edit_user_group);
-
- $sub_tabs = array();
- $sub_tabs['edit_group'] = array(
- 'title' => $lang->edit_user_group,
- 'description' => $lang->edit_user_group_desc
- );
-
- $form = new Form("index.php?module=user-groups&action=edit&gid={$usergroup['gid']}", "post");
-
- $page->output_nav_tabs($sub_tabs, 'edit_group');
-
- // If we have any error messages, show them
- if($errors)
- {
- $page->output_inline_error($errors);
- }
- else
- {
- if($usergroup['type'] == "3")
- {
- $usergroup['joinable'] = 1;
- $usergroup['moderate'] = 0;
- $usergroup['invite'] = 0;
- }
- elseif($usergroup['type'] == "4")
- {
- $usergroup['joinable'] = 1;
- $usergroup['moderate'] = 1;
- $usergroup['invite'] = 0;
- }
- elseif($usergroup['type'] == "5")
- {
- $usergroup['joinable'] = 1;
- $usergroup['moderate'] = 0;
- $usergroup['invite'] = 1;
- }
- else
- {
- $usergroup['joinable'] = 0;
- $usergroup['moderate'] = 0;
- $usergroup['invite'] = 0;
- }
- $mybb->input = array_merge($mybb->input, $usergroup);
- }
- $tabs = array(
- "general" => $lang->general,
- "forums_posts" => $lang->forums_posts,
- "users_permissions" => $lang->users_permissions,
- "misc" => $lang->misc,
- "modcp" => $lang->mod_cp
- );
- $tabs = $plugins->run_hooks("admin_user_groups_edit_graph_tabs", $tabs);
- $page->output_tab_control($tabs);
-
- echo "";
- $form_container = new FormContainer($lang->general);
- $form_container->output_row($lang->title."
*", "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
- $form_container->output_row($lang->short_description, "", $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description');
- $form_container->output_row($lang->username_style, $lang->username_style_desc, $form->generate_text_box('namestyle', $mybb->input['namestyle'], array('id' => 'namestyle')), 'namestyle');
- $form_container->output_row($lang->user_title, $lang->user_title_desc, $form->generate_text_box('usertitle', $mybb->input['usertitle'], array('id' => 'usertitle')), 'usertitle');
-
- $stars = "
| ".$form->generate_numeric_field('stars', $mybb->input['stars'], array('class' => 'field50', 'id' => 'stars', 'min' => 0))." | ".$form->generate_text_box('starimage', $mybb->input['starimage'], array('id' => 'starimage'))." |
";
- $stars .= "| {$lang->stars} | {$lang->star_image} |
";
- $form_container->output_row($lang->user_stars, $lang->user_stars_desc, $stars, "stars");
-
- $form_container->output_row($lang->group_image, $lang->group_image_desc, $form->generate_text_box('image', $mybb->input['image'], array('id' => 'image')), 'image');
-
- $general_options = array();
- $general_options[] = $form->generate_check_box("showmemberlist", 1, $lang->member_list, array("checked" => $mybb->input['showmemberlist']));
- if($usergroup['gid'] != "1" && $usergroup['gid'] != "5")
- {
- $general_options[] = $form->generate_check_box("showforumteam", 1, $lang->forum_team, array("checked" => $mybb->input['showforumteam']));
- }
- $general_options[] = $form->generate_check_box("isbannedgroup", 1, $lang->is_banned_group, array("checked" => $mybb->input['isbannedgroup']));
-
- $form_container->output_row($lang->general_options, "", "
".implode("
", $general_options)."
");
-
- if($usergroup['type'] != 1)
- {
- $public_options = array(
- $form->generate_check_box("joinable", 1, $lang->user_joinable, array("checked" => $mybb->input['joinable'])),
- $form->generate_check_box("moderate", 1, $lang->moderate_join_requests, array("checked" => $mybb->input['moderate'])),
- $form->generate_check_box("invite", 1, $lang->invite_only, array("checked" => $mybb->input['invite'])),
- $form->generate_check_box("candisplaygroup", 1, $lang->can_set_as_display_group, array("checked" => $mybb->input['candisplaygroup'])),
- );
- $form_container->output_row($lang->publicly_joinable_options, "", "
".implode("
", $public_options)."
");
- }
-
- $admin_options = array(
- $form->generate_check_box("issupermod", 1, $lang->is_super_mod, array("checked" => $mybb->input['issupermod'])),
- $form->generate_check_box("canmodcp", 1, $lang->can_access_mod_cp, array("checked" => $mybb->input['canmodcp'])),
- $form->generate_check_box("cancp", 1, $lang->can_access_admin_cp, array("checked" => $mybb->input['cancp']))
- );
- $form_container->output_row($lang->moderation_administration_options, "", "
".implode("
", $admin_options)."
");
-
- $form_container->end();
- echo "
";
-
- //
- // FORUMS AND POSTS
- //
- echo "";
- $form_container = new FormContainer($lang->forums_posts);
-
- $viewing_options = array(
- $form->generate_check_box("canview", 1, $lang->can_view_board, array("checked" => $mybb->input['canview'])),
- $form->generate_check_box("canviewthreads", 1, $lang->can_view_threads, array("checked" => $mybb->input['canviewthreads'])),
- $form->generate_check_box("cansearch", 1, $lang->can_search_forums, array("checked" => $mybb->input['cansearch'])),
- $form->generate_check_box("canviewprofiles", 1, $lang->can_view_profiles, array("checked" => $mybb->input['canviewprofiles'])),
- $form->generate_check_box("candlattachments", 1, $lang->can_download_attachments, array("checked" => $mybb->input['candlattachments'])),
- $form->generate_check_box("canviewboardclosed", 1, $lang->can_view_board_closed, array("checked" => $mybb->input['canviewboardclosed']))
- );
- $form_container->output_row($lang->viewing_options, "", "
".implode("
", $viewing_options)."
");
-
- $posting_options = array(
- $form->generate_check_box("canpostthreads", 1, $lang->can_post_threads, array("checked" => $mybb->input['canpostthreads'])),
- $form->generate_check_box("canpostreplys", 1, $lang->can_post_replies, array("checked" => $mybb->input['canpostreplys'])),
- $form->generate_check_box("canratethreads", 1, $lang->can_rate_threads, array("checked" => $mybb->input['canratethreads'])),
- "{$lang->max_posts_per_day}
{$lang->max_posts_per_day_desc}".$form->generate_numeric_field('maxposts', $mybb->input['maxposts'], array('id' => 'maxposts', 'class' => 'field50', 'min' => 0))
- );
- $form_container->output_row($lang->posting_rating_options, "", "
".implode("
", $posting_options)."
");
-
- $moderator_options = array(
- $form->generate_check_box("modposts", 1, $lang->mod_new_posts, array("checked" => $mybb->input['modposts'])),
- $form->generate_check_box("modthreads", 1, $lang->mod_new_threads, array("checked" => $mybb->input['modthreads'])),
- $form->generate_check_box("modattachments", 1, $lang->mod_new_attachments, array("checked" => $mybb->input['modattachments'])),
- $form->generate_check_box("mod_edit_posts", 1, $lang->mod_after_edit, array("checked" => $mybb->input['mod_edit_posts']))
- );
- $form_container->output_row($lang->moderation_options, "", "
".implode("
", $moderator_options)."
");
-
- $poll_options = array(
- $form->generate_check_box("canpostpolls", 1, $lang->can_post_polls, array("checked" => $mybb->input['canpostpolls'])),
- $form->generate_check_box("canvotepolls", 1, $lang->can_vote_polls, array("checked" => $mybb->input['canvotepolls'])),
- $form->generate_check_box("canundovotes", 1, $lang->can_undo_votes, array("checked" => $mybb->input['canundovotes']))
- );
- $form_container->output_row($lang->poll_options, "", "
".implode("
", $poll_options)."
");
-
- $attachment_options = array(
- $form->generate_check_box("canpostattachments", 1, $lang->can_post_attachments, array("checked" => $mybb->input['canpostattachments'])),
- "{$lang->attach_quota}
{$lang->attach_quota_desc}".$form->generate_numeric_field('attachquota', $mybb->input['attachquota'], array('id' => 'attachquota', 'class' => 'field50', 'min' => 0)). "KB"
- );
- $form_container->output_row($lang->attachment_options, "", "
".implode("
", $attachment_options)."
");
-
- $editing_options = array(
- $form->generate_check_box("caneditposts", 1, $lang->can_edit_posts, array("checked" => $mybb->input['caneditposts'])),
- $form->generate_check_box("candeleteposts", 1, $lang->can_delete_posts, array("checked" => $mybb->input['candeleteposts'])),
- $form->generate_check_box("candeletethreads", 1, $lang->can_delete_threads, array("checked" => $mybb->input['candeletethreads'])),
- $form->generate_check_box("caneditattachments", 1, $lang->can_edit_attachments, array("checked" => $mybb->input['caneditattachments'])),
- $form->generate_check_box("canviewdeletionnotice", 1, $lang->can_view_deletion_notices, array("checked" => $mybb->input['canviewdeletionnotice'])),
- "{$lang->edit_time_limit}
{$lang->edit_time_limit_desc}".$form->generate_numeric_field('edittimelimit', $mybb->input['edittimelimit'], array('id' => 'edittimelimit', 'class' => 'field50', 'min' => 0))
- );
- $form_container->output_row($lang->editing_deleting_options, "", "
".implode("
", $editing_options)."
");
-
- $form_container->end();
- echo "
";
-
- //
- // USERS AND PERMISSIONS
- //
- echo "";
- $form_container = new FormContainer($lang->users_permissions);
-
- $account_options = array(
- $form->generate_check_box("canbereported", 1, $lang->can_be_reported, array("checked" => $mybb->input['canbereported'])),
- $form->generate_check_box("canusercp", 1, $lang->can_access_usercp, array("checked" => $mybb->input['canusercp'])),
- $form->generate_check_box("canchangename", 1, $lang->can_change_username, array("checked" => $mybb->input['canchangename'])),
- $form->generate_check_box("cancustomtitle", 1, $lang->can_use_usertitles, array("checked" => $mybb->input['cancustomtitle'])),
- $form->generate_check_box("canuploadavatars", 1, $lang->can_upload_avatars, array("checked" => $mybb->input['canuploadavatars'])),
- $form->generate_check_box("canusesig", 1, $lang->can_use_signature, array("checked" => $mybb->input['canusesig'])),
- $form->generate_check_box("signofollow", 1, $lang->uses_no_follow, array("checked" => $mybb->input['signofollow'])),
- $form->generate_check_box("canchangewebsite", 1, $lang->can_change_website, array("checked" => $mybb->input['canchangewebsite'])),
- "{$lang->required_posts}
{$lang->required_posts_desc}".$form->generate_numeric_field('canusesigxposts', $mybb->input['canusesigxposts'], array('id' => 'canusesigxposts', 'class' => 'field50', 'min' => 0))
- );
- $form_container->output_row($lang->account_management, "", "
".implode("
", $account_options)."
");
-
- $reputation_options = array(
- $form->generate_check_box("usereputationsystem", 1, $lang->show_reputations, array("checked" => $mybb->input['usereputationsystem'])),
- $form->generate_check_box("cangivereputations", 1, $lang->can_give_reputation, array("checked" => $mybb->input['cangivereputations'])),
- $form->generate_check_box("candeletereputations", 1, $lang->can_delete_own_reputation, array("checked" => $mybb->input['candeletereputations'])),
- "{$lang->points_to_award_take}
{$lang->points_to_award_take_desc}".$form->generate_numeric_field('reputationpower', $mybb->input['reputationpower'], array('id' => 'reputationpower', 'class' => 'field50', 'min' => 0)),
- "{$lang->max_reputations_perthread}
{$lang->max_reputations_perthread_desc}".$form->generate_numeric_field('maxreputationsperthread', $mybb->input['maxreputationsperthread'], array('id' => 'maxreputationsperthread', 'class' => 'field50', 'min' => 0)),
- "{$lang->max_reputations_peruser}
{$lang->max_reputations_peruser_desc}".$form->generate_numeric_field('maxreputationsperuser', $mybb->input['maxreputationsperuser'], array('id' => 'maxreputationsperuser', 'class' => 'field50', 'min' => 0)),
- "{$lang->max_reputations_daily}
{$lang->max_reputations_daily_desc}".$form->generate_numeric_field('maxreputationsday', $mybb->input['maxreputationsday'], array('id' => 'maxreputationsday', 'class' => 'field50', 'min' => 0))
- );
- $form_container->output_row($lang->reputation_system, "", "
".implode("
", $reputation_options)."
");
-
- $warning_options = array(
- $form->generate_check_box("canwarnusers", 1, $lang->can_send_warnings, array("checked" => $mybb->input['canwarnusers'])),
- $form->generate_check_box("canreceivewarnings", 1, $lang->can_receive_warnings, array("checked" => $mybb->input['canreceivewarnings'])),
- "{$lang->warnings_per_day}
".$form->generate_numeric_field('maxwarningsday', $mybb->input['maxwarningsday'], array('id' => 'maxwarningsday', 'class' => 'field50'))
- );
- $form_container->output_row($lang->warning_system, "", "
".implode("
", $warning_options)."
");
-
- $pm_options = array(
- $form->generate_check_box("canusepms", 1, $lang->can_use_pms, array("checked" => $mybb->input['canusepms'])),
- $form->generate_check_box("cansendpms", 1, $lang->can_send_pms, array("checked" => $mybb->input['cansendpms'])),
- $form->generate_check_box("canoverridepm", 1, $lang->can_override_pms, array("checked" => $mybb->input['canoverridepm'])),
- $form->generate_check_box("cantrackpms", 1, $lang->can_track_pms, array("checked" => $mybb->input['cantrackpms'])),
- $form->generate_check_box("candenypmreceipts", 1, $lang->can_deny_reciept, array("checked" => $mybb->input['candenypmreceipts'])),
- "{$lang->message_quota}
{$lang->message_quota_desc}".$form->generate_numeric_field('pmquota', $mybb->input['pmquota'], array('id' => 'pmquota', 'class' => 'field50', 'min' => 0)),
- "{$lang->max_recipients}
{$lang->max_recipients_desc}".$form->generate_numeric_field('maxpmrecipients', $mybb->input['maxpmrecipients'], array('id' => 'maxpmrecipients', 'class' => 'field50', 'min' => 0))
- );
- $form_container->output_row($lang->private_messaging, "", "
".implode("
", $pm_options)."
");
-
- $form_container->end();
- echo "
";
-
- //
- // MISC
- //
- echo "";
- $form_container = new FormContainer($lang->misc);
-
- $calendar_options = array(
- $form->generate_check_box("canviewcalendar", 1, $lang->can_view_calendar, array("checked" => $mybb->input['canviewcalendar'])),
- $form->generate_check_box("canaddevents", 1, $lang->can_post_events, array("checked" => $mybb->input['canaddevents'])),
- $form->generate_check_box("canbypasseventmod", 1, $lang->can_bypass_event_moderation, array("checked" => $mybb->input['canbypasseventmod'])),
- $form->generate_check_box("canmoderateevents", 1, $lang->can_moderate_events, array("checked" => $mybb->input['canmoderateevents']))
- );
- $form_container->output_row($lang->calendar, "", "
".implode("
", $calendar_options)."
");
-
- $wol_options = array(
- $form->generate_check_box("canviewonline", 1, $lang->can_view_whos_online, array("checked" => $mybb->input['canviewonline'])),
- $form->generate_check_box("canviewwolinvis", 1, $lang->can_view_invisible, array("checked" => $mybb->input['canviewwolinvis'])),
- $form->generate_check_box("canviewonlineips", 1, $lang->can_view_ips, array("checked" => $mybb->input['canviewonlineips']))
- );
- $form_container->output_row($lang->whos_online, "", "
".implode("
", $wol_options)."
");
-
- $misc_options = array(
- $form->generate_check_box("canviewmemberlist", 1, $lang->can_view_member_list, array("checked" => $mybb->input['canviewmemberlist'])),
- $form->generate_check_box("showinbirthdaylist", 1, $lang->show_in_birthday_list, array("checked" => $mybb->input['showinbirthdaylist'])),
- $form->generate_check_box("cansendemail", 1, $lang->can_email_users, array("checked" => $mybb->input['cansendemail'])),
- $form->generate_check_box("cansendemailoverride", 1, $lang->can_email_users_override, array("checked" => $mybb->input['cansendemailoverride'])),
- "{$lang->max_emails_per_day}
{$lang->max_emails_per_day_desc}".$form->generate_numeric_field('maxemails', $mybb->input['maxemails'], array('id' => 'maxemails', 'class' => 'field50', 'min' => 0)),
- "{$lang->email_flood_time}
{$lang->email_flood_time_desc}".$form->generate_numeric_field('emailfloodtime', $mybb->input['emailfloodtime'], array('id' => 'emailfloodtime', 'class' => 'field50', 'min' => 0))
- );
- $form_container->output_row($lang->misc, "", "
".implode("
", $misc_options)."
");
-
- $form_container->end();
- echo "
";
-
- //
- // MODERATOR CP
- //
- echo "";
- $form_container = new FormContainer($lang->mod_cp);
-
- $forum_post_options = array(
- $form->generate_check_box("canmanageannounce", 1, $lang->can_manage_announce, array("checked" => $mybb->input['canmanageannounce'])),
- $form->generate_check_box("canmanagemodqueue", 1, $lang->can_manage_mod_queue, array("checked" => $mybb->input['canmanagemodqueue'])),
- $form->generate_check_box("canmanagereportedcontent", 1, $lang->can_manage_reported_content, array("checked" => $mybb->input['canmanagereportedcontent'])),
- $form->generate_check_box("canviewmodlogs", 1, $lang->can_view_mod_logs, array("checked" => $mybb->input['canviewmodlogs']))
- );
- $form_container->output_row($lang->forum_post_options, "", "
".implode("
", $forum_post_options)."
");
-
- $user_options = array(
- $form->generate_check_box("caneditprofiles", 1, $lang->can_edit_profiles, array("checked" => $mybb->input['caneditprofiles'])),
- $form->generate_check_box("canbanusers", 1, $lang->can_ban_users, array("checked" => $mybb->input['canbanusers'])),
- $form->generate_check_box("canviewwarnlogs", 1, $lang->can_view_warnlogs, array("checked" => $mybb->input['canviewwarnlogs'])),
- $form->generate_check_box("canuseipsearch", 1, $lang->can_use_ipsearch, array("checked" => $mybb->input['canuseipsearch']))
- );
- $form_container->output_row($lang->user_options, "", "
".implode("
", $user_options)."
");
-
- $form_container->end();
- echo "
";
-
- $plugins->run_hooks("admin_user_groups_edit_graph");
-
- $buttons[] = $form->generate_submit_button($lang->save_user_group);
- $form->output_submit_wrapper($buttons);
-
- $form->end();
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "delete")
-{
- $query = $db->simple_select("usergroups", "*", "gid='".$mybb->get_input('gid', MyBB::INPUT_INT)."'");
- $usergroup = $db->fetch_array($query);
-
- if(!$usergroup['gid'])
- {
- flash_message($lang->error_invalid_user_group, 'error');
- admin_redirect("index.php?module=user-groups");
- }
- if($usergroup['type'] == 1)
- {
- flash_message($lang->error_default_group_delete, 'error');
- admin_redirect("index.php?module=user-groups");
- }
-
- // User clicked no
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=user-groups");
- }
-
- $plugins->run_hooks("admin_user_groups_delete");
-
- if($mybb->request_method == "post")
- {
- if($usergroup['isbannedgroup'] == 1)
- {
- // If banned group, move users to default banned group
- $updated_users = array("usergroup" => 7);
- }
- else
- {
- // Move any users back to the registered group
- $updated_users = array("usergroup" => 2);
- }
-
- $db->update_query("users", $updated_users, "usergroup='{$usergroup['gid']}'");
-
- $updated_users = array("displaygroup" => "usergroup");
- $plugins->run_hooks("admin_user_groups_delete_commit");
-
- $db->update_query("users", $updated_users, "displaygroup='{$usergroup['gid']}'", "", true); // No quotes = displaygroup=usergroup
-
- switch($db->type)
- {
- case "pgsql":
- case "sqlite":
- $query = $db->simple_select("users", "uid", "','||additionalgroups||',' LIKE '%,{$usergroup['gid']},%'");
- break;
- default:
- $query = $db->simple_select("users", "uid", "CONCAT(',',additionalgroups,',') LIKE '%,{$usergroup['gid']},%'");
- }
- while($user = $db->fetch_array($query))
- {
- leave_usergroup($user['uid'], $usergroup['gid']);
- }
-
- $db->update_query("banned", array("gid" => 7), "gid='{$usergroup['gid']}'");
- $db->update_query("banned", array("oldgroup" => 2), "oldgroup='{$usergroup['gid']}'");
- $db->update_query("banned", array("olddisplaygroup" => "oldgroup"), "olddisplaygroup='{$usergroup['gid']}'", "", true); // No quotes = displaygroup=usergroup
-
- $db->delete_query("forumpermissions", "gid='{$usergroup['gid']}'");
- $db->delete_query("calendarpermissions", "gid='{$usergroup['gid']}'");
- $db->delete_query("joinrequests", "gid='{$usergroup['gid']}'");
- $db->delete_query("moderators", "id='{$usergroup['gid']}' AND isgroup='1'");
- $db->delete_query("groupleaders", "gid='{$usergroup['gid']}'");
- $db->delete_query("usergroups", "gid='{$usergroup['gid']}'");
-
- $plugins->run_hooks("admin_user_groups_delete_commit_end");
-
- $cache->update_groupleaders();
- $cache->update_moderators();
- $cache->update_usergroups();
- $cache->update_forumpermissions();
- $cache->update_banned();
-
- // Log admin action
- log_admin_action($usergroup['gid'], htmlspecialchars_uni($usergroup['title']));
-
- flash_message($lang->success_group_deleted, 'success');
- admin_redirect("index.php?module=user-groups");
- }
- else
- {
- $page->output_confirm_action("index.php?module=user-groups&action=delete&gid={$usergroup['gid']}", $lang->confirm_group_deletion);
- }
-}
-
-if($mybb->input['action'] == "disporder" && $mybb->request_method == "post")
-{
- $plugins->run_hooks("admin_user_groups_disporder");
-
- foreach($mybb->input['disporder'] as $gid=>$order)
- {
- $gid = (int)$gid;
- $order = (int)$order;
- if($gid != 0 && $order != 0)
- {
- $sql_array = array(
- 'disporder' => $order,
- );
- $db->update_query('usergroups', $sql_array, "gid = '{$gid}'");
- }
- }
-
- // Log admin action
- log_admin_action();
-
- $plugins->run_hooks("admin_user_groups_disporder_commit");
-
- flash_message($lang->success_group_disporders_updated, 'success');
- admin_redirect("index.php?module=user-groups");
-}
-
-if(!$mybb->input['action'])
-{
- $plugins->run_hooks("admin_user_groups_start");
-
- if($mybb->request_method == "post")
- {
- if(!empty($mybb->input['disporder']))
- {
- foreach($mybb->input['disporder'] as $gid => $order)
- {
- $db->update_query("usergroups", array('disporder' => (int)$order), "gid='".(int)$gid."'");
- }
-
- $plugins->run_hooks("admin_user_groups_start_commit");
-
- $cache->update_usergroups();
-
- flash_message($lang->success_groups_disporder_updated, 'success');
- admin_redirect("index.php?module=user-groups");
- }
- }
-
- $page->output_header($lang->manage_user_groups);
- $page->output_nav_tabs($sub_tabs, 'manage_groups');
-
- $form = new Form("index.php?module=user-groups", "post", "groups");
-
- $query = $db->query("
- SELECT g.gid, COUNT(u.uid) AS users
- FROM ".TABLE_PREFIX."users u
- LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup)
- GROUP BY g.gid
- ");
- while($groupcount = $db->fetch_array($query))
- {
- $primaryusers[$groupcount['gid']] = $groupcount['users'];
- }
-
- switch($db->type)
- {
- case "pgsql":
- case "sqlite":
- $query = $db->query("
- SELECT g.gid, COUNT(u.uid) AS users
- FROM ".TABLE_PREFIX."users u
- LEFT JOIN ".TABLE_PREFIX."usergroups g ON (','|| u.additionalgroups|| ',' LIKE '%,'|| g.gid|| ',%')
- WHERE g.gid != '0' AND g.gid is not NULL GROUP BY g.gid
- ");
- break;
- default:
- $query = $db->query("
- SELECT g.gid, COUNT(u.uid) AS users
- FROM ".TABLE_PREFIX."users u
- LEFT JOIN ".TABLE_PREFIX."usergroups g ON (CONCAT(',', u.additionalgroups, ',') LIKE CONCAT('%,', g.gid, ',%'))
- WHERE g.gid != '0' AND g.gid is not NULL GROUP BY g.gid
- ");
- }
- while($groupcount = $db->fetch_array($query))
- {
- $secondaryusers[$groupcount['gid']] = $groupcount['users'];
- }
-
- $query = $db->query("
- SELECT g.gid, COUNT(r.uid) AS users
- FROM ".TABLE_PREFIX."joinrequests r
- LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=r.gid)
- GROUP BY g.gid
- ");
-
- $joinrequests = array();
- while($joinrequest = $db->fetch_array($query))
- {
- $joinrequests[$joinrequest['gid']] = $joinrequest['users'];
- }
-
- // Fetch group leaders
- $leaders = array();
- $query = $db->query("
- SELECT u.username, u.uid, l.gid
- FROM ".TABLE_PREFIX."groupleaders l
- INNER JOIN ".TABLE_PREFIX."users u ON (u.uid=l.uid)
- ORDER BY u.username ASC
- ");
- while($leader = $db->fetch_array($query))
- {
- $leaders[$leader['gid']][] = build_profile_link(htmlspecialchars_uni($leader['username']), $leader['uid'], "_blank");
- }
-
- $form_container = new FormContainer($lang->user_groups);
- $form_container->output_row_header($lang->group);
- $form_container->output_row_header($lang->number_of_users, array("class" => "align_center", 'width' => '75'));
- $form_container->output_row_header($lang->order, array("class" => "align_center", 'width' => '5%'));
- $form_container->output_row_header($lang->controls, array("class" => "align_center"));
-
- $query = $db->simple_select("usergroups", "*", "", array('order_by' => 'disporder'));
- while($usergroup = $db->fetch_array($query))
- {
- if($usergroup['type'] > 1)
- {
- $icon = "
custom_user_group}\" style=\"vertical-align: middle;\" />";
- }
- else
- {
- $icon = "
default_user_group}\" style=\"vertical-align: middle;\" />";
- }
-
- $leaders_list = '';
- if(isset($leaders[$usergroup['gid']]))
- {
- $leaders_list = "
{$lang->group_leaders}: ".implode($lang->comma, $leaders[$usergroup['gid']]);
- }
-
- $join_requests = '';
- if($joinrequests[$usergroup['gid']] > 1 && $usergroup['type'] == 4)
- {
- $join_requests = " ({$joinrequests[$usergroup['gid']]} {$lang->outstanding_join_request})";
- }
- else if($joinrequests[$usergroup['gid']] == 1 && $usergroup['type'] == 4)
- {
- $join_requests = " ({$joinrequests[$usergroup['gid']]} {$lang->outstanding_join_request})";
- }
-
- $form_container->output_cell("{$icon}
");
-
- if(!$primaryusers[$usergroup['gid']])
- {
- $primaryusers[$usergroup['gid']] = 0;
- }
- $numusers = $primaryusers[$usergroup['gid']];
- $numusers += $secondaryusers[$usergroup['gid']];
-
- $form_container->output_cell(my_number_format($numusers), array("class" => "align_center"));
-
- if($usergroup['showforumteam'] == 1)
- {
- $form_container->output_cell("", array("class" => "align_center"));
- }
- else
- {
- $form_container->output_cell(" ", array("class" => "align_center"));
- }
-
- $popup = new PopupMenu("usergroup_{$usergroup['gid']}", $lang->options);
- $popup->add_item($lang->edit_group, "index.php?module=user-groups&action=edit&gid={$usergroup['gid']}");
- $popup->add_item($lang->list_users, "index.php?module=user-users&action=search&results=1&conditions[usergroup]={$usergroup['gid']}");
- if($joinrequests[$usergroup['gid']] > 0 && $usergroup['type'] == 4)
- {
- $popup->add_item($lang->join_requests, "index.php?module=user-groups&action=join_requests&gid={$usergroup['gid']}");
- }
- $popup->add_item($lang->group_leaders, "index.php?module=user-groups&action=leaders&gid={$usergroup['gid']}");
- if($usergroup['type'] > 1)
- {
- $popup->add_item($lang->delete_group, "index.php?module=user-groups&action=delete&gid={$usergroup['gid']}&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_group_deletion}')");
- }
- $form_container->output_cell($popup->fetch(), array("class" => "align_center"));
- $form_container->construct_row();
- }
-
- if($form_container->num_rows() == 0)
- {
- $form_container->output_cell($lang->no_groups, array('colspan' => 4));
- $form_container->construct_row();
- }
-
- $form_container->end();
-
- $buttons = array();
- $buttons[] = $form->generate_submit_button($lang->update_groups_order);
- $form->output_submit_wrapper($buttons);
-
- $form->end();
-
- echo <<
-
-LEGEND;
-
- $page->output_footer();
-}
diff --git a/html/forums/admin/modules/user/index.html b/html/forums/admin/modules/user/index.html
deleted file mode 100644
index efd2f36..0000000
--- a/html/forums/admin/modules/user/index.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/html/forums/admin/modules/user/mass_mail.php b/html/forums/admin/modules/user/mass_mail.php
deleted file mode 100644
index c607bbb..0000000
--- a/html/forums/admin/modules/user/mass_mail.php
+++ /dev/null
@@ -1,1668 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-require_once MYBB_ROOT."/inc/functions_massmail.php";
-
-$page->add_breadcrumb_item($lang->mass_mail, "index.php?module=user-mass_mail");
-
-if($mybb->input['action'] == "send" || $mybb->input['action'] == "archive" || !$mybb->input['action'])
-{
- $sub_tabs['mail_queue'] = array(
- 'title' => $lang->mass_mail_queue,
- 'link' => 'index.php?module=user-mass_mail',
- 'description' => $lang->mass_mail_queue_desc
- );
-
- $sub_tabs['send_mass_mail'] = array(
- 'title' => $lang->create_mass_mail,
- 'link' => 'index.php?module=user-mass_mail&action=send',
- 'description' => $lang->create_mass_mail_desc
- );
-
- $sub_tabs['archive'] = array(
- 'title' => $lang->mass_mail_archive,
- 'link' => 'index.php?module=user-mass_mail&action=archive',
- 'description' => $lang->mass_mail_archive_desc
- );
-}
-
-$plugins->run_hooks("admin_user_mass_email");
-
-if($mybb->input['action'] == "edit")
-{
- $page->add_breadcrumb_item($lang->edit_mass_mail);
-
- $query = $db->simple_select("massemails", "*", "mid='".$mybb->get_input('mid', MyBB::INPUT_INT)."'");
- $email = $db->fetch_array($query);
- if(!$email['mid'])
- {
- flash_message($lang->error_invalid_mid, 'error');
- admin_redirect("index.php?module=user-mass_mail");
- }
-
- $plugins->run_hooks("admin_user_mass_email_edit_start");
-
- if($email['conditions'] != '')
- {
- $email['conditions'] = my_unserialize($email['conditions']);
- }
-
- $sub_tabs['edit_mass_mail'] = array(
- 'title' => $lang->edit_mass_mail,
- 'link' => 'index.php?module=user-mass_mail&action=edit&mid='.$email['mid'],
- 'description' => $lang->edit_mass_mail_desc
- );
-
- $replacement_fields = array(
- "{username}" => $lang->username,
- "{email}" => $lang->email_addr,
- "{bbname}" => $lang->board_name,
- "{bburl}" => $lang->board_url
- );
-
- $html_personalisation = $text_personalisation = "\n";
- $text_personalisation = substr($text_personalisation, 0, -2)."');\n// -->\n";
-
- $localized_time_offset = (float)$mybb->user['timezone']*3600 + $mybb->user['dst']*3600;
-
- // All done here
- if($mybb->request_method == "post")
- {
- // Sending this message now
- if($mybb->input['delivery_type'] == "now")
- {
- $delivery_date = TIME_NOW;
- }
- // Delivering in the future
- else
- {
- if(stristr($mybb->input['deliverytime_time'], "pm"))
- {
- $mybb->input['deliveryhour'] += 12;
- }
-
- $exploded = explode(':', $mybb->input['endtime_time']);
- $mybb->input['deliveryhour'] = (int)$exploded[0];
-
- $exploded = explode(' ', $exploded[1]);
- $mybb->input['deliveryminute'] = (int)$exploded[0];
-
- $delivery_date = gmmktime($mybb->input['deliveryhour'], $mybb->input['deliveryminute'], 0, $mybb->input['endtime_month'], $mybb->input['endtime_day'], $mybb->input['endtime_year']) - $localized_time_offset;
- if($delivery_date <= TIME_NOW)
- {
- $errors[] = $lang->error_only_in_future;
- }
- }
-
- // Need to perform the search to fetch the number of users we're emailing
- $member_query = build_mass_mail_query($mybb->input['conditions']);
- $query = $db->simple_select("users u", "COUNT(uid) AS num", $member_query);
- $num = $db->fetch_field($query, "num");
-
- if($num == 0)
- {
- $errors[] = $lang->error_no_users;
- }
-
- if(!trim($mybb->input['subject']))
- {
- $errors[] = $lang->error_missing_subject;
- }
-
- if($mybb->input['type'] == 1)
- {
- if(!$mybb->input['message'])
- {
- $errors[] = $lang->error_missing_message;
- }
- }
- else
- {
- if($mybb->input['format'] == 2 && $mybb->input['automatic_text'] == 0 && !$mybb->input['message'])
- {
- $errors[] = $lang->error_missing_plain_text;
- }
-
- if(($mybb->input['format'] == 1 || $mybb->input['format'] == 2) && !$mybb->input['htmlmessage'])
- {
- $errors[] = $lang->error_missing_html;
- }
- else if($mybb->input['format'] == 0 && !$mybb->input['message'])
- {
- $errors[] = $lang->error_missing_plain_text;
- }
- }
-
- if(!$errors)
- {
- // Sending via a PM
- if($mybb->input['type'] == 1)
- {
- $mybb->input['format'] = 0;
- $mybb->input['htmlmessage'] = '';
- }
- // Sending via email
- else
- {
- // Do we need to generate a text based version?
- if($mybb->input['format'] == 2 && $mybb->input['automatic_text'])
- {
- $mybb->input['message'] = create_text_message($mybb->input['htmlmessage']);
- }
- else if($mybb->input['format'] == 1)
- {
- $mybb->input['message'] = '';
- }
- else if($mybb->input['format'] == 0)
- {
- $mybb->input['htmlmessage'] = '';
- }
- }
-
- // Mark as queued for delivery
- $updated_email = array(
- "status" => 1,
- "senddate" => $delivery_date,
- "totalcount" => $num,
- "conditions" => $db->escape_string(my_serialize($mybb->input['conditions'])),
- "message" => $db->escape_string($mybb->input['message']),
- "subject" => $db->escape_string($mybb->input['subject']),
- "htmlmessage" => $db->escape_string($mybb->input['htmlmessage']),
- "format" => $mybb->get_input('format', MyBB::INPUT_INT),
- "type" => $mybb->get_input('type', MyBB::INPUT_INT),
- "perpage" => $mybb->get_input('perpage', MyBB::INPUT_INT)
- );
-
- $plugins->run_hooks("admin_user_mass_email_edit_commit");
-
- $db->update_query("massemails", $updated_email, "mid='{$email['mid']}'");
-
- flash_message($lang->success_mass_mail_saved, 'success');
- admin_redirect("index.php?module=user-mass_mail");
- }
- }
-
- $page->output_header($lang->edit_mass_mail);
-
- $page->output_nav_tabs($sub_tabs, 'edit_mass_mail');
-
- // If we have any error messages, show them
- if($errors)
- {
- $page->output_inline_error($errors);
- $input = $mybb->input;
- }
- else
- {
- $input = $email;
-
- if($email['senddate'] != 0)
- {
- if($email['senddate'] <= TIME_NOW)
- {
- $input['delivery_type'] = "now";
- $delivery_type_checked['now'] = " checked=\"checked\"";
- }
- else
- {
- // correct date by timezone and dst
- $offset =
- $input['delivery_type'] = "future";
- $time = gmdate("d-n-Y", $email['senddate'] + $localized_time_offset);
- $time = explode('-', $time);
- $input['deliverymonth'] = (int)$time[1];
- $input['deliveryday'] = (int)$time[0];
- $input['deliveryyear'] = (int)$time[2];
- $input['endtime_time'] = gmdate($mybb->settings['timeformat'], $email['senddate'] + $localized_time_offset);
- $delivery_type_checked['future'] = " checked=\"checked\"";
- }
- }
- else
- {
- $input['delivery_type'] = "now";
- $delivery_type_checked['now'] = " checked=\"checked\"";
- }
- }
-
- if(!$input['endtime_time'])
- {
- $input['endtime_time'] = gmdate($mybb->settings['timeformat'], TIME_NOW + $localized_time_offset);
- }
-
- if(!$input['deliveryyear'])
- {
- $enddateyear = gmdate('Y', TIME_NOW + $localized_time_offset);
- }
- else
- {
- $enddateyear = (int)$input['deliveryyear'];
- }
-
- if(!$input['deliverymonth'])
- {
- $input['enddatemonth'] = gmdate('n', TIME_NOW + $localized_time_offset);
- }
- else
- {
- $input['enddatemonth'] = (int)$input['deliverymonth'];
- }
-
- if(!$input['deliveryday'])
- {
- $input['enddateday'] = gmdate('j', TIME_NOW + $localized_time_offset);
- }
- else
- {
- $input['enddateday'] = (int)$input['deliveryday'];
- }
-
- $form = new Form("index.php?module=user-mass_mail&action=edit", "post");
- echo $form->generate_hidden_field("mid", $email['mid']);
-
- $mid_add = '';
- if($email['mid'])
- {
- $mid_add = "&mid={$email['mid']}";
- }
-
- $form_container = new FormContainer("{$lang->edit_mass_mail}: {$lang->message_settings}");
-
- $form_container->output_row("{$lang->subject}: *", $lang->subject_desc, $form->generate_text_box('subject', $input['subject'], array('id' => 'subject')), 'subject');
-
- if($input['type'] == 0)
- {
- $type_email_checked = true;
- $type_pm_checked = false;
- }
- else if($input['type'] == 1)
- {
- $type_email_checked = false;
- $type_pm_checked = true;
- }
-
- $type_options = array(
- $form->generate_radio_button("type", 0, $lang->send_via_email, array("id" => "type_email", "checked" => $type_email_checked)),
- $form->generate_radio_button("type", 1, $lang->send_via_pm, array("id" => "type_pm", "checked" => $type_pm_checked))
- );
- $form_container->output_row("{$lang->message_type}: *", "", implode("
", $type_options));
-
- $monthnames = array(
- "offset",
- $lang->january,
- $lang->february,
- $lang->march,
- $lang->april,
- $lang->may,
- $lang->june,
- $lang->july,
- $lang->august,
- $lang->september,
- $lang->october,
- $lang->november,
- $lang->december,
- );
-
- $enddatemonth = "";
- foreach($monthnames as $key => $month)
- {
- if($month == "offset")
- {
- continue;
- }
-
- if($key == $input['enddatemonth'])
- {
- $enddatemonth .= "\n";
- }
- else
- {
- $enddatemonth .= "\n";
- }
- }
-
- $enddateday = "";
-
- // Construct option list for days
- for($i = 1; $i <= 31; ++$i)
- {
- if($i == $input['enddateday'])
- {
- $enddateday .= "\n";
- }
- else
- {
- $enddateday .= "\n";
- }
- }
-
- $actions = "
-
-
-
-
- -
-
-
-
- ";
- $form_container->output_row("{$lang->delivery_date}: *", $lang->delivery_date_desc, $actions);
-
- $form_container->output_row("{$lang->per_page}: *", $lang->per_page_desc, $form->generate_numeric_field('perpage', $input['perpage'], array('id' => 'perpage', 'min' => 1)), 'perpage');
-
- $format_options = array(
- 0 => $lang->plain_text_only,
- 1 => $lang->html_only,
- 2 => $lang->html_and_plain_text
- );
-
- $form_container->output_row("{$lang->message_format}: *", "", $form->generate_select_box('format', $format_options, $input['format'], array('id' => 'format')), 'format', null, array("id" => "format_container"));
-
- $form_container->end();
-
- if($input['format'] == 2)
- {
- if($input['automatic_text'] && !$email['mid'])
- {
- $automatic_text_check = true;
- $text_display = 'display: none';
- $automatic_display = 'display: none;';
- }
- }
- else if($input['format'] == 1 && $input['type'] != 1)
- {
- $text_display = 'display: none;';
- }
- else if($input['format'] == 0 || $input['type'] == 1)
- {
- $html_display = 'display: none';
- }
-
- echo "";
- $form_container = new FormContainer("{$lang->edit_mass_mail}: {$lang->define_html_message}");
- $form_container->output_row("{$lang->define_html_message_desc}:", $html_personalisation, $form->generate_text_area('htmlmessage', $input['htmlmessage'], array('id' => 'htmlmessage', 'rows' => 15, 'cols '=> 70, 'style' => 'width: 95%'))."
".$form->generate_check_box('automatic_text', 1, $lang->auto_gen_plain_text, array('checked' => $automatic_text_check, "id" => "automatic_text"))."
");
- $form_container->end();
- echo "
";
-
- echo "";
- $form_container = new FormContainer("{$lang->edit_mass_mail}: {$lang->define_text_version}");
- $form_container->output_row("{$lang->define_text_version_desc}:", $text_personalisation, $form->generate_text_area('message', $input['message'], array('id' => 'message', 'rows' => 15, 'cols '=> 70, 'style' => 'width: 95%')));
- $form_container->end();
- echo "
";
-
- echo "
- ";
-
- $form_container = new FormContainer("{$lang->edit_mass_mail}: {$lang->define_the_recipients}");
-
- $form_container->output_row($lang->username_contains, "", $form->generate_text_box('conditions[username]', htmlspecialchars_uni($input['conditions']['username']), array('id' => 'username')), 'username');
- $form_container->output_row($lang->email_addr_contains, "", $form->generate_text_box('conditions[email]', $input['conditions']['email'], array('id' => 'email')), 'email');
-
- $query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
-
- $options = array();
- while($usergroup = $db->fetch_array($query))
- {
- $options[$usergroup['gid']] = $usergroup['title'];
- }
-
- $form_container->output_row($lang->members_of, $lang->additional_user_groups_desc, $form->generate_select_box('conditions[usergroup][]', $options, $input['conditions']['usergroup'], array('id' => 'usergroups', 'multiple' => true, 'size' => 5)), 'usergroups');
-
- $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' => 'postnum_dir'))." ".$form->generate_numeric_field('conditions[postnum]', $input['conditions']['postnum'], array('id' => 'postnum', 'min' => 0)), 'postnum');
-
- $more_options = array(
- "more_than" => $lang->more_than,
- "less_than" => $lang->less_than
- );
-
- $date_options = array(
- "hours" => $lang->hours,
- "days" => $lang->days,
- "weeks" => $lang->weeks,
- "months" => $lang->months,
- "years" => $lang->years
- );
- $form_container->output_row($lang->user_registered, "", $form->generate_select_box('conditions[regdate_dir]', $more_options, $input['conditions']['regdate_dir'], array('id' => 'regdate_dir'))." ".$form->generate_numeric_field('conditions[regdate]', $input['conditions']['regdate'], array('id' => 'regdate', 'min' => 0))." ".$form->generate_select_box('conditions[regdate_date]', $date_options, $input['conditions']['regdate_date'], array('id' => 'regdate_date'))." {$lang->ago}", 'regdate');
-
- $form_container->output_row($lang->user_last_active, "", $form->generate_select_box('conditions[lastactive_dir]', $more_options, $input['conditions']['lastactive_dir'], array('id' => 'lastactive_dir'))." ".$form->generate_numeric_field('conditions[lastactive]', $input['conditions']['lastactive'], array('id' => 'lastactive', 'min' => 0))." ".$form->generate_select_box('conditions[lastactive_date]', $date_options, $input['conditions']['lastactive_date'], array('id' => 'lastactive_date'))." {$lang->ago}", 'lastactive');
-
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->save_mass_mail);
- $form->output_submit_wrapper($buttons);
-
- $form->end();
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "send")
-{
- $page->add_breadcrumb_item($lang->send_mass_mail);
-
- if($mybb->input['step'])
- {
- $query = $db->simple_select("massemails", "*", "status=0 and mid='".$mybb->get_input('mid', MyBB::INPUT_INT)."'");
- $email = $db->fetch_array($query);
- if(!$email['mid'] && $mybb->input['step'] != 1)
- {
- flash_message($lang->error_invalid_mid, 'error');
- admin_redirect("index.php?module=user-mass_mail");
- }
- }
-
- $replacement_fields = array(
- "{username}" => $lang->username,
- "{email}" => $lang->email_addr,
- "{bbname}" => $lang->board_name,
- "{bburl}" => $lang->board_url
- );
-
- $html_personalisation = $text_personalisation = "\n";
- $text_personalisation = substr($text_personalisation, 0, -2)."');\n// -->\n";
-
- $plugins->run_hooks("admin_user_mass_email_send_start");
-
- $localized_time_offset = (float)$mybb->user['timezone']*3600 + $mybb->user['dst']*3600;
-
- if($mybb->input['step'] == 4)
- {
- // All done here
- if($mybb->request_method == "post")
- {
- // Sending this message now
- if($mybb->input['delivery_type'] == "now")
- {
- $delivery_date = TIME_NOW;
- }
- // Delivering in the future
- else
- {
- if(stristr($mybb->input['deliverytime_time'], "pm"))
- {
- $mybb->input['deliveryhour'] += 12;
- }
-
- $exploded = explode(':', $mybb->input['endtime_time']);
- $mybb->input['deliveryhour'] = (int)$exploded[0];
-
- $exploded = explode(' ', $exploded[1]);
- $mybb->input['deliveryminute'] = (int)$exploded[0];
-
- $delivery_date = gmmktime($mybb->input['deliveryhour'], $mybb->input['deliveryminute'], 0, $mybb->input['endtime_month'], $mybb->input['endtime_day'], $mybb->input['endtime_year'])- $localized_time_offset;
- if($delivery_date <= TIME_NOW)
- {
- $errors[] = $lang->error_only_in_future;
- }
- }
-
- if(!$errors)
- {
- // Mark as queued for delivery
- $updated_email = array(
- "status" => 1,
- "senddate" => $delivery_date
- );
-
- $plugins->run_hooks("admin_user_mass_email_send_finalize_commit");
-
- $db->update_query("massemails", $updated_email, "mid='{$email['mid']}'");
-
- flash_message($lang->success_mass_mail_saved, 'success');
- admin_redirect("index.php?module=user-mass_mail");
- }
- }
-
- // Show summary of the mass email we've just been creating and allow the user to specify the delivery date
- $page->output_header("{$lang->send_mass_mail}: {$lang->step_four}");
-
- $page->output_nav_tabs($sub_tabs, 'send_mass_mail');
-
- // If we have any error messages, show them
- if($errors)
- {
- $page->output_inline_error($errors);
- $input = $mybb->input;
- }
- else
- {
- $input = array();
- if($email['senddate'] != 0)
- {
- if($email['senddate'] <= TIME_NOW)
- {
- $input['delivery_type'] = "now";
- $delivery_type_checked['now'] = " checked=\"checked\"";
- }
- else
- {
- $input['delivery_type'] = "future";
- $time = gmdate("d-n-Y", $email['senddate'] + $localized_time_offset);
- $time = explode('-', $time);
- $input['deliverymonth'] = (int)$time[1];
- $input['deliveryday'] = (int)$time[0];
- $input['deliveryyear'] = (int)$time[2];
- $input['endtime_time'] = gmdate($mybb->settings['timeformat'], $email['senddate'] + $localized_time_offset);
- $delivery_type_checked['future'] = " checked=\"checked\"";
- }
- }
- else
- {
- $input['delivery_type'] = "now";
- $delivery_type_checked['now'] = " checked=\"checked\"";
- }
- }
-
- $table = new Table;
- $table->construct_cell("{$lang->delivery_method}:", array('width' => '25%'));
- if($email['type'] == 1)
- {
- $delivery_type = $lang->private_message;
- }
- else if($email['type'] == 0)
- {
- $delivery_type = $lang->email;
- }
- $table->construct_cell($delivery_type);
- $table->construct_row();
-
- $table->construct_cell("{$lang->subject}:");
- $table->construct_cell(htmlspecialchars_uni($email['subject']));
- $table->construct_row();
-
- $table->construct_cell("{$lang->message}:");
- $format_preview = '';
- if($email['format'] == 0 || $email['format'] == 2)
- {
- $format_preview .= "{$lang->text_based} - {$lang->preview}";
- }
- if($email['format'] == 2)
- {
- $format_preview .= " {$lang->and}
";
- }
- if($email['format'] == 1 || $email['format'] == 2)
- {
- $format_preview.= "{$lang->html_based} - {$lang->preview}";
- }
- $table->construct_cell($format_preview);
- $table->construct_row();
-
- // Recipient counts & details
- $table->construct_cell("{$lang->total_recipients}:");
- $table->construct_cell(my_number_format($email['totalcount'])." - {$lang->change_recipient_conds}");
- $table->construct_row();
-
- $table->output("{$lang->send_mass_mail}: {$lang->step_four} - {$lang->review_message}");
-
- if(!$input['endtime_time'])
- {
- $input['endtime_time'] = gmdate($mybb->settings['timeformat'], TIME_NOW + $localized_time_offset);
- }
-
- if(!$input['deliveryyear'])
- {
- $enddateyear = gmdate('Y', TIME_NOW + $localized_time_offset);
- }
- else
- {
- $enddateyear = (int)$input['deliveryyear'];
- }
-
- if(!$input['deliverymonth'])
- {
- $input['enddatemonth'] = gmdate('n', TIME_NOW + $localized_time_offset);
- }
- else
- {
- $input['enddatemonth'] = (int)$input['deliverymonth'];
- }
-
- if(!$input['deliveryday'])
- {
- $input['enddateday'] = gmdate('j', TIME_NOW + $localized_time_offset);
- }
- else
- {
- $input['enddateday'] = (int)$input['deliveryday'];
- }
-
- $monthnames = array(
- "offset",
- $lang->january,
- $lang->february,
- $lang->march,
- $lang->april,
- $lang->may,
- $lang->june,
- $lang->july,
- $lang->august,
- $lang->september,
- $lang->october,
- $lang->november,
- $lang->december,
- );
-
- $enddatemonth = "";
- foreach($monthnames as $key => $month)
- {
- if($month == "offset")
- {
- continue;
- }
-
- if($key == $input['enddatemonth'])
- {
- $enddatemonth .= "\n";
- }
- else
- {
- $enddatemonth .= "\n";
- }
- }
-
- $enddateday = "";
-
- // Construct option list for days
- for($i = 1; $i <= 31; ++$i)
- {
- if($i == $input['enddateday'])
- {
- $enddateday .= "\n";
- }
- else
- {
- $enddateday .= "\n";
- }
- }
-
- $form = new Form("index.php?module=user-mass_mail&action=send&step=4&mid={$email['mid']}", "post");
- $form_container = new FormContainer("{$lang->send_mass_mail}: {$lang->step_four} - {$lang->define_delivery_date}");
-
- $actions = "
-
-
-
-
- -
-
-
-
- ";
- $form_container->output_row("{$lang->delivery_date}: *", $lang->delivery_date_desc, $actions);
-
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->schedule_for_delivery);
- $form->output_submit_wrapper($buttons);
-
- $form->end();
- $page->output_footer();
- }
- elseif($mybb->input['step'] == 3)
- {
- // Define the recipients/conditions
- if($mybb->request_method == "post")
- {
- // Need to perform the search to fetch the number of users we're emailing
- $member_query = build_mass_mail_query($mybb->input['conditions']);
- $query = $db->simple_select("users u", "COUNT(uid) AS num", $member_query);
- $num = $db->fetch_field($query, "num");
-
- if($num == 0)
- {
- $errors[] = $lang->error_no_users;
- }
- // Got one or more results
- else
- {
- $updated_email = array(
- "totalcount" => $num,
- "conditions" => $db->escape_string(my_serialize($mybb->input['conditions']))
- );
-
- $plugins->run_hooks("admin_user_mass_email_send_define_commit");
-
- $db->update_query("massemails", $updated_email, "mid='{$email['mid']}'");
-
- // Take the user to the next step
- admin_redirect("index.php?module=user-mass_mail&action=send&step=4&mid={$email['mid']}");
- }
- }
-
- $page->output_header("{$lang->send_mass_mail}: {$lang->step_three}");
-
- $form = new Form("index.php?module=user-mass_mail&action=send&step=3&mid={$email['mid']}", "post");
- $page->output_nav_tabs($sub_tabs, 'send_mass_mail');
-
- // If we have any error messages, show them
- if($errors)
- {
- $page->output_inline_error($errors);
- $input = $mybb->input;
- }
- else
- {
- if($email['conditions'] != '')
- {
- $input = array(
- "conditions" => my_unserialize($email['conditions'])
- );
- }
- else
- {
- $input = array();
- }
- }
-
- $options = array(
- 'username', 'email', 'postnum_dir', 'postnum', 'regdate', 'regdate_date', 'regdate_dir', 'lastactive', 'lastactive_date', 'lastactive_dir'
- );
-
- foreach($options as $option)
- {
- if(!isset($input['conditions'][$option]))
- {
- $input['conditions'][$option] = '';
- }
- }
- if(!isset($input['conditions']['usergroup']) || !is_array($input['conditions']['usergroup']))
- {
- $input['conditions']['usergroup'] = array();
- }
-
- $form_container = new FormContainer("{$lang->send_mass_mail}: {$lang->step_three} - {$lang->define_the_recipients}");
-
- $form_container->output_row($lang->username_contains, "", $form->generate_text_box('conditions[username]', htmlspecialchars_uni($input['conditions']['username']), array('id' => 'username')), 'username');
- $form_container->output_row($lang->email_addr_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']] = $usergroup['title'];
- }
-
- $form_container->output_row($lang->members_of, $lang->additional_user_groups_desc, $form->generate_select_box('conditions[usergroup][]', $options, $input['conditions']['usergroup'], array('id' => 'usergroups', 'multiple' => true, 'size' => 5)), 'usergroups');
-
- $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' => 'postnum_dir'))." ".$form->generate_numeric_field('conditions[postnum]', $input['conditions']['postnum'], array('id' => 'postnum', 'min' => 0)), 'postnum');
-
- $more_options = array(
- "more_than" => $lang->more_than,
- "less_than" => $lang->less_than
- );
-
- $date_options = array(
- "hours" => $lang->hours,
- "days" => $lang->days,
- "weeks" => $lang->weeks,
- "months" => $lang->months,
- "years" => $lang->years
- );
- $form_container->output_row($lang->user_registered, "", $form->generate_select_box('conditions[regdate_dir]', $more_options, $input['conditions']['regdate_dir'], array('id' => 'regdate_dir'))." ".$form->generate_numeric_field('conditions[regdate]', $input['conditions']['regdate'], array('id' => 'regdate', 'min' => 0))." ".$form->generate_select_box('conditions[regdate_date]', $date_options, $input['conditions']['regdate_date'], array('id' => 'regdate_date'))." {$lang->ago}", 'regdate');
-
- $form_container->output_row($lang->user_last_active, "", $form->generate_select_box('conditions[lastactive_dir]', $more_options, $input['conditions']['lastactive_dir'], array('id' => 'lastactive_dir'))." ".$form->generate_numeric_field('conditions[lastactive]', $input['conditions']['lastactive'], array('id' => 'lastactive', 'min' => 0))." ".$form->generate_select_box('conditions[lastactive_date]', $date_options, $input['conditions']['lastactive_date'], array('id' => 'lastactive_date'))." {$lang->ago}", 'lastactive');
-
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->next_step);
- $form->output_submit_wrapper($buttons);
-
- $form->end();
- $page->output_footer();
- }
- // Reviewing the automatic text based version of the message.
- elseif($mybb->input['step'] == 2)
- {
- // Update text based version
- if($mybb->request_method == "post")
- {
- if(!trim($mybb->input['message']))
- {
- $errors[] = $lang->error_missing_plain_text;
- }
- else
- {
- $updated_email = array(
- "message" => $db->escape_string($mybb->input['message'])
- );
-
- $plugins->run_hooks("admin_user_mass_email_send_review_commit");
-
- $db->update_query("massemails", $updated_email, "mid='{$email['mid']}'");
-
- // Take the user to the next step
- admin_redirect("index.php?module=user-mass_mail&action=send&step=3&mid={$email['mid']}");
- }
- }
-
- $page->output_header("{$lang->send_mass_mail}: {$lang->step_two}");
-
- $form = new Form("index.php?module=user-mass_mail&action=send&step=2&mid={$email['mid']}", "post");
- $page->output_nav_tabs($sub_tabs, 'send_mass_mail');
-
- // If we have any error messages, show them
- if($errors)
- {
- $page->output_inline_error($errors);
- }
-
- $form_container = new FormContainer("{$lang->send_mass_mail}: {$lang->step_two} - {$lang->review_text_version}");
- $form_container->output_row("{$lang->review_text_version_desc}:", $text_personalisation, $form->generate_text_area('message', $email['message'], array('id' => 'message', 'rows' => 15, 'cols '=> 70, 'style' => 'width: 95%')));
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->next_step);
- $form->output_submit_wrapper($buttons);
-
- $form->end();
- $page->output_footer();
- }
- elseif(!$mybb->input['step'] || $mybb->input['step'] == 1)
- {
- if($mybb->request_method == "post")
- {
- if(!trim($mybb->input['subject']))
- {
- $errors[] = $lang->error_missing_subject;
- }
-
- if($mybb->input['type'] == 1)
- {
- if(!$mybb->input['message'])
- {
- $errors[] = $lang->error_missing_message;
- }
- }
- else
- {
- if($mybb->input['format'] == 2 && $mybb->input['automatic_text'] == 0 && !$mybb->input['message'])
- {
- $errors[] = $lang->error_missing_plain_text;
- }
-
- if(($mybb->input['format'] == 1 || $mybb->input['format'] == 2) && !$mybb->input['htmlmessage'])
- {
- $errors[] = $lang->error_missing_html;
- }
- else if($mybb->input['format'] == 0 && !$mybb->input['message'])
- {
- $errors[] = $lang->error_missing_plain_text;
- }
- }
-
- // No errors, insert away
- if(!$errors)
- {
- if(!$new_email['mid'])
- {
- // Sending via a PM
- if($mybb->input['type'] == 1)
- {
- $mybb->input['format'] = 0;
- $mybb->input['htmlmessage'] = '';
- }
- // Sending via email
- else
- {
- // Do we need to generate a text based version?
- if($mybb->input['format'] == 2 && $mybb->input['automatic_text'])
- {
- $mybb->input['message'] = create_text_message($mybb->input['htmlmessage']);
- }
- else if($mybb->input['format'] == 1)
- {
- $mybb->input['message'] = '';
- }
- else if($mybb->input['format'] == 0)
- {
- $mybb->input['htmlmessage'] = '';
- }
- }
-
- $new_email = array(
- "uid" => $mybb->user['uid'],
- "subject" => $db->escape_string($mybb->input['subject']),
- "message" => $db->escape_string($mybb->input['message']),
- "htmlmessage" => $db->escape_string($mybb->input['htmlmessage']),
- "format" => $mybb->get_input('format', MyBB::INPUT_INT),
- "type" => $mybb->get_input('type', MyBB::INPUT_INT),
- "dateline" => TIME_NOW,
- "senddate" => 0,
- "status" => 0,
- "sentcount" => 0,
- "totalcount" => 0,
- "conditions" => "",
- "perpage" => $mybb->get_input('perpage', MyBB::INPUT_INT)
- );
-
- $mid = $db->insert_query("massemails", $new_email);
-
- $plugins->run_hooks("admin_user_mass_email_send_insert_commit");
- }
- // Updating an existing one
- else
- {
- $updated_email = array(
- "subject" => $db->escape_string($mybb->input['subject']),
- "message" => $db->escape_string($mybb->input['message']),
- "htmlmessage" => $db->escape_string($mybb->input['htmlmessage']),
- "format" => $mybb->get_input('format', MyBB::INPUT_INT),
- "type" => $mybb->get_input('type', MyBB::INPUT_INT),
- "perpage" => $mybb->get_input('perpage', MyBB::INPUT_INT)
- );
-
- $plugins->run_hooks("admin_user_mass_email_send_update_commit");
-
- $db->update_query("massemails", $updated_email, "mid='{$email['mid']}'");
- $mid = $email['mid'];
- }
-
- if($mybb->input['format'] == 2 && $mybb->input['automatic_text'] == 1)
- {
- $next = 2;
- }
- else
- {
- $next = 3;
- }
- admin_redirect("index.php?module=user-mass_mail&action=send&step={$next}&mid={$mid}");
- }
- }
-
- $page->output_header("{$lang->send_mass_mail}: {$lang->step_one}");
-
- $mid_add = '';
- if($email['mid'])
- {
- $mid_add = "&mid={$email['mid']}";
- }
-
- $form = new Form("index.php?module=user-mass_mail&action=send{$mid_add}", "post");
- $page->output_nav_tabs($sub_tabs, 'send_mass_mail');
-
- // If we have any error messages, show them
- if($errors)
- {
- $page->output_inline_error($errors);
- $input = $mybb->input;
- }
- else if(!$email)
- {
- $input = array(
- "type" => 0,
- "format" => 2,
- "automatic_text" => 1,
- "perpage" => 50,
- );
- }
- else
- {
- $input = $email;
- }
-
- $form_container = new FormContainer("{$lang->send_mass_mail}: {$lang->step_one} - {$lang->message_settings}");
-
- $form_container->output_row("{$lang->subject}: *", $lang->subject_desc, $form->generate_text_box('subject', $input['subject'], array('id' => 'subject')), 'subject');
-
- if($mybb->input['type'] == 0)
- {
- $type_email_checked = true;
- $type_pm_checked = false;
- }
- else if($mybb->input['type'] == 1)
- {
- $type_email_checked = false;
- $type_pm_checked = true;
- }
-
- $type_options = array(
- $form->generate_radio_button("type", 0, $lang->send_via_email, array("id" => "type_email", "checked" => $type_email_checked)),
- $form->generate_radio_button("type", 1, $lang->send_via_pm, array("id" => "type_pm", "checked" => $type_pm_checked))
- );
- $form_container->output_row("{$lang->message_type}:", "", implode("
", $type_options));
-
- $format_options = array(
- 0 => $lang->plain_text_only,
- 1 => $lang->html_only,
- 2 => $lang->html_and_plain_text
- );
-
- $form_container->output_row("{$lang->message_format}:", "", $form->generate_select_box('format', $format_options, $input['format'], array('id' => 'format')), 'format', null, array("id" => "format_container"));
-
- $form_container->output_row("{$lang->per_page}: *", $lang->per_page_desc, $form->generate_numeric_field('perpage', $input['perpage'], array('id' => 'perpage', 'min' => 1)), 'perpage');
-
- $form_container->end();
-
- if($mybb->input['format'] == 2)
- {
- if($mybb->input['automatic_text'] && !$email['mid'])
- {
- $automatic_text_check = true;
- $text_display = 'display: none';
- $automatic_display = 'display: none;';
- }
- }
- else if($mybb->input['format'] == 1 && $mybb->input['type'] != 1)
- {
- $text_display = 'display: none;';
- }
- else if($mybb->input['format'] == 0 || $mybb->input['type'] == 1)
- {
- $html_display = 'display: none';
- }
-
- echo "";
- $form_container = new FormContainer("{$lang->send_mass_mail}: {$lang->step_one} - {$lang->define_html_message}");
- $form_container->output_row("{$lang->define_html_message_desc}:", $html_personalisation, $form->generate_text_area('htmlmessage', $input['htmlmessage'], array('id' => 'htmlmessage', 'rows' => 15, 'cols '=> 70, 'style' => 'width: 95%'))."
".$form->generate_check_box('automatic_text', 1, $lang->auto_gen_plain_text, array('checked' => $automatic_text_check, "id" => "automatic_text"))."
");
- $form_container->end();
- echo "
";
-
- echo "";
- $form_container = new FormContainer("{$lang->send_mass_mail}: {$lang->step_one} - {$lang->define_text_version}");
- $form_container->output_row("{$lang->define_text_version_desc}:", $text_personalisation, $form->generate_text_area('message', $input['message'], array('id' => 'message', 'rows' => 15, 'cols '=> 70, 'style' => 'width: 95%')));
- $form_container->end();
- echo "
";
-
- echo "
- ";
-
- $buttons[] = $form->generate_submit_button($lang->next_step);
- $form->output_submit_wrapper($buttons);
-
- $form->end();
- $page->output_footer();
- }
-
- $plugins->run_hooks("admin_user_mass_email_preview_end");
-}
-
-if($mybb->input['action'] == "delete")
-{
- $query = $db->simple_select("massemails", "*", "mid='".$mybb->get_input('mid', MyBB::INPUT_INT)."'");
- $mass_email = $db->fetch_array($query);
-
- if(!$mass_email['mid'])
- {
- flash_message($lang->error_delete_invalid_mid, 'error');
- admin_redirect("index.php?module=user-mass_mail");
- }
-
- // User clicked no
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=user-mass_mail");
- }
-
- $plugins->run_hooks("admin_user_mass_email_delete_start");
-
- if($mybb->request_method == "post")
- {
- $db->delete_query("massemails", "mid='{$mass_email['mid']}'");
-
- $plugins->run_hooks("admin_user_mass_email_delete_commit");
-
- // Log admin action
- log_admin_action($mass_email['mid'], $mass_email['subject']);
-
- if($mybb->input['archive'] == 1)
- {
- flash_message($lang->success_mass_mail_deleted, 'success');
- admin_redirect("index.php?module=user-mass_mail&action=archive");
- }
- else
- {
- flash_message($lang->success_mass_mail_deleted, 'success');
- admin_redirect("index.php?module=user-mass_mail");
- }
- }
- else
- {
- if($mybb->input['archive'] == 1)
- {
- $page->output_confirm_action("index.php?module=user-mass_mail&action=delete&mid={$mass_email['mid']}&archive=1", $lang->mass_mail_deletion_confirmation);
- }
- else
- {
- $page->output_confirm_action("index.php?module=user-mass_mail&action=delete&mid={$mass_email['mid']}", $lang->mass_mail_deletion_confirmation);
- }
- }
-}
-
-if($mybb->input['action'] == "preview")
-{
- $query = $db->simple_select("massemails", "*", "mid='".$mybb->get_input('mid', MyBB::INPUT_INT)."'");
- $mass_email = $db->fetch_array($query);
-
- if(!$mass_email['mid'])
- {
- flash_message($lang->error_invalid_mid, 'error');
- admin_redirect("index.php?module=user-mass_mail");
- }
-
- $plugins->run_hooks("admin_user_mass_email_preview_start");
-
- echo '
-
';
-
- $table = new Table();
-
- if($mybb->input['format'] == 'text' || !$mass_email['htmlmessage'])
- {
- // Show preview of the text version
- $table->construct_cell(nl2br($mass_email['message']));
- }
- else
- {
- // Preview the HTML version
- $table->construct_cell($mass_email['htmlmessage']);
- }
-
- $plugins->run_hooks("admin_user_mass_email_preview_end");
-
- $table->construct_row();
-
- $table->output($lang->mass_mail_preview);
-
- echo '
-
';
- exit;
-}
-
-if($mybb->input['action'] == "resend")
-{
- // Copy and resend an email
- $query = $db->simple_select("massemails", "*", "mid='".$mybb->get_input('mid', MyBB::INPUT_INT)."'");
- $mass_email = $db->fetch_array($query);
-
- if(!$mass_email['mid'])
- {
- flash_message($lang->error_invalid_mid, 'error');
- admin_redirect("index.php?module=user-mass_mail");
- }
-
- $plugins->run_hooks("admin_user_mass_email_resend_start");
-
- // Need to perform the search to fetch the number of users we're emailing
- $member_query = build_mass_mail_query(my_unserialize($mass_email['conditions']));
- $query = $db->simple_select("users u", "COUNT(uid) AS num", $member_query);
- $total_recipients = $db->fetch_field($query, "num");
-
- // Create the new email based off the old one.
- $new_email = array(
- "uid" => $mass_email['uid'],
- "subject" => $db->escape_string($mass_email['subject']),
- "message" => $db->escape_string($mass_email['message']),
- "htmlmessage" => $db->escape_string($mass_email['htmlmessage']),
- "type" => $db->escape_string($mass_email['type']),
- "format" => $db->escape_string($mass_email['format']),
- "dateline" => TIME_NOW,
- "senddate" => '0',
- "status" => 0,
- "sentcount" => 0,
- "totalcount" => $total_recipients,
- "conditions" => $db->escape_string($mass_email['conditions']),
- "perpage" => $mass_email['perpage']
- );
-
- $mid = $db->insert_query("massemails", $new_email);
-
- $plugins->run_hooks("admin_user_mass_email_resend_end");
-
- // Redirect the user to the summary page so they can select when to deliver this message
- flash_message($lang->success_mass_mail_resent, 'success');
- admin_redirect("index.php?module=user-mass_mail&action=send&step=4&mid={$mid}");
- exit;
-}
-
-if($mybb->input['action'] == "cancel")
-{
- if(!verify_post_check($mybb->input['my_post_key']))
- {
- flash_message($lang->invalid_post_verify_key2, 'error');
- admin_redirect("index.php?module=user-users");
- }
-
- // Cancel the delivery of a mass-email.
- $query = $db->simple_select("massemails", "*", "mid='".$mybb->get_input('mid', MyBB::INPUT_INT)."'");
- $mass_email = $db->fetch_array($query);
-
- if(!$mass_email['mid'])
- {
- flash_message($lang->error_invalid_mid, 'error');
- admin_redirect("index.php?module=user-mass_mail");
- }
-
- $updated_email = array(
- 'status' => 4
- );
-
- $plugins->run_hooks("admin_user_mass_email_cancel");
-
- $db->update_query("massemails", $updated_email, "mid='{$mass_email['mid']}'");
-
- flash_message($lang->success_mass_mail_canceled, 'success');
- admin_redirect("index.php?module=user-mass_mail");
- exit;
-}
-
-if($mybb->input['action'] == "archive")
-{
- // View a list of archived email messages
- $page->output_header($lang->mass_mail_archive);
-
- $plugins->run_hooks("admin_user_mass_email_archive_start");
-
- $page->output_nav_tabs($sub_tabs, 'archive');
-
- $table = new Table;
- $table->construct_header($lang->subject);
- $table->construct_header($lang->status, array('width' => '130', 'class' => 'align_center'));
- $table->construct_header($lang->delivery_date, array('width' => '130', 'class' => 'align_center'));
- $table->construct_header($lang->recipients, array('width' => '130', 'class' => 'align_center'));
- $table->construct_header($lang->controls, array("class" => "align_center", "colspan" => 2, "width" => 200));
-
- $query = $db->simple_select("massemails", "*", "status NOT IN (0, 1, 2)", array('order_by' => 'senddate'));
- while($email = $db->fetch_array($query))
- {
- $email['subject'] = htmlspecialchars_uni($email['subject']);
- if($email['senddate'] < TIME_NOW)
- {
- $table->construct_cell("{$email['subject']}");
- }
- if($email['status'] == 3)
- {
- $status = $lang->delivered;
- }
- else if($email['status'] == 4)
- {
- $status = $lang->canceled;
- }
- $table->construct_cell($status, array("class" => "align_center"));
-
- $delivery_date = my_date($mybb->settings['dateformat'], $email['senddate']);
-
- $table->construct_cell($delivery_date, array("class" => "align_center"));
- $table->construct_cell(my_number_format($email['totalcount']), array("class" => "align_center"));
-
- $table->construct_cell("{$lang->resend}", array("width" => 100, "class" => "align_center"));
- $table->construct_cell("post_code}&archive=1\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->mass_mail_deletion_confirmation}')\">{$lang->delete}", array("width" => 100, "class" => "align_center"));
-
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_archived_messages, array('colspan' => 6));
- $table->construct_row();
- $no_results = true;
- }
-
- $plugins->run_hooks("admin_user_mass_email_archive_end");
-
- $table->output($lang->mass_mail_archive);
-
- $page->output_footer();
-}
-
-if(!$mybb->input['action'])
-{
- $page->output_header($lang->mass_mail_queue);
-
- $plugins->run_hooks("admin_user_mass_email_start");
-
- $page->output_nav_tabs($sub_tabs, 'mail_queue');
-
- $table = new Table;
- $table->construct_header($lang->subject);
- $table->construct_header($lang->status, array('width' => '130', 'class' => 'align_center'));
- $table->construct_header($lang->delivery_date, array('width' => '130', 'class' => 'align_center'));
- $table->construct_header($lang->recipients, array('width' => '130', 'class' => 'align_center'));
- $table->construct_header($lang->controls, array("class" => "align_center", "colspan" => 2, "width" => 200));
-
- $query = $db->simple_select("massemails", "*", "status IN (0, 1, 2)", array('order_by' => 'senddate'));
- while($email = $db->fetch_array($query))
- {
- $email['subject'] = htmlspecialchars_uni($email['subject']);
- if(TIME_NOW >= $email['senddate'] && $email['status'] > 1)
- {
- $table->construct_cell("{$email['subject']}");
- }
- else
- {
- $table->construct_cell("{$email['subject']}");
- }
- if($email['status'] == 0)
- {
- $status = $lang->draft;
- }
- else if($email['status'] == 1)
- {
- $status = $lang->queued;
- }
- else if($email['status'] == 2)
- {
- $progress = ceil($email['sentcount']/$email['totalcount']*100);
- if($progress > 100)
- {
- $progress = 100;
- }
- $status = "{$lang->delivering} ({$progress}%)";
- }
- $table->construct_cell($status, array("class" => "align_center"));
-
- if($email['status'] != 0)
- {
- $delivery_date = my_date($mybb->settings['dateformat'], $email['senddate']);
- }
- else
- {
- $delivery_date = $lang->na;
- }
-
- $table->construct_cell($delivery_date, array("class" => "align_center"));
- $table->construct_cell(my_number_format($email['totalcount']), array("class" => "align_center"));
- if(TIME_NOW >= $email['senddate'] && $email['status'] > 1)
- {
- $table->construct_cell("post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->mass_mail_cancel_confirmation}')\">{$lang->cancel}", array("width" => 100, "colspan" => 2, "class" => "align_center"));
- }
- else
- {
- $table->construct_cell("{$lang->edit}", array("width" => 100, "class" => "align_center"));
- $table->construct_cell("post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->mass_mail_deletion_confirmation}')\">{$lang->delete}", array("width" => 100, "class" => "align_center"));
- }
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_unsent_messages, array('colspan' => 6));
- $table->construct_row();
- $no_results = true;
- }
-
- $plugins->run_hooks("admin_user_mass_email_end");
-
- $table->output($lang->mass_mail_queue);
-
- $page->output_footer();
-}
diff --git a/html/forums/admin/modules/user/module_meta.php b/html/forums/admin/modules/user/module_meta.php
deleted file mode 100644
index a7b1707..0000000
--- a/html/forums/admin/modules/user/module_meta.php
+++ /dev/null
@@ -1,97 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-/**
- * @return bool true
- */
-function user_meta()
-{
- global $page, $lang, $plugins;
-
- $sub_menu = array();
- $sub_menu['10'] = array("id" => "users", "title" => $lang->users, "link" => "index.php?module=user-users");
- $sub_menu['20'] = array("id" => "awaiting_activation", "title" => $lang->awaiting_activation, "link" => "index.php?module=user-awaiting_activation");
- $sub_menu['30'] = array("id" => "groups", "title" => $lang->groups, "link" => "index.php?module=user-groups");
- $sub_menu['40'] = array("id" => "titles", "title" => $lang->user_titles, "link" => "index.php?module=user-titles");
- $sub_menu['50'] = array("id" => "banning", "title" => $lang->banning, "link" => "index.php?module=user-banning");
- $sub_menu['60'] = array("id" => "admin_permissions", "title" => $lang->admin_permissions, "link" => "index.php?module=user-admin_permissions");
- $sub_menu['70'] = array("id" => "mass_mail", "title" => $lang->mass_mail, "link" => "index.php?module=user-mass_mail");
- $sub_menu['80'] = array("id" => "group_promotions", "title" => $lang->group_promotions, "link" => "index.php?module=user-group_promotions");
-
- $sub_menu = $plugins->run_hooks("admin_user_menu", $sub_menu);
-
- $page->add_menu_item($lang->users_and_groups, "user", "index.php?module=user", 30, $sub_menu);
- return true;
-}
-
-/**
- * @param string $action
- *
- * @return string
- */
-function user_action_handler($action)
-{
- global $page, $lang, $plugins;
-
- $page->active_module = "user";
-
- $actions = array(
- 'awaiting_activation' => array('active' => 'awaiting_activation', 'file' => 'awaiting_activation.php'),
- 'group_promotions' => array('active' => 'group_promotions', 'file' => 'group_promotions.php'),
- 'admin_permissions' => array('active' => 'admin_permissions', 'file' => 'admin_permissions.php'),
- 'titles' => array('active' => 'titles', 'file' => 'titles.php'),
- 'banning' => array('active' => 'banning', 'file' => 'banning.php'),
- 'groups' => array('active' => 'groups', 'file' => 'groups.php'),
- 'mass_mail' => array('active' => 'mass_mail', 'file' => 'mass_mail.php'),
- 'users' => array('active' => 'users', 'file' => 'users.php')
- );
-
- $actions = $plugins->run_hooks("admin_user_action_handler", $actions);
-
- if(isset($actions[$action]))
- {
- $page->active_action = $actions[$action]['active'];
- return $actions[$action]['file'];
- }
- else
- {
- $page->active_action = "users";
- return "users.php";
- }
-}
-
-/**
- * @return array
- */
-function user_admin_permissions()
-{
- global $lang, $plugins;
-
- $admin_permissions = array(
- "users" => $lang->can_manage_users,
- "awaiting_activation" => $lang->can_manage_awaiting_activation,
- "groups" => $lang->can_manage_user_groups,
- "titles" => $lang->can_manage_user_titles,
- "banning" => $lang->can_manage_user_bans,
- "admin_permissions" => $lang->can_manage_admin_permissions,
- "mass_mail" => $lang->can_send_mass_mail,
- "group_promotions" => $lang->can_manage_group_promotions
- );
-
- $admin_permissions = $plugins->run_hooks("admin_user_permissions", $admin_permissions);
-
- return array("name" => $lang->users_and_groups, "permissions" => $admin_permissions, "disporder" => 30);
-}
diff --git a/html/forums/admin/modules/user/titles.php b/html/forums/admin/modules/user/titles.php
deleted file mode 100644
index d33e789..0000000
--- a/html/forums/admin/modules/user/titles.php
+++ /dev/null
@@ -1,280 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-$page->add_breadcrumb_item($lang->user_titles, "index.php?module=user-titles");
-
-if($mybb->input['action'] == "add" || !$mybb->input['action'])
-{
- $sub_tabs['manage_titles'] = array(
- 'title' => $lang->user_titles,
- 'link' => "index.php?module=user-titles",
- 'description' => $lang->user_titles_desc
- );
- $sub_tabs['add_title'] = array(
- 'title' => $lang->add_new_user_title,
- 'link' => "index.php?module=user-titles&action=add",
- 'description' => $lang->add_new_user_title_desc
- );
-}
-
-$plugins->run_hooks("admin_user_titles_begin");
-
-if($mybb->input['action'] == "add")
-{
- $plugins->run_hooks("admin_user_titles_add");
-
- if($mybb->request_method == "post")
- {
- if(!trim($mybb->input['title']))
- {
- $errors[] = $lang->error_missing_title;
- }
-
- if(!isset($mybb->input['posts']))
- {
- $errors[] = $lang->error_missing_posts;
- }
-
- $query = $db->simple_select("usertitles", "utid", "posts= '".$mybb->get_input('posts', MyBB::INPUT_INT)."'");
- if($db->num_rows($query))
- {
- $errors[] = $lang->error_cannot_have_same_posts;
- }
-
- if(!$errors)
- {
- $new_title = array(
- "title" => $db->escape_string($mybb->input['title']),
- "posts" => $mybb->get_input('posts', MyBB::INPUT_INT),
- "stars" => $mybb->get_input('stars', MyBB::INPUT_INT),
- "starimage" => $db->escape_string($mybb->input['starimage'])
- );
-
- $utid = $db->insert_query("usertitles", $new_title);
-
- $plugins->run_hooks("admin_user_titles_add_commit");
-
- $cache->update_usertitles();
-
- // Log admin action
- log_admin_action($utid, htmlspecialchars_uni($mybb->input['title']), $mybb->input['posts']);
-
- flash_message($lang->success_user_title_created, 'success');
- admin_redirect("index.php?module=user-titles");
- }
- }
- else
- {
- $mybb->input = array_merge($mybb->input, array(
- 'stars' => '1',
- 'starimage' => '{theme}/star.png',
- )
- );
- }
-
- $page->add_breadcrumb_item($lang->add_new_user_title);
- $page->output_header($lang->user_titles." - ".$lang->add_new_user_title);
-
- $page->output_nav_tabs($sub_tabs, 'add_title');
- $form = new Form("index.php?module=user-titles&action=add", "post");
-
-
- if($errors)
- {
- $page->output_inline_error($errors);
- }
-
- $form_container = new FormContainer($lang->add_new_user_title);
- $form_container->output_row($lang->title_to_assign."*", $lang->title_to_assign_desc, $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
- $form_container->output_row($lang->minimum_posts, $lang->minimum_posts_desc, $form->generate_numeric_field('posts', $mybb->input['posts'], array('id' => 'posts', 'min' => 0)), 'posts');
- $form_container->output_row($lang->number_of_stars, $lang->number_of_stars_desc, $form->generate_numeric_field('stars', $mybb->input['stars'], array('id' => 'stars', 'min' => 0)), 'stars');
- $form_container->output_row($lang->star_image, $lang->star_image_desc, $form->generate_text_box('starimage', $mybb->input['starimage'], array('id' => 'starimage')), 'starimage');
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->save_user_title);
-
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "edit")
-{
- $query = $db->simple_select("usertitles", "*", "utid='".$mybb->get_input('utid', MyBB::INPUT_INT)."'");
- $usertitle = $db->fetch_array($query);
-
- if(!$usertitle['utid'])
- {
- flash_message($lang->error_invalid_user_title, 'error');
- admin_redirect("index.php?module=user-titles");
- }
-
- $plugins->run_hooks("admin_user_titles_edit");
-
- if($mybb->request_method == "post")
- {
- if(!trim($mybb->input['title']))
- {
- $errors[] = $lang->error_missing_title;
- }
-
- if(!isset($mybb->input['posts']))
- {
- $errors[] = $lang->error_missing_posts;
- }
-
- $query = $db->simple_select("usertitles", "utid", "posts= '".$mybb->get_input('posts', MyBB::INPUT_INT)."' AND utid!= '".$mybb->get_input('utid', MyBB::INPUT_INT)."'");
- if($db->num_rows($query))
- {
- $errors[] = $lang->error_cannot_have_same_posts;
- }
-
- if(!$errors)
- {
- $updated_title = array(
- "title" => $db->escape_string($mybb->input['title']),
- "posts" => $mybb->get_input('posts', MyBB::INPUT_INT),
- "stars" => $mybb->get_input('stars', MyBB::INPUT_INT),
- "starimage" => $db->escape_string($mybb->input['starimage'])
- );
-
- $plugins->run_hooks("admin_user_titles_edit_commit");
-
- $db->update_query("usertitles", $updated_title, "utid='{$usertitle['utid']}'");
-
- $cache->update_usertitles();
-
- // Log admin action
- log_admin_action($usertitle['utid'], htmlspecialchars_uni($mybb->input['title']), $mybb->input['posts']);
-
- flash_message($lang->success_user_title_updated, 'success');
- admin_redirect("index.php?module=user-titles");
- }
- }
-
- $page->add_breadcrumb_item($lang->edit_user_title);
- $page->output_header($lang->user_titles." - ".$lang->edit_user_title);
-
- $sub_tabs['edit_title'] = array(
- 'title' => $lang->edit_user_title,
- 'link' => "index.php?module=user-titles&action=edit&utid=".$usertitle['utid'],
- 'description' => $lang->edit_user_title_desc
- );
-
- $page->output_nav_tabs($sub_tabs, 'edit_title');
- $form = new Form("index.php?module=user-titles&action=edit&utid={$usertitle['utid']}", "post");
-
-
- if($errors)
- {
- $page->output_inline_error($errors);
- }
- else
- {
- $mybb->input = array_merge($mybb->input, $usertitle);
- }
-
- $form_container = new FormContainer($lang->edit_user_title);
- $form_container->output_row($lang->title_to_assign."*", $lang->title_to_assign_desc, $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
- $form_container->output_row($lang->minimum_posts, $lang->minimum_posts_desc, $form->generate_numeric_field('posts', $mybb->input['posts'], array('id' => 'posts', 'min' => 0)), 'posts');
- $form_container->output_row($lang->number_of_stars, $lang->number_of_stars_desc, $form->generate_numeric_field('stars', $mybb->input['stars'], array('id' => 'stars', 'min' => 0)), 'stars');
- $form_container->output_row($lang->star_image, $lang->star_image_desc, $form->generate_text_box('starimage', $mybb->input['starimage'], array('id' => 'starimage')), 'starimage');
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->save_user_title);
-
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-
-}
-
-if($mybb->input['action'] == "delete")
-{
- $query = $db->simple_select("usertitles", "*", "utid='".$mybb->get_input('utid', MyBB::INPUT_INT)."'");
- $usertitle = $db->fetch_array($query);
-
- if(!$usertitle['utid'])
- {
- flash_message($lang->error_invalid_user_title, 'error');
- admin_redirect("index.php?module=user-titles");
- }
-
- // User clicked no
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=user-titles");
- }
-
- $plugins->run_hooks("admin_user_titles_delete");
-
- if($mybb->request_method == "post")
- {
- $db->delete_query("usertitles", "utid='{$usertitle['utid']}'");
-
- $plugins->run_hooks("admin_user_titles_delete_commit");
-
- $cache->update_usertitles();
-
- // Log admin action
- log_admin_action($usertitle['utid'], htmlspecialchars_uni($usertitle['title']), $usertitle['posts']);
-
- flash_message($lang->success_user_title_deleted, 'success');
- admin_redirect("index.php?module=user-titles");
- }
- else
- {
- $page->output_confirm_action("index.php?module=user-titles&action=delete&utid={$usertitle['utid']}", $lang->user_title_deletion_confirmation);
- }
-}
-
-if(!$mybb->input['action'])
-{
- $plugins->run_hooks("admin_user_titles_start");
-
- $page->output_header($lang->manage_user_titles);
-
- $page->output_nav_tabs($sub_tabs, 'manage_titles');
-
- $table = new Table;
- $table->construct_header($lang->user_title);
- $table->construct_header($lang->minimum_posts, array('width' => '130', 'class' => 'align_center'));
- $table->construct_header($lang->controls, array("class" => "align_center", "colspan" => 2, "width" => 200));
-
- $query = $db->simple_select("usertitles", "*", "", array('order_by' => 'posts'));
- while($usertitle = $db->fetch_array($query))
- {
- $usertitle['title'] = htmlspecialchars_uni($usertitle['title']);
- $table->construct_cell("{$usertitle['title']}");
- $table->construct_cell($usertitle['posts'], array("class" => "align_center"));
- $table->construct_cell("{$lang->edit}", array("width" => 100, "class" => "align_center"));
- $table->construct_cell("post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->user_title_deletion_confirmation}')\">{$lang->delete}", array("width" => 100, "class" => "align_center"));
- $table->construct_row();
- }
-
- if($table->num_rows() == 0)
- {
- $table->construct_cell($lang->no_user_titles, array('colspan' => 4));
- $table->construct_row();
- $no_results = true;
- }
-
- $table->output($lang->manage_user_titles);
-
- $page->output_footer();
-}
diff --git a/html/forums/admin/modules/user/users.php b/html/forums/admin/modules/user/users.php
deleted file mode 100644
index bb64038..0000000
--- a/html/forums/admin/modules/user/users.php
+++ /dev/null
@@ -1,4319 +0,0 @@
-
Please make sure IN_MYBB is defined.");
-}
-
-require_once MYBB_ROOT."inc/functions_upload.php";
-
-$page->add_breadcrumb_item($lang->users, "index.php?module=user-users");
-
-if($mybb->input['action'] == "add" || $mybb->input['action'] == "merge" || $mybb->input['action'] == "search" || !$mybb->input['action'])
-{
- $sub_tabs['browse_users'] = array(
- 'title' => $lang->browse_users,
- 'link' => "index.php?module=user-users",
- 'description' => $lang->browse_users_desc
- );
-
- $sub_tabs['find_users'] = array(
- 'title' => $lang->find_users,
- 'link' => "index.php?module=user-users&action=search",
- 'description' => $lang->find_users_desc
- );
-
- $sub_tabs['create_user'] = array(
- 'title' => $lang->create_user,
- 'link' => "index.php?module=user-users&action=add",
- 'description' => $lang->create_user_desc
- );
-
- $sub_tabs['merge_users'] = array(
- 'title' => $lang->merge_users,
- 'link' => "index.php?module=user-users&action=merge",
- 'description' => $lang->merge_users_desc
- );
-}
-
-$user_view_fields = array(
- "avatar" => array(
- "title" => $lang->avatar,
- "width" => "24",
- "align" => ""
- ),
-
- "username" => array(
- "title" => $lang->username,
- "width" => "",
- "align" => ""
- ),
-
- "email" => array(
- "title" => $lang->email,
- "width" => "",
- "align" => "center"
- ),
-
- "usergroup" => array(
- "title" => $lang->primary_group,
- "width" => "",
- "align" => "center"
- ),
-
- "additionalgroups" => array(
- "title" => $lang->additional_groups,
- "width" => "",
- "align" => "center"
- ),
-
- "regdate" => array(
- "title" => $lang->registered,
- "width" => "",
- "align" => "center"
- ),
-
- "lastactive" => array(
- "title" => $lang->last_active,
- "width" => "",
- "align" => "center"
- ),
-
- "postnum" => array(
- "title" => $lang->post_count,
- "width" => "",
- "align" => "center"
- ),
-
- "threadnum" => array(
- "title" => $lang->thread_count,
- "width" => "",
- "align" => "center"
- ),
-
- "reputation" => array(
- "title" => $lang->reputation,
- "width" => "",
- "align" => "center"
- ),
-
- "warninglevel" => array(
- "title" => $lang->warning_level,
- "width" => "",
- "align" => "center"
- ),
-
- "regip" => array(
- "title" => $lang->registration_ip,
- "width" => "",
- "align" => "center"
- ),
-
- "lastip" => array(
- "title" => $lang->last_known_ip,
- "width" => "",
- "align" => "center"
- ),
-
- "controls" => array(
- "title" => $lang->controls,
- "width" => "",
- "align" => "center"
- )
-);
-
-$sort_options = array(
- "username" => $lang->username,
- "regdate" => $lang->registration_date,
- "lastactive" => $lang->last_active,
- "numposts" => $lang->post_count,
- "reputation" => $lang->reputation,
- "warninglevel" => $lang->warning_level
-);
-
-$plugins->run_hooks("admin_user_users_begin");
-
-// Initialise the views manager for user based views
-require MYBB_ADMIN_DIR."inc/functions_view_manager.php";
-if($mybb->input['action'] == "views")
-{
- view_manager("index.php?module=user-users", "user", $user_view_fields, $sort_options, "user_search_conditions");
-}
-
-if($mybb->input['action'] == 'iplookup')
-{
- $mybb->input['ipaddress'] = $mybb->get_input('ipaddress');
- $lang->ipaddress_misc_info = $lang->sprintf($lang->ipaddress_misc_info, htmlspecialchars_uni($mybb->input['ipaddress']));
- $ipaddress_location = $lang->na;
- $ipaddress_host_name = $lang->na;
- $modcp_ipsearch_misc_info = '';
- if(!strstr($mybb->input['ipaddress'], "*"))
- {
- // Return GeoIP information if it is available to us
- if(function_exists('geoip_record_by_name'))
- {
- $ip_record = @geoip_record_by_name($mybb->input['ipaddress']);
- if($ip_record)
- {
- $ipaddress_location = htmlspecialchars_uni(utf8_encode($ip_record['country_name']));
- if($ip_record['city'])
- {
- $ipaddress_location .= $lang->comma.htmlspecialchars_uni(utf8_encode($ip_record['city']));
- }
- }
- }
-
- $ipaddress_host_name = htmlspecialchars_uni(@gethostbyaddr($mybb->input['ipaddress']));
-
- // gethostbyaddr returns the same ip on failure
- if($ipaddress_host_name == $mybb->input['ipaddress'])
- {
- $ipaddress_host_name = $lang->na;
- }
- }
-
- ?>
-
-
-
- construct_cell($lang->ipaddress_host_name.":");
- $table->construct_cell($ipaddress_host_name);
- $table->construct_row();
-
- $table->construct_cell($lang->ipaddress_location.":");
- $table->construct_cell($ipaddress_location);
- $table->construct_row();
-
- $table->output($lang->ipaddress_misc_info);
-
- ?>
-
-
-input['action'] == "activate_user")
-{
- if(!verify_post_check($mybb->input['my_post_key']))
- {
- flash_message($lang->invalid_post_verify_key2, 'error');
- admin_redirect("index.php?module=user-users");
- }
-
- $user = get_user($mybb->input['uid']);
-
- // Does the user not exist?
- if(!$user['uid'] || $user['usergroup'] != 5)
- {
- flash_message($lang->error_invalid_user, 'error');
- admin_redirect("index.php?module=user-users");
- }
-
- $plugins->run_hooks("admin_user_users_coppa_activate");
-
- $updated_user['usergroup'] = $user['usergroup'];
-
- // Update
- if($user['coppauser'])
- {
- $updated_user = array(
- "coppauser" => 0
- );
- }
- else
- {
- $db->delete_query("awaitingactivation", "uid='{$user['uid']}'");
- }
-
- // Move out of awaiting activation if they're in it.
- if($user['usergroup'] == 5)
- {
- $updated_user['usergroup'] = 2;
- }
-
- $plugins->run_hooks("admin_user_users_coppa_activate_commit");
-
- $db->update_query("users", $updated_user, "uid='{$user['uid']}'");
-
- $cache->update_awaitingactivation();
-
- $message = $lang->sprintf($lang->email_adminactivateaccount, $user['username'], $mybb->settings['bbname'], $mybb->settings['bburl']);
- my_mail($user['email'], $lang->sprintf($lang->emailsubject_activateaccount, $mybb->settings['bbname']), $message);
-
- // Log admin action
- log_admin_action($user['uid'], htmlspecialchars_uni($user['username']));
-
- if($mybb->input['from'] == "home")
- {
- if($user['coppauser'])
- {
- $message = $lang->success_coppa_activated;
- }
- else
- {
- $message = $lang->success_activated;
- }
-
- update_admin_session('flash_message2', array('message' => $message, 'type' => 'success'));
- }
- else
- {
- if($user['coppauser'])
- {
- flash_message($lang->success_coppa_activated, 'success');
- }
- else
- {
- flash_message($lang->success_activated, 'success');
- }
- }
-
- if($admin_session['data']['last_users_url'])
- {
- $url = $admin_session['data']['last_users_url'];
- update_admin_session('last_users_url', '');
-
- if($mybb->input['from'] == "home")
- {
- update_admin_session('from', 'home');
- }
- }
- else
- {
- $url = "index.php?module=user-users&action=edit&uid={$user['uid']}";
- }
-
- $plugins->run_hooks("admin_user_users_coppa_end");
-
- admin_redirect($url);
-}
-
-if($mybb->input['action'] == "add")
-{
- $plugins->run_hooks("admin_user_users_add");
-
- if($mybb->request_method == "post")
- {
- // Determine the usergroup stuff
- if(is_array($mybb->input['additionalgroups']))
- {
- foreach($mybb->input['additionalgroups'] as $key => $gid)
- {
- if($gid == $mybb->input['usergroup'])
- {
- unset($mybb->input['additionalgroups'][$key]);
- }
- }
- $additionalgroups = implode(",", $mybb->input['additionalgroups']);
- }
- else
- {
- $additionalgroups = '';
- }
-
- // Set up user handler.
- require_once MYBB_ROOT."inc/datahandlers/user.php";
- $userhandler = new UserDataHandler('insert');
-
- // Set the data for the new user.
- $new_user = array(
- "uid" => $mybb->input['uid'],
- "username" => $mybb->input['username'],
- "password" => $mybb->input['password'],
- "password2" => $mybb->input['confirm_password'],
- "email" => $mybb->input['email'],
- "email2" => $mybb->input['email'],
- "usergroup" => $mybb->input['usergroup'],
- "additionalgroups" => $additionalgroups,
- "displaygroup" => $mybb->input['displaygroup'],
- "profile_fields" => $mybb->input['profile_fields'],
- "profile_fields_editable" => true,
- );
-
- // Set the data of the user in the datahandler.
- $userhandler->set_data($new_user);
- $errors = '';
-
- // Validate the user and get any errors that might have occurred.
- if(!$userhandler->validate_user())
- {
- $errors = $userhandler->get_friendly_errors();
- }
- else
- {
- $user_info = $userhandler->insert_user();
-
- $plugins->run_hooks("admin_user_users_add_commit");
-
- // Log admin action
- log_admin_action($user_info['uid'], htmlspecialchars_uni($user_info['username']));
-
- flash_message($lang->success_user_created, 'success');
- admin_redirect("index.php?module=user-users&action=edit&uid={$user_info['uid']}");
- }
- }
-
- // Fetch custom profile fields - only need required profile fields here
- $query = $db->simple_select("profilefields", "*", "required=1", array('order_by' => 'disporder'));
-
- $profile_fields = array();
- while($profile_field = $db->fetch_array($query))
- {
- $profile_fields['required'][] = $profile_field;
- }
-
- $page->add_breadcrumb_item($lang->create_user);
- $page->output_header($lang->create_user);
-
- $form = new Form("index.php?module=user-users&action=add", "post");
-
- $page->output_nav_tabs($sub_tabs, 'create_user');
-
- // If we have any error messages, show them
- if($errors)
- {
- $page->output_inline_error($errors);
- }
- else
- {
- $mybb->input = array_merge($mybb->input, array('usergroup' => 2));
- }
-
- $form_container = new FormContainer($lang->required_profile_info);
- $form_container->output_row($lang->username." *", "", $form->generate_text_box('username', htmlspecialchars_uni($mybb->get_input('username')), array('id' => 'username')), 'username');
- $form_container->output_row($lang->password." *", "", $form->generate_password_box('password', $mybb->input['password'], array('id' => 'password', 'autocomplete' => 'off')), 'password');
- $form_container->output_row($lang->confirm_password." *", "", $form->generate_password_box('confirm_password', $mybb->input['confirm_password'], array('id' => 'confirm_new_password')), 'confirm_new_password');
- $form_container->output_row($lang->email_address." *", "", $form->generate_text_box('email', $mybb->input['email'], array('id' => 'email')), 'email');
-
- $display_group_options[0] = $lang->use_primary_user_group;
- $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']);
- $display_group_options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);
- }
-
- $form_container->output_row($lang->primary_user_group." *", "", $form->generate_select_box('usergroup', $options, $mybb->input['usergroup'], array('id' => 'usergroup')), 'usergroup');
- $form_container->output_row($lang->additional_user_groups, $lang->additional_user_groups_desc, $form->generate_select_box('additionalgroups[]', $options, $mybb->input['additionalgroups'], array('id' => 'additionalgroups', 'multiple' => true, 'size' => 5)), 'additionalgroups');
- $form_container->output_row($lang->display_user_group." *", "", $form->generate_select_box('displaygroup', $display_group_options, $mybb->input['displaygroup'], array('id' => 'displaygroup')), 'displaygroup');
-
- // Output custom profile fields - required
- output_custom_profile_fields($profile_fields['required'], $mybb->input['profile_fields'], $form_container, $form);
-
- $form_container->end();
- $buttons[] = $form->generate_submit_button($lang->save_user);
- $form->output_submit_wrapper($buttons);
-
- $form->end();
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "edit")
-{
- $user = get_user($mybb->input['uid']);
-
- // Does the user not exist?
- if(!$user['uid'])
- {
- flash_message($lang->error_invalid_user, 'error');
- admin_redirect("index.php?module=user-users");
- }
-
- $plugins->run_hooks("admin_user_users_edit");
-
- if($mybb->request_method == "post")
- {
- $plugins->run_hooks("admin_user_users_edit_start");
- if(is_super_admin($mybb->input['uid']) && $mybb->user['uid'] != $mybb->input['uid'] && !is_super_admin($mybb->user['uid']))
- {
- flash_message($lang->error_no_perms_super_admin, 'error');
- admin_redirect("index.php?module=user-users");
- }
-
- // Determine the usergroup stuff
- if(is_array($mybb->input['additionalgroups']))
- {
- foreach($mybb->input['additionalgroups'] as $key => $gid)
- {
- if($gid == $mybb->input['usergroup'])
- {
- unset($mybb->input['additionalgroups'][$key]);
- }
- }
- $additionalgroups = implode(",", $mybb->input['additionalgroups']);
- }
- else
- {
- $additionalgroups = '';
- }
-
- $returndate = "";
- if(!empty($mybb->input['away_day']))
- {
- $awaydate = TIME_NOW;
- // If the user has indicated that they will return on a specific day, but not month or year, assume it is current month and year
- if(!$mybb->input['away_month'])
- {
- $mybb->input['away_month'] = my_date('n', $awaydate);
- }
- if(!$mybb->input['away_year'])
- {
- $mybb->input['away_year'] = my_date('Y', $awaydate);
- }
-
- $return_month = (int)substr($mybb->input['away_month'], 0, 2);
- $return_day = (int)substr($mybb->input['away_day'], 0, 2);
- $return_year = min($mybb->get_input('away_year', MyBB::INPUT_INT), 9999);
-
- // Check if return date is after the away date.
- $returntimestamp = gmmktime(0, 0, 0, $return_month, $return_day, $return_year);
- $awaytimestamp = gmmktime(0, 0, 0, my_date('n', $awaydate), my_date('j', $awaydate), my_date('Y', $awaydate));
- if($return_year < my_date('Y', $awaydate) || ($returntimestamp < $awaytimestamp && $return_year == my_date('Y', $awaydate)))
- {
- $away_in_past = true;
- }
-
- $returndate = "{$return_day}-{$return_month}-{$return_year}";
- }
-
- // Set up user handler.
- require_once MYBB_ROOT."inc/datahandlers/user.php";
- $userhandler = new UserDataHandler('update');
-
- // Set the data for the new user.
- $updated_user = array(
- "uid" => $mybb->input['uid'],
- "username" => $mybb->input['username'],
- "email" => $mybb->input['email'],
- "email2" => $mybb->input['email'],
- "usergroup" => $mybb->input['usergroup'],
- "additionalgroups" => $additionalgroups,
- "displaygroup" => $mybb->input['displaygroup'],
- "postnum" => $mybb->input['postnum'],
- "threadnum" => $mybb->input['threadnum'],
- "usertitle" => $mybb->input['usertitle'],
- "timezone" => $mybb->input['timezone'],
- "language" => $mybb->input['language'],
- "profile_fields" => $mybb->input['profile_fields'],
- "profile_fields_editable" => true,
- "website" => $mybb->input['website'],
- "icq" => $mybb->input['icq'],
- "aim" => $mybb->input['aim'],
- "yahoo" => $mybb->input['yahoo'],
- "skype" => $mybb->input['skype'],
- "google" => $mybb->input['google'],
- "birthday" => array(
- "day" => $mybb->input['bday1'],
- "month" => $mybb->input['bday2'],
- "year" => $mybb->input['bday3']
- ),
- "style" => $mybb->input['style'],
- "signature" => $mybb->input['signature'],
- "dateformat" => $mybb->get_input('dateformat', MyBB::INPUT_INT),
- "timeformat" => $mybb->get_input('timeformat', MyBB::INPUT_INT),
- "usernotes" => $mybb->input['usernotes'],
- "away" => array(
- "away" => $mybb->input['away'],
- "date" => TIME_NOW,
- "returndate" => $returndate,
- "awayreason" => $mybb->input['awayreason']
- )
- );
-
- if($user['usergroup'] == 5 && $mybb->input['usergroup'] != 5)
- {
- if($user['coppauser'] == 1)
- {
- $updated_user['coppa_user'] = 0;
- }
- }
- if($mybb->input['new_password'])
- {
- $updated_user['password'] = $mybb->input['new_password'];
- $updated_user['password2'] = $mybb->input['confirm_new_password'];
- }
-
- $updated_user['options'] = array(
- "allownotices" => $mybb->input['allownotices'],
- "hideemail" => $mybb->input['hideemail'],
- "subscriptionmethod" => $mybb->input['subscriptionmethod'],
- "invisible" => $mybb->input['invisible'],
- "dstcorrection" => $mybb->input['dstcorrection'],
- "threadmode" => $mybb->input['threadmode'],
- "classicpostbit" => $mybb->input['classicpostbit'],
- "showimages" => $mybb->input['showimages'],
- "showvideos" => $mybb->input['showvideos'],
- "showsigs" => $mybb->input['showsigs'],
- "showavatars" => $mybb->input['showavatars'],
- "showquickreply" => $mybb->input['showquickreply'],
- "receivepms" => $mybb->input['receivepms'],
- "receivefrombuddy" => $mybb->input['receivefrombuddy'],
- "pmnotice" => $mybb->input['pmnotice'],
- "daysprune" => $mybb->input['daysprune'],
- "showcodebuttons" => $mybb->input['showcodebuttons'],
- "sourceeditor" => $mybb->input['sourceeditor'],
- "pmnotify" => $mybb->input['pmnotify'],
- "buddyrequestspm" => $mybb->input['buddyrequestspm'],
- "buddyrequestsauto" => $mybb->input['buddyrequestsauto'],
- "showredirect" => $mybb->input['showredirect']
- );
-
- if($mybb->settings['usertppoptions'])
- {
- $updated_user['options']['tpp'] = $mybb->get_input('tpp', MyBB::INPUT_INT);
- }
-
- if($mybb->settings['userpppoptions'])
- {
- $updated_user['options']['ppp'] = $mybb->get_input('ppp', MyBB::INPUT_INT);
- }
-
- // Set the data of the user in the datahandler.
- $userhandler->set_data($updated_user);
- $errors = '';
-
- // Validate the user and get any errors that might have occurred.
- if(!$userhandler->validate_user())
- {
- $errors = $userhandler->get_friendly_errors();
- }
- else
- {
- // Are we removing an avatar from this user?
- if($mybb->input['remove_avatar'])
- {
- $extra_user_updates = array(
- "avatar" => "",
- "avatardimensions" => "",
- "avatartype" => ""
- );
- remove_avatars($user['uid']);
- }
-
- // Are we uploading a new avatar?
- if($_FILES['avatar_upload']['name'])
- {
- $avatar = upload_avatar($_FILES['avatar_upload'], $user['uid']);
- if($avatar['error'])
- {
- $errors = array($avatar['error']);
- }
- else
- {
- if($avatar['width'] > 0 && $avatar['height'] > 0)
- {
- $avatar_dimensions = $avatar['width']."|".$avatar['height'];
- }
- $extra_user_updates = array(
- "avatar" => $avatar['avatar'].'?dateline='.TIME_NOW,
- "avatardimensions" => $avatar_dimensions,
- "avatartype" => "upload"
- );
- }
- }
- // Are we setting a new avatar from a URL?
- else if($mybb->input['avatar_url'] && $mybb->input['avatar_url'] != $user['avatar'])
- {
- if(!$mybb->settings['allowremoteavatars'])
- {
- $errors = array($lang->error_remote_avatar_not_allowed);
- }
- else
- {
- if(filter_var($mybb->input['avatar_url'], FILTER_VALIDATE_EMAIL) !== false)
- {
- // Gravatar
- $email = md5(strtolower(trim($mybb->input['avatar_url'])));
-
- $s = '';
- if(!$mybb->settings['maxavatardims'])
- {
- $mybb->settings['maxavatardims'] = '100x100'; // Hard limit of 100 if there are no limits
- }
-
- // Because Gravatars are square, hijack the width
- list($maxwidth, $maxheight) = explode("x", my_strtolower($mybb->settings['maxavatardims']));
-
- $s = "?s={$maxwidth}";
- $maxheight = (int)$maxwidth;
-
- $extra_user_updates = array(
- "avatar" => "https://www.gravatar.com/avatar/{$email}{$s}",
- "avatardimensions" => "{$maxheight}|{$maxheight}",
- "avatartype" => "gravatar"
- );
- }
- else
- {
- $mybb->input['avatar_url'] = preg_replace("#script:#i", "", $mybb->input['avatar_url']);
- $ext = get_extension($mybb->input['avatar_url']);
-
- // Copy the avatar to the local server (work around remote URL access disabled for getimagesize)
- $file = fetch_remote_file($mybb->input['avatar_url']);
- if(!$file)
- {
- $avatar_error = $lang->error_invalidavatarurl;
- }
- else
- {
- $tmp_name = "../".$mybb->settings['avataruploadpath']."/remote_".md5(random_str());
- $fp = @fopen($tmp_name, "wb");
- if(!$fp)
- {
- $avatar_error = $lang->error_invalidavatarurl;
- }
- else
- {
- fwrite($fp, $file);
- fclose($fp);
- list($width, $height, $type) = @getimagesize($tmp_name);
- @unlink($tmp_name);
- echo $type;
- if(!$type)
- {
- $avatar_error = $lang->error_invalidavatarurl;
- }
- }
- }
-
- if(empty($avatar_error))
- {
- if($width && $height && $mybb->settings['maxavatardims'] != "")
- {
- list($maxwidth, $maxheight) = explode("x", my_strtolower($mybb->settings['maxavatardims']));
- if(($maxwidth && $width > $maxwidth) || ($maxheight && $height > $maxheight))
- {
- $lang->error_avatartoobig = $lang->sprintf($lang->error_avatartoobig, $maxwidth, $maxheight);
- $avatar_error = $lang->error_avatartoobig;
- }
- }
- }
-
- if(empty($avatar_error))
- {
- if($width > 0 && $height > 0)
- {
- $avatar_dimensions = (int)$width."|".(int)$height;
- }
- $extra_user_updates = array(
- "avatar" => $db->escape_string($mybb->input['avatar_url'].'?dateline='.TIME_NOW),
- "avatardimensions" => $avatar_dimensions,
- "avatartype" => "remote"
- );
- remove_avatars($user['uid']);
- }
- else
- {
- $errors = array($avatar_error);
- }
- }
- }
- }
-
- // Moderator "Options" (suspend signature, suspend/moderate posting)
- $moderator_options = array(
- 1 => array(
- "action" => "suspendsignature", // The moderator action we're performing
- "period" => "action_period", // The time period we've selected from the dropdown box
- "time" => "action_time", // The time we've entered
- "update_field" => "suspendsignature", // The field in the database to update if true
- "update_length" => "suspendsigtime" // The length of suspension field in the database
- ),
- 2 => array(
- "action" => "moderateposting",
- "period" => "modpost_period",
- "time" => "modpost_time",
- "update_field" => "moderateposts",
- "update_length" => "moderationtime"
- ),
- 3 => array(
- "action" => "suspendposting",
- "period" => "suspost_period",
- "time" => "suspost_time",
- "update_field" => "suspendposting",
- "update_length" => "suspensiontime"
- )
- );
-
- require_once MYBB_ROOT."inc/functions_warnings.php";
- foreach($moderator_options as $option)
- {
- if(!$mybb->input[$option['action']])
- {
- if($user[$option['update_field']] == 1)
- {
- // We're revoking the suspension
- $extra_user_updates[$option['update_field']] = 0;
- $extra_user_updates[$option['update_length']] = 0;
- }
-
- // Skip this option if we haven't selected it
- continue;
- }
-
- if($mybb->input[$option['action']])
- {
- if((int)$mybb->input[$option['time']] == 0 && $mybb->input[$option['period']] != "never" && $user[$option['update_field']] != 1)
- {
- // User has selected a type of ban, but not entered a valid time frame
- $string = $option['action']."_error";
- $errors[] = $lang->$string;
- }
-
- if(!is_array($errors))
- {
- $suspend_length = fetch_time_length((int)$mybb->input[$option['time']], $mybb->input[$option['period']]);
-
- if($user[$option['update_field']] == 1 && ($mybb->input[$option['time']] || $mybb->input[$option['period']] == "never"))
- {
- // We already have a suspension, but entered a new time
- if($suspend_length == "-1")
- {
- // Permanent ban on action
- $extra_user_updates[$option['update_length']] = 0;
- }
- elseif($suspend_length && $suspend_length != "-1")
- {
- // Temporary ban on action
- $extra_user_updates[$option['update_length']] = TIME_NOW + $suspend_length;
- }
- }
- elseif(!$user[$option['update_field']])
- {
- // New suspension for this user... bad user!
- $extra_user_updates[$option['update_field']] = 1;
- if($suspend_length == "-1")
- {
- $extra_user_updates[$option['update_length']] = 0;
- }
- else
- {
- $extra_user_updates[$option['update_length']] = TIME_NOW + $suspend_length;
- }
- }
- }
- }
- }
-
- if($extra_user_updates['moderateposts'] && $extra_user_updates['suspendposting'])
- {
- $errors[] = $lang->suspendmoderate_error;
- }
-
- if(isset($away_in_past))
- {
- $errors[] = $lang->error_acp_return_date_past;
- }
-
- if(!$errors)
- {
- $user_info = $userhandler->update_user();
-
- $plugins->run_hooks("admin_user_users_edit_commit_start");
-
- $db->update_query("users", $extra_user_updates, "uid='{$user['uid']}'");
-
- // if we're updating the user's signature preferences, do so now
- if($mybb->input['update_posts'] == 'enable' || $mybb->input['update_posts'] == 'disable')
- {
- $update_signature = array(
- 'includesig' => ($mybb->input['update_posts'] == 'enable' ? 1 : 0)
- );
- $db->update_query("posts", $update_signature, "uid='{$user['uid']}'");
- }
-
- $plugins->run_hooks("admin_user_users_edit_commit");
-
- if($user['usergroup'] == 5 && $mybb->input['usergroup'] != 5)
- {
- $cache->update_awaitingactivation();
- }
-
- // Log admin action
- log_admin_action($user['uid'], htmlspecialchars_uni($mybb->input['username']));
-
- flash_message($lang->success_user_updated, 'success');
- admin_redirect("index.php?module=user-users");
- }
- $plugins->run_hooks("admin_user_users_edit_end");
- }
- }
-
- if(!$errors)
- {
- $user['usertitle'] = htmlspecialchars_decode($user['usertitle']);
- $mybb->input = array_merge($mybb->input, $user);
-
- $options = array(
- 'bday1', 'bday2', 'bday3',
- 'new_password', 'confirm_new_password',
- 'action_time', 'action_period',
- 'modpost_period', 'moderateposting', 'modpost_time', 'suspost_period', 'suspost_time'
- );
-
- foreach($options as $option)
- {
- if(!isset($input_user[$option]))
- {
- $mybb->input[$option] = '';
- }
- }
-
- // We need to fetch this users profile field values
- $query = $db->simple_select("userfields", "*", "ufid='{$user['uid']}'");
- $mybb->input['profile_fields'] = $db->fetch_array($query);
- }
-
- if($mybb->input['bday1'] || $mybb->input['bday2'] || $mybb->input['bday3'])
- {
- $mybb->input['bday'][0] = $mybb->input['bday1'];
- $mybb->input['bday'][1] = $mybb->input['bday2'];
- $mybb->input['bday'][2] = $mybb->get_input('bday3', MyBB::INPUT_INT);
- }
- else
- {
- $mybb->input['bday'] = array(0, 0, '');
-
- if($user['birthday'])
- {
- $mybb->input['bday'] = explode('-', $user['birthday']);
- }
- }
-
- if($mybb->input['away_day'] || $mybb->input['away_month'] || $mybb->input['away_year'])
- {
- $mybb->input['away_year'] = $mybb->get_input('away_year', MyBB::INPUT_INT);
- }
- else
- {
- $mybb->input['away_day'] = 0;
- $mybb->input['away_month'] = 0;
- $mybb->input['away_year'] = '';
-
- if($user['returndate'])
- {
- list($mybb->input['away_day'], $mybb->input['away_month'], $mybb->input['away_year']) = explode('-', $user['returndate']);
- }
- }
-
- // 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;
- }
- }
-
- $page->add_breadcrumb_item($lang->edit_user.": ".htmlspecialchars_uni($user['username']));
-
- $page->extra_header .= <<
-
-
-
-EOF;
- $page->output_header($lang->edit_user);
-
- $sub_tabs['edit_user'] = array(
- 'title' => $lang->edit_user,
- 'description' => $lang->edit_user_desc
- );
-
- $form = new Form("index.php?module=user-users&action=edit&uid={$user['uid']}", "post", "", 1);
-
- $page->output_nav_tabs($sub_tabs, 'edit_user');
-
- // If we have any error messages, show them
- if($errors)
- {
- $page->output_inline_error($errors);
- }
-
- // Is this user a COPPA user? We show a warning & activate link
- if($user['coppauser'])
- {
- echo $lang->sprintf($lang->warning_coppa_user, $user['uid']);
- }
-
- $tabs = array(
- "overview" => $lang->overview,
- "profile" => $lang->profile,
- "settings" => $lang->account_settings,
- "signature" => $lang->signature,
- "avatar" => $lang->avatar,
- "modoptions" => $lang->mod_options
- );
- $tabs = $plugins->run_hooks("admin_user_users_edit_graph_tabs", $tabs);
- $page->output_tab_control($tabs);
-
- //
- // OVERVIEW
- //
- echo "\n";
- $table = new Table;
- $table->construct_header($lang->avatar, array('class' => 'align_center'));
- $table->construct_header($lang->general_account_stats, array('colspan' => '2', 'class' => 'align_center'));
-
- // Avatar
- $avatar_dimensions = explode("|", $user['avatardimensions']);
- if($user['avatar'] && (my_strpos($user['avatar'], '://') === false || $mybb->settings['allowremoteavatars']))
- {
- if($user['avatardimensions'])
- {
- require_once MYBB_ROOT."inc/functions_image.php";
- list($width, $height) = explode("|", $user['avatardimensions']);
- $scaled_dimensions = scale_image($width, $height, 120, 120);
- }
- else
- {
- $scaled_dimensions = array(
- "width" => 120,
- "height" => 120
- );
- }
- if(!my_validate_url($user['avatar']))
- {
- $user['avatar'] = "../{$user['avatar']}\n";
- }
- }
- else
- {
- if(my_validate_url($mybb->settings['useravatar']))
- {
- $user['avatar'] = str_replace('{theme}', 'images', $mybb->settings['useravatar']);
- }
- else
- {
- $user['avatar'] = "../".str_replace('{theme}', 'images', $mybb->settings['useravatar']);
- }
- $scaled_dimensions = array(
- "width" => 120,
- "height" => 120
- );
- }
- $avatar_top = ceil((126-$scaled_dimensions['height'])/2);
- if($user['lastactive'])
- {
- $last_active = my_date('relative', $user['lastactive']);
- }
- else
- {
- $last_active = $lang->never;
- }
- $reg_date = my_date('relative', $user['regdate']);
- if($user['dst'] == 1)
- {
- $timezone = (float)$user['timezone']+1;
- }
- else
- {
- $timezone = (float)$user['timezone'];
- }
- $local_date = gmdate($mybb->settings['dateformat'], TIME_NOW + ($timezone * 3600));
- $local_time = gmdate($mybb->settings['timeformat'], TIME_NOW + ($timezone * 3600));
-
- $localtime = $lang->sprintf($lang->local_time_format, $local_date, $local_time);
- $days_registered = (TIME_NOW - $user['regdate']) / (24*3600);
- $posts_per_day = 0;
- if($days_registered > 0)
- {
- $posts_per_day = round($user['postnum'] / $days_registered, 2);
- if($posts_per_day > $user['postnum'])
- {
- $posts_per_day = $user['postnum'];
- }
- }
- $posts_per_day = my_number_format($posts_per_day);
-
- $stats = $cache->read("stats");
- $posts = $stats['numposts'];
- if($posts == 0)
- {
- $percent_posts = "0";
- }
- else
- {
- $percent_posts = round($user['postnum']*100/$posts, 2);
- }
-
- $user_permissions = user_permissions($user['uid']);
-
- // Fetch the reputation for this user
- if($user_permissions['usereputationsystem'] == 1 && $mybb->settings['enablereputation'] == 1)
- {
- $reputation = get_reputation($user['reputation']);
- }
- else
- {
- $reputation = "-";
- }
-
- if($mybb->settings['enablewarningsystem'] != 0 && $user_permissions['canreceivewarnings'] != 0)
- {
- if($mybb->settings['maxwarningpoints'] < 1)
- {
- $mybb->settings['maxwarningpoints'] = 10;
- }
-
- $warning_level = round($user['warningpoints']/$mybb->settings['maxwarningpoints']*100);
- if($warning_level > 100)
- {
- $warning_level = 100;
- }
- $warning_level = get_colored_warning_level($warning_level);
- }
-
- $age = $lang->na;
- if($user['birthday'])
- {
- $age = get_age($user['birthday']);
- }
-
- $postnum = my_number_format($user['postnum']);
-
- $table->construct_cell("
."\")
", array('rowspan' => 6, 'width' => 1));
- $table->construct_cell("
{$lang->email_address}: ".htmlspecialchars_uni($user['email'])."");
- $table->construct_cell("
{$lang->last_active}: {$last_active}");
- $table->construct_row();
- $table->construct_cell("
{$lang->registration_date}: {$reg_date}");
- $table->construct_cell("
{$lang->local_time}: {$localtime}");
- $table->construct_row();
- $table->construct_cell("
{$lang->posts}: {$postnum}");
- $table->construct_cell("
{$lang->age}: {$age}");
- $table->construct_row();
- $table->construct_cell("
{$lang->posts_per_day}: {$posts_per_day}");
- $table->construct_cell("
{$lang->reputation}: {$reputation}");
- $table->construct_row();
- $table->construct_cell("
{$lang->percent_of_total_posts}: {$percent_posts}");
- $table->construct_cell("
{$lang->warning_level}: {$warning_level}");
- $table->construct_row();
- $table->construct_cell("
{$lang->registration_ip}: ".my_inet_ntop($db->unescape_binary($user['regip'])));
- $table->construct_cell("
{$lang->last_known_ip}: ".my_inet_ntop($db->unescape_binary($user['lastip'])));
- $table->construct_row();
-
- $username = htmlspecialchars_uni($user['username']);
- $table->output("{$lang->user_overview}: {$username}");
- $plugins->run_hooks("admin_user_users_edit_overview");
- echo "
\n";
-
- //
- // PROFILE
- //
- echo "\n";
-
- $form_container = new FormContainer($lang->required_profile_info.": ".htmlspecialchars_uni($user['username']));
- $form_container->output_row($lang->username." *", "", $form->generate_text_box('username', $mybb->input['username'], array('id' => 'username')), 'username');
- $form_container->output_row($lang->new_password, $lang->new_password_desc, $form->generate_password_box('new_password', $mybb->input['new_password'], array('id' => 'new_password', 'autocomplete' => 'off')), 'new_password');
- $form_container->output_row($lang->confirm_new_password, $lang->new_password_desc, $form->generate_password_box('confirm_new_password', $mybb->input['confirm_new_password'], array('id' => 'confirm_new_password')), 'confirm_new_password');
- $form_container->output_row($lang->email_address." *", "", $form->generate_text_box('email', $mybb->input['email'], array('id' => 'email')), 'email');
-
- $display_group_options[0] = $lang->use_primary_user_group;
- $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']);
- $display_group_options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);
- }
-
- if(!is_array($mybb->input['additionalgroups']))
- {
- $mybb->input['additionalgroups'] = explode(',', $mybb->input['additionalgroups']);
- }
-
- $form_container->output_row($lang->primary_user_group." *", "", $form->generate_select_box('usergroup', $options, $mybb->input['usergroup'], array('id' => 'usergroup')), 'usergroup');
- $form_container->output_row($lang->additional_user_groups, $lang->additional_user_groups_desc, $form->generate_select_box('additionalgroups[]', $options, $mybb->input['additionalgroups'], array('id' => 'additionalgroups', 'multiple' => true, 'size' => 5)), 'additionalgroups');
- $form_container->output_row($lang->display_user_group." *", "", $form->generate_select_box('displaygroup', $display_group_options, $mybb->input['displaygroup'], array('id' => 'displaygroup')), 'displaygroup');
- $form_container->output_row($lang->post_count." *", "", $form->generate_numeric_field('postnum', $mybb->input['postnum'], array('id' => 'postnum', 'min' => 0)), 'postnum');
- $form_container->output_row($lang->thread_count." *", "", $form->generate_numeric_field('threadnum', $mybb->input['threadnum'], array('id' => 'threadnum', 'min' => 0)), 'threadnum');
-
- // Output custom profile fields - required
- if(!isset($profile_fields['required']))
- {
- $profile_fields['required'] = array();
- }
- output_custom_profile_fields($profile_fields['required'], $mybb->input['profile_fields'], $form_container, $form);
-
- $form_container->end();
-
- $form_container = new FormContainer($lang->optional_profile_info.': '.htmlspecialchars_uni($user['username']));
- $form_container->output_row($lang->custom_user_title, $lang->custom_user_title_desc, $form->generate_text_box('usertitle', $mybb->input['usertitle'], array('id' => 'usertitle')), 'usertitle');
- $form_container->output_row($lang->website, "", $form->generate_text_box('website', $mybb->input['website'], array('id' => 'website')), 'website');
- $form_container->output_row($lang->icq_number, "", $form->generate_numeric_field('icq', $mybb->input['icq'], array('id' => 'icq', 'min' => 0)), 'icq');
- $form_container->output_row($lang->aim_handle, "", $form->generate_text_box('aim', $mybb->input['aim'], array('id' => 'aim')), 'aim');
- $form_container->output_row($lang->yahoo_messanger_handle, "", $form->generate_text_box('yahoo', $mybb->input['yahoo'], array('id' => 'yahoo')), 'yahoo');
- $form_container->output_row($lang->skype_handle, "", $form->generate_text_box('skype', $mybb->input['skype'], array('id' => 'skype')), 'skype');
- $form_container->output_row($lang->google_handle, "", $form->generate_text_box('google', $mybb->input['google'], array('id' => 'google')), 'google');
-
- // Birthday
- $birthday_days = array(0 => '');
- for($i = 1; $i <= 31; $i++)
- {
- $birthday_days[$i] = $i;
- }
-
- $birthday_months = array(
- 0 => '',
- 1 => $lang->january,
- 2 => $lang->february,
- 3 => $lang->march,
- 4 => $lang->april,
- 5 => $lang->may,
- 6 => $lang->june,
- 7 => $lang->july,
- 8 => $lang->august,
- 9 => $lang->september,
- 10 => $lang->october,
- 11 => $lang->november,
- 12 => $lang->december
- );
-
- $birthday_row = $form->generate_select_box('bday1', $birthday_days, $mybb->input['bday'][0], array('id' => 'bday_day'));
- $birthday_row .= ' '.$form->generate_select_box('bday2', $birthday_months, $mybb->input['bday'][1], array('id' => 'bday_month'));
- $birthday_row .= ' '.$form->generate_numeric_field('bday3', $mybb->input['bday'][2], array('id' => 'bday_year', 'style' => 'width: 4em;', 'min' => 0));
-
- $form_container->output_row($lang->birthday, "", $birthday_row, 'birthday');
-
- // Output custom profile fields - optional
- output_custom_profile_fields($profile_fields['optional'], $mybb->input['profile_fields'], $form_container, $form);
-
- $form_container->end();
-
-
- if($mybb->settings['allowaway'] != 0)
- {
- $form_container = new FormContainer($lang->away_information.': '.htmlspecialchars_uni($user['username']));
- $awaycheck = array(false, true);
- if($mybb->input['away'] == 1)
- {
- $awaycheck = array(true, false);
- }
- $form_container->output_row($lang->away_status, $lang->away_status_desc, $form->generate_radio_button('away', 1, $lang->im_away, array('id' => 'away', "checked" => $awaycheck[0]))." ".$form->generate_radio_button('away', 0, $lang->im_here, array('id' => 'away2', "checked" => $awaycheck[1])), 'away');
- $form_container->output_row($lang->away_reason, $lang->away_reason_desc, $form->generate_text_box('awayreason', $mybb->input['awayreason'], array('id' => 'awayreason')), 'awayreason');
-
- //Return date (we can use the arrays from birthday)
- $return_row = $form->generate_select_box('away_day', $birthday_days, $mybb->input['away_day'], array('id' => 'away_day'));
- $return_row .= ' '.$form->generate_select_box('away_month', $birthday_months, $mybb->input['away_month'], array('id' => 'away_month'));
- $return_row .= ' '.$form->generate_numeric_field('away_year', $mybb->input['away_year'], array('id' => 'away_year', 'style' => 'width: 4em;', 'min' => 0));
-
- $form_container->output_row($lang->return_date, $lang->return_date_desc, $return_row, 'away_date');
-
- $form_container->end();
- }
-
- $plugins->run_hooks("admin_user_users_edit_profile");
- echo "
\n";
-
- //
- // ACCOUNT SETTINGS
- //
-
- // Plugin hook note - we should add hooks in above each output_row for the below so users can add their own options to each group :>
-
- echo "\n";
- $form_container = new FormContainer($lang->account_settings.': '.htmlspecialchars_uni($user['username']));
- $login_options = array(
- $form->generate_check_box("invisible", 1, $lang->hide_from_whos_online, array("checked" => $mybb->input['invisible'])),
- );
- $form_container->output_row($lang->login_cookies_privacy, "", "
".implode("
", $login_options)."
");
-
- if($mybb->input['pmnotice'] > 1)
- {
- $mybb->input['pmnotice'] = 1;
- }
-
- $messaging_options = array(
- $form->generate_check_box("allownotices", 1, $lang->recieve_admin_emails, array("checked" => $mybb->input['allownotices'])),
- $form->generate_check_box("hideemail", 1, $lang->hide_email_from_others, array("checked" => $mybb->input['hideemail'])),
- $form->generate_check_box("receivepms", 1, $lang->recieve_pms_from_others, array("checked" => $mybb->input['receivepms'])),
- $form->generate_check_box("receivefrombuddy", 1, $lang->recieve_pms_from_buddy, array("checked" => $mybb->input['receivefrombuddy'])),
- $form->generate_check_box("pmnotice", 1, $lang->alert_new_pms, array("checked" => $mybb->input['pmnotice'])),
- $form->generate_check_box("pmnotify", 1, $lang->email_notify_new_pms, array("checked" => $mybb->input['pmnotify'])),
- $form->generate_check_box("buddyrequestspm", 1, $lang->buddy_requests_pm, array("checked" => $mybb->input['buddyrequestspm'])),
- $form->generate_check_box("buddyrequestsauto", 1, $lang->buddy_requests_auto, array("checked" => $mybb->input['buddyrequestsauto'])),
- "
".$form->generate_select_box("subscriptionmethod", array($lang->do_not_subscribe, $lang->no_email_notification, $lang->instant_email_notification), $mybb->input['subscriptionmethod'], array('id' => 'subscriptionmethod'))
- );
- $form_container->output_row($lang->messaging_and_notification, "", "
".implode("
", $messaging_options)."
");
-
- $date_format_options = array($lang->use_default);
- foreach($date_formats as $key => $format)
- {
- $date_format_options[$key] = my_date($format, TIME_NOW, "", 0);
- }
-
- $time_format_options = array($lang->use_default);
- foreach($time_formats as $key => $format)
- {
- $time_format_options[$key] = my_date($format, TIME_NOW, "", 0);
- }
-
- $date_options = array(
- "
".$form->generate_select_box("dateformat", $date_format_options, $mybb->input['dateformat'], array('id' => 'dateformat')),
- "
".$form->generate_select_box("timeformat", $time_format_options, $mybb->input['timeformat'], array('id' => 'timeformat')),
- "
".build_timezone_select("timezone", $mybb->input['timezone']),
- "
".$form->generate_select_box("dstcorrection", array(2 => $lang->automatically_detect, 1 => $lang->always_use_dst_correction, 0 => $lang->never_use_dst_correction), $mybb->input['dstcorrection'], array('id' => 'dstcorrection'))
- );
- $form_container->output_row($lang->date_and_time_options, "", "
".implode("
", $date_options)."
");
-
-
- $tpp_options = array($lang->use_default);
- if($mybb->settings['usertppoptions'])
- {
- $explodedtpp = explode(",", $mybb->settings['usertppoptions']);
- if(is_array($explodedtpp))
- {
- foreach($explodedtpp as $tpp)
- {
- if($tpp <= 0) continue;
- $tpp_options[$tpp] = $tpp;
- }
- }
- }
-
- $thread_age_options = array(
- 0 => $lang->use_default,
- 1 => $lang->show_threads_last_day,
- 5 => $lang->show_threads_last_5_days,
- 10 => $lang->show_threads_last_10_days,
- 20 => $lang->show_threads_last_20_days,
- 50 => $lang->show_threads_last_50_days,
- 75 => $lang->show_threads_last_75_days,
- 100 => $lang->show_threads_last_100_days,
- 365 => $lang->show_threads_last_year,
- 9999 => $lang->show_all_threads
- );
-
- $forum_options = array(
- "
".$form->generate_select_box("tpp", $tpp_options, $mybb->input['tpp'], array('id' => 'tpp')),
- "
".$form->generate_select_box("daysprune", $thread_age_options, $mybb->input['daysprune'], array('id' => 'daysprune'))
- );
- $form_container->output_row($lang->forum_display_options, "", "
".implode("
", $forum_options)."
");
-
- $ppp_options = array($lang->use_default);
- if($mybb->settings['userpppoptions'])
- {
- $explodedppp = explode(",", $mybb->settings['userpppoptions']);
- if(is_array($explodedppp))
- {
- foreach($explodedppp as $ppp)
- {
- if($ppp <= 0) continue;
- $ppp_options[$ppp] = $ppp;
- }
- }
- }
-
- $thread_options = array(
- $form->generate_check_box("classicpostbit", 1, $lang->show_classic_postbit, array("checked" => $mybb->input['classicpostbit'])),
- $form->generate_check_box("showimages", 1, $lang->display_images, array("checked" => $mybb->input['showimages'])),
- $form->generate_check_box("showvideos", 1, $lang->display_videos, array("checked" => $mybb->input['showvideos'])),
- $form->generate_check_box("showsigs", 1, $lang->display_users_sigs, array("checked" => $mybb->input['showsigs'])),
- $form->generate_check_box("showavatars", 1, $lang->display_users_avatars, array("checked" => $mybb->input['showavatars'])),
- $form->generate_check_box("showquickreply", 1, $lang->show_quick_reply, array("checked" => $mybb->input['showquickreply'])),
- "
".$form->generate_select_box("ppp", $ppp_options, $mybb->input['ppp'], array('id' => 'ppp')),
- "
".$form->generate_select_box("threadmode", array("" => $lang->use_default, "linear" => $lang->linear_mode, "threaded" => $lang->threaded_mode), $mybb->input['threadmode'], array('id' => 'threadmode'))
- );
- $form_container->output_row($lang->thread_view_options, "", "
".implode("
", $thread_options)."
");
-
- $languages = array_merge(array('' => $lang->use_default), $lang->get_languages());
-
- $other_options = array(
- $form->generate_check_box("showredirect", 1, $lang->show_redirect, array("checked" => $mybb->input['showredirect'])),
- $form->generate_check_box("showcodebuttons", "1", $lang->show_code_buttons, array("checked" => $mybb->input['showcodebuttons'])),
- $form->generate_check_box("sourceeditor", "1", $lang->source_editor, array("checked" => $mybb->input['sourceeditor'])),
- "
".build_theme_select("style", $mybb->input['style'], 0, "", true, false, true),
- "
".$form->generate_select_box("language", $languages, $mybb->input['language'], array('id' => 'language'))
- );
- $form_container->output_row($lang->other_options, "", "
".implode("
", $other_options)."
");
-
- $form_container->end();
- $plugins->run_hooks("admin_user_users_edit_settings");
- echo "
\n";
-
- //
- // SIGNATURE EDITOR
- //
- $signature_editor = $form->generate_text_area("signature", $mybb->input['signature'], array('id' => 'signature', 'rows' => 15, 'cols' => '70', 'style' => 'height: 250px; width: 95%'));
- $sig_smilies = $lang->off;
- if($mybb->settings['sigsmilies'] == 1)
- {
- $sig_smilies = $lang->on;
- }
- $sig_mycode = $lang->off;
- if($mybb->settings['sigmycode'] == 1)
- {
- $sig_mycode = $lang->on;
- $signature_editor .= build_mycode_inserter("signature");
- }
- $sig_html = $lang->off;
- if($mybb->settings['sightml'] == 1)
- {
- $sig_html = $lang->on;
- }
- $sig_imgcode = $lang->off;
- if($mybb->settings['sigimgcode'] == 1)
- {
- $sig_imgcode = $lang->on;
- }
- echo "\n";
- $form_container = new FormContainer($lang->signature.': '.htmlspecialchars_uni($user['username']));
- $form_container->output_row($lang->signature, $lang->sprintf($lang->signature_desc, $sig_mycode, $sig_smilies, $sig_imgcode, $sig_html), $signature_editor, 'signature');
-
- $periods = array(
- "hours" => $lang->expire_hours,
- "days" => $lang->expire_days,
- "weeks" => $lang->expire_weeks,
- "months" => $lang->expire_months,
- "never" => $lang->expire_permanent
- );
-
- // Are we already suspending the signature?
- if($mybb->input['suspendsignature'])
- {
- $sig_checked = 1;
-
- // Display how much time is left on the ban for the user to extend it
- if($user['suspendsigtime'] == "0")
- {
- // Permanent
- $lang->suspend_expire_info = $lang->suspend_sig_perm;
- }
- else
- {
- // There's a limit to the suspension!
- $remaining = $user['suspendsigtime']-TIME_NOW;
- $expired = nice_time($remaining, array('seconds' => false));
-
- $color = 'inherit';
- if($remaining < 3600)
- {
- $color = 'red';
- }
- elseif($remaining < 86400)
- {
- $color = 'maroon';
- }
- elseif($remaining < 604800)
- {
- $color = 'green';
- }
-
- $lang->suspend_expire_info = $lang->sprintf($lang->suspend_expire_info, $expired, $color);
- }
- $user_suspend_info = '
-
- '.$lang->suspend_expire_info.' '.$lang->suspend_sig_extend.' |
-
';
- }
- else
- {
- $sig_checked = 0;
- $user_suspend_info = '';
- }
-
- $actions = '
-
-
-
- - '.$form->generate_check_box("suspendsignature", 1, $lang->suspend_sig_box, array('checked' => $sig_checked, 'onclick' => 'toggleAction();')).'
- -
-
'.$user_suspend_info.'
-
- | '.$lang->expire_length.' |
- '.$form->generate_numeric_field('action_time', $mybb->input['action_time'], array('style' => 'width: 3em;', 'min' => 0)).' '.$form->generate_select_box('action_period', $periods, $mybb->input['action_period']).' |
-
-
-
-
-
- ';
-
- $form_container->output_row($lang->suspend_sig, $lang->suspend_sig_info, $actions);
-
- $signature_options = array(
- $form->generate_radio_button("update_posts", "enable", $lang->enable_sig_in_all_posts, array("checked" => 0)),
- $form->generate_radio_button("update_posts", "disable", $lang->disable_sig_in_all_posts, array("checked" => 0)),
- $form->generate_radio_button("update_posts", "no", $lang->do_nothing, array("checked" => 1))
- );
-
- $form_container->output_row($lang->signature_preferences, "", implode("
", $signature_options));
-
- $form_container->end();
- $plugins->run_hooks("admin_user_users_edit_signatur");
- echo "
\n";
-
- //
- // AVATAR MANAGER
- //
- echo "\n";
- $table = new Table;
- $table->construct_header($lang->current_avatar, array('colspan' => 2));
-
- $table->construct_cell("
", array('width' => 1));
-
- $avatar_url = '';
- if($user['avatartype'] == "upload" || stristr($user['avatar'], $mybb->settings['avataruploadpath']))
- {
- $current_avatar_msg = "
{$lang->user_current_using_uploaded_avatar}";
- }
- elseif($user['avatartype'] == "remote" || my_validate_url($user['avatar']))
- {
- $current_avatar_msg = "
{$lang->user_current_using_remote_avatar}";
- $avatar_url = $user['avatar'];
- }
-
- if($errors)
- {
- $avatar_url = htmlspecialchars_uni($mybb->input['avatar_url']);
- }
-
- if($mybb->settings['maxavatardims'] != "")
- {
- list($max_width, $max_height) = explode("x", my_strtolower($mybb->settings['maxavatardims']));
- $max_size = "
{$lang->max_dimensions_are} {$max_width}x{$max_height}";
- }
-
- if($mybb->settings['avatarsize'])
- {
- $maximum_size = get_friendly_size($mybb->settings['avatarsize']*1024);
- $max_size .= "
{$lang->avatar_max_size} {$maximum_size}";
- }
-
- if($user['avatar'])
- {
- $remove_avatar = "
".$form->generate_check_box("remove_avatar", 1, "
{$lang->remove_avatar}");
- }
-
- $table->construct_cell($lang->avatar_desc."{$remove_avatar}
{$max_size}");
- $table->construct_row();
-
- $table->output($lang->avatar.': '.htmlspecialchars_uni($user['username']));
-
- // Custom avatar
- if($mybb->settings['avatarresizing'] == "auto")
- {
- $auto_resize = $lang->avatar_auto_resize;
- }
- else if($mybb->settings['avatarresizing'] == "user")
- {
- $auto_resize = "
";
- }
- $form_container = new FormContainer($lang->specify_custom_avatar);
- $form_container->output_row($lang->upload_avatar, $auto_resize, $form->generate_file_upload_box('avatar_upload', array('id' => 'avatar_upload')), 'avatar_upload');
- if($mybb->settings['allowremoteavatars'])
- {
- $form_container->output_row($lang->or_specify_avatar_url, "", $form->generate_text_box('avatar_url', $avatar_url, array('id' => 'avatar_url')), 'avatar_url');
- }
- $form_container->end();
- $plugins->run_hooks("admin_user_users_edit_avatar");
- echo "
\n";
-
- //
- // MODERATOR OPTIONS
- //
- $periods = array(
- "hours" => $lang->expire_hours,
- "days" => $lang->expire_days,
- "weeks" => $lang->expire_weeks,
- "months" => $lang->expire_months,
- "never" => $lang->expire_permanent
- );
-
- echo "\n";
- $form_container = new FormContainer($lang->mod_options.': '.htmlspecialchars_uni($user['username']));
- $form_container->output_row($lang->user_notes, '', $form->generate_text_area('usernotes', $mybb->input['usernotes'], array('id' => 'usernotes')), 'usernotes');
-
- // Mod posts
- // Generate check box
- $modpost_options = $form->generate_select_box('modpost_period', $periods, $mybb->input['modpost_period'], array('id' => 'modpost_period'));
-
- // Do we have any existing suspensions here?
- $existing_info = '';
- if($user['moderateposts'] || ($mybb->input['moderateposting'] && !empty($errors)))
- {
- $mybb->input['moderateposting'] = 1;
- if($user['moderationtime'] != 0)
- {
- $remaining = $user['moderationtime']-TIME_NOW;
- $expired = nice_time($remaining, array('seconds' => false));
-
- $color = 'inherit';
- if($remaining < 3600)
- {
- $color = 'red';
- }
- elseif($remaining < 86400)
- {
- $color = 'maroon';
- }
- elseif($remaining < 604800)
- {
- $color = 'green';
- }
-
- $existing_info = $lang->sprintf($lang->moderate_length, $expired, $color);
- }
- else
- {
- $existing_info = $lang->moderated_perm;
- }
- }
-
- $modpost_div = '
'.$existing_info.''.$lang->moderate_for.' '.$form->generate_numeric_field("modpost_time", $mybb->input['modpost_time'], array('style' => 'width: 3em;', 'min' => 0)).' '.$modpost_options.'
';
- $lang->moderate_posts_info = $lang->sprintf($lang->moderate_posts_info, htmlspecialchars_uni($user['username']));
- $form_container->output_row($form->generate_check_box("moderateposting", 1, $lang->moderate_posts, array("id" => "moderateposting", "onclick" => "toggleBox('modpost');", "checked" => $mybb->input['moderateposting'])), $lang->moderate_posts_info, $modpost_div);
-
- // Suspend posts
- // Generate check box
- $suspost_options = $form->generate_select_box('suspost_period', $periods, $mybb->input['suspost_period'], array('id' => 'suspost_period'));
-
- // Do we have any existing suspensions here?
- if($user['suspendposting'] || ($mybb->input['suspendposting'] && !empty($errors)))
- {
- $mybb->input['suspendposting'] = 1;
-
- if($user['suspensiontime'] == 0 || $mybb->input['suspost_period'] == "never")
- {
- $existing_info = $lang->suspended_perm;
- }
- else
- {
- $remaining = $user['suspensiontime']-TIME_NOW;
- $suspost_date = nice_time($remaining, array('seconds' => false));
-
- $color = 'inherit';
- if($remaining < 3600)
- {
- $color = 'red';
- }
- elseif($remaining < 86400)
- {
- $color = 'maroon';
- }
- elseif($remaining < 604800)
- {
- $color = 'green';
- }
-
- $existing_info = $lang->sprintf($lang->suspend_length, $suspost_date, $color);
- }
- }
-
- $suspost_div = '
'.$existing_info.''.$lang->suspend_for.' '.$form->generate_numeric_field("suspost_time", $mybb->input['suspost_time'], array('style' => 'width: 3em;', 'min' => 0)).' '.$suspost_options.'
';
- $lang->suspend_posts_info = $lang->sprintf($lang->suspend_posts_info, htmlspecialchars_uni($user['username']));
- $form_container->output_row($form->generate_check_box("suspendposting", 1, $lang->suspend_posts, array("id" => "suspendposting", "onclick" => "toggleBox('suspost');", "checked" => $mybb->input['suspendposting'])), $lang->suspend_posts_info, $suspost_div);
-
-
- $form_container->end();
- $plugins->run_hooks("admin_user_users_edit_moderator_options");
- echo "
\n";
-
- $plugins->run_hooks("admin_user_users_edit_graph");
-
- $buttons[] = $form->generate_submit_button($lang->save_user);
- $form->output_submit_wrapper($buttons);
-
- $form->end();
-
- echo '';
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "delete")
-{
- $user = get_user($mybb->input['uid']);
-
- // Does the user not exist?
- if(!$user['uid'])
- {
- flash_message($lang->error_invalid_user, 'error');
- admin_redirect("index.php?module=user-users");
- }
-
- if(is_super_admin($mybb->input['uid']) && $mybb->user['uid'] != $mybb->input['uid'] && !is_super_admin($mybb->user['uid']))
- {
- flash_message($lang->error_no_perms_super_admin, 'error');
- admin_redirect("index.php?module=user-users");
- }
-
- // User clicked no
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=user-users");
- }
-
- $plugins->run_hooks("admin_user_users_delete");
-
- if($mybb->request_method == "post")
- {
- $plugins->run_hooks("admin_user_users_delete_commit");
-
- // Set up user handler.
- require_once MYBB_ROOT.'inc/datahandlers/user.php';
- $userhandler = new UserDataHandler('delete');
-
- // Delete the user
- if(!$userhandler->delete_user($user['uid']))
- {
- flash_message($lang->error_cannot_delete_user, 'error');
- admin_redirect("index.php?module=user-users");
- }
-
- $cache->update_awaitingactivation();
-
- $plugins->run_hooks("admin_user_users_delete_commit_end");
-
- log_admin_action($user['uid'], htmlspecialchars_uni($user['username']));
-
- flash_message($lang->success_user_deleted, 'success');
- admin_redirect("index.php?module=user-users");
- }
- else
- {
- $page->output_confirm_action("index.php?module=user-users&action=delete&uid={$user['uid']}", $lang->user_deletion_confirmation);
- }
-}
-
-if($mybb->input['action'] == "referrers")
-{
- $page->add_breadcrumb_item($lang->show_referrers);
- $page->output_header($lang->show_referrers);
-
- $sub_tabs['referrers'] = array(
- 'title' => $lang->show_referrers,
- 'link' => "index.php?module=user-users&action=referrers&uid={$mybb->input['uid']}",
- 'description' => $lang->show_referrers_desc
- );
-
- $plugins->run_hooks("admin_user_users_referrers");
-
- $page->output_nav_tabs($sub_tabs, 'referrers');
-
- // Fetch default admin view
- $default_view = fetch_default_view("user");
- if(!$default_view)
- {
- $default_view = "0";
- }
- $query = $db->simple_select("adminviews", "*", "type='user' AND (vid='{$default_view}' OR uid=0)", array("order_by" => "uid", "order_dir" => "desc"));
- $admin_view = $db->fetch_array($query);
-
- if($mybb->input['type'])
- {
- $admin_view['view_type'] = $mybb->input['type'];
- }
-
- $admin_view['conditions'] = my_unserialize($admin_view['conditions']);
- $admin_view['conditions']['referrer'] = $mybb->input['uid'];
-
- $view = build_users_view($admin_view);
-
- // No referred users
- if(!$view)
- {
- $table = new Table;
- $table->construct_cell($lang->error_no_referred_users);
- $table->construct_row();
- $table->output($lang->show_referrers);
- }
- else
- {
- echo $view;
- }
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "ipaddresses")
-{
- $page->add_breadcrumb_item($lang->ip_addresses);
- $page->output_header($lang->ip_addresses);
-
- $sub_tabs['ipaddresses'] = array(
- 'title' => $lang->show_ip_addresses,
- 'link' => "index.php?module=user-users&action=ipaddresses&uid={$mybb->input['uid']}",
- 'description' => $lang->show_ip_addresses_desc
- );
-
- $plugins->run_hooks("admin_user_users_ipaddresses");
-
- $page->output_nav_tabs($sub_tabs, 'ipaddresses');
-
- $query = $db->simple_select("users", "uid, regip, username, lastip", "uid='{$mybb->input['uid']}'", array('limit' => 1));
- $user = $db->fetch_array($query);
-
- // Log admin action
- log_admin_action($user['uid'], htmlspecialchars_uni($user['username']));
-
- $table = new Table;
-
- $table->construct_header($lang->ip_address);
- $table->construct_header($lang->controls, array('width' => 200, 'class' => "align_center"));
-
- if(empty($user['lastip']))
- {
- $user['lastip'] = $lang->unknown;
- $controls = '';
- }
- else
- {
- $user['lastip'] = my_inet_ntop($db->unescape_binary($user['lastip']));
- $popup = new PopupMenu("user_last", $lang->options);
- $popup->add_item($lang->show_users_regged_with_ip,
- "index.php?module=user-users&action=search&results=1&conditions=".urlencode(my_serialize(array("regip" => $user['lastip']))));
- $popup->add_item($lang->show_users_posted_with_ip, "index.php?module=user-users&results=1&action=search&conditions=".urlencode(my_serialize(array("postip" => $user['lastip']))));
- $popup->add_item($lang->info_on_ip, "index.php?module=user-users&action=iplookup&ipaddress={$user['lastip']}", "MyBB.popupWindow('index.php?module=user-users&action=iplookup&ipaddress={$user['lastip']}', null, true); return false;");
- $popup->add_item($lang->ban_ip, "index.php?module=config-banning&filter={$user['lastip']}");
- $controls = $popup->fetch();
- }
- $table->construct_cell("{$lang->last_known_ip}: ".$user['lastip']);
- $table->construct_cell($controls, array('class' => "align_center"));
- $table->construct_row();
-
- if(empty($user['regip']))
- {
- $user['regip'] = $lang->unknown;
- $controls = '';
- }
- else
- {
- $user['regip'] = my_inet_ntop($db->unescape_binary($user['regip']));
- $popup = new PopupMenu("user_reg", $lang->options);
- $popup->add_item($lang->show_users_regged_with_ip, "index.php?module=user-users&results=1&action=search&conditions=".urlencode(my_serialize(array("regip" => $user['regip']))));
- $popup->add_item($lang->show_users_posted_with_ip, "index.php?module=user-users&results=1&action=search&conditions=".urlencode(my_serialize(array("postip" => $user['regip']))));
- $popup->add_item($lang->info_on_ip, "index.php?module=user-users&action=iplookup&ipaddress={$user['regip']}", "MyBB.popupWindow('index.php?module=user-users&action=iplookup&ipaddress={$user['regip']}', null, true); return false;");
- $popup->add_item($lang->ban_ip, "index.php?module=config-banning&filter={$user['regip']}");
- $controls = $popup->fetch();
- }
- $table->construct_cell("{$lang->registration_ip}: ".$user['regip']);
- $table->construct_cell($controls, array('class' => "align_center"));
- $table->construct_row();
-
- $counter = 0;
-
- $query = $db->simple_select("posts", "DISTINCT ipaddress", "uid='{$mybb->input['uid']}'");
- while($ip = $db->fetch_array($query))
- {
- ++$counter;
- $ip['ipaddress'] = my_inet_ntop($db->unescape_binary($ip['ipaddress']));
- $popup = new PopupMenu("id_{$counter}", $lang->options);
- $popup->add_item($lang->show_users_regged_with_ip, "index.php?module=user-users&results=1&action=search&conditions=".urlencode(my_serialize(array("regip" => $ip['ipaddress']))));
- $popup->add_item($lang->show_users_posted_with_ip, "index.php?module=user-users&results=1&action=search&conditions=".urlencode(my_serialize(array("postip" => $ip['ipaddress']))));
- $popup->add_item($lang->info_on_ip, "index.php?module=user-users&action=iplookup&ipaddress={$ip['ipaddress']}", "MyBB.popupWindow('index.php?module=user-users&action=iplookup&ipaddress={$ip['ipaddress']}', null, true); return false;");
- $popup->add_item($lang->ban_ip, "index.php?module=config-banning&filter={$ip['ipaddress']}");
- $controls = $popup->fetch();
-
- $table->construct_cell($ip['ipaddress']);
- $table->construct_cell($controls, array('class' => "align_center"));
- $table->construct_row();
- }
-
- $table->output($lang->ip_address_for.' '.htmlspecialchars_uni($user['username']));
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "merge")
-{
- $plugins->run_hooks("admin_user_users_merge");
-
- if($mybb->request_method == "post")
- {
- $source_user = get_user_by_username($mybb->input['source_username'], array('fields' => '*'));
- if(!$source_user['uid'])
- {
- $errors[] = $lang->error_invalid_user_source;
- }
-
- $destination_user = get_user_by_username($mybb->input['destination_username'], array('fields' => '*'));
- if(!$destination_user['uid'])
- {
- $errors[] = $lang->error_invalid_user_destination;
- }
-
- // If we're not a super admin and we're merging a source super admin or a destination super admin then dissallow this action
- if(!is_super_admin($mybb->user['uid']) && (is_super_admin($source_user['uid']) || is_super_admin($destination_user['uid'])))
- {
- flash_message($lang->error_no_perms_super_admin, 'error');
- admin_redirect("index.php?module=user-users");
- }
-
- if($source_user['uid'] == $destination_user['uid'])
- {
- $errors[] = $lang->error_cannot_merge_same_account;
- }
-
- if(empty($errors))
- {
- // Begin to merge the accounts
- $uid_update = array(
- "uid" => $destination_user['uid']
- );
- $query = $db->simple_select("adminoptions", "uid", "uid='{$destination_user['uid']}'");
- $existing_admin_options = $db->fetch_field($query, "uid");
-
- // Only carry over admin options/permissions if we don't already have them
- if(!$existing_admin_options)
- {
- $db->update_query("adminoptions", $uid_update, "uid='{$source_user['uid']}'");
- }
-
- $db->update_query("adminlog", $uid_update, "uid='{$source_user['uid']}'");
- $db->update_query("announcements", $uid_update, "uid='{$source_user['uid']}'");
- $db->update_query("events", $uid_update, "uid='{$source_user['uid']}'");
- $db->update_query("threadsubscriptions", $uid_update, "uid='{$source_user['uid']}'");
- $db->update_query("forumsubscriptions", $uid_update, "uid='{$source_user['uid']}'");
- $db->update_query("joinrequests", $uid_update, "uid='{$source_user['uid']}'");
- $db->update_query("moderatorlog", $uid_update, "uid='{$source_user['uid']}'");
- $db->update_query("pollvotes", $uid_update, "uid='{$source_user['uid']}'");
- $db->update_query("posts", $uid_update, "uid='{$source_user['uid']}'");
- $db->update_query("privatemessages", $uid_update, "uid='{$source_user['uid']}'");
- $db->update_query("reportedcontent", $uid_update, "uid='{$source_user['uid']}'");
- $db->update_query("threads", $uid_update, "uid='{$source_user['uid']}'");
- $db->update_query("warnings", $uid_update, "uid='{$source_user['uid']}'");
- $db->update_query("warnings", array("revokedby" => $destination_user['uid']), "revokedby='{$source_user['uid']}'");
- $db->update_query("warnings", array("issuedby" => $destination_user['uid']), "issuedby='{$source_user['uid']}'");
-
- // Thread ratings
- merge_thread_ratings($source_user['uid'], $destination_user['uid']);
-
- // Banning
- $db->update_query("banned", array('admin' => $destination_user['uid']), "admin = '{$source_user['uid']}'");
-
- // Merging Reputation
- // First, let's change all the details over to our new user...
- $db->update_query("reputation", array("adduid" => $destination_user['uid']), "adduid = '".$source_user['uid']."'");
- $db->update_query("reputation", array("uid" => $destination_user['uid']), "uid = '".$source_user['uid']."'");
-
- // Now that all the repuation is merged, figure out what to do with this user's comments...
- $options = array(
- "order_by" => "uid",
- "order_dir" => "ASC"
- );
-
- $to_remove = array();
- $query = $db->simple_select("reputation", "*", "adduid = '".$destination_user['uid']."'");
- while($rep = $db->fetch_array($query))
- {
- if($rep['pid'] == 0 && $mybb->settings['multirep'] == 0 && $last_result['uid'] == $rep['uid'])
- {
- // Multiple reputation is disallowed, and this isn't a post, so let's remove this comment
- $to_remove[] = $rep['rid'];
- }
-
- // Remove comments or posts liked by "me"
- if($last_result['uid'] == $destination_user['uid'] || $rep['uid'] == $destination_user['uid'])
- {
- if(!in_array($rep['rid'], $to_remove))
- {
- $to_remove[] = $rep['rid'];
- continue;
- }
- }
-
- $last_result = array(
- "rid" => $rep['rid'],
- "uid" => $rep['uid']
- );
- }
-
- // Remove any reputations we've selected to remove...
- if(!empty($to_remove))
- {
- $imp = implode(",", $to_remove);
- $db->delete_query("reputation", "rid IN (".$imp.")");
- }
-
- // Calculate the new reputation for this user...
- $query = $db->simple_select("reputation", "SUM(reputation) as total_rep", "uid='{$destination_user['uid']}'");
- $total_reputation = $db->fetch_field($query, "total_rep");
-
- $db->update_query("users", array('reputation' => (int)$total_reputation), "uid='{$destination_user['uid']}'");
-
- // Calculate warning points
- $query = $db->query("
- SELECT SUM(points) as warn_lev
- FROM ".TABLE_PREFIX."warnings
- WHERE uid='{$source_user['uid']}' AND expired='0'
- ");
- $original_warn_level = $db->fetch_field($query, "warn_lev");
-
- $query = $db->query("
- SELECT SUM(points) as warn_lev
- FROM ".TABLE_PREFIX."warnings
- WHERE uid='{$destination_user['uid']}' AND expired='0'
- ");
- $new_warn_level = $db->fetch_field($query, "warn_lev");
- $db->update_query("users", array("warningpoints" => (int)$original_warn_level + $new_warn_level), "uid='{$destination_user['uid']}'");
-
- // Additional updates for non-uid fields
- $last_poster = array(
- "lastposteruid" => $destination_user['uid'],
- "lastposter" => $db->escape_string($destination_user['username'])
- );
- $db->update_query("forums", $last_poster, "lastposteruid='{$source_user['uid']}'");
- $db->update_query("threads", $last_poster, "lastposteruid='{$source_user['uid']}'");
- $edit_uid = array(
- "edituid" => $destination_user['uid']
- );
- $db->update_query("posts", $edit_uid, "edituid='{$source_user['uid']}'");
-
- $from_uid = array(
- "fromid" => $destination_user['uid']
- );
- $db->update_query("privatemessages", $from_uid, "fromid='{$source_user['uid']}'");
- $to_uid = array(
- "toid" => $destination_user['uid']
- );
- $db->update_query("privatemessages", $to_uid, "toid='{$source_user['uid']}'");
-
- // Buddy/ignore lists
- $destination_buddies = explode(',', $destination_user['buddylist']);
- $source_buddies = explode(',', $source_user['buddylist']);
- $buddies = array_unique(array_merge($source_buddies, $destination_buddies));
- // Make sure the new buddy list doesn't contain either users
- $buddies_array = array_diff($buddies, array($destination_user['uid'], $source_user['uid']));
-
- $destination_ignored = explode(',', $destination_user['ignorelist']);
- $source_ignored = explode(',', $destination_user['ignorelist']);
- $ignored = array_unique(array_merge($source_ignored, $destination_ignored));
- // ... and the same for the new ignore list
- $ignored_array = array_diff($ignored, array($destination_user['uid'], $source_user['uid']));
-
- // Remove any ignored users from the buddy list
- $buddies = array_diff($buddies_array, $ignored_array);
- // implode the arrays so we get a nice neat list for each
- $buddies = trim(implode(',', $buddies), ',');
- $ignored = trim(implode(',', $ignored_array), ',');
-
- $lists = array(
- "buddylist" => $buddies,
- "ignorelist" => $ignored
- );
- $db->update_query("users", $lists, "uid='{$destination_user['uid']}'");
-
- // Get a list of forums where post count doesn't apply
- $fids = array();
- $query = $db->simple_select("forums", "fid", "usepostcounts=0");
- while($fid = $db->fetch_field($query, "fid"))
- {
- $fids[] = $fid;
- }
-
- $fids_not_in = '';
- if(!empty($fids))
- {
- $fids_not_in = "AND fid NOT IN(".implode(',', $fids).")";
- }
-
- // Update user post count
- $query = $db->simple_select("posts", "COUNT(*) AS postnum", "uid='".$destination_user['uid']."' {$fids_not_in}");
- $num = $db->fetch_array($query);
- $updated_count = array(
- "postnum" => $num['postnum']
- );
- $db->update_query("users", $updated_count, "uid='{$destination_user['uid']}'");
-
- // Update user thread count
- $query = $db->simple_select("threads", "COUNT(*) AS threadnum", "uid='".$destination_user['uid']."' {$fids_not_in}");
- $num = $db->fetch_array($query);
- $updated_count = array(
- "threadnum" => $num['threadnum']
- );
- $db->update_query("users", $updated_count, "uid='{$destination_user['uid']}'");
-
- // Use the earliest registration date
- if($destination_user['regdate'] > $source_user['regdate'])
- {
- $db->update_query("users", array('regdate' => $source_user['regdate']), "uid='{$destination_user['uid']}'");
- }
-
- $plugins->run_hooks("admin_user_users_merge_commit");
-
- // Set up user handler.
- require_once MYBB_ROOT.'inc/datahandlers/user.php';
- $userhandler = new UserDataHandler('delete');
-
- // Delete the old user
- $userhandler->delete_user($source_user['uid']);
-
- $cache->update_awaitingactivation();
-
- // Log admin action
- log_admin_action($source_user['uid'], htmlspecialchars_uni($source_user['username']), $destination_user['uid'], htmlspecialchars_uni($destination_user['username']));
-
- // Redirect!
- $username = htmlspecialchars_uni($source_user['username']);
- $destination_username = htmlspecialchars_uni($destination_user['username']);
- flash_message("{$username} {$lang->success_merged} {$destination_username}", "success");
- admin_redirect("index.php?module=user-users");
- exit;
- }
- }
-
- $page->add_breadcrumb_item($lang->merge_users);
- $page->output_header($lang->merge_users);
-
- $page->output_nav_tabs($sub_tabs, 'merge_users');
-
- // If we have any error messages, show them
- if($errors)
- {
- $page->output_inline_error($errors);
- }
-
- $form = new Form("index.php?module=user-users&action=merge", "post");
-
- $form_container = new FormContainer($lang->merge_users);
- $form_container->output_row($lang->source_account." *", $lang->source_account_desc, $form->generate_text_box('source_username', $mybb->input['source_username'], array('id' => 'source_username')), 'source_username');
- $form_container->output_row($lang->destination_account." *", $lang->destination_account_desc, $form->generate_text_box('destination_username', $mybb->input['destination_username'], array('id' => 'destination_username')), 'destination_username');
- $form_container->end();
-
- // Autocompletion for usernames
- echo '
-
-
- ';
-
- $buttons[] = $form->generate_submit_button($lang->merge_user_accounts);
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "search")
-{
- $plugins->run_hooks("admin_user_users_search");
-
- if($mybb->request_method == "post" || $mybb->input['results'] == 1)
- {
- // Build view options from incoming search options
- if($mybb->input['vid'])
- {
- $query = $db->simple_select("adminviews", "*", "vid='".$mybb->get_input('vid', MyBB::INPUT_INT)."'");
- $admin_view = $db->fetch_array($query);
- // View does not exist or this view is private and does not belong to the current user
- if(!$admin_view['vid'] || ($admin_view['visibility'] == 1 && $admin_view['uid'] != $mybb->user['uid']))
- {
- unset($admin_view);
- }
- }
-
- if($mybb->input['search_id'] && $admin_session['data']['user_views'][$mybb->input['search_id']])
- {
- $admin_view = $admin_session['data']['user_views'][$mybb->input['search_id']];
- unset($admin_view['extra_sql']);
- }
- else
- {
- // Don't have a view? Fetch the default
- if(!$admin_view['vid'])
- {
- $default_view = fetch_default_view("user");
- if(!$default_view)
- {
- $default_view = "0";
- }
- $query = $db->simple_select("adminviews", "*", "type='user' AND (vid='{$default_view}' OR uid=0)", array("order_by" => "uid", "order_dir" => "desc"));
- $admin_view = $db->fetch_array($query);
- }
- }
-
- // Override specific parts of the view
- unset($admin_view['vid']);
-
- if($mybb->input['type'])
- {
- $admin_view['view_type'] = $mybb->input['type'];
- }
-
- if($mybb->input['conditions'])
- {
- $admin_view['conditions'] = $mybb->input['conditions'];
- }
-
- if($mybb->input['sortby'])
- {
- $admin_view['sortby'] = $mybb->input['sortby'];
- }
-
- if($mybb->get_input('perpage', MyBB::INPUT_INT))
- {
- $admin_view['perpage'] = $mybb->input['perpage'];
- }
-
- if($mybb->input['order'])
- {
- $admin_view['sortorder'] = $mybb->input['order'];
- }
-
- if($mybb->input['displayas'])
- {
- $admin_view['view_type'] = $mybb->input['displayas'];
- }
-
- if($mybb->input['profile_fields'])
- {
- $admin_view['custom_profile_fields'] = $mybb->input['profile_fields'];
- }
-
- $plugins->run_hooks("admin_user_users_search_commit");
-
- $results = build_users_view($admin_view);
-
- if($results)
- {
- $page->output_header($lang->find_users);
- echo "";
- $page->output_nav_tabs($sub_tabs, 'find_users');
- echo $results;
- $page->output_footer();
- }
- else
- {
- if($mybb->input['from'] == "home")
- {
- flash_message($lang->error_no_users_found, 'error');
- admin_redirect("index.php");
- exit;
- }
- else
- {
- $errors[] = $lang->error_no_users_found;
- }
- }
- }
-
- $page->add_breadcrumb_item($lang->find_users);
- $page->output_header($lang->find_users);
-
- $page->output_nav_tabs($sub_tabs, 'find_users');
-
- // If we have any error messages, show them
- if($errors)
- {
- $page->output_inline_error($errors);
- }
-
- if(!$mybb->input['displayas'])
- {
- $mybb->input['displayas'] = "card";
- }
-
- $form = new Form("index.php?module=user-users&action=search", "post");
-
- user_search_conditions($mybb->input, $form);
-
- $form_container = new FormContainer($lang->display_options);
- $sort_directions = array(
- "asc" => $lang->ascending,
- "desc" => $lang->descending
- );
- $form_container->output_row($lang->sort_results_by, "", $form->generate_select_box('sortby', $sort_options, $mybb->input['sortby'], array('id' => 'sortby'))." {$lang->in} ".$form->generate_select_box('order', $sort_directions, $mybb->input['order'], array('id' => 'order')), 'sortby');
- $form_container->output_row($lang->results_per_page, "", $form->generate_numeric_field('perpage', $mybb->input['perpage'], array('id' => 'perpage', 'min' => 1)), 'perpage');
- $form_container->output_row($lang->display_results_as, "", $form->generate_radio_button('displayas', 'table', $lang->table, array('checked' => ($mybb->input['displayas'] != "card" ? true : false)))."
".$form->generate_radio_button('displayas', 'card', $lang->business_card, array('checked' => ($mybb->input['displayas'] == "card" ? true : false))));
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->find_users);
- $form->output_submit_wrapper($buttons);
- $form->end();
-
- $page->output_footer();
-}
-
-if($mybb->input['action'] == "inline_edit")
-{
- $plugins->run_hooks("admin_user_users_inline");
-
- if($mybb->input['vid'] || $mybb->cookies['acp_view'])
- {
- // We have a custom view
- if(!$mybb->cookies['acp_view'])
- {
- // Set a cookie
- my_setcookie("acp_view", $mybb->input['vid'], 60);
- }
- elseif($mybb->cookies['acp_view'])
- {
- // We already have a cookie, so let's use it...
- $mybb->input['vid'] = $mybb->cookies['acp_view'];
- }
-
- $vid_url = "&vid=".$mybb->input['vid'];
- }
-
- // First, collect the user IDs that we're performing the moderation on
- $ids = explode("|", $mybb->cookies['inlinemod_useracp']);
- foreach($ids as $id)
- {
- if($id != '')
- {
- $selected[] = (int)$id;
- }
- }
-
- // Verify incoming POST request
- if(!verify_post_check($mybb->input['my_post_key']))
- {
- flash_message($lang->invalid_post_verify_key2, 'error');
- admin_redirect("index.php?module=user-user");
- }
- $sub_tabs['manage_users'] = array(
- "title" => $lang->manage_users,
- "link" => "./",
- "description" => $lang->manage_users_desc
- );
- $page->add_breadcrumb_item($lang->manage_users);
-
- if(!is_array($selected))
- {
- // Not selected any users, show error
- flash_message($lang->error_inline_no_users_selected, 'error');
- admin_redirect("index.php?module=user-users".$vid_url);
- }
-
- switch($mybb->input['inline_action'])
- {
- case 'multiactivate':
- // Run through the activating users, so that users already registered (but have been selected) aren't affected
- if(is_array($selected))
- {
- $sql_array = implode(",", $selected);
- $query = $db->simple_select("users", "uid, username, email", "usergroup = '5' AND uid IN (".$sql_array.")");
- $user_mail_data = array();
- while($user = $db->fetch_array($query))
- {
- $to_update[] = $user['uid'];
- $user_mail_data[] = array('username' => $user['username'], 'email' => $user['email']);
- }
- }
-
- if(is_array($to_update))
- {
- $sql_array = implode(",", $to_update);
- $db->write_query("UPDATE ".TABLE_PREFIX."users SET usergroup = '2' WHERE uid IN (".$sql_array.")");
-
- $cache->update_awaitingactivation();
-
- // send activation mail
- foreach($user_mail_data as $mail_data)
- {
- $message = $lang->sprintf($lang->email_adminactivateaccount, $mail_data['username'], $mybb->settings['bbname'], $mybb->settings['bburl']);
- my_mail($mail_data['email'], $lang->sprintf($lang->emailsubject_activateaccount, $mybb->settings['bbname']), $message);
- }
-
- // Action complete, grab stats and show success message - redirect user
- $to_update_count = count($to_update);
- $lang->inline_activated = $lang->sprintf($lang->inline_activated, my_number_format($to_update_count));
-
- if($to_update_count != count($selected))
- {
- // The update count is different to how many we selected!
- $not_updated_count = count($selected) - $to_update_count;
- $lang->inline_activated_more = $lang->sprintf($lang->inline_activated_more, my_number_format($not_updated_count));
- $lang->inline_activated = $lang->inline_activated."
".$lang->inline_activated_more; // Add these stats to the message
- }
-
- $mybb->input['action'] = "inline_activated"; // Force a change to the action so we can add it to the adminlog
- log_admin_action($to_update_count); // Add to adminlog
- my_unsetcookie("inlinemod_useracp"); // Unset the cookie, so that the users aren't still selected when we're redirected
-
- flash_message($lang->inline_activated, 'success');
- admin_redirect("index.php?module=user-users".$vid_url);
- }
- else
- {
- // Nothing was updated, show an error
- flash_message($lang->inline_activated_failed, 'error');
- admin_redirect("index.php?module=user-users".$vid_url);
- }
- break;
- case 'multilift':
- // Get the users that are banned, and check that they have been selected
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=user-users".$vid_url); // User clicked on 'No'
- }
-
- if($mybb->request_method == "post")
- {
- $sql_array = implode(",", $selected);
- $query = $db->simple_select("banned", "*", "uid IN (".$sql_array.")");
- $to_be_unbanned = $db->num_rows($query);
- while($ban = $db->fetch_array($query))
- {
- $updated_group = array(
- "usergroup" => $ban['oldgroup'],
- "additionalgroups" => $ban['oldadditionalgroups'],
- "displaygroup" => $ban['olddisplaygroup']
- );
- $db->update_query("users", $updated_group, "uid = '".$ban['uid']."'");
- $db->delete_query("banned", "uid = '".$ban['uid']."'");
- }
-
- $cache->update_banned();
- $cache->update_moderators();
-
- $mybb->input['action'] = "inline_lift";
- log_admin_action($to_be_unbanned);
- my_unsetcookie("inlinemod_useracp");
-
- $lang->success_ban_lifted = $lang->sprintf($lang->success_ban_lifted, my_number_format($to_be_unbanned));
- flash_message($lang->success_ban_lifted, 'success');
- admin_redirect("index.php?module=user-users".$vid_url);
- }
- else
- {
- $page->output_confirm_action("index.php?module=user-users&action=inline_edit&inline_action=multilift", $lang->confirm_multilift);
- }
-
- break;
- case 'multiban':
- if($mybb->input['processed'] == 1)
- {
- // We've posted ban information!
- // Build an array of users to ban, =D
- $sql_array = implode(",", $selected);
- // Build a cache array for this users that have been banned already
- $query = $db->simple_select("banned", "uid", "uid IN (".$sql_array.")");
- while($user = $db->fetch_array($query))
- {
- $bannedcache[] = "u_".$user['uid'];
- }
-
- // Collect the users
- $query = $db->simple_select("users", "uid, username, usergroup, additionalgroups, displaygroup", "uid IN (".$sql_array.")");
-
- if($mybb->input['bantime'] == '---')
- {
- $lifted = 0;
- }
- else
- {
- $lifted = ban_date2timestamp($mybb->input['bantime']);
- }
-
- $reason = my_substr($mybb->input['reason'], 0, 255);
-
- $banned_count = 0;
- while($user = $db->fetch_array($query))
- {
- if($user['uid'] == $mybb->user['uid'] || is_super_admin($user['uid']))
- {
- // We remove ourselves and Super Admins from the mix
- continue;
- }
-
- if(is_array($bannedcache) && in_array("u_".$user['uid'], $bannedcache))
- {
- // User already has a ban, update it!
- $update_array = array(
- "admin" => (int)$mybb->user['uid'],
- "dateline" => TIME_NOW,
- "bantime" => $db->escape_string($mybb->input['bantime']),
- "lifted" => $db->escape_string($lifted),
- "reason" => $db->escape_string($reason)
- );
- $db->update_query("banned", $update_array, "uid = '".$user['uid']."'");
- }
- else
- {
- // Not currently banned - insert the ban
- $insert_array = array(
- 'uid' => $user['uid'],
- 'gid' => $mybb->get_input('usergroup', MyBB::INPUT_INT),
- 'oldgroup' => $user['usergroup'],
- 'oldadditionalgroups' => $user['additionalgroups'],
- 'olddisplaygroup' => $user['displaygroup'],
- 'admin' => (int)$mybb->user['uid'],
- 'dateline' => TIME_NOW,
- 'bantime' => $db->escape_string($mybb->input['bantime']),
- 'lifted' => $db->escape_string($lifted),
- 'reason' => $db->escape_string($reason)
- );
- $db->insert_query('banned', $insert_array);
- }
-
- // Moved the user to the 'Banned' Group
- $update_array = array(
- 'usergroup' => 7,
- 'displaygroup' => 0,
- 'additionalgroups' => '',
- );
- $db->update_query('users', $update_array, "uid = '{$user['uid']}'");
-
- $db->delete_query("forumsubscriptions", "uid = '{$user['uid']}'");
- $db->delete_query("threadsubscriptions", "uid = '{$user['uid']}'");
-
- $cache->update_banned();
- ++$banned_count;
- }
- $mybb->input['action'] = "inline_banned";
- log_admin_action($banned_count, $lifted);
- my_unsetcookie("inlinemod_useracp"); // Remove the cookie of selected users as we've finished with them
-
- $lang->users_banned = $lang->sprintf($lang->users_banned, $banned_count);
- flash_message($lang->users_banned, 'success');
- admin_redirect("index.php?module=user-users".$vid_url);
- }
-
- $page->output_header($lang->manage_users);
- $page->output_nav_tabs($sub_tabs, 'manage_users');
-
- // Provide the user with a warning of what they're about to do
- $table = new Table;
- $lang->mass_ban_info = $lang->sprintf($lang->mass_ban_info, count($selected));
- $table->construct_cell($lang->mass_ban_info);
- $table->construct_row();
- $table->output($lang->important);
-
- // If there's any errors, display inline
- if($errors)
- {
- $page->output_inline_error($errors);
- }
-
- $form = new Form("index.php?module=user-users", "post");
- echo $form->generate_hidden_field('action', 'inline_edit');
- echo $form->generate_hidden_field('inline_action', 'multiban');
- echo $form->generate_hidden_field('processed', '1');
-
- $form_container = new FormContainer(''.$lang->mass_ban);
- $form_container->output_row($lang->ban_reason, "", $form->generate_text_area('reason', $mybb->input['reason'], array('id' => 'reason', 'maxlength' => '255')), 'reason');
- $ban_times = fetch_ban_times();
- foreach($ban_times as $time => $period)
- {
- if($time != '---')
- {
- $friendly_time = my_date("D, jS M Y @ {$mybb->settings['timeformat']}", ban_date2timestamp($time));
- $period = "{$period} ({$friendly_time})";
- }
- $length_list[$time] = $period;
- }
- $form_container->output_row($lang->ban_time, "", $form->generate_select_box('bantime', $length_list, $mybb->input['bantime'], array('id' => 'bantime')), 'bantime');
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->ban_users);
- $form->output_submit_wrapper($buttons);
- $form->end();
- $page->output_footer();
- break;
- case 'multidelete':
- if($mybb->input['no'])
- {
- admin_redirect("index.php?module=user-users".$vid_url); // User clicked on 'No
- }
- else
- {
- if($mybb->input['processed'] == 1)
- {
- // Set up user handler.
- require_once MYBB_ROOT.'inc/datahandlers/user.php';
- $userhandler = new UserDataHandler('delete');
-
- // Delete users
- $deleted = $userhandler->delete_user($selected);
- $to_be_deleted = $deleted['deleted_users']; // Get the correct number of deleted users
-
- // Update forum stats, remove the cookie and redirect the user
- my_unsetcookie("inlinemod_useracp");
- $mybb->input['action'] = "inline_delete";
- log_admin_action($to_be_deleted);
-
- $lang->users_deleted = $lang->sprintf($lang->users_deleted, $to_be_deleted);
-
- $cache->update_awaitingactivation();
-
- flash_message($lang->users_deleted, 'success');
- admin_redirect("index.php?module=user-users".$vid_url);
- }
-
- $to_be_deleted = count($selected);
- $lang->confirm_multidelete = $lang->sprintf($lang->confirm_multidelete, my_number_format($to_be_deleted));
- $page->output_confirm_action("index.php?module=user-users&action=inline_edit&inline_action=multidelete&my_post_key={$mybb->post_code}&processed=1", $lang->confirm_multidelete);
- }
- break;
- case 'multiprune':
- if($mybb->input['processed'] == 1)
- {
- if(($mybb->input['day'] || $mybb->input['month'] || $mybb->input['year']) && $mybb->input['set'])
- {
- $errors[] = $lang->multi_selected_dates;
- }
-
- $day = $mybb->get_input('day', MyBB::INPUT_INT);
- $month = $mybb->get_input('month', MyBB::INPUT_INT);
- $year = $mybb->get_input('year', MyBB::INPUT_INT);
-
- // Selected a date - check if the date the user entered is valid
- if($mybb->input['day'] || $mybb->input['month'] || $mybb->input['year'])
- {
- // Is the date sort of valid?
- if($day < 1 || $day > 31 || $month < 1 || $month > 12 || ($month == 2 && $day > 29))
- {
- $errors[] = $lang->incorrect_date;
- }
-
- // Check the month
- $months = get_bdays($year);
- if($day > $months[$month-1])
- {
- $errors[] = $lang->incorrect_date;
- }
-
- // Check the year
- if($year != 0 && ($year < (date("Y")-100)) || $year > date("Y"))
- {
- $errors[] = $lang->incorrect_date;
- }
-
- if(!$errors)
- {
- // No errors, so let's continue and set the date to delete from
- $date = mktime(date('H'), date('i'), date('s'), $month, $day, $year); // Generate a unix time stamp
- }
- }
- elseif($mybb->input['set'] > 0)
- {
- // Set options
- // For this purpose, 1 month = 31 days
- $base_time = 24 * 60 * 60;
-
- switch($mybb->input['set'])
- {
- case '1':
- $threshold = $base_time * 31; // 1 month = 31 days, in the standard terms
- break;
- case '2':
- $threshold = $base_time * 93; // 3 months = 31 days * 3
- break;
- case '3':
- $threshold = $base_time * 183; // 6 months = 365 days / 2
- break;
- case '4':
- $threshold = $base_time * 365; // 1 year = 365 days
- break;
- case '5':
- $threshold = $base_time * 548; // 18 months = 365 + 183
- break;
- case '6':
- $threshold = $base_time * 730; // 2 years = 365 * 2
- break;
- }
-
- if(!$threshold)
- {
- // An option was entered that isn't in the dropdown box
- $errors[] = $lang->no_set_option;
- }
- else
- {
- $date = TIME_NOW - $threshold;
- }
- }
- else
- {
- $errors[] = $lang->no_prune_option;
- }
-
- if(!$errors)
- {
- $sql_array = implode(",", $selected);
- $prune_array = array();
- $query = $db->simple_select("users", "uid", "uid IN (".$sql_array.")");
- while($user = $db->fetch_array($query))
- {
- // Protect Super Admins
- if(is_super_admin($user['uid']) && !is_super_admin($mybb->user['uid']))
- {
- continue;
- }
-
- $return_array = delete_user_posts($user['uid'], $date); // Delete user posts, and grab a list of threads to delete
- if($return_array && is_array($return_array))
- {
- $prune_array = array_merge_recursive($prune_array, $return_array);
- }
- }
-
- // No posts were found for the user, return error
- if(!is_array($prune_array) || count($prune_array) == 0)
- {
- flash_message($lang->prune_fail, 'error');
- admin_redirect("index.php?module=user-users".$vid_url);
- }
-
- // Require the rebuild functions
- require_once MYBB_ROOT.'/inc/functions.php';
- require_once MYBB_ROOT.'/inc/functions_rebuild.php';
-
- // We've finished deleting user's posts, so let's delete the threads
- if(is_array($prune_array['to_delete']) && count($prune_array['to_delete']) > 0)
- {
- foreach($prune_array['to_delete'] as $tid)
- {
- $db->delete_query("threads", "tid='$tid'");
- $db->delete_query("threads", "closed='moved|$tid'");
- $db->delete_query("threadsubscriptions", "tid='$tid'");
- $db->delete_query("polls", "tid='$tid'");
- $db->delete_query("threadsread", "tid='$tid'");
- $db->delete_query("threadratings", "tid='$tid'");
- }
- }
-
- // After deleting threads, rebuild the thread counters for the affected threads
- if(is_array($prune_array['thread_update']) && count($prune_array['thread_update']) > 0)
- {
- $sql_array = implode(",", $prune_array['thread_update']);
- $query = $db->simple_select("threads", "tid", "tid IN (".$sql_array.")", array('order_by' => 'tid', 'order_dir' => 'asc'));
- while($thread = $db->fetch_array($query))
- {
- rebuild_thread_counters($thread['tid']);
- }
- }
-
- // After updating thread counters, update the affected forum counters
- if(is_array($prune_array['forum_update']) && count($prune_array['forum_update']) > 0)
- {
- $sql_array = implode(",", $prune_array['forum_update']);
- $query = $db->simple_select("forums", "fid", "fid IN (".$sql_array.")", array('order_by' => 'fid', 'order_dir' => 'asc'));
- while($forum = $db->fetch_array($query))
- {
- // Because we have a recursive array merge, check to see if there isn't a duplicated forum to update
- if($looped_forum == $forum['fid'])
- {
- continue;
- }
- $looped_forum = $forum['fid'];
- rebuild_forum_counters($forum['fid']);
- }
- }
-
- //log_admin_action();
- my_unsetcookie("inlinemod_useracp"); // We've got our users, remove the cookie
- flash_message($lang->prune_complete, 'success');
- admin_redirect("index.php?module=user-users".$vid_url);
- }
- }
-
- $page->output_header($lang->manage_users);
- $page->output_nav_tabs($sub_tabs, 'manage_users');
-
- // Display a table warning
- $table = new Table;
- $lang->mass_prune_info = $lang->sprintf($lang->mass_prune_info, count($selected));
- $table->construct_cell($lang->mass_prune_info);
- $table->construct_row();
- $table->output($lang->important);
-
- if($errors)
- {
- $page->output_inline_error($errors);
- }
-
- // Display the prune options
- $form = new Form("index.php?module=user-users", "post");
- echo $form->generate_hidden_field('action', 'inline_edit');
- echo $form->generate_hidden_field('inline_action', 'multiprune');
- echo $form->generate_hidden_field('processed', '1');
-
- $form_container = new FormContainer($lang->mass_prune_posts);
-
- // Generate a list of days (1 - 31)
- $day_options = array();
- $day_options[] = " ";
- for($i = 1; $i <= 31; ++$i)
- {
- $day_options[] = $i;
- }
-
- // Generate a list of months (1 - 12)
- $month_options = array();
- $month_options[] = " ";
- for($i = 1; $i <= 12; ++$i)
- {
- $string = "month_{$i}";
- $month_options[] = $lang->$string;
- }
- $date_box = $form->generate_select_box('day', $day_options, $mybb->input['day']);
- $month_box = $form->generate_select_box('month', $month_options, $mybb->input['month']);
- $year_box = $form->generate_numeric_field('year', $mybb->input['year'], array('id' => 'year', 'style' => 'width: 50px;', 'min' => 0));
-
- $prune_select = $date_box.$month_box.$year_box;
- $form_container->output_row($lang->manual_date, "", $prune_select, 'date');
-
- // Generate the set date box
- $set_options = array();
- $set_options[] = $lang->set_an_option;
- for($i = 1; $i <= 6; ++$i)
- {
- $string = "option_{$i}";
- $set_options[] = $lang->$string;
- }
-
- $form_container->output_row($lang->relative_date, "", $lang->delete_posts." ".$form->generate_select_box('set', $set_options, $mybb->input['set']), 'set');
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->prune_posts);
- $form->output_submit_wrapper($buttons);
- $form->end();
- $page->output_footer();
- break;
- case 'multiusergroup':
- if($mybb->input['processed'] == 1)
- {
- // Determine additional usergroups
- if(is_array($mybb->input['additionalgroups']))
- {
- foreach($mybb->input['additionalgroups'] as $key => $gid)
- {
- if($gid == $mybb->input['usergroup'])
- {
- unset($mybb->input['additionalgroups'][$key]);
- }
- }
-
- $additionalgroups = implode(",", array_map('intval', $mybb->input['additionalgroups']));
- }
- else
- {
- $additionalgroups = '';
- }
-
- // Create an update array
- $update_array = array(
- "usergroup" => $mybb->get_input('usergroup', MyBB::INPUT_INT),
- "additionalgroups" => $additionalgroups,
- "displaygroup" => $mybb->get_input('displaygroup', MyBB::INPUT_INT)
- );
-
- // Do the usergroup update for all those selected
- // If the a selected user is a super admin, don't update that user
- foreach($selected as $user)
- {
- if(!is_super_admin($user))
- {
- $users_to_update[] = $user;
- }
- }
-
- $to_update_count = count($users_to_update);
- if($to_update_count > 0 && is_array($users_to_update))
- {
- // Update the users in the database
- $sql = implode(",", $users_to_update);
- $db->update_query("users", $update_array, "uid IN (".$sql.")");
-
- // Redirect the admin...
- $mybb->input['action'] = "inline_usergroup";
- log_admin_action($to_update_count);
- my_unsetcookie("inlinemod_useracp");
- flash_message($lang->success_mass_usergroups, 'success');
- admin_redirect("index.php?module=user-users".$vid_url);
- }
- else
- {
- // They tried to edit super admins! Uh-oh!
- $errors[] = $lang->no_usergroup_changed;
- }
- }
-
- $page->output_header($lang->manage_users);
- $page->output_nav_tabs($sub_tabs, 'manage_users');
-
- // Display a table warning
- $table = new Table;
- $lang->usergroup_info = $lang->sprintf($lang->usergroup_info, count($selected));
- $table->construct_cell($lang->usergroup_info);
- $table->construct_row();
- $table->output($lang->important);
-
- if($errors)
- {
- $page->output_inline_error($errors);
- }
-
- // Display the usergroup options
- $form = new Form("index.php?module=user-users", "post");
- echo $form->generate_hidden_field('action', 'inline_edit');
- echo $form->generate_hidden_field('inline_action', 'multiusergroup');
- echo $form->generate_hidden_field('processed', '1');
-
- $form_container = new FormContainer($lang->mass_usergroups);
-
- // Usergroups
- $display_group_options[0] = $lang->use_primary_user_group;
- $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']);
- $display_group_options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);
- }
-
- if(!is_array($mybb->input['additionalgroups']))
- {
- $mybb->input['additionalgroups'] = explode(',', $mybb->input['additionalgroups']);
- }
-
- $form_container->output_row($lang->primary_user_group, "", $form->generate_select_box('usergroup', $options, $mybb->input['usergroup'], array('id' => 'usergroup')), 'usergroup');
- $form_container->output_row($lang->additional_user_groups, $lang->additional_user_groups_desc, $form->generate_select_box('additionalgroups[]', $options, $mybb->input['additionalgroups'], array('id' => 'additionalgroups', 'multiple' => true, 'size' => 5)), 'additionalgroups');
- $form_container->output_row($lang->display_user_group, "", $form->generate_select_box('displaygroup', $display_group_options, $mybb->input['displaygroup'], array('id' => 'displaygroup')), 'displaygroup');
-
- $form_container->end();
-
- $buttons[] = $form->generate_submit_button($lang->alter_usergroups);
- $form->output_submit_wrapper($buttons);
- $form->end();
- $page->output_footer();
- break;
- }
-}
-
-if(!$mybb->input['action'])
-{
- $plugins->run_hooks("admin_user_users_start");
-
- $page->output_header($lang->browse_users);
- echo "";
-
- $page->output_nav_tabs($sub_tabs, 'browse_users');
-
- if(isset($mybb->input['search_id']) && $admin_session['data']['user_views'][$mybb->input['search_id']])
- {
- $admin_view = $admin_session['data']['user_views'][$mybb->input['search_id']];
- unset($admin_view['extra_sql']);
- }
- else
- {
- // Showing a specific view
- if(isset($mybb->input['vid']))
- {
- $query = $db->simple_select("adminviews", "*", "vid='".$mybb->get_input('vid', MyBB::INPUT_INT)."'");
- $admin_view = $db->fetch_array($query);
- // View does not exist or this view is private and does not belong to the current user
- if(!$admin_view['vid'] || ($admin_view['visibility'] == 1 && $admin_view['uid'] != $mybb->user['uid']))
- {
- unset($admin_view);
- }
- }
-
- // Don't have a view? Fetch the default
- if(!isset($admin_view))
- {
- $default_view = fetch_default_view("user");
- if(!$default_view)
- {
- $default_view = "0";
- }
- $query = $db->simple_select("adminviews", "*", "type='user' AND (vid='{$default_view}' OR uid=0)", array("order_by" => "uid", "order_dir" => "desc"));
- $admin_view = $db->fetch_array($query);
- }
- }
-
- // Fetch a list of all of the views for this user
- $popup = new PopupMenu("views", $lang->views);
-
- $query = $db->simple_select("adminviews", "*", "type='user' AND (visibility=2 OR uid={$mybb->user['uid']})", array("order_by" => "title"));
- while($view = $db->fetch_array($query))
- {
- $popup->add_item(htmlspecialchars_uni($view['title']), "index.php?module=user-users&vid={$view['vid']}");
- }
- $popup->add_item("{$lang->manage_views}", "index.php?module=user-users&action=views");
- $admin_view['popup'] = $popup->fetch();
-
- if(isset($mybb->input['type']))
- {
- $admin_view['view_type'] = $mybb->input['type'];
- }
-
- $results = build_users_view($admin_view);
-
- if(!$results)
- {
- // If we came from the home page and clicked on the "Activate Users" link, send them back to here
- if($admin_session['data']['from'] == "home")
- {
- flash_message($admin_session['data']['flash_message2']['message'], $admin_session['data']['flash_message2']['type']);
- update_admin_session('flash_message2', '');
- update_admin_session('from', '');
- admin_redirect("index.php");
- exit;
- }
- else
- {
- $errors[] = $lang->error_no_users_found;
- }
- }
-
- // If we have any error messages, show them
- if($errors)
- {
- if($inline != true)
- {
- echo "{$admin_view['popup']}
\n";
- }
- $page->output_inline_error($errors);
- }
-
- echo $results;
-
- $page->output_footer();
-}
-
-/**
- * @param array $view
- *
- * @return string
- */
-function build_users_view($view)
-{
- global $mybb, $db, $cache, $lang, $user_view_fields, $page;
-
- if($view['view_type'] != 'card')
- {
- $view['view_type'] = 'table';
- }
-
- $view_title = '';
- if($view['title'])
- {
- $title_string = "view_title_{$view['vid']}";
-
- if($lang->$title_string)
- {
- $view['title'] = $lang->$title_string;
- }
-
- $view_title .= " (".htmlspecialchars_uni($view['title']).")";
- }
-
- // Build the URL to this view
- if(!isset($view['url']))
- {
- $view['url'] = "index.php?module=user-users";
- }
- if(!is_array($view['conditions']))
- {
- $view['conditions'] = my_unserialize($view['conditions']);
- }
- if(!is_array($view['fields']))
- {
- $view['fields'] = my_unserialize($view['fields']);
- }
- if(!is_array($view['custom_profile_fields']))
- {
- $view['custom_profile_fields'] = my_unserialize($view['custom_profile_fields']);
- }
- if(isset($mybb->input['username']))
- {
- $view['conditions']['username'] = $mybb->input['username'];
- $view['url'] .= "&username=".urlencode(htmlspecialchars_uni($mybb->input['username']));
- }
- if($view['vid'])
- {
- $view['url'] .= "&vid={$view['vid']}";
- }
- else
- {
- // If this is a custom view we need to save everything ready to pass it on from page to page
- global $admin_session;
- if(!$mybb->input['search_id'])
- {
- $search_id = md5(random_str());
- $admin_session['data']['user_views'][$search_id] = $view;
- update_admin_session('user_views', $admin_session['data']['user_views']);
- $mybb->input['search_id'] = $search_id;
- }
- $view['url'] .= "&search_id=".htmlspecialchars_uni($mybb->input['search_id']);
- }
-
- if(!isset($admin_session['data']['last_users_view']) || $admin_session['data']['last_users_view'] != str_replace("&", "&", $view['url']))
- {
- update_admin_session('last_users_url', str_replace("&", "&", $view['url']));
- }
-
- if(isset($view['conditions']['referrer'])){
- $view['url'] .= "&action=referrers&uid=".htmlspecialchars_uni($view['conditions']['referrer']);
- }
-
- // Do we not have any views?
- if(empty($view))
- {
- return false;
- }
-
- $table = new Table;
-
- // Build header for table based view
- if($view['view_type'] != "card")
- {
- foreach($view['fields'] as $field)
- {
- if(!$user_view_fields[$field])
- {
- continue;
- }
- $view_field = $user_view_fields[$field];
- $field_options = array();
- if($view_field['width'])
- {
- $field_options['width'] = $view_field['width'];
- }
- if($view_field['align'])
- {
- $field_options['class'] = "align_".$view_field['align'];
- }
- $table->construct_header($view_field['title'], $field_options);
- }
- $table->construct_header(""); // Create a header for the "select" boxes
- }
-
- $search_sql = '1=1';
-
- // Build the search SQL for users
-
- // List of valid LIKE search fields
- $user_like_fields = array("username", "email", "website", "icq", "aim", "yahoo", "skype", "google", "signature", "usertitle");
- foreach($user_like_fields as $search_field)
- {
- if(!empty($view['conditions'][$search_field]) && !$view['conditions'][$search_field.'_blank'])
- {
- $search_sql .= " AND u.{$search_field} LIKE '%".$db->escape_string_like($view['conditions'][$search_field])."%'";
- }
- else if(!empty($view['conditions'][$search_field.'_blank']))
- {
- $search_sql .= " AND u.{$search_field} != ''";
- }
- }
-
- // EXACT matching fields
- $user_exact_fields = array("referrer");
- foreach($user_exact_fields as $search_field)
- {
- if(!empty($view['conditions'][$search_field]))
- {
- $search_sql .= " AND u.{$search_field}='".$db->escape_string($view['conditions'][$search_field])."'";
- }
- }
-
- // LESS THAN or GREATER THAN
- $direction_fields = array("postnum", "threadnum");
- foreach($direction_fields as $search_field)
- {
- $direction_field = $search_field."_dir";
- if(isset($view['conditions'][$search_field]) && ($view['conditions'][$search_field] || $view['conditions'][$search_field] === '0') && $view['conditions'][$direction_field])
- {
- switch($view['conditions'][$direction_field])
- {
- case "greater_than":
- $direction = ">";
- break;
- case "less_than":
- $direction = "<";
- break;
- default:
- $direction = "=";
- }
- $search_sql .= " AND u.{$search_field}{$direction}'".$db->escape_string($view['conditions'][$search_field])."'";
- }
- }
-
- // Registration searching
- $reg_fields = array("regdate");
- foreach($reg_fields as $search_field)
- {
- if(!empty($view['conditions'][$search_field]) && (int)$view['conditions'][$search_field])
- {
- $threshold = TIME_NOW - ((int)$view['conditions'][$search_field] * 24 * 60 * 60);
-
- $search_sql .= " AND u.{$search_field} >= '{$threshold}'";
- }
- }
-
- // IP searching
- $ip_fields = array("regip", "lastip");
- foreach($ip_fields as $search_field)
- {
- if(!empty($view['conditions'][$search_field]))
- {
- $ip_range = fetch_ip_range($view['conditions'][$search_field]);
- if(!is_array($ip_range))
- {
- $ip_sql = "{$search_field}=".$db->escape_binary($ip_range);
- }
- else
- {
- $ip_sql = "{$search_field} BETWEEN ".$db->escape_binary($ip_range[0])." AND ".$db->escape_binary($ip_range[1]);
- }
- $search_sql .= " AND {$ip_sql}";
- }
- }
-
- // Post IP searching
- if(!empty($view['conditions']['postip']))
- {
- $ip_range = fetch_ip_range($view['conditions']['postip']);
- if(!is_array($ip_range))
- {
- $ip_sql = "ipaddress=".$db->escape_binary($ip_range);
- }
- else
- {
- $ip_sql = "ipaddress BETWEEN ".$db->escape_binary($ip_range[0])." AND ".$db->escape_binary($ip_range[1]);
- }
- $ip_uids = array(0);
- $query = $db->simple_select("posts", "uid", $ip_sql);
- while($uid = $db->fetch_field($query, "uid"))
- {
- $ip_uids[] = $uid;
- }
- $search_sql .= " AND u.uid IN(".implode(',', $ip_uids).")";
- unset($ip_uids);
- }
-
- // Custom Profile Field searching
- if($view['custom_profile_fields'])
- {
- $userfield_sql = '1=1';
- foreach($view['custom_profile_fields'] as $column => $input)
- {
- if(is_array($input))
- {
- foreach($input as $value => $text)
- {
- if($value == $column)
- {
- $value = $text;
- }
-
- if($value == $lang->na)
- {
- continue;
- }
-
- if(strpos($column, '_blank') !== false)
- {
- $column = str_replace('_blank', '', $column);
- $userfield_sql .= ' AND '.$db->escape_string($column)." != ''";
- }
- else
- {
- $userfield_sql .= ' AND '.$db->escape_string($column)."='".$db->escape_string($value)."'";
- }
- }
- }
- else if(!empty($input))
- {
- if($input == $lang->na)
- {
- continue;
- }
-
- if(strpos($column, '_blank') !== false)
- {
- $column = str_replace('_blank', '', $column);
- $userfield_sql .= ' AND '.$db->escape_string($column)." != ''";
- }
- else
- {
- $userfield_sql .= ' AND '.$db->escape_string($column)." LIKE '%".$db->escape_string_like($input)."%'";
- }
- }
- }
-
- if($userfield_sql != '1=1')
- {
- $userfield_uids = array(0);
- $query = $db->simple_select("userfields", "ufid", $userfield_sql);
- while($userfield = $db->fetch_array($query))
- {
- $userfield_uids[] = $userfield['ufid'];
- }
- $search_sql .= " AND u.uid IN(".implode(',', $userfield_uids).")";
- unset($userfield_uids);
- }
- }
-
- // Usergroup based searching
- if(isset($view['conditions']['usergroup']))
- {
- if(!is_array($view['conditions']['usergroup']))
- {
- $view['conditions']['usergroup'] = array($view['conditions']['usergroup']);
- }
-
- foreach($view['conditions']['usergroup'] as $usergroup)
- {
- $usergroup = (int)$usergroup;
-
- if(!$usergroup)
- {
- continue;
- }
-
- $additional_sql = '';
-
- switch($db->type)
- {
- case "pgsql":
- case "sqlite":
- $additional_sql .= " OR ','||additionalgroups||',' LIKE '%,{$usergroup},%'";
- break;
- default:
- $additional_sql .= "OR CONCAT(',',additionalgroups,',') LIKE '%,{$usergroup},%'";
- }
- }
-
- $search_sql .= " AND (u.usergroup IN (".implode(",", array_map('intval', $view['conditions']['usergroup'])).") {$additional_sql})";
- }
-
- // COPPA users only?
- if(isset($view['conditions']['coppa']))
- {
- $search_sql .= " AND u.coppauser=1 AND u.usergroup=5";
- }
-
- // Extra SQL?
- if(isset($view['extra_sql']))
- {
- $search_sql .= $view['extra_sql'];
- }
-
- // Lets fetch out how many results we have
- $query = $db->query("
- SELECT COUNT(u.uid) AS num_results
- FROM ".TABLE_PREFIX."users u
- WHERE {$search_sql}
- ");
- $num_results = $db->fetch_field($query, "num_results");
-
- // No matching results then return false
- if(!$num_results)
- {
- return false;
- }
- // Generate the list of results
- else
- {
- if(!$view['perpage'])
- {
- $view['perpage'] = 20;
- }
- $view['perpage'] = (int)$view['perpage'];
-
- // Establish which page we're viewing and the starting index for querying
- if(!isset($mybb->input['page']))
- {
- $mybb->input['page'] = 1;
- }
- else
- {
- $mybb->input['page'] = $mybb->get_input('page', MyBB::INPUT_INT);
- }
-
- if($mybb->input['page'])
- {
- $start = ($mybb->input['page'] - 1) * $view['perpage'];
- }
- else
- {
- $start = 0;
- $mybb->input['page'] = 1;
- }
-
- $from_bit = "";
- if(isset($mybb->input['from']) && $mybb->input['from'] == "home")
- {
- $from_bit = "&from=home";
- }
-
- switch($view['sortby'])
- {
- case "regdate":
- case "lastactive":
- case "postnum":
- case "reputation":
- $view['sortby'] = $db->escape_string($view['sortby']);
- break;
- case "numposts":
- $view['sortby'] = "postnum";
- break;
- case "numthreads":
- $view['sortby'] = "threadnum";
- break;
- case "warninglevel":
- $view['sortby'] = "warningpoints";
- break;
- default:
- $view['sortby'] = "username";
- }
-
- if($view['sortorder'] != "desc")
- {
- $view['sortorder'] = "asc";
- }
-
- $usergroups = $cache->read("usergroups");
-
- // Fetch matching users
- $query = $db->query("
- SELECT u.*
- FROM ".TABLE_PREFIX."users u
- WHERE {$search_sql}
- ORDER BY {$view['sortby']} {$view['sortorder']}
- LIMIT {$start}, {$view['perpage']}
- ");
- $users = '';
- while($user = $db->fetch_array($query))
- {
- $comma = $groups_list = '';
- $user['username'] = htmlspecialchars_uni($user['username']);
- $user['view']['username'] = "".format_name($user['username'], $user['usergroup'], $user['displaygroup'])."";
- $user['view']['usergroup'] = htmlspecialchars_uni($usergroups[$user['usergroup']]['title']);
- if($user['additionalgroups'])
- {
- $additional_groups = explode(",", $user['additionalgroups']);
-
- foreach($additional_groups as $group)
- {
- $groups_list .= $comma.htmlspecialchars_uni($usergroups[$group]['title']);
- $comma = $lang->comma;
- }
- }
- if(!$groups_list)
- {
- $groups_list = $lang->none;
- }
- $user['view']['additionalgroups'] = "{$groups_list}";
- $user['view']['email'] = "".htmlspecialchars_uni($user['email'])."";
- $user['view']['regdate'] = my_date('relative', $user['regdate']);
- $user['view']['lastactive'] = my_date('relative', $user['lastactive']);
-
- // Build popup menu
- $popup = new PopupMenu("user_{$user['uid']}", $lang->options);
- $popup->add_item($lang->view_profile, $mybb->settings['bburl'].'/'.get_profile_link($user['uid']));
- $popup->add_item($lang->edit_profile_and_settings, "index.php?module=user-users&action=edit&uid={$user['uid']}");
-
- // Banning options... is this user banned?
- if($usergroups[$user['usergroup']]['isbannedgroup'] == 1)
- {
- // Yes, so do we want to edit the ban or pardon his crime?
- $popup->add_item($lang->edit_ban, "index.php?module=user-banning&uid={$user['uid']}#username");
- $popup->add_item($lang->lift_ban, "index.php?module=user-banning&action=lift&uid={$user['uid']}&my_post_key={$mybb->post_code}");
- }
- else
- {
- // Not banned... but soon maybe!
- $popup->add_item($lang->ban_user, "index.php?module=user-banning&uid={$user['uid']}#username");
- }
-
- if($user['usergroup'] == 5)
- {
- if($user['coppauser'])
- {
- $popup->add_item($lang->approve_coppa_user, "index.php?module=user-users&action=activate_user&uid={$user['uid']}&my_post_key={$mybb->post_code}{$from_bit}");
- }
- else
- {
- $popup->add_item($lang->approve_user, "index.php?module=user-users&action=activate_user&uid={$user['uid']}&my_post_key={$mybb->post_code}{$from_bit}");
- }
- }
-
- $popup->add_item($lang->delete_user, "index.php?module=user-users&action=delete&uid={$user['uid']}&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->user_deletion_confirmation}')");
- $popup->add_item($lang->show_referred_users, "index.php?module=user-users&action=referrers&uid={$user['uid']}");
- $popup->add_item($lang->show_ip_addresses, "index.php?module=user-users&action=ipaddresses&uid={$user['uid']}");
- $popup->add_item($lang->show_attachments, "index.php?module=forum-attachments&results=1&username=".urlencode($user['username']));
- $user['view']['controls'] = $popup->fetch();
-
- // Fetch the reputation for this user
- if($usergroups[$user['usergroup']]['usereputationsystem'] == 1 && $mybb->settings['enablereputation'] == 1)
- {
- $user['view']['reputation'] = get_reputation($user['reputation']);
- }
- else
- {
- $reputation = "-";
- }
-
- if($mybb->settings['enablewarningsystem'] != 0 && $usergroups[$user['usergroup']]['canreceivewarnings'] != 0)
- {
- if($mybb->settings['maxwarningpoints'] < 1)
- {
- $mybb->settings['maxwarningpoints'] = 10;
- }
-
- $warning_level = round($user['warningpoints']/$mybb->settings['maxwarningpoints']*100);
- if($warning_level > 100)
- {
- $warning_level = 100;
- }
- $user['view']['warninglevel'] = get_colored_warning_level($warning_level);
- }
-
- if($user['avatar'] && !my_validate_url($user['avatar']))
- {
- $user['avatar'] = "../{$user['avatar']}";
- }
- if($view['view_type'] == "card")
- {
- $scaled_avatar = fetch_scaled_avatar($user, 80, 80);
- }
- else
- {
- $scaled_avatar = fetch_scaled_avatar($user, 34, 34);
- }
- if(!$user['avatar'] || (my_strpos($user['avatar'], '://') !== false && !$mybb->settings['allowremoteavatars']))
- {
- if(my_validate_url($mybb->settings['useravatar']))
- {
- $user['avatar'] = str_replace('{theme}', 'images', $mybb->settings['useravatar']);
- }
- else
- {
- $user['avatar'] = "../".str_replace('{theme}', 'images', $mybb->settings['useravatar']);
- }
- }
- $user['view']['avatar'] = "
";
-
- // Convert IP's to readable
- $user['regip'] = my_inet_ntop($db->unescape_binary($user['regip']));
- $user['lastip'] = my_inet_ntop($db->unescape_binary($user['lastip']));
-
- if($view['view_type'] == "card")
- {
- $users .= build_user_view_card($user, $view, $i);
- }
- else
- {
- build_user_view_table($user, $view, $table);
- }
- }
-
- // If card view, we need to output the results
- if($view['view_type'] == "card")
- {
- $table->construct_cell($users);
- $table->construct_row();
- }
- }
-
- if(!isset($view['table_id']))
- {
- $view['table_id'] = "users_list";
- }
-
- $switch_view = "";
- $switch_url = $view['url'];
- if($mybb->input['page'] > 0)
- {
- $switch_url .= "&page=".$mybb->get_input('page', MyBB::INPUT_INT);
- }
- if($view['view_type'] != "card")
- {
- $switch_view .= "
{$lang->table_view} |
{$lang->card_view}";
- }
- else
- {
- $switch_view .= "
{$lang->table_view} |
{$lang->card_view}";
- }
- $switch_view .= "
";
-
- // Do we need to construct the pagination?
- if($num_results > $view['perpage'])
- {
- $view_type = htmlspecialchars_uni($view['view_type']);
- $pagination = draw_admin_pagination($mybb->input['page'], $view['perpage'], $num_results, $view['url']."&type={$view_type}");
- $search_class = "float_right";
- $search_style = "";
- }
- else
- {
- $search_class = '';
- $search_style = "text-align: right;";
- }
-
- $search_action = $view['url'];
- // stop &username= in the query string
- if($view_upos = strpos($search_action, '&username='))
- {
- $search_action = substr($search_action, 0, $view_upos);
- }
- $search_action = str_replace("&", "&", $search_action);
- $search = new Form(htmlspecialchars_uni($search_action), 'post', 'search_form', 0, '', true);
- $built_view = $search->construct_return;
- $built_view .= "";
- $built_view .= $search->generate_hidden_field('action', 'search')."\n";
- if(isset($view['conditions']['username']))
- {
- $default_class = '';
- $value = $view['conditions']['username'];
- }
- else
- {
- $default_class = "search_default";
- $value = $lang->search_for_user;
- }
- $built_view .= $search->generate_text_box('username', htmlspecialchars_uni($value), array('id' => 'search_keywords', 'class' => "{$default_class} field150 field_small"))."\n";
- $built_view .= "
search}\" />\n";
- if($view['popup'])
- {
- $built_view .= "
{$view['popup']}
\n";
- }
- $built_view .= "\n";
- $built_view .= "
\n";
-
- // Autocompletion for usernames
- // TODO Select2
-
- $built_view .= $search->end();
-
- if(isset($pagination))
- {
- $built_view .= $pagination;
- }
- if($view['view_type'] != "card")
- {
- $checkbox = '';
- }
- else
- {
- $checkbox = " ";
- }
- $built_view .= $table->construct_html("{$switch_view}{$checkbox}{$lang->users}{$view_title}
", 1, "", $view['table_id']);
- if(isset($pagination))
- {
- $built_view .= $pagination;
- }
-
- $built_view .= '
-
-
-
-';
-
- return $built_view;
-}
-
-/**
- * @param array $user
- * @param array $view
- * @param int $i
- *
- * @return string
- */
-function build_user_view_card($user, $view, &$i)
-{
- global $user_view_fields;
-
- ++$i;
- if($i == 3)
- {
- $i = 1;
- }
-
- // Loop through fields user wants to show
- foreach($view['fields'] as $field)
- {
- if(!$user_view_fields[$field])
- {
- continue;
- }
-
- $view_field = $user_view_fields[$field];
-
- // Special conditions for avatar
- if($field == "avatar")
- {
- $avatar = $user['view']['avatar'];
- }
- else if($field == "controls")
- {
- $controls = $user['view']['controls'];
- }
- // Otherwise, just user data
- else if($field != "username")
- {
- if(isset($user['view'][$field]))
- {
- $value = $user['view'][$field];
- }
- else
- {
- $value = $user[$field];
- }
-
- if($field == "postnum")
- {
- $value = my_number_format($value);
- }
-
- $user_details[] = "{$view_field['title']}: {$value}";
- }
-
- }
- // Floated to the left or right?
- if($i == 1)
- {
- $float = "left";
- }
- else
- {
- $float = "right";
- }
-
- // And build the final card
- $card = "";
- return $card;
-
-}
-
-/**
- * @param array $user
- * @param array $view
- * @param DefaultTable $table
- */
-function build_user_view_table($user, $view, &$table)
-{
- global $user_view_fields;
-
- foreach($view['fields'] as $field)
- {
- if(!$user_view_fields[$field])
- {
- continue;
- }
- $view_field = $user_view_fields[$field];
- $field_options = array();
- if($view_field['align'])
- {
- $field_options['class'] = "align_".$view_field['align'];
- }
- if($user['view'][$field])
- {
- $value = $user['view'][$field];
- }
- else
- {
- $value = $user[$field];
- }
-
- if($field == "postnum")
- {
- $value = my_number_format($user[$field]);
- }
- $table->construct_cell($value, $field_options);
- }
-
- $table->construct_cell("");
-
- $table->construct_row();
-}
-
-/**
- * @param array $user
- * @param int $max_width
- * @param int $max_height
- *
- * @return array
- */
-function fetch_scaled_avatar($user, $max_width=80, $max_height=80)
-{
- $scaled_dimensions = array(
- "width" => $max_width,
- "height" => $max_height,
- );
-
- global $mybb;
-
- if($user['avatar'] && (my_strpos($user['avatar'], '://') === false || $mybb->settings['allowremoteavatars']))
- {
- if($user['avatardimensions'])
- {
- require_once MYBB_ROOT."inc/functions_image.php";
- list($width, $height) = explode("|", $user['avatardimensions']);
- $scaled_dimensions = scale_image($width, $height, $max_width, $max_height);
- }
- }
-
- return array("width" => $scaled_dimensions['width'], "height" => $scaled_dimensions['height']);
-}
-
-/**
- * @param array $fields
- * @param array $values
- * @param DefaultFormContainer $form_container
- * @param DefaultForm $form
- * @param bool $search
- */
-function output_custom_profile_fields($fields, $values, &$form_container, &$form, $search=false)
-{
- global $lang;
-
- if(!is_array($fields))
- {
- return;
- }
- foreach($fields as $profile_field)
- {
- $profile_field['name'] = htmlspecialchars_uni($profile_field['name']);
- $profile_field['description'] = htmlspecialchars_uni($profile_field['description']);
- list($type, $options) = explode("\n", $profile_field['type'], 2);
- $type = trim($type);
- $field_name = "fid{$profile_field['fid']}";
-
- switch($type)
- {
- case "multiselect":
- if(!is_array($values[$field_name]))
- {
- $user_options = explode("\n", $values[$field_name]);
- }
- else
- {
- $user_options = $values[$field_name];
- }
-
- $selected_options = array();
- foreach($user_options as $val)
- {
- $selected_options[$val] = htmlspecialchars_uni($val);
- }
-
- $select_options = explode("\n", $options);
- $options = array();
- if($search == true)
- {
- $select_options[''] = $lang->na;
- }
-
- foreach($select_options as $val)
- {
- $val = htmlspecialchars_uni(trim($val));
- $options[$val] = $val;
- }
- if(!$profile_field['length'])
- {
- $profile_field['length'] = 3;
- }
- $code = $form->generate_select_box("profile_fields[{$field_name}][]", $options, $selected_options, array('id' => "profile_field_{$field_name}", 'multiple' => true, 'size' => $profile_field['length']));
- break;
- case "select":
- $select_options = array();
- if($search == true)
- {
- $select_options[''] = $lang->na;
- }
- $select_options += explode("\n", $options);
- $options = array();
- foreach($select_options as $val)
- {
- $val = htmlspecialchars_uni(trim($val));
- $options[$val] = $val;
- }
- if(!$profile_field['length'])
- {
- $profile_field['length'] = 1;
- }
- if($search == true)
- {
- $code = $form->generate_select_box("profile_fields[{$field_name}][{$field_name}]", $options, htmlspecialchars_uni($values[$field_name]), array('id' => "profile_field_{$field_name}", 'size' => $profile_field['length']));
- }
- else
- {
- $code = $form->generate_select_box("profile_fields[{$field_name}]", $options, htmlspecialchars_uni($values[$field_name]), array('id' => "profile_field_{$field_name}", 'size' => $profile_field['length']));
- }
- break;
- case "radio":
- $radio_options = array();
- if($search == true)
- {
- $radio_options[''] = $lang->na;
- }
- $radio_options += explode("\n", $options);
- $code = '';
- foreach($radio_options as $val)
- {
- $val = trim($val);
- $code .= $form->generate_radio_button("profile_fields[{$field_name}]", $val, htmlspecialchars_uni($val), array('id' => "profile_field_{$field_name}", 'checked' => ($val == $values[$field_name] ? true : false)))."
";
- }
- break;
- case "checkbox":
- if(!is_array($values[$field_name]))
- {
- $user_options = explode("\n", $values[$field_name]);
- }
- else
- {
- $user_options = $values[$field_name];
- }
- foreach($user_options as $val)
- {
- $selected_options[$val] = $val;
- }
- $select_options = array();
- if($search == true)
- {
- $select_options[''] = $lang->na;
- }
- $select_options += explode("\n", $options);
- $code = '';
- foreach($select_options as $val)
- {
- $val = trim($val);
- $code .= $form->generate_check_box("profile_fields[{$field_name}][]", $val, htmlspecialchars_uni($val), array('id' => "profile_field_{$field_name}", 'checked' => ($val == $selected_options[$val] ? true : false)))."
";
- }
- break;
- case "textarea":
- $extra = '';
- if(isset($mybb->input['action']) && $mybb->input['action'] == "search")
- {
- $extra = " {$lang->or} ".$form->generate_check_box("profile_fields[{$field_name}_blank]", 1, $lang->is_not_blank, array('id' => "{$field_name}_blank", 'checked' => $values[$field_name.'_blank']));
- }
-
- $code = $form->generate_text_area("profile_fields[{$field_name}]", $values[$field_name], array('id' => "profile_field_{$field_name}", 'rows' => 6, 'cols' => 50)).$extra;
- break;
- default:
- $extra = '';
- if(isset($mybb->input['action']) && $mybb->input['action'] == "search")
- {
- $extra = " {$lang->or} ".$form->generate_check_box("profile_fields[{$field_name}_blank]", 1, $lang->is_not_blank, array('id' => "{$field_name}_blank", 'checked' => $values[$field_name.'_blank']));
- }
-
- $code = $form->generate_text_box("profile_fields[{$field_name}]", $values[$field_name], array('id' => "profile_field_{$field_name}", 'maxlength' => $profile_field['maxlength'], 'length' => $profile_field['length'])).$extra;
- break;
- }
-
- $form_container->output_row($profile_field['name'], $profile_field['description'], $code, "", array('id' => "profile_field_{$field_name}"));
- $code = $user_options = $selected_options = $radio_options = $val = $options = '';
- }
-}
-
-/**
- * @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]', htmlspecialchars_uni($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 '
-
-
-';
-}
-
-/**
- * @param int $source_uid
- * @param int $destination_uid
- */
-function merge_thread_ratings($source_uid, $destination_uid)
-{
- global $db;
-
- $source_ratings = $dest_threads = $delete_list = $decrement_list = array();
-
- // Get all thread ratings from both accounts
- $query = $db->simple_select('threadratings', 'tid, uid, rid, rating', "uid IN ({$destination_uid}, {$source_uid})");
- while($rating = $db->fetch_array($query))
- {
- if($rating['uid'] == $destination_uid)
- {
- $dest_threads[] = $rating['tid'];
- }
- else
- {
- $source_ratings[] = $rating;
- }
- }
-
- // If there are duplicates, mark them for deletion
- foreach($source_ratings as $rating)
- {
- if(in_array($rating['tid'], $dest_threads))
- {
- $delete_list[] = $rating['rid'];
- $decrement_list[$rating['tid']][] = (int) $rating['rating'];
- }
- }
-
- // Attribute all of the source user's ratings to the destination user
- $db->update_query("threadratings", array("uid" => $destination_uid), "uid='{$source_uid}'");
-
- // Remove ratings previously given to recently acquired threads
- $query = $db->query("
- SELECT tr.rid, tr.rating, t.tid
- FROM {$db->table_prefix}threadratings tr
- LEFT JOIN {$db->table_prefix}threads t ON (t.tid=tr.tid)
- WHERE tr.uid='{$destination_uid}' AND tr.uid=t.uid
- ");
- while($rating = $db->fetch_array($query))
- {
- $delete_list[] = $rating['rid'];
- $decrement_list[$rating['tid']][] = (int) $rating['rating'];
- }
-
- // Delete the duplicate/disallowed ratings
- if(!empty($delete_list))
- {
- $imp = implode(',', $delete_list);
- $db->delete_query('threadratings', "rid IN ({$imp})");
- }
-
- // Correct the thread rating counters
- if(!empty($decrement_list))
- {
- foreach($decrement_list as $tid => $ratings)
- {
- $db->update_query('threads', array('numratings' => 'numratings-'.count($ratings), 'totalratings' => 'totalratings-'.array_sum($ratings)), "tid='{$tid}'", 1, true);
- }
- }
-}
diff --git a/html/forums/admin/styles/default/config.css b/html/forums/admin/styles/default/config.css
deleted file mode 100644
index 421013c..0000000
--- a/html/forums/admin/styles/default/config.css
+++ /dev/null
@@ -1,77 +0,0 @@
-/* language editor issue icons */
-.langeditor_ok {
- width: 16px;
- height: 16px;
- display: inline-block;
- margin: 1px;
- background: url(images/icons/tick.png) no-repeat;
-}
-
-.langeditor_nothingtocompare {
- width: 16px;
- height: 16px;
- display: inline-block;
- margin: 1px;
- background: url(images/icons/no_change.png) no-repeat;
-}
-
-.langeditor_warning {
- width: 16px;
- height: 16px;
- display: inline-block;
- margin: 1px;
- background: url(images/icons/warning.png) no-repeat;
-}
-
-/* language editor file list rows */
-.langeditor_editwithfile,
-.langeditor_phrases,
-.langeditor_editfile,
-.langeditor_issues,
-.langeditor_edit {
- font-weight: bold;
- text-align: center;
-}
-
-.langeditor_editwithfile,
-.langeditor_editfile {
- text-align: left;
-}
-
-.langeditor_edit,
-.langeditor_phrases {
- font-weight: normal;
-}
-
-/* language editor edit mode textareas */
-.langeditor_textarea_issue {
- border: 1px solid red;
-}
-
-.langeditor_textarea_editwith {
- background: #E0E0E0;
-}
-.langeditor_textarea_edit,
-.langeditor_textarea_editwith {
- width: 98%;
- padding: 4px;
-}
-
-/* language editor main page */
-.langeditor_info_name {
- font-weight: bold;
-}
-
-.langeditor_info_author {
- font-size: x-small;
-}
-
-.langeditor_rtl {
- direction: rtl;
- unicode-bidi: bidi-override;
-}
-
-.langeditor_ltr {
- direction: ltr;
- unicode-bidi: bidi-override;
-}
diff --git a/html/forums/admin/styles/default/forum.css b/html/forums/admin/styles/default/forum.css
deleted file mode 100644
index 38d2c3f..0000000
--- a/html/forums/admin/styles/default/forum.css
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Moderation Queue */
-.modqueue_message {
- overflow: auto;
- max-height: 250px;
-}
-
-.modqueue_controls {
- width: 270px;
- float: right;
- text-align: center;
- border: 1px solid #ccc;
- background: #fff;
- padding: 6px;
- font-weight: bold;
-}
-
-.modqueue_controls label {
- margin-right: 8px;
-}
-
-.label_radio_ignore, .label_radio_delete, .label_radio_approve {
- font-weight: bold;
-}
-
-.modqueue_meta {
- color: #444;
- font-size: 95%;
- margin-bottom: 8px;
-}
-
-.modqueue_mass {
- list-style: none;
- margin: 0;
- width: 150px;
- padding: 0;
-}
-
-.modqueue_mass li {
- margin-bottom: 4px;
- padding: 0;
-}
-
-.modqueue_mass li a {
- display: block;
- padding: 4px;
- border: 1px solid transparent;
-}
-
-.modqueue_mass li a:hover {
- background: #efefef;
- border: 1px solid #ccc;
- text-decoration: none;
-}
-
-.forum_settings_bit {
- margin-bottom: 8px;
-}
-
-.forum_settings_bit input {
- vertical-align: middle;
- margin-right: 8px;
-}
-
-.forum_settings_bit select,
-.forum_settings_bit input.text_input,
-.forum_settings_bit textarea {
- margin-top: 8px;
-}
-
-.forum_settings_bit label {
- font-weight: normal;
-}
-
-.forum_settings_bit small {
- padding-left: 25px;
-}
\ No newline at end of file
diff --git a/html/forums/admin/styles/default/home.css b/html/forums/admin/styles/default/home.css
deleted file mode 100644
index e84dc60..0000000
--- a/html/forums/admin/styles/default/home.css
+++ /dev/null
@@ -1,15 +0,0 @@
-#left_menu div.left_menu_box ul.online_admins li a {
- background: url('images/icons/user.png') no-repeat 15px 4px;
- padding-left: 37px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-#left_menu div.left_menu_box ul.online_admins li.mobile_user a {
- background: url('images/icons/mobile_user.png') no-repeat 15px 4px;
- padding-left: 37px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-}
\ No newline at end of file
diff --git a/html/forums/admin/styles/default/images/close.png b/html/forums/admin/styles/default/images/close.png
deleted file mode 100644
index 6ca5558f30408653ee50348fb5f3b851f6865807..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1048
zcmV+z1n2vSP)&&;+9HW$4(qgat`zheJgS`pks1v
z)j4rUyY6cu6I6Cml0DFAuf=+)uAgoHXUOf{KalV97B*RWB3j8uRjO|i#ZMuj%
zoUSdng}Y-#&xx*?KC2T{qw~k0$g^A13lIx4YZJCvQ%86D`nt%;KqS49TPWN8;NQ9K
zA33b^T4at-8*
zJ}#-z&;+9-$X7p>R9TJMW|>Ztt7&1y2=pkSmJT9-}z
z@;Q;ET1q>Q>Q#;IwqPXEhsH1OV?0`_WhWY%6^=b}iSD4)srGY`Pgij%HD=ezdxi3e
zZ>(4AUK`WP92C*FuoF|z1^Mb?lwV0+vPS5uo8#Cw@7^Ci6N)eVuK%*{vhQ^tH;3})
zkB6SdKFmR1W~wWx9s^{cIR@zFSa;&eu@}DhM5@TQUtWF9a1}d=4q#U0W1yZP#2}Ns
z^yRYFSPtQe;jQT7Qhh1Wcw*z(`u1>CI!b*3+x1vv=4K!;~x(
zq7lt0000%-h$kf*NbO;SC&1@=+oR+d+dYHZT
z!N(sHE}0yimfE;1bAblej&sUnb;IL@
z22DDrcU(Px&ryIyJT!EpiszE0y?5RxoD>ys@-hCsaN+57AL^ez4PZ`GW1bndtMN0?
Op$wj`elF{r5}E*27g)0Z
diff --git a/html/forums/admin/styles/default/images/icons/bullet_on.png b/html/forums/admin/styles/default/images/icons/bullet_on.png
deleted file mode 100644
index 6a97d238ce8a889b1aa334eaabf8246ceacc62e5..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 238
zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`TRmMILn;{G3T+iUY+!JD#wr72
zW8>tvm$ojyXml`k-?iE=GZoHkTasSKt#q$s|5Zm7Ax)RXfnwc9%~(3^ZZm2=FWT9h
zD3LHrO?}4MH2x#@ryUgp5_YXSoVE4P#f+A{as0<08w&i_VYi!~zd1r@#|ft3l~-O)
zJDuwHXS2+X7`+9XVt{{8ZsWuw`KLc%(Y3!
k*fkJnW!(e0Ke956Q(E^KOX*hE13kdt>FVdQ&MBb@04z0JssI20
diff --git a/html/forums/admin/styles/default/images/icons/cross.png b/html/forums/admin/styles/default/images/icons/cross.png
deleted file mode 100644
index ba0bce78b02706c738b39d845115041448d5e752..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 385
zcmV-{0e=38P)kdh48AmctB=n`vMMFWUd6nN*n
z6DJoO7s2f(LTIX>@Kgvj7&x`U
fpXB-6sFE82zTp!z>hC`j00000NkvXXu0mjfirlP<
diff --git a/html/forums/admin/styles/default/images/icons/custom.png b/html/forums/admin/styles/default/images/icons/custom.png
deleted file mode 100644
index 8f49806eacc954ca219bcc9618bcf97fa0cd908d..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 543
zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbMf{{Wv5*Z=?jhk!vqKtNz%Advj^
z>(|$>U%kD(%gV}Ly?T|HnCRo<^X%DEcX#&(4<4L8ed_7cCtJ2`dGh4RojZ5z?d^ku
zgD+mZaN)xFd-v`>di2o3!ot$ha^b=SSFT)Mwrr`6j*gL$(U~)+_wV0#{P?j;moDk*
z>S=3hA31Vl_wL=7FJCh-Fj7@jRZ&ryJbB9b^H(-)+GA{NCMzpzWMq8o*qOb158u4`
zXzl3J3@sJ9e3qlarg9o1LBg
z`t|3RFFyi$5e`^cS%KnkE}S7*HmeuN2`vfo3udrPx5||M|KEDT|Elc&xxkRQ{r|sA
z9gzNSUwr5P^{HhbW_u-&XmYK&|NnfgLJvr!35Xy3_gwOSV(WjecBTLSS;V!C<2!XF
zn0UmbYLw-AfEHAFx;TbZFy@|X7i=~VX-+iv)SoUmqsj2Z)-z{#cn-+C%zOFg3;zb$
zJN~jY9RGL?7ryb>*f`N-W1QB8?aGmkdsS8*P}p~ALSsl?>{MlK1IBZVoua3B4f-4^
zCnhq+Csz92E}m_`ocr=XOoEk1?#o;9%Xz|tG&dI;d}ol`%Dv>%#;M1%e?EHjAT#Ssl=sKm
zS099X+(}D47V7vi()U_o)V=`oyJ@NCV*>a4n_o?e+UIY6J|V!luG;`brmc$y>mqNCu3Vt_`UugI)5%7WL)^Fqe&EK
OD1)b~pUXO@geCw#gHq%G
diff --git a/html/forums/admin/styles/default/images/icons/default.png b/html/forums/admin/styles/default/images/icons/default.png
deleted file mode 100644
index 4f3e27d9cce04af0c06c584ff36660d244856c56..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 307
zcmV-30nGl1P)L08{{UBM-*_
zR&9#0GBMP-(9vXDQV^sN5qv@j32(*m8U>FExHSsb*5JBE
z2INuzAp{=C0V{tAyuZ_(0@)joYyI0B1>n8U-hf=|OD3?^f?WIZ_{cbL&V7tzFM#y2
zyuEVpqFnY1vNF>DH#aXb0%=Yl<^{QmMExK?f2KG)0|3kW`64W~)jt3L002ovPDHLk
FV1g62g^d6J
diff --git a/html/forums/admin/styles/default/images/icons/delete.png b/html/forums/admin/styles/default/images/icons/delete.png
deleted file mode 100644
index e07ffcff87e2c6010bbe8fa6ffb54dae610fdb01..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 601
zcmV-f0;c_mP)0Uw`zu_r|@qT{myM?6`H~W&5p?+MV*m2$=gs=udZ0v49v;vg7zpi)cJ~%f8y8S7sfOa1fn{0Pl{&^uS*{l!
z6T!+BAamvXkf%YxR#RUeP7Ltj{3!e19tf%-M@Qo3PmOA5-G;_824j}zA>!Fo^6&1a-x{jw2ePC5uF68{O2@#HFRBtpfl=
n4%@KngvsT%E4WLKCjI^fvHUJcab)XL00000NkvXXu0mjf-9{P<
diff --git a/html/forums/admin/styles/default/images/icons/error.png b/html/forums/admin/styles/default/images/icons/error.png
deleted file mode 100644
index c18dbc389791479a9c7cc8e2e2f761f33d0abab2..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 580
zcmV-K0=xZ*P)}xt)ZahLJz;`rA3a){
zMvj!?UcKbg$Cx$Ss8Qk?Inq4h=a)r|HrS2*6?X1?hkq;W(?`hd?%lNkVqLEqI8bi2
zZheOuZLnRbBXt7@8d*Jh2qEWNx0Z(wABw}_kliscvNJML$llmkx!9tGL5()pjFZOS
zts7ms$kq1kStLy%-UpIZ7CR!-Npd9
z1b7C|pFd};>ttU*z#VF|!6IDAaxbr}ocMUN7^^78&`m%wVO&gD4+}Gwd3t71qYcO$
zJdUN_-WBL|B9|YwV5v
z(No6f4dOtXM5X%nQ)=!MrB0;dqzPlz*uzXa5KqmQ2A&`o#Dc`%5XV_+sC@?=%mrU=
S<3L^j0000*?j2&Sd1n}BA+qP}nwu9PkP}>O3wr$(CZ6n(Lzw^Uh@>|Z#=~-J_Q`p$p
zr~^mfvwK!Y&-XI8WeW=n4p(55Cm3!qq
z?W4<;|3VXgpd8r&EiEng^qRp~G=Qh5Wi%P($PTEgs@}?Poyy+}qwh+rvS+Rg<;V`m
z%gg)ZHVh@cAlCsKuUS3{mlCqML5}UHJ^1ZmY1dLxm=-rQheqke%
z^QChuTkT`h3uXR+AyNGN0xu{iCQTUc1VEiJ9ZI5;>zLx|^K9N*r*&B)!|`+HMUA0{d){ujzpBw-wTf3*AE
z-P4$wnwCG5wMm2c(AOCn8X9eCYUV0r$trsTigA|Cv*O-ow(}}HHUua874IJIL@x=-n-8u0G
zoa?M|$E~GKn3$|j{0^S*HKrm|T^D77d(Zh|;`uacr+6JGOc7Y6!C~@zQZ)hjdn;^A1NRoG*6d#l)iH;2a}W@Hw6*DPG+@e^q{5SAE|<
zmv{uH=bG$;b5GMvF!3^l6``B>7x2Q@a6OLf9wcb@y~r}h_Y$-QT^^8Q=>l6k
zJUq;_)!i7ZdETf0NUG`;+Hr>#yn_}i+C+;L>%XgObawoU)iy~rk_Aamg)>ZXLqh{5
zCLgF(dtjw<7fcy%Oa)pXeH<;6BlEvxftzMp!!x_^LS|iJt&AtF|H=jB(+VcZ+YX&k
zpbR%ABb{|QNOg4?D6Fi5W3w%Q=1o#(alLfWJg1@GtF{;G#6MuxCHAiC!xp&>11!#U
z*XfgPmH@EyvrGb-EhO3~^$9l3c!|jeD&aRsU8czg=2;EcIPEDW_uy;L>jVwy<4y(C
zDbIAo5)_R%q62sB+9d@HBbMN3>XcU+ecU;p+;M1%@4UL&zN4UZTmIAw
zU8QT17TlbgwkR}gy2qiL2MSlkWh@DI@3Sdd9UnQ<%e+~?Wm{g!>IAO|ww5ghrE3zc
zS`9Cze|iiwjj<%iFPOpM*^M+H$Ia8lF{FZVEx$9<0fvm7Y5)GO-u&*S)+dGu58fMd
z|EUQz`|)ef#N+DmVbM$Ml&kkOW|&`{D{9LhUEO1I*Y@+X{E4cQ=0z~>vt?W|_tF$e
Ppot8gu6{1-oD!M
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/html/forums/admin/styles/default/images/icons/logout.png b/html/forums/admin/styles/default/images/icons/logout.png
deleted file mode 100644
index 2f86a302d32ca53e3ceccdd795c14eef92dddca1..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 352
zcmV-m0iXVfP){P36mWrsfhFWC3-f7cnm;Xntd-xxu4u~-g5YOB)Q!Hci8EjZ})0h7S+rRz?v4QGhND4&$xRqzbcm4kl
zq6Okt#gH5eoS_TOfH1pbCH`mx0%jl<1Y%_%HUwg05N5V6UdC*kTmoe40kJF)a|1CW
yHUpS|m=lPFfLIcUrO>cA5c2~u8_0mclbHbBZbn?p7Dd2e3J~9A_b1IG8+si>NII2h@|}Xj*f-mw*1cCgJoAYtuw4Xb4Ir5J#Mip>n&Txph59tSQmt#IyCKjqFej5
zr{od&Ak`q%rTc7dRb=Re53rVeQRL@R?Mtq|mUL=6j$1ViA{mCE%+75}&)y5TUgA>a
z8=xTM7v+PfG9|e361sGnOlDRCH2Y2vCJAX-jp)&LA(vkoRC*ftx>Tg#;?syOU8mxv
z7or)>nqd%#Fpder5GTEew%ulO?&1azkpdGC`fKREphMRw*iJsa+G|OPW=(Agl)zJy
zUJy{}Tl5{ig7maBzD!+xJ$X_ka%=t}Qp)@KEbu>h3w17epyfy?+A2!mTJ>!W%>47hHP=H)wfl(Mn1GH|f5F>rBkz%e%`Cj%EdI|B!h
z%>k6xkBm&e3DJWv;P2nRN~>nhWDs;Ihlv33S1?8gR~bT0SQysN0+2D0@J=L*P`v7AV`G
z{aqEPs}&HGJ)k{Epzp7sm0p5F1;a3SD>&M_)?0x&+yMhATR7NBpwG+x2Jp{^PAw(I
zfievOV5S9z@1MDV`ow_T&mfaP27owg7A#nhz;I6B0m01t_30C+o<9I`U%PB{ICZZ8
O0000!VaUKEO
z&_oQNtUE&B-2MIYL;PgU6Tl4(UZn&4CbjPTW{v#<58qm)(Y^256s`9V(B1D^^u{uc
z;30!-@c_!}iI4
z|2{wU-#7WPLNMJ@kHP?*{NqVkSy_Ni{Pw^A-BgPtWKK)_C8L8be)agpZ{^R+_|YZ#
zprV1p-<&BdEG!!w`s!3PfXoG1e?kXc3=HLmY`DbFeW=CHf2P7MdMm@0e)-8({Q5L_
z@Zg<*E&ugd(0;)~23d5_#XwDgZUVh?M-6WJuk{?YI$-10000{P36mWrsfhFWC3-f7cnm;Xntd-xxu4u~-g5YOB)Q!Hci8EjZ})0h7S+rRz?v4QGhND4&$xRqzbcm4kl
zq6Okt#gH5eoS_TOfH1pbCH`mx0%jl<1Y%_%HUwg05N5V6UdC*kTmoe40kJF)a|1CW
yHUpS|m=lPFfLIcUrO>cA5c2~u8_0mclbHbBZAk$%h
zk&%(1wzl>PpmC~3h!_Zf6Zhcm+F%t?;Uo49M~m02c6Y!R<$_K#mGnTU*2Z{XJGzR@ib3;#mT?1&oc2A*v;xX$71)s?EHG
z@$qp)wW$FwFE0w8@Y2!}5AIJ(oP1OO-?}YIb
ZAcp7LB%OJ5{nS84d%F6$taD0e0suAID+2%k
diff --git a/html/forums/admin/styles/default/images/icons/run_task.png b/html/forums/admin/styles/default/images/icons/run_task.png
deleted file mode 100644
index 3262eaebe1b1e416b7d11473b547731dbbcac233..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 696
zcmV;p0!RIcP)!pv8Qe&A1gxO8!5x)L`R=Q`l=XpAyJyDKizZByLUbqxY;EiZD55~Jf
z+OlPfH2^d0aD!VoaA{RP+PZZ@>F5h5SF>a?vEI+mDy>yR`=X;o*$E&TLMB
z1DEjfL5Le}I$esrT(@proC4JihWHQ<>Lqn)Qu*W*{l$FvLi