Vergleich admin/modules/tools/tasks.php - 1.8.4 - 1.8.27

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 23Zeile 23
/**
* Validates a string or array of values
*

/**
* Validates a string or array of values
*

 * @param mixed Comma-separated list or array of values
* @param int Minimum value
* @param int Maximum value
* @param string Set "string" to return in a comma-separated list, or "array" to return in an array
* @return mixed String or array of valid values OR false if string/array is invalid

 * @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)
{

 */
function check_time_values($value, $min, $max, $return_type)
{

Zeile 79Zeile 79
			$errors[] = $lang->error_missing_description;
}


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


		if(!file_exists(MYBB_ROOT."inc/tasks/".$mybb->input['file'].".php"))




		$file = $mybb->get_input('file');
$file = basename($file, '.php');

if(!file_exists(MYBB_ROOT."inc/tasks/".$file.".php"))

		{
$errors[] = $lang->error_invalid_task_file;

		{
$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['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)


$mybb->input['hour'] = check_time_values($mybb->input['hour'], 0, 59, 'string');
if($mybb->input['hour'] === false)

Zeile 102Zeile 105
			if($mybb->input['day'] === false)
{
$errors[] = $lang->error_invalid_day;

			if($mybb->input['day'] === false)
{
$errors[] = $lang->error_invalid_day;

			}

			}

			$mybb->input['weekday'] = array('*');
}
else

			$mybb->input['weekday'] = array('*');
}
else

Zeile 115Zeile 118
			$mybb->input['day'] = '*';
}


			$mybb->input['day'] = '*';
}


		$mybb->input['month'] = check_time_values($mybb->input['month'], 1, 12, 'array');

		$mybb->input['month'] = check_time_values($mybb->get_input('month', MyBB::INPUT_ARRAY), 1, 12, 'array');

		if($mybb->input['month'] === false)
{
$errors[] = $lang->error_invalid_month;

		if($mybb->input['month'] === false)
{
$errors[] = $lang->error_invalid_month;

Zeile 126Zeile 129
			$new_task = array(
"title" => $db->escape_string($mybb->input['title']),
"description" => $db->escape_string($mybb->input['description']),

			$new_task = array(
"title" => $db->escape_string($mybb->input['title']),
"description" => $db->escape_string($mybb->input['description']),

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

				"file" => $db->escape_string($file),

				"minute" => $db->escape_string($mybb->input['minute']),
"hour" => $db->escape_string($mybb->input['hour']),
"day" => $db->escape_string($mybb->input['day']),

				"minute" => $db->escape_string($mybb->input['minute']),
"hour" => $db->escape_string($mybb->input['hour']),
"day" => $db->escape_string($mybb->input['day']),

Zeile 144Zeile 147
			$cache->update_tasks();

// Log admin action

			$cache->update_tasks();

// Log admin action

			log_admin_action($tid, htmlspecialchars_uni($mybb->input['title']));

			log_admin_action($tid, $mybb->input['title']);


flash_message($lang->success_task_created, 'success');
admin_redirect("index.php?module=tools-tasks");


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);


	$page->add_breadcrumb_item($lang->add_new_task);
$page->output_header($lang->scheduled_tasks." - ".$lang->add_new_task);


Zeile 185Zeile 188
		$mybb->input['month'] = '*';
}
$form_container = new FormContainer($lang->add_new_task);

		$mybb->input['month'] = '*';
}
$form_container = new FormContainer($lang->add_new_task);

	$form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->short_description." <em>*</em>", "", $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description');

	$form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('title', $mybb->get_input('title'), array('id' => 'title')), 'title');
$form_container->output_row($lang->short_description." <em>*</em>", "", $form->generate_text_box('description', $mybb->get_input('description'), array('id' => 'description')), 'description');


$task_list = array();
$task_files = scandir(MYBB_ROOT."inc/tasks/");


$task_list = array();
$task_files = scandir(MYBB_ROOT."inc/tasks/");

Zeile 196Zeile 199
		{
$file_id = preg_replace("#\.".get_extension($task_file)."$#i", "$1", $task_file);
$task_list[$file_id] = $task_file;

		{
$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." <em>*</em>", $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');

	$form_container->output_row($lang->task_file." <em>*</em>", $lang->task_file_desc, $form->generate_select_box("file", $task_list, $mybb->get_input('file'), array('id' => 'file')), 'file');
$form_container->output_row($lang->time_minutes, $lang->time_minutes_desc, $form->generate_text_box('minute', $mybb->get_input('minute'), array('id' => 'minute')), 'minute');
$form_container->output_row($lang->time_hours, $lang->time_hours_desc, $form->generate_text_box('hour', $mybb->get_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->get_input('day'), array('id' => 'day')), 'day');


$options = array(
"*" => $lang->every_weekday,


$options = array(
"*" => $lang->every_weekday,

Zeile 230Zeile 233
		"11" => $lang->november,
"12" => $lang->december
);

		"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->time_months, $lang->time_months_desc, $form->generate_select_box('month[]', $options, $mybb->get_input('month', MyBB::INPUT_ARRAY), array('id' => 'month', 'multiple' => true, 'size' => 13)), 'month');





	$form_container->output_row($lang->enable_logging." <em>*</em>", "", $form->generate_yes_no_radio("logging", $mybb->input['logging'], true));

	$form_container->output_row($lang->enable_logging." <em>*</em>", "", $form->generate_yes_no_radio("logging", $mybb->get_input('logging'), true));





	$form_container->output_row($lang->enabled." <em>*</em>", "", $form->generate_yes_no_radio("enabled", $mybb->input['enabled'], true));

	$form_container->output_row($lang->enabled." <em>*</em>", "", $form->generate_yes_no_radio("enabled", $mybb->get_input('enabled'), true));

	$form_container->end();

$buttons[] = $form->generate_submit_button($lang->save_task);

	$form_container->end();

$buttons[] = $form->generate_submit_button($lang->save_task);

Zeile 271Zeile 274
			$errors[] = $lang->error_missing_description;
}


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


		if(!file_exists(MYBB_ROOT."inc/tasks/".$mybb->input['file'].".php"))




        $file = $mybb->get_input('file');
$file = basename($file, '.php');

if(!file_exists(MYBB_ROOT."inc/tasks/".$file.".php"))

		{
$errors[] = $lang->error_invalid_task_file;
}

		{
$errors[] = $lang->error_invalid_task_file;
}

Zeile 307Zeile 313
			$mybb->input['day'] = '*';
}


			$mybb->input['day'] = '*';
}


		$mybb->input['month'] = check_time_values($mybb->input['month'], 1, 12, 'array');

		$mybb->input['month'] = check_time_values($mybb->get_input('month', MyBB::INPUT_ARRAY), 1, 12, 'array');

		if($mybb->input['month'] === false)
{
$errors[] = $lang->error_invalid_month;

		if($mybb->input['month'] === false)
{
$errors[] = $lang->error_invalid_month;

Zeile 326Zeile 332
			$updated_task = array(
"title" => $db->escape_string($mybb->input['title']),
"description" => $db->escape_string($mybb->input['description']),

			$updated_task = array(
"title" => $db->escape_string($mybb->input['title']),
"description" => $db->escape_string($mybb->input['description']),

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

				"file" => $db->escape_string($file),

				"minute" => $db->escape_string($mybb->input['minute']),
"hour" => $db->escape_string($mybb->input['hour']),
"day" => $db->escape_string($mybb->input['day']),

				"minute" => $db->escape_string($mybb->input['minute']),
"hour" => $db->escape_string($mybb->input['hour']),
"day" => $db->escape_string($mybb->input['day']),

Zeile 345Zeile 351
			$cache->update_tasks();

// Log admin action

			$cache->update_tasks();

// Log admin action

			log_admin_action($task['tid'], htmlspecialchars_uni($mybb->input['title']));

			log_admin_action($task['tid'], $mybb->input['title']);


flash_message($lang->success_task_updated, 'success');



flash_message($lang->success_task_updated, 'success');


Zeile 460Zeile 466
	}

// User clicked no

	}

// User clicked no

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

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

	{
admin_redirect("index.php?module=tools-tasks");
}

	{
admin_redirect("index.php?module=tools-tasks");
}

Zeile 480Zeile 486
		$cache->update_tasks();

// Log admin action

		$cache->update_tasks();

// Log admin action

		log_admin_action($task['tid'], htmlspecialchars_uni($task['title']));

		log_admin_action($task['tid'], $task['title']);


flash_message($lang->success_task_deleted, 'success');
admin_redirect("index.php?module=tools-tasks");


flash_message($lang->success_task_deleted, 'success');
admin_redirect("index.php?module=tools-tasks");

Zeile 523Zeile 529
		if($task['file'] == "backupdb" || $task['file'] == "checktables")
{
// User clicked no

		if($task['file'] == "backupdb" || $task['file'] == "checktables")
{
// User clicked no

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

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

			{
admin_redirect("index.php?module=tools-tasks");
}

			{
admin_redirect("index.php?module=tools-tasks");
}

Zeile 538Zeile 544
				$cache->update_tasks();

// Log admin action

				$cache->update_tasks();

// Log admin action

				log_admin_action($task['tid'], htmlspecialchars_uni($task['title']), $mybb->input['action']);

				log_admin_action($task['tid'], $task['title'], $mybb->input['action']);


flash_message($lang->success_task_enabled, 'success');
admin_redirect("index.php?module=tools-tasks");


flash_message($lang->success_task_enabled, 'success');
admin_redirect("index.php?module=tools-tasks");

Zeile 558Zeile 564
			$cache->update_tasks();

// Log admin action

			$cache->update_tasks();

// Log admin action

			log_admin_action($task['tid'], htmlspecialchars_uni($task['title']), $mybb->input['action']);

			log_admin_action($task['tid'], $task['title'], $mybb->input['action']);


flash_message($lang->success_task_enabled, 'success');
admin_redirect("index.php?module=tools-tasks");


flash_message($lang->success_task_enabled, 'success');
admin_redirect("index.php?module=tools-tasks");

Zeile 573Zeile 579
		$cache->update_tasks();

// Log admin action

		$cache->update_tasks();

// Log admin action

		log_admin_action($task['tid'], htmlspecialchars_uni($task['title']), htmlspecialchars_uni($mybb->input['action']));

		log_admin_action($task['tid'], $task['title'], $mybb->input['action']);


flash_message($lang->success_task_disabled, 'success');
admin_redirect("index.php?module=tools-tasks");


flash_message($lang->success_task_disabled, 'success');
admin_redirect("index.php?module=tools-tasks");

Zeile 608Zeile 614
	$plugins->run_hooks("admin_tools_tasks_run_commit");

// Log admin action

	$plugins->run_hooks("admin_tools_tasks_run_commit");

// Log admin action

	log_admin_action($task['tid'], htmlspecialchars_uni($task['title']));

	log_admin_action($task['tid'], $task['title']);


flash_message($lang->success_task_run, 'success');
admin_redirect("index.php?module=tools-tasks");


flash_message($lang->success_task_run, 'success');
admin_redirect("index.php?module=tools-tasks");

Zeile 650Zeile 656
	$per_page = 50;
$current_page = 1;


	$per_page = 50;
$current_page = 1;


	if($mybb->input['page'] > 0)

	if(($mybb->get_input('page', MyBB::INPUT_INT)) > 0)

	{
$current_page = $mybb->get_input('page', MyBB::INPUT_INT);
$start = ($current_page-1)*$per_page;

	{
$current_page = $mybb->get_input('page', MyBB::INPUT_INT);
$start = ($current_page-1)*$per_page;

Zeile 730Zeile 736
	{
$task['title'] = htmlspecialchars_uni($task['title']);
$task['description'] = htmlspecialchars_uni($task['description']);

	{
$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']);

		$next_run = my_date('normal', $task['nextrun'], "", 2);

		if($task['enabled'] == 1)
{
$icon = "<img src=\"styles/{$page->style}/images/icons/bullet_on.png\" alt=\"({$lang->alt_enabled})\" title=\"{$lang->alt_enabled}\" style=\"vertical-align: middle;\" /> ";

		if($task['enabled'] == 1)
{
$icon = "<img src=\"styles/{$page->style}/images/icons/bullet_on.png\" alt=\"({$lang->alt_enabled})\" title=\"{$lang->alt_enabled}\" style=\"vertical-align: middle;\" /> ";