Vergleich admin/modules/tools/tasks.php - 1.8.3 - 1.8.30

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

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']),
"month" => $db->escape_string(implode(',', $mybb->input['month'])),
"weekday" => $db->escape_string(implode(',', $mybb->input['weekday'])),

				"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" => (int)$mybb->input['enabled'],
"logging" => (int)$mybb->input['logging']

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

			);

$new_task['nextrun'] = fetch_next_run($new_task);

			);

$new_task['nextrun'] = fetch_next_run($new_task);

Zeile 148Zeile 151

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 198Zeile 201
			$task_list[$file_id] = $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 247Zeile 250

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


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

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

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

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

// Does the task not exist?

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

// Does the task not exist?

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']),
"month" => $db->escape_string(implode(',', $mybb->input['month'])),
"weekday" => $db->escape_string(implode(',', $mybb->input['weekday'])),

				"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" => (int)$mybb->input['enabled'],
"logging" => (int)$mybb->input['logging']

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

			);

$updated_task['nextrun'] = fetch_next_run($updated_task);

			);

$updated_task['nextrun'] = fetch_next_run($updated_task);

Zeile 449Zeile 455

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


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

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

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

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

// Does the task not exist?

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

// Does the task not exist?

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 493Zeile 499

if($mybb->input['action'] == "enable" || $mybb->input['action'] == "disable")
{


if($mybb->input['action'] == "enable" || $mybb->input['action'] == "disable")
{

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

	if(!verify_post_check($mybb->get_input('my_post_key')))

	{
flash_message($lang->invalid_post_verify_key2, 'error');
admin_redirect("index.php?module=tools-tasks");
}


	{
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', 1)."'");

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

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

// Does the task not exist?

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

// Does the task not exist?

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 582Zeile 588

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


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

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

	if(!verify_post_check($mybb->get_input('my_post_key')))

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

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

Zeile 593Zeile 599

$plugins->run_hooks("admin_tools_tasks_run");



$plugins->run_hooks("admin_tools_tasks_run");


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

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

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

// Does the task not exist?

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

// Does the task not exist?

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', 1);

		$current_page = $mybb->get_input('page', MyBB::INPUT_INT);

		$start = ($current_page-1)*$per_page;
$pages = $log_count / $per_page;
$pages = ceil($pages);

		$start = ($current_page-1)*$per_page;
$pages = $log_count / $per_page;
$pages = ceil($pages);

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;\" /> ";