Vergleich admin/modules/config/spiders.php - 1.8.0 - 1.8.35

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 38Zeile 38
		{
$new_spider = array(
"name" => $db->escape_string($mybb->input['name']),

		{
$new_spider = array(
"name" => $db->escape_string($mybb->input['name']),

				"theme" => (int)$mybb->input['theme'],

				"theme" => $mybb->get_input('theme', MyBB::INPUT_INT),

				"language" => $db->escape_string($mybb->input['language']),

				"language" => $db->escape_string($mybb->input['language']),

				"usergroup" => (int)$mybb->input['usergroup'],

				"usergroup" => $mybb->get_input('usergroup', MyBB::INPUT_INT),

				"useragent" => $db->escape_string($mybb->input['useragent']),
"lastvisit" => 0
);
$sid = $db->insert_query("spiders", $new_spider);


				"useragent" => $db->escape_string($mybb->input['useragent']),
"lastvisit" => 0
);
$sid = $db->insert_query("spiders", $new_spider);


			$cache->update_spiders();

$plugins->run_hooks("admin_config_spiders_add_commit");


			$plugins->run_hooks("admin_config_spiders_add_commit");

$cache->update_spiders();


			// Log admin action
log_admin_action($sid, $mybb->input['name']);

			// Log admin action
log_admin_action($sid, $mybb->input['name']);





			flash_message($lang->success_bot_created, 'success');
admin_redirect("index.php?module=config-spiders");
}

			flash_message($lang->success_bot_created, 'success');
admin_redirect("index.php?module=config-spiders");
}

Zeile 70Zeile 70
		'link' => "index.php?module=config-spiders&action=add",
'description' => $lang->add_new_bot_desc
);

		'link' => "index.php?module=config-spiders&action=add",
'description' => $lang->add_new_bot_desc
);





	$page->output_nav_tabs($sub_tabs, "add_spider");

	$page->output_nav_tabs($sub_tabs, "add_spider");





	$form = new Form("index.php?module=config-spiders&action=add", "post");

	$form = new Form("index.php?module=config-spiders&action=add", "post");


if($errors)
{


if($errors)
{

		$page->output_inline_error($errors);

		$page->output_inline_error($errors);

	}


	}


	$form_container = new FormContainer($lang->add_new_bot);

	$form_container = new FormContainer($lang->add_new_bot);

	$form_container->output_row($lang->name." <em>*</em>", $lang->name_desc, $form->generate_text_box('name', $mybb->input['name'], array('id' => 'name')), 'name');
$form_container->output_row($lang->user_agent." <em>*</em>", $lang->user_agent_desc, $form->generate_text_box('useragent', $mybb->input['useragent'], array('id' => 'useragent')), 'useragent');

	$form_container->output_row($lang->name." <em>*</em>", $lang->name_desc, $form->generate_text_box('name', $mybb->get_input('name'), array('id' => 'name')), 'name');
$form_container->output_row($lang->user_agent." <em>*</em>", $lang->user_agent_desc, $form->generate_text_box('useragent', $mybb->get_input('useragent'), array('id' => 'useragent')), 'useragent');


$languages = array('' => $lang->use_board_default);
$languages = array_merge($languages, $lang->get_languages());


$languages = array('' => $lang->use_board_default);
$languages = array_merge($languages, $lang->get_languages());

	$form_container->output_row($lang->language_str, $lang->language_desc, $form->generate_select_box("language", $languages, $mybb->input['language'], array("id" => "language")), 'language');

$form_container->output_row($lang->theme, $lang->theme_desc, build_theme_select("theme", $mybb->input['theme'], 0, "", true));


	$form_container->output_row($lang->language_str, $lang->language_desc, $form->generate_select_box("language", $languages, $mybb->get_input('language'), array("id" => "language")), 'language');

$form_container->output_row($lang->theme, $lang->theme_desc, build_theme_select("theme", $mybb->get_input('theme'), 0, "", true, false, true));


	$query = $db->simple_select("usergroups", "*", "", array("order_by" => "title", "order_dir" => "asc"));

$usergroups = array();

	$query = $db->simple_select("usergroups", "*", "", array("order_by" => "title", "order_dir" => "asc"));

$usergroups = array();

Zeile 97Zeile 97
	{
$usergroups[$usergroup['gid']] = $usergroup['title'];
}

	{
$usergroups[$usergroup['gid']] = $usergroup['title'];
}

	if(!$mybb->input['usergroup'])

	if(!$mybb->get_input('usergroup'))

	{
$mybb->input['usergroup'] = 1;
}
$form_container->output_row($lang->user_group, $lang->user_group_desc, $form->generate_select_box("usergroup", $usergroups, $mybb->input['usergroup'], array("id" => "usergroup")), 'usergroup');

	{
$mybb->input['usergroup'] = 1;
}
$form_container->output_row($lang->user_group, $lang->user_group_desc, $form->generate_select_box("usergroup", $usergroups, $mybb->input['usergroup'], array("id" => "usergroup")), 'usergroup');



$form_container->end();
$buttons[] = $form->generate_submit_button($lang->save_bot);
$form->output_submit_wrapper($buttons);
$form->end();

$page->output_footer();
}




$form_container->end();
$buttons[] = $form->generate_submit_button($lang->save_bot);
$form->output_submit_wrapper($buttons);
$form->end();

$page->output_footer();
}


if($mybb->input['action'] == "delete")
{

if($mybb->input['action'] == "delete")
{

	$query = $db->simple_select("spiders", "*", "sid='".$mybb->get_input('sid', 1)."'");

	$query = $db->simple_select("spiders", "*", "sid='".$mybb->get_input('sid', MyBB::INPUT_INT)."'");

	$spider = $db->fetch_array($query);

	$spider = $db->fetch_array($query);





	// Does the spider not exist?
if(!$spider['sid'])

	// Does the spider not exist?
if(!$spider['sid'])

	{

	{

		flash_message($lang->error_invalid_bot, 'error');

		flash_message($lang->error_invalid_bot, 'error');

		admin_redirect("index.php?module=config-spiders");
}

		admin_redirect("index.php?module=config-spiders");
}


// User clicked no


// User clicked no

	if($mybb->input['no'])
{

	if($mybb->get_input('no'))
{

		admin_redirect("index.php?module=config-spiders");
}


		admin_redirect("index.php?module=config-spiders");
}


Zeile 136Zeile 136
	{
// Delete the spider
$db->delete_query("spiders", "sid='{$spider['sid']}'");

	{
// Delete the spider
$db->delete_query("spiders", "sid='{$spider['sid']}'");


$cache->update_spiders();






		$plugins->run_hooks("admin_config_spiders_delete_commit");

		$plugins->run_hooks("admin_config_spiders_delete_commit");

 

$cache->update_spiders();


// Log admin action
log_admin_action($spider['sid'], $spider['name']);


// Log admin action
log_admin_action($spider['sid'], $spider['name']);

Zeile 155Zeile 155

if($mybb->input['action'] == "edit")
{


if($mybb->input['action'] == "edit")
{

	$query = $db->simple_select("spiders", "*", "sid='".$mybb->get_input('sid', 1)."'");

	$query = $db->simple_select("spiders", "*", "sid='".$mybb->get_input('sid', MyBB::INPUT_INT)."'");

	$spider = $db->fetch_array($query);

// Does the spider not exist?

	$spider = $db->fetch_array($query);

// Does the spider not exist?

Zeile 175Zeile 175
		}

if(!trim($mybb->input['useragent']))

		}

if(!trim($mybb->input['useragent']))

		{

		{

			$errors[] = $lang->error_missing_agent;
}


			$errors[] = $lang->error_missing_agent;
}


Zeile 183Zeile 183
		{
$updated_spider = array(
"name" => $db->escape_string($mybb->input['name']),

		{
$updated_spider = array(
"name" => $db->escape_string($mybb->input['name']),

				"theme" => (int)$mybb->input['theme'],

				"theme" => $mybb->get_input('theme', MyBB::INPUT_INT),

				"language" => $db->escape_string($mybb->input['language']),

				"language" => $db->escape_string($mybb->input['language']),

				"usergroup" => (int)$mybb->input['usergroup'],

				"usergroup" => $mybb->get_input('usergroup', MyBB::INPUT_INT),

				"useragent" => $db->escape_string($mybb->input['useragent'])
);

				"useragent" => $db->escape_string($mybb->input['useragent'])
);

 

$plugins->run_hooks("admin_config_spiders_edit_commit");


			$db->update_query("spiders", $updated_spider, "sid='{$spider['sid']}'");

$cache->update_spiders();

			$db->update_query("spiders", $updated_spider, "sid='{$spider['sid']}'");

$cache->update_spiders();


$plugins->run_hooks("admin_config_spiders_edit_commit");

 

// Log admin action
log_admin_action($spider['sid'], $mybb->input['name']);


// Log admin action
log_admin_action($spider['sid'], $mybb->input['name']);

Zeile 233Zeile 234
	$languages = array_merge($languages, $lang->get_languages());
$form_container->output_row($lang->language_str, $lang->language_desc, $form->generate_select_box("language", $languages, $spider_data['language'], array("id" => "language")), 'language');


	$languages = array_merge($languages, $lang->get_languages());
$form_container->output_row($lang->language_str, $lang->language_desc, $form->generate_select_box("language", $languages, $spider_data['language'], array("id" => "language")), 'language');


	$form_container->output_row($lang->theme, $lang->theme_desc, build_theme_select("theme", $spider_data['theme'], 0, "", true));

	$form_container->output_row($lang->theme, $lang->theme_desc, build_theme_select("theme", $spider_data['theme'], 0, "", true, false, true));


$query = $db->simple_select("usergroups", "*", "", array("order_by" => "title", "order_dir" => "asc"));
while($usergroup = $db->fetch_array($query))
{
$usergroups[$usergroup['gid']] = $usergroup['title'];


$query = $db->simple_select("usergroups", "*", "", array("order_by" => "title", "order_dir" => "asc"));
while($usergroup = $db->fetch_array($query))
{
$usergroups[$usergroup['gid']] = $usergroup['title'];

	}

	}

	if(!$spider_data['usergroup'])
{
$spider_data['usergroup'] = 1;

	if(!$spider_data['usergroup'])
{
$spider_data['usergroup'] = 1;

Zeile 271Zeile 272
	);

$page->output_nav_tabs($sub_tabs, "spiders");

	);

$page->output_nav_tabs($sub_tabs, "spiders");

 

$query = $db->simple_select("spiders", "COUNT(sid) AS spiders");
$total_rows = $db->fetch_field($query, "spiders");

$pagenum = $mybb->get_input('page', MyBB::INPUT_INT);
if($pagenum)
{
$start = ($pagenum - 1) * 20;
$pages = ceil($total_rows / 20);
if($pagenum > $pages)
{
$start = 0;
$pagenum = 1;
}
}
else
{
$start = 0;
$pagenum = 1;
}


$table = new Table;
$table->construct_header($lang->bot);
$table->construct_header($lang->last_visit, array("class" => "align_center", "width" => 200));
$table->construct_header($lang->controls, array("class" => "align_center", "width" => 150, "colspan" => 2));



$table = new Table;
$table->construct_header($lang->bot);
$table->construct_header($lang->last_visit, array("class" => "align_center", "width" => 200));
$table->construct_header($lang->controls, array("class" => "align_center", "width" => 150, "colspan" => 2));


	$query = $db->simple_select("spiders", "*", "", array("order_by" => "lastvisit", "order_dir" => "desc"));

	$query = $db->simple_select("spiders", "*", "", array('limit_start' => $start, 'limit' => 20, "order_by" => "lastvisit", "order_dir" => "desc"));

	while($spider = $db->fetch_array($query))
{
$lastvisit = $lang->never;

	while($spider = $db->fetch_array($query))
{
$lastvisit = $lang->never;

Zeile 287Zeile 308
		{
$lastvisit = my_date('relative', $spider['lastvisit']);
}

		{
$lastvisit = my_date('relative', $spider['lastvisit']);
}





		$table->construct_cell("<a href=\"index.php?module=config-spiders&amp;action=edit&amp;sid={$spider['sid']}\"><strong>{$spider['name']}</strong></a>");
$table->construct_cell($lastvisit, array("class" => "align_center", "width" => 200));
$table->construct_cell("<a href=\"index.php?module=config-spiders&amp;action=edit&amp;sid={$spider['sid']}\">{$lang->edit}</a>", array("class" => "align_center", "width" => 75));
$table->construct_cell("<a href=\"index.php?module=config-spiders&amp;action=delete&amp;sid={$spider['sid']}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_bot_deletion}');\">{$lang->delete}</a>", array("class" => "align_center", "width" => 75));

		$table->construct_cell("<a href=\"index.php?module=config-spiders&amp;action=edit&amp;sid={$spider['sid']}\"><strong>{$spider['name']}</strong></a>");
$table->construct_cell($lastvisit, array("class" => "align_center", "width" => 200));
$table->construct_cell("<a href=\"index.php?module=config-spiders&amp;action=edit&amp;sid={$spider['sid']}\">{$lang->edit}</a>", array("class" => "align_center", "width" => 75));
$table->construct_cell("<a href=\"index.php?module=config-spiders&amp;action=delete&amp;sid={$spider['sid']}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_bot_deletion}');\">{$lang->delete}</a>", array("class" => "align_center", "width" => 75));

		$table->construct_row();
}


		$table->construct_row();
}


	if($table->num_rows() == 0)
{
$table->construct_cell($lang->no_bots, array("colspan" => 4));

	if($table->num_rows() == 0)
{
$table->construct_cell($lang->no_bots, array("colspan" => 4));

Zeile 302Zeile 323
	}

$table->output($lang->spiders_bots);

	}

$table->output($lang->spiders_bots);

 

echo "<br />".draw_admin_pagination($pagenum, "20", $total_rows, "index.php?module=config-spiders&amp;page={page}");


	$page->output_footer();
}

	$page->output_footer();
}