Quellcode durchsuchen

Code consistency changes (#3)

Alex vor 1 Jahr
Ursprung
Commit
128ba1ac39

+ 2 - 0
app_defaults.php

@@ -44,3 +44,5 @@ if ($domains_processed == 1) {
 		maintenance::app_defaults($database);
 		maintenance::app_defaults($database);
 	}
 	}
 }
 }
+
+?>

+ 119 - 112
maintenance.php

@@ -177,7 +177,6 @@ if (permission_exists('maintenance_show_all') && $show_all) {
 	$sql .= " where domain_setting_category = 'maintenance'";
 	$sql .= " where domain_setting_category = 'maintenance'";
 	$sql .= " and (domain_setting_subcategory like '%_database_retention_days' or domain_setting_subcategory like '%_filesystem_retention_days')";
 	$sql .= " and (domain_setting_subcategory like '%_database_retention_days' or domain_setting_subcategory like '%_filesystem_retention_days')";
 	$sql .= " and domain_uuid = '$domain_uuid'";
 	$sql .= " and domain_uuid = '$domain_uuid'";
-	//filter based on search
 	if (!empty($search)) {
 	if (!empty($search)) {
 		$search_param = "%$search%";
 		$search_param = "%$search%";
 		$sql .= " and domain_setting_subcategory like :search";
 		$sql .= " and domain_setting_subcategory like :search";
@@ -187,7 +186,7 @@ if (permission_exists('maintenance_show_all') && $show_all) {
 		$sql .= limit_offset($rows_per_page, $offset);
 		$sql .= limit_offset($rows_per_page, $offset);
 	}
 	}
 
 
-	$result = $database->execute($sql, $parameters, 'all');
+	$result = $database->execute($sql, $parameters ?? null, 'all');
 
 
 	if (!empty($result)) {
 	if (!empty($result)) {
 		foreach ($result as $row) {
 		foreach ($result as $row) {
@@ -229,120 +228,128 @@ require_once dirname(__DIR__, 2) . '/resources/header.php';
 
 
 $document['title'] = $text['title-maintenance'];
 $document['title'] = $text['title-maintenance'];
 
 
-	echo "<div class='action_bar' id='action_bar'>";
-	echo "<div class='heading'><b>Maintenance (" . count($classes) . ")</b></div>";
-	echo "<div class='actions'>";
-		echo button::create(['type'=>'button','label'=>$text['button-logs'],'icon'=>'fas fa-scroll fa-fw','id'=>'btn_logs', 'link'=>'maintenance_logs.php']);
-		//show all
-		if (!$show_all) {
-			echo button::create(['type'=>'button','alt'=>$text['button-show_all']??'Show All','label'=>$text['button-show_all']??'Show All','class'=>'btn btn-default','icon'=>$_SESSION['theme']['button_icon_all']??'globe','link'=>(empty($url_params) ? '?show=all' : $url_params . '&show=all')]);
+echo "<div class='action_bar' id='action_bar'>";
+echo "	<div class='heading'><b>Maintenance (".count($classes).")</b></div>";
+echo "	<div class='actions'>";
+echo button::create(['type'=>'button','label'=>$text['button-logs'],'icon'=>'fas fa-scroll fa-fw','id'=>'btn_logs', 'link'=>'maintenance_logs.php']);
+//show all
+if (!$show_all) {
+	echo button::create(['type'=>'button','alt'=>$text['button-show_all']??'Show All','label'=>$text['button-show_all']??'Show All','class'=>'btn btn-default','icon'=>$_SESSION['theme']['button_icon_all']??'globe','link'=>(empty($url_params) ? '?show=all' : $url_params . '&show=all')]);
+}
+//search form
+echo "		<form id='form_search' class='inline' method='get'>";
+if (!empty($page)) {
+	echo "		<input name='page' type=hidden value='$page'>";
+}
+if ($show_all) {
+	echo "		<input name='show' type=hidden value='all'>";
+}
+echo "			<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
+echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search']);
+echo "		</form>";
+echo "	</div>";
+
+//javascript modal boxes
+echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=> button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('copy'); list_form_submit('form_list');"])]);
+echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=> button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
+echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=> button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('toggle'); list_form_submit('form_list');"])]);
+
+echo "	<div style='clear: both;'></div>";
+echo "	<br/><br/>";
+echo "	<form id='form_list' method='post'>";
+echo "		<input type='hidden' id='action' name='action' value=''>";
+echo "		<input type='hidden' name='search' value=\"".escape($search)."\">";
+echo "		<table class='list'>";
+echo "			<tr class='list-header'>";
+echo "				<th>Name</th>";
+if (permission_exists('maintenance_show_all')) {
+	echo "			<th>Domain</th>";
+}
+echo "				<th>Database Enabled</th>";
+echo "				<th>Retention Days</th>";
+echo "				<th>File System Enabled</th>";
+echo "				<th>Retention Days</th>";
+echo "			</tr>";
+
+//list all maintenance applications from the defaults settings for global and each domain and show if they are enabled or disabled
+foreach ($maintenance_apps as $class => $app_settings) {
+	//make the class name more user friendly
+	$display_name = ucwords(str_replace('_', ' ', $class));
+
+	//display global first
+	if ((isset($app_settings['database_maintenance']['global']) || isset($app_settings['filesystem_maintenance']['global'])) && permission_exists('maintenance_show_all')) {
+		echo "<tr class='list-row' style=''>";
+		echo "	<td>$display_name</td>";
+		echo "	<td>".$text['label-global']."</td>";
+		if (isset($app_settings['database_maintenance']['global'])) {
+			$enabled = $app_settings['database_maintenance']['global']['default_setting_enabled'] ? $text['label-yes'] : $text['label-no'];
+			$value = $app_settings['database_maintenance']['global']['default_setting_value'];
+			echo "<td>$enabled</td>";
+			echo "<td>$value</td>";
+		} else {
+			echo "<td>&nbsp;</td>";
+			echo "<td>&nbsp;</td>";
+		}
+		if (isset($app_settings['filesystem_maintenance']['global'])) {
+			$enabled = $app_settings['filesystem_maintenance']['global']['default_setting_enabled'] ? $text['label-yes'] : $text['label-no'];
+			$value = $app_settings['filesystem_maintenance']['global']['default_setting_value'];
+			echo "<td>$enabled</td>";
+			echo "<td>$value</td>";
+		} else {
+			echo "<td>&nbsp;</td>";
+			echo "<td>&nbsp;</td>";
 		}
 		}
-		//search form
-		echo "<form id='form_search' class='inline' method='get'>";
-			if (!empty($page)) {
-				echo "<input name='page' type=hidden value='$page'>";
+		echo "</tr>";
+	}
+	if (isset($app_settings['database_maintenance']) || isset($app_settings['filesystem_maintenance'])) {
+		//get all domains with database traits
+		$database_domain_uuids = array_keys($app_settings['database_maintenance'] ?? []);
+
+		//get all domains with filesystem traits
+		$filesystem_domain_uuids = array_keys($app_settings['filesystem_maintenance'] ?? []);
+
+		//combine database and filesystem domain_uuids without duplicates
+		$domain_uuids = $database_domain_uuids + $filesystem_domain_uuids;
+
+		//loop through domains that have the database and filesystem traits
+		foreach ($domain_uuids as $domain_uuid) {
+			//skip global it has already been done
+			if ($domain_uuid === 'global') {
+				continue;
 			}
 			}
-			if ($show_all) {
-				echo "<input name='show' type=hidden value='all'>";
+			echo "<tr class='list-row' style=''>";
+			echo "	<td>$display_name</td>";
+			if (permission_exists('maintenance_show_all')) {
+				echo "<td>".$domain_names[$domain_uuid]."</td>";
 			}
 			}
-			echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
-			echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search']);
-		echo "</form>";
-	echo "</div>";
-
-	//javascript modal boxes
-	echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=> button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('copy'); list_form_submit('form_list');"])]);
-	echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=> button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
-	echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=> button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('toggle'); list_form_submit('form_list');"])]);
-
-	echo "<div style='clear: both;'></div>";
-	echo "<br/><br/>";
-	echo "<form id='form_list' method='post'>";
-		echo "<input type='hidden' id='action' name='action' value=''>";
-		echo "<input type='hidden' name='search' value=\"".escape($search)."\">";
-		echo "<table class='list'>";
-			echo "<tr class='list-header'>";
-				echo "<th>Name</th>";
-				if (permission_exists('maintenance_show_all')) {
-					echo "<th>Domain</th>";
-				}
-				echo "<th>Database Enabled</th>";
-				echo "<th>Retention Days</th>";
-				echo "<th>File System Enabled</th>";
-				echo "<th>Retention Days</th>";
-			echo "</tr>";
-			//list all maintenance applications from the defaults settings for global and each domain and show if they are enabled or disabled
-			foreach ($maintenance_apps as $class => $app_settings) {
-				//make the class name more user friendly
-				$display_name = ucwords(str_replace('_', ' ', $class));
-				//display global first
-				if ((isset($app_settings['database_maintenance']['global']) || isset($app_settings['filesystem_maintenance']['global'])) && permission_exists('maintenance_show_all')) {
-					echo "<tr class='list-row' style=''>";
-						echo "<td>$display_name</td>";
-							echo "<td>" . $text['label-global'] . "</td>";
-						if (isset($app_settings['database_maintenance']['global'])) {
-							$enabled = $app_settings['database_maintenance']['global']['default_setting_enabled'] ? $text['label-yes'] : $text['label-no'];
-							$value = $app_settings['database_maintenance']['global']['default_setting_value'];
-							echo "<td>$enabled</td>";
-							echo "<td>$value</td>";
-						} else {
-							echo "<td>&nbsp;</td>";
-							echo "<td>&nbsp;</td>";
-						}
-						if (isset($app_settings['filesystem_maintenance']['global'])) {
-							$enabled = $app_settings['filesystem_maintenance']['global']['default_setting_enabled'] ? $text['label-yes'] : $text['label-no'];
-							$value = $app_settings['filesystem_maintenance']['global']['default_setting_value'];
-							echo "<td>$enabled</td>";
-							echo "<td>$value</td>";
-						} else {
-							echo "<td>&nbsp;</td>";
-							echo "<td>&nbsp;</td>";
-						}
-					echo "</tr>";
-				}
-				if (isset($app_settings['database_maintenance']) || isset($app_settings['filesystem_maintenance'])) {
-					//get all domains with database traits
-					$database_domain_uuids = array_keys($app_settings['database_maintenance'] ?? []);
-					//get all domains with filesystem traits
-					$filesystem_domain_uuids = array_keys($app_settings['filesystem_maintenance'] ?? []);
-					//combine database and filesystem domain_uuids without duplicates
-					$domain_uuids = $database_domain_uuids + $filesystem_domain_uuids;
-					//loop through domains that have the database and filesystem traits
-					foreach ($domain_uuids as $domain_uuid) {
-						//skip global it has already been done
-						if ($domain_uuid === 'global') {
-							continue;
-						}
-						echo "<tr class='list-row' style=''>";
-							echo "<td>$display_name</td>";
-							if (permission_exists('maintenance_show_all')) {
-								echo "<td>" . $domain_names[$domain_uuid] . "</td>";
-							}
-							if (isset($app_settings['database_maintenance'][$domain_uuid])) {
-								$enabled = $app_settings['database_maintenance'][$domain_uuid]['domain_setting_enabled'] ? $text['label-yes'] : $text['label-no'];
-								$value = $app_settings['database_maintenance'][$domain_uuid]['domain_setting_value'];
-								echo "<td>$enabled</td>";
-								echo "<td>$value</td>";
-							} else {
-								echo "<td>&nbsp;</td>";
-								echo "<td>&nbsp;</td>";
-							}
-							if (isset($app_settings['filesystem_maintenance'][$domain_uuid])) {
-								$enabled = $app_settings['filesystem_maintenance'][$domain_uuid]['domain_setting_enabled'] ? $text['label-yes'] : $text['label-no'];
-								$value = $app_settings['filesystem_maintenance'][$domain_uuid]['domain_setting_value'];
-								echo "<td>$enabled</td>";
-								echo "<td>$value</td>";
-							} else {
-								echo "<td>&nbsp;</td>";
-								echo "<td>&nbsp;</td>";
-							}
-						echo "</tr>";
-					}
-				}
+			if (isset($app_settings['database_maintenance'][$domain_uuid])) {
+				$enabled = $app_settings['database_maintenance'][$domain_uuid]['domain_setting_enabled'] ? $text['label-yes'] : $text['label-no'];
+				$value = $app_settings['database_maintenance'][$domain_uuid]['domain_setting_value'];
+				echo "<td>$enabled</td>";
+				echo "<td>$value</td>";
+			} else {
+				echo "<td>&nbsp;</td>";
+				echo "<td>&nbsp;</td>";
+			}
+			if (isset($app_settings['filesystem_maintenance'][$domain_uuid])) {
+				$enabled = $app_settings['filesystem_maintenance'][$domain_uuid]['domain_setting_enabled'] ? $text['label-yes'] : $text['label-no'];
+				$value = $app_settings['filesystem_maintenance'][$domain_uuid]['domain_setting_value'];
+				echo "<td>$enabled</td>";
+				echo "<td>$value</td>";
+			} else {
+				echo "<td>&nbsp;</td>";
+				echo "<td>&nbsp;</td>";
 			}
 			}
-		echo "</table>";
-		echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>";
-	echo "</form>";
+			echo "</tr>";
+		}
+	}
+}
+echo "		</table>";
+echo "		<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>";
+echo "	</form>";
 echo "</div>";
 echo "</div>";
 
 
+//include the footer
 require_once dirname(__DIR__, 2) . '/resources/footer.php';
 require_once dirname(__DIR__, 2) . '/resources/footer.php';
+
+?>

+ 96 - 96
maintenance_logs.php

@@ -128,7 +128,7 @@ if (isset($search)) {
 	$parameters['search'] = '%'.$search.'%';
 	$parameters['search'] = '%'.$search.'%';
 }
 }
 
 
-//	$parameters['time_zone'] = $time_zone;
+//$parameters['time_zone'] = $time_zone;
 $sql .= " GROUP BY m.maintenance_log_epoch";
 $sql .= " GROUP BY m.maintenance_log_epoch";
 $sql .= order_by($order_by, $order, 'maintenance_log_epoch', 'desc');
 $sql .= order_by($order_by, $order, 'maintenance_log_epoch', 'desc');
 $sql .= limit_offset($rows_per_page, $offset);
 $sql .= limit_offset($rows_per_page, $offset);
@@ -141,12 +141,12 @@ if (count($parameters) > 0) {
 }
 }
 
 
 //prepare to page the results
 //prepare to page the results
-	$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
-	$param = $search ? "&search=".$search : null;
-	$page = isset($_GET['page']) ? $_GET['page'] : 0;
-	list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
-	list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
-	$offset = $rows_per_page * $page;
+$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
+$param = $search ? "&search=".$search : null;
+$page = isset($_GET['page']) ? $_GET['page'] : 0;
+list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
+list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
+$offset = $rows_per_page * $page;
 
 
 //get the list
 //get the list
 $sql = "SELECT"
 $sql = "SELECT"
@@ -178,7 +178,7 @@ if (isset($search)) {
 	$parameters['search'] = '%'.$search.'%';
 	$parameters['search'] = '%'.$search.'%';
 }
 }
 
 
-//	$parameters['time_zone'] = $time_zone;
+//$parameters['time_zone'] = $time_zone;
 $sql .= order_by($order_by, $order, 'maintenance_log_epoch', 'desc');
 $sql .= order_by($order_by, $order, 'maintenance_log_epoch', 'desc');
 $sql .= limit_offset($rows_per_page, $offset);
 $sql .= limit_offset($rows_per_page, $offset);
 $maintenance_logs = $database->select($sql, $parameters, 'all');
 $maintenance_logs = $database->select($sql, $parameters, 'all');
@@ -189,7 +189,7 @@ if ($maintenance_logs === false) {
 	$maintenance_logs = [];
 	$maintenance_logs = [];
 }
 }
 
 
-////create token
+//create token
 //$token = new token;
 //$token = new token;
 //$token_arr = $token->create($_SERVER['PHP_SELF']);
 //$token_arr = $token->create($_SERVER['PHP_SELF']);
 
 
@@ -199,32 +199,32 @@ require_once "resources/header.php";
 
 
 //show the content
 //show the content
 echo "<div class='action_bar' id='action_bar'>\n";
 echo "<div class='action_bar' id='action_bar'>\n";
-	echo "<div class='heading'>";
-		echo "<b>".$text['title-maintenance_logs']." (".$num_rows.")</b>";
-	echo "</div>\n";
-	echo "<div class='actions'>\n";
-		echo button_back::create('maintenance.php');
-		if (permission_exists('maintenance_log_delete') && $maintenance_logs) {
-			echo button_delete::create();
-		}
-		echo "<form id='form_search' class='inline' method='get'>\n";
-			if (permission_exists('maintenance_log_all')) {
-				if ($show == 'all') {
-					echo "<input type='hidden' name='show' value='all'>\n";
-				}
-				else {
-					echo button_show_all::create();
-				}
-			}
-			echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
-			echo button_search::create(empty($search));
-			echo button_reset::create(empty($search));
-			if (!empty($paging_controls_mini)) {
-				echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
-			}
-		echo "</form>\n";
-	echo "</div>\n";
-	echo "<div style='clear: both;'></div>\n";
+echo "	<div class='heading'>";
+echo "		<b>".$text['title-maintenance_logs']." (".$num_rows.")</b>";
+echo "	</div>\n";
+echo "	<div class='actions'>\n";
+echo button_back::create('maintenance.php');
+if (permission_exists('maintenance_log_delete') && $maintenance_logs) {
+	echo button_delete::create();
+}
+echo "		<form id='form_search' class='inline' method='get'>\n";
+if (permission_exists('maintenance_log_all')) {
+	if ($show == 'all') {
+		echo "	<input type='hidden' name='show' value='all'>\n";
+	}
+	else {
+		echo button_show_all::create();
+	}
+}
+echo "			<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
+echo button_search::create(empty($search));
+echo button_reset::create(empty($search));
+if (!empty($paging_controls_mini)) {
+	echo "		<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
+}
+echo "		</form>\n";
+echo "	</div>\n";
+echo "	<div style='clear: both;'></div>\n";
 echo "</div>\n";
 echo "</div>\n";
 
 
 if (permission_exists('maintenance_log_delete') && $maintenance_logs) {
 if (permission_exists('maintenance_log_delete') && $maintenance_logs) {
@@ -235,69 +235,69 @@ echo $text['description-maintenance_logs']."\n";
 echo "<br /><br />\n";
 echo "<br /><br />\n";
 
 
 echo "<form id='form_list' method='post'>\n";
 echo "<form id='form_list' method='post'>\n";
-	echo "<input type='hidden' id='action' name='action' value=''>\n";
-	echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
-
-	echo "<table class='list'>\n";
-		//header row
-		echo "<tr class='list-header'>\n";
-			if (permission_exists('maintenance_log_delete')) {
-				echo "<th class='checkbox'>\n";
-					echo "<input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($maintenance_logs ?: "style='visibility: hidden;'").">\n";
-				echo "</th>\n";
-			}
-			if ($show == 'all' && permission_exists('maintenance_log_all')) {
-				echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
-			}
-			echo th_order_by('application', $text['label-application'], $order_by, $order);
-			echo th_order_by('server_timestamp', $text['label-server_timestamp'], $order_by, $order);
-			echo th_order_by('status', $text['label-status'], $order_by, $order);
-			echo th_order_by('message', $text['label-message'], $order_by, $order);
-//			echo "<th class='left hide-md-dn'>".$text['label-message']."</th>\n";
-			if (permission_exists('maintenance_log_edit') && $list_row_edit_button == 'true') {
-				echo "<td class='action-button'>&nbsp;</td>\n";
-			}
-		echo "</tr>\n";
-
-		//data rows
-		if (is_array($maintenance_logs) && @sizeof($maintenance_logs) != 0) {
-			$domains = maintenance_service::get_domains($database);
-			$x = 0;
-			foreach ($maintenance_logs as $row) {
-				$application_name = ucwords(str_replace('_', ' ', $row['maintenance_log_application']));
-				$domain_name = $domains[$row['domain_uuid']] ?: 'Global';
-				if (permission_exists('maintenance_log_edit')) {
-					$list_row_url = "maintenance_log_edit.php?id=".urlencode($row['maintenance_log_uuid']);
-				}
-				echo "<tr class='list-row' href='".$list_row_url."'>\n";
-					if (permission_exists('maintenance_log_delete')) {
-						echo "<td class='checkbox'>\n";
-							echo "<input type='checkbox' name='maintenance_logs[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
-							echo "<input type='hidden' name='maintenance_logs[$x][uuid]' value='".escape($row['maintenance_log_uuid'])."' />\n";
-						echo "</td>\n";
-					}
-					if ($show === 'all') {
-						echo "<td class='left'>$domain_name</td>\n";
-					}
-					echo "<td class='left'>".escape($application_name)."</td>\n";
-					echo "<td class='left'>".escape($row['maintenance_log_epoch'])."</td>\n";
-					echo "<td class='left'>".escape($row['maintenance_log_status'])."</td>\n";
-					echo "<td class='left hide-sm-dn'>".escape($row['maintenance_log_message'])."</td>\n";
-					if (permission_exists('maintenance_log_edit') && $list_row_edit_button == 'true') {
-						echo "<td class='action-button'>\n";
-							echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
-						echo "</td>\n";
-					}
-				echo "</tr>\n";
-				$x++;
-			}
+echo "	<input type='hidden' id='action' name='action' value=''>\n";
+echo "	<input type='hidden' name='search' value=\"".escape($search)."\">\n";
+
+echo "	<table class='list'>\n";
+//header row
+echo "		<tr class='list-header'>\n";
+if (permission_exists('maintenance_log_delete')) {
+	echo "		<th class='checkbox'>\n";
+	echo "			<input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($maintenance_logs ?: "style='visibility: hidden;'").">\n";
+	echo "		</th>\n";
+}
+if ($show == 'all' && permission_exists('maintenance_log_all')) {
+	echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
+}
+echo th_order_by('application', $text['label-application'], $order_by, $order);
+echo th_order_by('server_timestamp', $text['label-server_timestamp'], $order_by, $order);
+echo th_order_by('status', $text['label-status'], $order_by, $order);
+echo th_order_by('message', $text['label-message'], $order_by, $order);
+//echo "<th class='left hide-md-dn'>".$text['label-message']."</th>\n";
+if (permission_exists('maintenance_log_edit') && $list_row_edit_button == 'true') {
+	echo "		<td class='action-button'>&nbsp;</td>\n";
+}
+echo "		</tr>\n";
+
+//data rows
+if (is_array($maintenance_logs) && @sizeof($maintenance_logs) != 0) {
+	$domains = maintenance_service::get_domains($database);
+	$x = 0;
+	foreach ($maintenance_logs as $row) {
+		$application_name = ucwords(str_replace('_', ' ', $row['maintenance_log_application']));
+		$domain_name = $domains[$row['domain_uuid']] ?: 'Global';
+		if (permission_exists('maintenance_log_edit')) {
+			$list_row_url = "maintenance_log_edit.php?id=".urlencode($row['maintenance_log_uuid']);
 		}
 		}
+		echo "<tr class='list-row' href='".$list_row_url."'>\n";
+		if (permission_exists('maintenance_log_delete')) {
+			echo "<td class='checkbox'>\n";
+			echo "	<input type='checkbox' name='maintenance_logs[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
+			echo "	<input type='hidden' name='maintenance_logs[$x][uuid]' value='".escape($row['maintenance_log_uuid'])."' />\n";
+			echo "</td>\n";
+		}
+		if ($show === 'all') {
+			echo "<td class='left'>$domain_name</td>\n";
+		}
+		echo "	<td class='left'>".escape($application_name)."</td>\n";
+		echo "	<td class='left'>".escape($row['maintenance_log_epoch'])."</td>\n";
+		echo "	<td class='left'>".escape($row['maintenance_log_status'])."</td>\n";
+		echo "	<td class='left hide-sm-dn'>".escape($row['maintenance_log_message'])."</td>\n";
+		if (permission_exists('maintenance_log_edit') && $list_row_edit_button == 'true') {
+			echo "<td class='action-button'>\n";
+			echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
+			echo "</td>\n";
+		}
+		echo "</tr>\n";
+		$x++;
+	}
+}
 
 
-	echo "</table>\n";
-	echo "<br />\n";
-	echo "<div align='center'>".$paging_controls."</div>\n";
-	//echo new token;
-	echo "<input type='hidden' name='".$token_arr['name']."' value='".$token_arr['hash']."'>\n";
+echo "	</table>\n";
+echo "	<br />\n";
+echo "	<div align='center'>".$paging_controls."</div>\n";
+//echo new token;
+echo "	<input type='hidden' name='".$token_arr['name']."' value='".$token_arr['hash']."'>\n";
 echo "</form>\n";
 echo "</form>\n";
 
 
 //include the footer
 //include the footer

+ 2 - 0
resources/classes/maintenance.php

@@ -280,3 +280,5 @@ class maintenance {
 		return $found_classes;
 		return $found_classes;
 	}
 	}
 }
 }
+
+?>

+ 2 - 0
resources/classes/maintenance_logs.php

@@ -268,3 +268,5 @@ class maintenance_logs {
 		}
 		}
 	}
 	}
 }
 }
