function forum_check_maintenance() { $forum_maintenance_functions_array = array('pm_system_prune_folders', 'thread_auto_prune_unread_data', 'sitemap_create_file'); $new_forum_settings = array(); if (!forum_self_clean_check_ajax()) { return; } $forum_maintenance_hour = forum_get_setting('forum_maintenance_hour', 'is_numeric', 3); $forum_maintenance_duration = forum_get_setting('forum_maintenance_duration', 'is_numeric', 1); $forum_maintenance_function = forum_get_setting('forum_maintenance_function', 'is_numeric', 0); $forum_maintenance_function++; if (!isset($forum_maintenance_functions_array[$forum_maintenance_function])) { $forum_maintenance_function = 0; } $forum_maintenance_date_var = sprintf("%s_last_run", $forum_maintenance_functions_array[$forum_maintenance_function]); $forum_maintenance_last_run = forum_get_setting($forum_maintenance_date_var, 'is_numeric', 0); if (time() - $forum_maintenance_last_run < DAY_IN_SECONDS) { return; } if (time() < mktime($forum_maintenance_hour)) { return; } if (time() > mktime($forum_maintenance_hour + $forum_maintenance_duration)) { return; } if (!function_exists($forum_maintenance_functions_array[$forum_maintenance_function])) { return; } ignore_user_abort(true); $forum_maintenance_functions_array[$forum_maintenance_function](); $new_forum_settings[$forum_maintenance_date_var] = time(); $new_forum_settings['forum_maintenance_function'] = $forum_maintenance_function; forum_save_global_settings($new_forum_settings); }
echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"center\">", form_submit("confirm_unread_cutoff", gettext("Yes")), " ", form_submit("cancel_unread_cutoff", gettext("No")), "</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo "</form>\n"; echo "</div>\n"; html_display_warning_msg(gettext("Clicking 'No' will only cancel the unread cut-off changes. Other changes you've made will still be saved."), '600', 'center'); html_draw_bottom(); exit; } } if (forum_save_global_settings($new_forum_settings)) { if (isset($_POST['confirm_unread_cutoff'])) { forum_update_unread_data($unread_cutoff_stamp); } header_redirect("admin_default_forum_settings.php?webtag={$webtag}&updated=true", gettext("Forum settings successfully updated")); } else { $valid = false; $error_msg_array[] = gettext("Failed to update forum settings. Please try again later."); } } $forum_global_settings = array_merge($forum_global_settings, $new_forum_settings); } // Start Output Here html_draw_top(sprintf('title=%s', gettext("Admin - Global Forum Settings")), 'class=window_title', "admin.js", "emoticons.js"); echo "<h1>", gettext("Admin"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", gettext("Global Forum Settings"), "</h1>\n"; if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {