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 132 | Zeile 132 |
---|
"day" => $db->escape_string($mybb->input['day']), "month" => $db->escape_string(implode(',', $mybb->input['month'])), "weekday" => $db->escape_string(implode(',', $mybb->input['weekday'])),
|
"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 186 | Zeile 187 |
---|
$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 = 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');
|
$task_list = array(); $task_files = scandir(MYBB_ROOT."inc/tasks/"); foreach($task_files as $task_file) {
| $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);
| 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);
|
Zeile 234 | Zeile 235 |
---|
$form_container->output_row($lang->enable_logging." <em>*</em>", "", $form->generate_yes_no_radio("logging", $mybb->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->enable_logging." <em>*</em>", "", $form->generate_yes_no_radio("logging", $mybb->input['logging'], true));
$form_container->output_row($lang->enabled." <em>*</em>", "", $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(); }
| $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") {
|
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 263 | Zeile 264 |
---|
if(!trim($mybb->input['title'])) { $errors[] = $lang->error_missing_title;
|
if(!trim($mybb->input['title'])) { $errors[] = $lang->error_missing_title;
|
}
| }
|
if(!trim($mybb->input['description'])) { $errors[] = $lang->error_missing_description;
|
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;
| if(!file_exists(MYBB_ROOT."inc/tasks/".$mybb->input['file'].".php")) { $errors[] = $lang->error_invalid_task_file;
|
Zeile 295 | Zeile 296 |
---|
$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 304 | Zeile 305 |
---|
$errors[] = $lang->error_invalid_weekday; } $mybb->input['day'] = '*';
|
$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)
| $mybb->input['month'] = check_time_values($mybb->input['month'], 1, 12, 'array'); if($mybb->input['month'] === false)
|
Zeile 331 | Zeile 332 |
---|
"day" => $db->escape_string($mybb->input['day']), "month" => $db->escape_string(implode(',', $mybb->input['month'])), "weekday" => $db->escape_string(implode(',', $mybb->input['weekday'])),
|
"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);
|
$db->update_query("tasks", $updated_task, "tid='{$task['tid']}'"); $cache->update_tasks();
$plugins->run_hooks("admin_tools_tasks_edit_commit");
// Log admin action log_admin_action($task['tid'], $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
| $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"); }
| { admin_redirect("index.php?module=tools-tasks"); }
|
Zeile 376 | Zeile 379 |
---|
$task_data = $mybb->input; } else
|
$task_data = $mybb->input; } else
|
{
| {
|
$task_data = $task; $task_data['weekday'] = explode(',', $task['weekday']); $task_data['month'] = explode(',', $task['month']);
| $task_data = $task; $task_data['weekday'] = explode(',', $task['weekday']); $task_data['month'] = explode(',', $task['month']);
|
Zeile 401 | Zeile 404 |
---|
$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');
|
$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(
| $options = array(
|
"*" => $lang->every_weekday, "0" => $lang->sunday, "1" => $lang->monday,
| "*" => $lang->every_weekday, "0" => $lang->sunday, "1" => $lang->monday,
|
Zeile 411 | Zeile 414 |
---|
"4" => $lang->thursday, "5" => $lang->friday, "6" => $lang->saturday
|
"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(
| $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(
|
Zeile 445 | Zeile 448 |
---|
}
if($mybb->input['action'] == "delete")
|
}
if($mybb->input['action'] == "delete")
|
{ $query = $db->simple_select("tasks", "*", "tid='".$mybb->get_input('tid', 1)."'"); $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'])
| { $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"); }
|
admin_redirect("index.php?module=tools-tasks"); }
|
$plugins->run_hooks("admin_tools_tasks_delete");
| // 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") {
| if($mybb->request_method == "post") {
|
Zeile 471 | Zeile 474 |
---|
$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'); admin_redirect("index.php?module=tools-tasks"); } else
|
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); } }
| $page->output_confirm_action("index.php?module=tools-tasks&action=delete&tid={$task['tid']}", $lang->confirm_task_deletion); } }
|
Zeile 492 | Zeile 496 |
---|
if(!verify_post_check($mybb->input['my_post_key'])) { flash_message($lang->invalid_post_verify_key2, 'error');
|
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', 1)."'"); $task = $db->fetch_array($query);
| 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'])
| // Does the task not exist? if(!$task['tid'])
|
Zeile 508 | Zeile 512 |
---|
if($mybb->input['action'] == "enable") { $plugins->run_hooks("admin_tools_tasks_enable");
|
if($mybb->input['action'] == "enable") { $plugins->run_hooks("admin_tools_tasks_enable");
|
} else
| } else
|
{ $plugins->run_hooks("admin_tools_tasks_disable"); }
| { $plugins->run_hooks("admin_tools_tasks_disable"); }
|
Zeile 520 | Zeile 524 |
---|
{ // User clicked no if($mybb->input['no'])
|
{ // User clicked no if($mybb->input['no'])
|
{ admin_redirect("index.php?module=tools-tasks"); }
| { 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']}'");
|
if($mybb->request_method == "post") { $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 552 |
---|
{ $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 567 |
---|
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 593 |
---|
$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 608 |
---|
$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 652 |
---|
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);
|