+
+?>

+ 2 - 0
resources/classes/maintenance_service.php

@@ -620,3 +620,5 @@ class maintenance_service extends service {
 		return floor(self::weeks_since_modified($file) / 52);
 		return floor(self::weeks_since_modified($file) / 52);
 	}
 	}
 }
 }
+
+?>

+ 2 - 0
resources/dashboard/config.php

@@ -37,3 +37,5 @@ $y = 0;
 $array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '6fb4d5c8-c95d-400f-b96c-edc044571a92';
 $array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '6fb4d5c8-c95d-400f-b96c-edc044571a92';
 $array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '7ce1d732-06b4-4834-ac8f-c18d8fab81e0';
 $array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '7ce1d732-06b4-4834-ac8f-c18d8fab81e0';
 $array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
 $array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
+
+?>

+ 230 - 233
resources/dashboard/maintenance.php

@@ -182,244 +182,241 @@
 if (permission_exists('maintenance_view')) {
 if (permission_exists('maintenance_view')) {
 	//show the box
 	//show the box
 	echo "<div class='hud_box'>";
 	echo "<div class='hud_box'>";
-		echo "<div class='hud_content' onclick=\"$('#hud_maintenance_details').slideToggle('fast'); toggle_grid_row_end('Maintenance')\">";
-			echo "<span class='hud_title' onclick=\"document.location.href='/app/maintenance/maintenance.php'\">".$text['label-maintenance']."</span>";
-			echo "<script src='/app/maintenance/resources/javascript/maintenance_functions.js'></script>";
-			if ($dashboard_chart_type === 'doughnut') {
-				//add an event listener for showing and hiding the days input box
-				?>
-				<div class='hud_chart' style='width: 250px;'><canvas id='maintenance_chart'></canvas></div>
-				<script>
-					const maintenance_chart = new Chart(
-						document.getElementById('maintenance_chart').getContext('2d'),
-						{
-							type: 'doughnut',
-							data: {
-								labels: ['<?php echo $text['label-running']; ?>: <?php echo $total_running_maintenance_apps; ?>', '<?php echo $text['label-total']; ?>: <?php echo $total_maintenance_apps; ?>'],
-								datasets: [{
-									data: [<?php echo $total_running_maintenance_apps; ?>, <?php echo $total_maintenance_apps; ?>],
-									backgroundColor: [
-										'<?php echo ($settings->get('theme', 'dashboard_maintenance_chart_main_color') ?? "#2a9df4"); ?>',
-										'<?php echo ($settings->get('theme', 'dashboard_maintenance_chart_sub_color') ?? "#d4d4d4"); ?>'
-									],
-									borderColor: '<?php echo $settings->get('theme', 'dashboard_chart_border_color'); ?>',
-									borderWidth: '<?php echo $settings->get('theme', 'dashboard_chart_border_width'); ?>',
-								}]
-							},
-							options: {
-								plugins: {
-									chart_number: {
-										text: '<?php echo $total_running_maintenance_apps; ?>'
-									},
-									legend: {
-										display: true,
-										position: 'right',
-										reverse: true,
-										labels: {
-											usePointStyle: true,
-											pointStyle: 'rect'
-										}
-									},
-								}
-							},
-							plugins: [{
-								id: 'chart_number',
-								beforeDraw(chart, args, options){
-									const {ctx, chartArea: {top, right, bottom, left, width, height} } = chart;
-									ctx.font = chart_text_size + ' ' + chart_text_font;
-									ctx.textBaseline = 'middle';
-									ctx.textAlign = 'center';
-									ctx.fillStyle = '<?php echo $dashboard_number_text_color; ?>';
-									ctx.fillText(options.text, width / 2, top + (height / 2));
-									ctx.save();
-								}
-							}]
-						}
-					);
-				</script>
-				<?php
-				//echo "<span class='hud_stat' style='color: $dashboard_number_text_color; padding-bottom: 27px;'>$total_running_maintenance_apps / $total_maintenance_apps</span>";
-			}
-			if ($dashboard_chart_type === 'number') {
-				//echo "<script src='/app/maintenance/resources/javascript/maintenance_chart.js'></script>";
-				echo "<span class='hud_stat'>$total_running_maintenance_apps / $total_maintenance_apps</span>";
-			}
-		echo "</div>";
-		//form for maintenance changes
-		echo "<form id='form_list_maintainers' name='form_list_maintainers' method='POST'>";
-			echo "<div class='hud_details hud_box' id='hud_maintenance_details' style='text-align: right'>";
-				//save button for changes
-				echo "<button type='button' alt='Save' title='Save' onclick=\"list_form_submit('form_list_maintainers');\" class='btn btn-default ' style='position: absolute; margin-top: -35px; margin-left: -72px;'><span class='fas fa-bolt fa-fw'></span><span class='button-label  pad'>Save</span></button>";
-				echo "<table class='tr_hover' width='100%' cellpadding='0' cellspacing='0' border='0'>";
-					echo "<tr style='position: -webkit-sticky; position: sticky; z-index: 5; top: 0; left: 2px;'>";
-						echo "<th class='hud_heading' style='width: 40%;'>".($text['label-app'] ?? 'Application')."</th>";
-						echo "<th class='hud_heading' style='width: 15%;'>".'Database'."</th>";
-						echo "<th class='hud_heading' style='width: 15%;'>".'Days'."</th>";
-						echo "<th class='hud_heading' style='width: 15%;'>".'Filesystem'."</th>";
-						echo "<th class='hud_heading' style='width: 15%;'>".'Days'."</th>";
-					echo "</tr>";
-
-					//iterate maintainers
-					foreach($maintainers as $x => $maintenance_app) {
-						$database_days = "";
-						$filesystem_days = "";
-						$database_category = '';
-						$database_subcategory = '';
-						$filesystem_category = '';
-						$filesystem_subcategory = '';
-						$filesystem_checkbox_state = CHECKBOX_HIDDEN;
-						$database_checkbox_state = CHECKBOX_HIDDEN;
-						$param = [];
-						if (class_exists($maintenance_app)) {
-							//check for database status
-							if (method_exists($maintenance_app, 'database_maintenance')) {
-								$database_category = 'maintenance';
-								$database_subcategory = $maintenance_app . '_database_retention_days';
-								$database_default_value = '30';
-								$database_days = $setting->get($database_category, $database_subcategory, '');
-								//uuid of setting
-								$database_setting_uuids = maintenance_service::find_uuid($database, $database_category, $database_subcategory);
-								$database_setting_uuid = $database_setting_uuids['uuid'];
-								$database_setting_table = $database_setting_uuids['table'];
-								if (empty($database_days)) {
-									$database_checkbox_state = CHECKBOX_UNCHECKED;
-								} else {
-									$database_checkbox_state = CHECKBOX_CHECKED;
-								}
-							}
+	echo "	<div class='hud_content' onclick=\"$('#hud_maintenance_details').slideToggle('fast'); toggle_grid_row_end('Maintenance')\">";
+	echo "		<span class='hud_title' onclick=\"document.location.href='/app/maintenance/maintenance.php'\">".$text['label-maintenance']."</span>";
+	echo "		<script src='/app/maintenance/resources/javascript/maintenance_functions.js'></script>";
+	if ($dashboard_chart_type === 'doughnut') {
+		//add an event listener for showing and hiding the days input box
+		echo "	<div class='hud_chart' style='width: 250px;'><canvas id='maintenance_chart'></canvas></div>";
+		echo "	<script>\n";
+		echo "		const maintenance_chart = new Chart(\n";
+		echo "			document.getElementById('maintenance_chart').getContext('2d'),\n";
+		echo "			{\n";
+		echo "				type: 'doughnut',\n";
+		echo "				data: {\n";
+		echo "					labels: ['".$text['label-running'].": ".$total_running_maintenance_apps."', '".$text['label-total'].": ".$total_maintenance_apps."'],\n";
+		echo "					datasets: [{\n";
+		echo "						data: [".$total_running_maintenance_apps.", ".$total_maintenance_apps."],\n";
+		echo "						backgroundColor: [\n";
+		echo "							'".($settings->get('theme', 'dashboard_maintenance_chart_main_color') ?? "#2a9df4")."',\n";
+		echo "							'".($settings->get('theme', 'dashboard_maintenance_chart_sub_color') ?? "#d4d4d4")."'\n";
+		echo "						],\n";
+		echo "						borderColor: '".$settings->get('theme', 'dashboard_chart_border_color')."',\n";
+		echo "						borderWidth: '".$settings->get('theme', 'dashboard_chart_border_width')."',\n";
+		echo "					}]\n";
+		echo "				},\n";
+		echo "				options: {\n";
+		echo "					plugins: {\n";
+		echo "						chart_number: {\n";
+		echo "							text: ".$total_running_maintenance_apps."\n";
+		echo "						},\n";
+		echo "						legend: {\n";
+		echo "							display: true,\n";
+		echo "							position: 'right',\n";
+		echo "							reverse: true,\n";
+		echo "							labels: {\n";
+		echo "								usePointStyle: true,\n";
+		echo "								pointStyle: 'rect'\n";
+		echo "							}\n";
+		echo "						},\n";
+		echo "					}\n";
+		echo "				},\n";
+		echo "				plugins: [{\n";
+		echo "					id: 'chart_number',\n";
+		echo "					beforeDraw(chart, args, options){\n";
+		echo "						const {ctx, chartArea: {top, right, bottom, left, width, height} } = chart;\n";
+		echo "						ctx.font = chart_text_size + ' ' + chart_text_font;\n";
+		echo "						ctx.textBaseline = 'middle';\n";
+		echo "						ctx.textAlign = 'center';\n";
+		echo "						ctx.fillStyle = '".$dashboard_number_text_color."';\n";
+		echo "						ctx.fillText(options.text, width / 2, top + (height / 2));\n";
+		echo "						ctx.save();\n";
+		echo "					}\n";
+		echo "				}]\n";
+		echo "			}\n";
+		echo "		);\n";
+		echo "	</script>\n";
+	}
+	if ($dashboard_chart_type === 'number') {
+		echo "	<span class='hud_stat'>$total_running_maintenance_apps / $total_maintenance_apps</span>";
+	}
+	echo "	</div>";
+	//form for maintenance changes
+	echo "	<form id='form_list_maintainers' name='form_list_maintainers' method='POST'>";
+	echo "		<div class='hud_details hud_box' id='hud_maintenance_details' style='text-align: right'>";
+	//save button for changes
+	echo "			<button type='button' alt='Save' title='Save' onclick=\"list_form_submit('form_list_maintainers');\" class='btn btn-default ' style='position: absolute; margin-top: -35px; margin-left: -72px;'><span class='fas fa-bolt fa-fw'></span><span class='button-label  pad'>Save</span></button>";
+	echo "			<table class='tr_hover' width='100%' cellpadding='0' cellspacing='0' border='0'>";
+	echo "				<tr style='position: -webkit-sticky; position: sticky; z-index: 5; top: 0; left: 2px;'>";
+	echo "					<th class='hud_heading' style='width: 40%;'>".($text['label-app'] ?? 'Application')."</th>";
+	echo "					<th class='hud_heading' style='width: 15%;'>".'Database'."</th>";
+	echo "					<th class='hud_heading' style='width: 15%;'>".'Days'."</th>";
+	echo "					<th class='hud_heading' style='width: 15%;'>".'Filesystem'."</th>";
+	echo "					<th class='hud_heading' style='width: 15%;'>".'Days'."</th>";
+	echo "				</tr>";
 
 
-							//check for filesystem status
-							if (method_exists($maintenance_app, 'filesystem_maintenance')) {
-								$filesystem_category = 'maintenance';
-								$filesystem_subcategory = $maintenance_app . '_filesystem_retention_days';
-								$filesystem_default_value = '30';
-								$filesystem_days = $setting->get($filesystem_category, $filesystem_subcategory, '');
-								//uuid of setting
-								$filesystem_setting_uuids = maintenance_service::find_uuid($database, $filesystem_category, $filesystem_subcategory);
-								$filesystem_setting_uuid = $filesystem_setting_uuids['uuid'];
-								$filesystem_setting_table = $filesystem_setting_uuids['table'];
-								if (empty($filesystem_days)) {
-									$filesystem_checkbox_state = CHECKBOX_UNCHECKED;
-								} else {
-									$filesystem_checkbox_state = CHECKBOX_CHECKED;
-								}
-							} else {
-								$filesystem_setting_uuid = '';
-								$filesystem_setting_table = '';
-							}
-						}
+	//iterate maintainers
+	foreach($maintainers as $x => $maintenance_app) {
+		$database_days = "";
+		$filesystem_days = "";
+		$database_category = '';
+		$database_subcategory = '';
+		$filesystem_category = '';
+		$filesystem_subcategory = '';
+		$filesystem_checkbox_state = CHECKBOX_HIDDEN;
+		$database_checkbox_state = CHECKBOX_HIDDEN;
+		$param = [];
+		if (class_exists($maintenance_app)) {
+			//check for database status
+			if (method_exists($maintenance_app, 'database_maintenance')) {
+				$database_category = 'maintenance';
+				$database_subcategory = $maintenance_app . '_database_retention_days';
+				$database_default_value = '30';
+				$database_days = $setting->get($database_category, $database_subcategory, '');
+				//uuid of setting
+				$database_setting_uuids = maintenance_service::find_uuid($database, $database_category, $database_subcategory);
+				$database_setting_uuid = $database_setting_uuids['uuid'];
+				$database_setting_table = $database_setting_uuids['table'];
+				if (empty($database_days)) {
+					$database_checkbox_state = CHECKBOX_UNCHECKED;
+				} else {
+					$database_checkbox_state = CHECKBOX_CHECKED;
+				}
+			}
 
 
-						//set status and color for database maintenance apps
-						if ($database_checkbox_state === CHECKBOX_CHECKED) {
-							$database_checked = "checked='checked'";
-						}
-						else {
-							$database_checked = '';
-						}
-						//display the maintanence application
-						echo "<tr>";
-							$display_name = ucwords(str_replace('_', ' ', $maintenance_app));
-							echo "<td valign='top' class='".$row_style[$c]." hud_text'>$display_name</td>";
-							//
-							// Database apps
-							//
-							//hide or show database maintenance ability
-							if ($database_checkbox_state !== CHECKBOX_HIDDEN) {
-								//enable or disable checkbox
-								if (substr($setting->get('theme','input_toggle_style', ''), 0, 6) == 'switch') {
-									echo "<td valign='top' class='".$row_style[$c]." hud_text input tr_link_void' style='width: 1%; text-align: center;'>";
-										echo "<label class='switch'>";
-											echo "<input type='checkbox' name='database_retention_days[$x][status]' value='true' $database_checked onclick=\"this.checked ? show_input_box('database_days_$x') : hide_input_box('database_days_$x');\">";
-											echo "<span class='slider'></span>";
-										echo "</label>";
-									echo "</td>";
-								} else {
-									echo "<td valign='top' class='".$row_style[$c]." hud_text'>$database_status</td>";
-								}
-							} else {
-								//not a database maintenance application
-								echo "<td valign='top' class='".$row_style[$c]." hud_text'>&nbsp;</td>";
-							}
-							//database days input box
-							echo "<td valign='top' class='".$row_style[$c]." hud_text input tr_link_void'>";
-								//hide the input box if we are hiding the checkbox
-								if ($database_checkbox_state !== CHECKBOX_CHECKED) {
-									$database_input_days_style = " display: none;";
-								} else {
-									$database_input_days_style = "";
-								}
-								//check for permission
-								if (permission_exists('maintenance_edit')) {
-									echo "<input class='formfld' style='width: 20%; min-width: 40px;$database_input_days_style' type='text' name='database_retention_days[$x][days]' id='database_days_$x' placeholder='days' maxlength='255' value='" . ($database_checkbox_state === CHECKBOX_CHECKED ? $database_days : $database_default_value) . "'>";
-									echo "<input type='hidden' id='database_uuid_$x' name='database_retention_days[$x][uuid]' value='$database_setting_uuid'>";
-									echo "<input type='hidden' id='database_category_$x' name='database_retention_days[$x][category]' value='$database_category'>";
-									echo "<input type='hidden' id='database_subcategory_$x' name='database_retention_days[$x][subcategory]' value='$database_subcategory'>";
-									echo "<input type='hidden' id='database_type_$x' name='database_retention_days[$x][type]' value='$database_setting_table'>";
-								} else {
-									echo "$database_days";
-								}
-							echo "</td>";
-							//set the checkboxes to checked
-							if ($filesystem_checkbox_state === CHECKBOX_CHECKED) {
-								$filesystem_checked = "checked='checked'";
-							}
-							else {
-								$filesystem_checked = '';
-							}
-							//
-							//filesystem apps
-							//
-							echo "<td valign='top' class='".$row_style[$c]." hud_text input tr_link_void' style='width: 1%; text-align: center;'>";
-							if ($filesystem_checkbox_state !== CHECKBOX_HIDDEN) {
-								if (substr($setting->get('theme','input_toggle_style', ''), 0, 6) == 'switch') {
-										echo "<label class='switch'>";
-										echo "<input type='checkbox' locked id='filesystem_enabled_$x' name='filesystem_retention_days[$x][status]' value='true' $filesystem_checked onclick=\"this.checked ? show_input_box('filesystem_days_$x') : hide_input_box('filesystem_days_$x');\">";
-										echo "<span class='slider'></span>";
-										echo "</label>";
-								}
-								else {
-									echo "<td valign='top' class='".$row_style[$c]." hud_text'>";
-									if ($show_filesystem_days) {
-										echo $filesystem_enabled;
-									} else {
-										echo "&nbsp;";
-									}
-									echo "</td>";
-								}
-							} else {
-								echo "&nbsp;";
-							}
-							echo "</td>";
-							//filesystem days input box
-							echo "<td valign='top' class='".$row_style[$c]." hud_text input tr_link_void'>";
-								//hide the input box if we are hiding the checkbox
-								if ($filesystem_checkbox_state !== CHECKBOX_CHECKED) {
-									$filesystem_input_days_style = " display: none;";
-								} else {
-									$filesystem_input_days_style = "";
-								}
-								if (permission_exists('maintenance_edit')) {
-									echo "<input class='formfld' style='width: 20%; min-width: 40px;$filesystem_input_days_style' type='text' name='filesystem_retention_days[$x][days]' id='filesystem_days_$x' placeholder='days' maxlength='255' value='$filesystem_days'>";
-									echo "<input type='hidden' id='filesystem_uuid_$x' name='filesystem_retention_days[$x][uuid]' value='$filesystem_setting_uuid'>";
-									echo "<input type='hidden' id='filesystem_category_$x' name='filesystem_retention_days[$x][category]' value='$filesystem_category'>";
-									echo "<input type='hidden' id='filesystem_subcategory_$x' name='filesystem_retention_days[$x][subcategory]' value='$filesystem_subcategory'>";
-									echo "<input type='hidden' id='filesystem_type_$x' name='filesystem_retention_days[$x][type]' value='$filesystem_setting_table'>";
-								} else {
-									echo "$filesystem_days";
-								}
-							echo "</td>";
-						echo "</tr>";
-						$c = !$c;
-					}
-				echo "</table>";
-			echo "</div>";
+			//check for filesystem status
+			if (method_exists($maintenance_app, 'filesystem_maintenance')) {
+				$filesystem_category = 'maintenance';
+				$filesystem_subcategory = $maintenance_app . '_filesystem_retention_days';
+				$filesystem_default_value = '30';
+				$filesystem_days = $setting->get($filesystem_category, $filesystem_subcategory, '');
+				//uuid of setting
+				$filesystem_setting_uuids = maintenance_service::find_uuid($database, $filesystem_category, $filesystem_subcategory);
+				$filesystem_setting_uuid = $filesystem_setting_uuids['uuid'];
+				$filesystem_setting_table = $filesystem_setting_uuids['table'];
+				if (empty($filesystem_days)) {
+					$filesystem_checkbox_state = CHECKBOX_UNCHECKED;
+				} else {
+					$filesystem_checkbox_state = CHECKBOX_CHECKED;
+				}
+			} else {
+				$filesystem_setting_uuid = '';
+				$filesystem_setting_table = '';
+			}
+		}
 
 
-		//form save submit
+		//set status and color for database maintenance apps
+		if ($database_checkbox_state === CHECKBOX_CHECKED) {
+			$database_checked = "checked='checked'";
+		}
+		else {
+			$database_checked = '';
+		}
+		//display the maintanence application
+		echo "<tr>";
+		$display_name = ucwords(str_replace('_', ' ', $maintenance_app));
+		echo "	<td valign='top' class='".$row_style[$c]." hud_text'>$display_name</td>";
+		//
+		// Database apps
+		//
+		//hide or show database maintenance ability
+		if ($database_checkbox_state !== CHECKBOX_HIDDEN) {
+			//enable or disable checkbox
+			if (substr($setting->get('theme','input_toggle_style', ''), 0, 6) == 'switch') {
+				echo "<td valign='top' class='".$row_style[$c]." hud_text input tr_link_void' style='width: 1%; text-align: center;'>";
+				echo "	<label class='switch'>";
+				echo "		<input type='checkbox' name='database_retention_days[$x][status]' value='true' $database_checked onclick=\"this.checked ? show_input_box('database_days_$x') : hide_input_box('database_days_$x');\">";
+				echo "		<span class='slider'></span>";
+				echo "	</label>";
+				echo "</td>";
+			} else {
+				echo "<td valign='top' class='".$row_style[$c]." hud_text'>$database_status</td>";
+			}
+		} else {
+			//not a database maintenance application
+			echo "<td valign='top' class='".$row_style[$c]." hud_text'>&nbsp;</td>";
+		}
+		//database days input box
+		echo "	<td valign='top' class='".$row_style[$c]." hud_text input tr_link_void'>";
+		//hide the input box if we are hiding the checkbox
+		if ($database_checkbox_state !== CHECKBOX_CHECKED) {
+			$database_input_days_style = " display: none;";
+		} else {
+			$database_input_days_style = "";
+		}
+		//check for permission
+		if (permission_exists('maintenance_edit')) {
+			echo "<input class='formfld' style='width: 20%; min-width: 40px;$database_input_days_style' type='text' name='database_retention_days[$x][days]' id='database_days_$x' placeholder='days' maxlength='255' value='" . ($database_checkbox_state === CHECKBOX_CHECKED ? $database_days : $database_default_value) . "'>";
+			echo "<input type='hidden' id='database_uuid_$x' name='database_retention_days[$x][uuid]' value='$database_setting_uuid'>";
+			echo "<input type='hidden' id='database_category_$x' name='database_retention_days[$x][category]' value='$database_category'>";
+			echo "<input type='hidden' id='database_subcategory_$x' name='database_retention_days[$x][subcategory]' value='$database_subcategory'>";
+			echo "<input type='hidden' id='database_type_$x' name='database_retention_days[$x][type]' value='$database_setting_table'>";
+		} else {
+			echo "$database_days";
+		}
+		echo "	</td>";
+		//set the checkboxes to checked
+		if ($filesystem_checkbox_state === CHECKBOX_CHECKED) {
+			$filesystem_checked = "checked='checked'";
+		}
+		else {
+			$filesystem_checked = '';
+		}
+		//
+		//filesystem apps
+		//
+		echo "	<td valign='top' class='".$row_style[$c]." hud_text input tr_link_void' style='width: 1%; text-align: center;'>";
+		if ($filesystem_checkbox_state !== CHECKBOX_HIDDEN) {
+		if (substr($setting->get('theme','input_toggle_style', ''), 0, 6) == 'switch') {
+			echo "<label class='switch'>";
+			echo "<input type='checkbox' locked id='filesystem_enabled_$x' name='filesystem_retention_days[$x][status]' value='true' $filesystem_checked onclick=\"this.checked ? show_input_box('filesystem_days_$x') : hide_input_box('filesystem_days_$x');\">";
+			echo "<span class='slider'></span>";
+			echo "</label>";
+		}
+		else {
+			echo "<td valign='top' class='".$row_style[$c]." hud_text'>";
+			if ($show_filesystem_days) {
+				echo $filesystem_enabled;
+			} else {
+				echo "&nbsp;";
+			}
+			echo "</td>";
+		}
+		} else {
+			echo "&nbsp;";
+		}
+		echo "	</td>";
+		//filesystem days input box
+		echo "	<td valign='top' class='".$row_style[$c]." hud_text input tr_link_void'>";
+		//hide the input box if we are hiding the checkbox
+		if ($filesystem_checkbox_state !== CHECKBOX_CHECKED) {
+			$filesystem_input_days_style = " display: none;";
+		} else {
+			$filesystem_input_days_style = "";
+		}
 		if (permission_exists('maintenance_edit')) {
 		if (permission_exists('maintenance_edit')) {
-			echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>";
+			echo "<input class='formfld' style='width: 20%; min-width: 40px;$filesystem_input_days_style' type='text' name='filesystem_retention_days[$x][days]' id='filesystem_days_$x' placeholder='days' maxlength='255' value='$filesystem_days'>";
+			echo "<input type='hidden' id='filesystem_uuid_$x' name='filesystem_retention_days[$x][uuid]' value='$filesystem_setting_uuid'>";
+			echo "<input type='hidden' id='filesystem_category_$x' name='filesystem_retention_days[$x][category]' value='$filesystem_category'>";
+			echo "<input type='hidden' id='filesystem_subcategory_$x' name='filesystem_retention_days[$x][subcategory]' value='$filesystem_subcategory'>";
+			echo "<input type='hidden' id='filesystem_type_$x' name='filesystem_retention_days[$x][type]' value='$filesystem_setting_table'>";
+		} else {
+			echo "$filesystem_days";
 		}
 		}
-		echo "</form>";
-	echo "<span class='hud_expander' onclick=\"$('#hud_maintenance_details').slideToggle('fast'); toggle_grid_row_end('Maintenance')\"><span class='fas fa-ellipsis-h'></span></span>";
+		echo "	</td>";
+		echo "</tr>";
+		$c = !$c;
+	}
+	echo "			</table>";
+	echo "		</div>";
+
+	//form save submit
+	if (permission_exists('maintenance_edit')) {
+		echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>";
+	}
+	echo "	</form>";
+	echo "	<span class='hud_expander' onclick=\"$('#hud_maintenance_details').slideToggle('fast'); toggle_grid_row_end('Maintenance')\"><span class='fas fa-ellipsis-h'></span></span>";
 	echo "</div>";
 	echo "</div>";
 }
 }
+
 ?>
 ?>

+ 2 - 0
resources/functions.php

@@ -194,3 +194,5 @@
 			return $trait_classes;
 			return $trait_classes;
 		}
 		}
 	}
 	}
+
+?>

+ 2 - 0
resources/interfaces/database_maintenance.php

@@ -7,3 +7,5 @@
 interface database_maintenance {
 interface database_maintenance {
 	public static function database_maintenance(settings $settings): void;
 	public static function database_maintenance(settings $settings): void;
 }
 }
+
+?>

+ 2 - 0
resources/interfaces/filesystem_maintenance.php

@@ -7,3 +7,5 @@
 interface filesystem_maintenance {
 interface filesystem_maintenance {
 	public static function filesystem_maintenance(settings $settings): void;
 	public static function filesystem_maintenance(settings $settings): void;
 }
 }
+
+?>

+ 2 - 0
resources/service/maintenance_service

@@ -38,3 +38,5 @@ try {
 	echo $t->getMessage();
 	echo $t->getMessage();
 	exit(1);
 	exit(1);
 }
 }
+
+?>