Zeile 23 | Zeile 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 79 | Zeile 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 92 | Zeile 95 |
---|
$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)
|
{
| {
|
$errors[] = $lang->error_invalid_hour; }
| $errors[] = $lang->error_invalid_hour; }
|
Zeile 106 | Zeile 109 |
---|
$mybb->input['weekday'] = array('*'); } else
|
$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['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; }
|
$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']),
|
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']),
| "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); $tid = $db->insert_query("tasks", $new_task);
|
);
$new_task['nextrun'] = fetch_next_run($new_task); $tid = $db->insert_query("tasks", $new_task);
|
$cache->update_tasks();
$plugins->run_hooks("admin_tools_tasks_add_commit");
| $plugins->run_hooks("admin_tools_tasks_add_commit");
$cache->update_tasks();
|
// Log admin action
|
// Log admin action
|
log_admin_action($tid, $mybb->input['title']);
| log_admin_action($tid, htmlspecialchars_uni($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");
|
Zeile 156 | Zeile 160 |
---|
$sub_tabs['scheduled_tasks'] = array( 'title' => $lang->scheduled_tasks, 'link' => "index.php?module=tools-tasks"
|
$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['add_task'] = array( 'title' => $lang->add_new_task, 'link' => "index.php?module=tools-tasks&action=add",
|
Zeile 172 | Zeile 176 |
---|
$page->output_nav_tabs($sub_tabs, 'add_task'); $form = new Form("index.php?module=tools-tasks&action=add", "post", "add"); if($errors)
|
$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
| $page->output_inline_error($errors); } else
|
Zeile 201 | Zeile 205 |
---|
$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->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,
| $options = array( "*" => $lang->every_weekday, "0" => $lang->sunday,
|
Zeile 246 | Zeile 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 270 | Zeile 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; }
$mybb->input['minute'] = check_time_values($mybb->input['minute'], 0, 59, 'string'); if($mybb->input['minute'] === false)
|
{ $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_minute; }
$mybb->input['hour'] = check_time_values($mybb->input['hour'], 0, 59, 'string'); if($mybb->input['hour'] === false)
|
{
| {
|
$errors[] = $lang->error_invalid_hour; }
| $errors[] = $lang->error_invalid_hour; }
|
Zeile 295 | Zeile 302 |
---|
$errors[] = $lang->error_invalid_day; } $mybb->input['weekday'] = array('*');
|
$errors[] = $lang->error_invalid_day; } $mybb->input['weekday'] = array('*');
|
}
| }
|
else { $mybb->input['weekday'] = check_time_values($mybb->input['weekday'], 0, 6, 'array');
| else { $mybb->input['weekday'] = check_time_values($mybb->input['weekday'], 0, 6, 'array');
|
Zeile 308 | Zeile 315 |
---|
$mybb->input['month'] = check_time_values($mybb->input['month'], 1, 12, 'array'); if($mybb->input['month'] === false)
|
$mybb->input['month'] = check_time_values($mybb->input['month'], 1, 12, 'array'); if($mybb->input['month'] === false)
|
{
| {
|
$errors[] = $lang->error_invalid_month; }
| $errors[] = $lang->error_invalid_month; }
|
Zeile 320 | Zeile 327 |
---|
{ $mybb->input['enabled'] = 0; $enable_confirmation = true;
|
{ $mybb->input['enabled'] = 0; $enable_confirmation = true;
|
}
| }
|
$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);
|
| $plugins->run_hooks("admin_tools_tasks_edit_commit");
|
$db->update_query("tasks", $updated_task, "tid='{$task['tid']}'");
|
$db->update_query("tasks", $updated_task, "tid='{$task['tid']}'");
|
$cache->update_tasks();
| |
|
|
$plugins->run_hooks("admin_tools_tasks_edit_commit");
| $cache->update_tasks();
|
// Log admin action
|
// Log admin action
|
log_admin_action($task['tid'], $mybb->input['title']);
| log_admin_action($task['tid'], htmlspecialchars_uni($mybb->input['title']));
|
flash_message($lang->success_task_updated, 'success');
| flash_message($lang->success_task_updated, 'success');
|
Zeile 446 | Zeile 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 471 | Zeile 480 |
---|
$db->delete_query("tasklog", "tid='{$task['tid']}'");
// Fetch next task run
|
$db->delete_query("tasklog", "tid='{$task['tid']}'");
// Fetch next task run
|
$cache->update_tasks();
$plugins->run_hooks("admin_tools_tasks_delete_commit");
| $plugins->run_hooks("admin_tools_tasks_delete_commit");
$cache->update_tasks();
|
// Log admin action
|
// Log admin action
|
log_admin_action($task['tid'], $task['title']);
| log_admin_action($task['tid'], htmlspecialchars_uni($task['title']));
|
flash_message($lang->success_task_deleted, 'success');
|
flash_message($lang->success_task_deleted, 'success');
|
admin_redirect("index.php?module=tools-tasks");
| admin_redirect("index.php?module=tools-tasks");
|
} else {
| } else {
|
Zeile 495 | Zeile 505 |
---|
admin_redirect("index.php?module=tools-tasks"); }
|
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 503 | Zeile 513 |
---|
{ flash_message($lang->error_invalid_task, 'error'); admin_redirect("index.php?module=tools-tasks");
|
{ flash_message($lang->error_invalid_task, 'error'); admin_redirect("index.php?module=tools-tasks");
|
}
| }
|
if($mybb->input['action'] == "enable") {
| if($mybb->input['action'] == "enable") {
|
Zeile 525 | Zeile 535 |
---|
}
if($mybb->request_method == "post")
|
}
if($mybb->request_method == "post")
|
{
| {
|
$nextrun = fetch_next_run($task); $db->update_query("tasks", array("nextrun" => $nextrun, "enabled" => 1), "tid='{$task['tid']}'");
|
$nextrun = fetch_next_run($task); $db->update_query("tasks", array("nextrun" => $nextrun, "enabled" => 1), "tid='{$task['tid']}'");
|
$cache->update_tasks();
|
|
$plugins->run_hooks("admin_tools_tasks_enable_commit");
|
$plugins->run_hooks("admin_tools_tasks_enable_commit");
|
| $cache->update_tasks();
|
// Log admin action
|
// Log admin action
|
log_admin_action($task['tid'], $task['title'], $mybb->input['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");
| flash_message($lang->success_task_enabled, 'success'); admin_redirect("index.php?module=tools-tasks");
|
Zeile 547 | Zeile 558 |
---|
{ $nextrun = fetch_next_run($task); $db->update_query("tasks", array("nextrun" => $nextrun, "enabled" => 1), "tid='{$task['tid']}'");
|
{ $nextrun = fetch_next_run($task); $db->update_query("tasks", array("nextrun" => $nextrun, "enabled" => 1), "tid='{$task['tid']}'");
|
$cache->update_tasks();
|
|
$plugins->run_hooks("admin_tools_tasks_enable_commit");
|
$plugins->run_hooks("admin_tools_tasks_enable_commit");
|
| $cache->update_tasks();
|
// Log admin action
|
// Log admin action
|
log_admin_action($task['tid'], $task['title'], $mybb->input['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");
| flash_message($lang->success_task_enabled, 'success'); admin_redirect("index.php?module=tools-tasks");
|
Zeile 561 | Zeile 573 |
---|
else { $db->update_query("tasks", array("enabled" => 0), "tid='{$task['tid']}'");
|
else { $db->update_query("tasks", array("enabled" => 0), "tid='{$task['tid']}'");
|
$cache->update_tasks();
|
|
$plugins->run_hooks("admin_tools_tasks_disable_commit");
|
$plugins->run_hooks("admin_tools_tasks_disable_commit");
|
| $cache->update_tasks();
|
// Log admin action
|
// Log admin action
|
log_admin_action($task['tid'], $task['title'], $mybb->input['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");
| flash_message($lang->success_task_disabled, 'success'); admin_redirect("index.php?module=tools-tasks");
|
Zeile 586 | Zeile 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 601 | Zeile 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'], $task['title']);
| log_admin_action($task['tid'], htmlspecialchars_uni($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 645 | Zeile 658 |
---|
if($mybb->input['page'] > 0) {
|
if($mybb->input['page'] > 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 723 | Zeile 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;\" /> ";
|