$aus['conf'].=table_output($lang['L_SEND_MAIL_FORM'],$lang['L_YES'] . ", " . $lang['L_EMAIL_ADRESS'] . ": " . $config['email_recipient']); if ($config['email_recipient_cc'] > '') $aus['conf'].=table_output($lang['L_EMAIL_CC'],$config['email_recipient_cc']); $text=$lang['L_YES'] . ", " . $lang['L_MAX_UPLOAD_SIZE'] . ": "; $bytes=$config['email_maxsize1'] * 1024; if ($config['email_maxsize2'] == 2) $bytes=$bytes * 1024; $text.=byte_output($bytes); if ($config['send_mail_dump'] == 1) $aus['conf'].=table_output($lang['L_SEND_MAIL_DUMP'],$text); } for ($x=0; $x < 3; $x++) { if (isset($config['ftp_transfer'][$x]) && $config['ftp_transfer'][$x] > 0) { //$aus['conf'].=table_output($lang['L_FTP'],sprintf($lang['L_FTP_SEND_TO'],$config['ftp_server'][$x],$config['ftp_dir'][$x]),1,2); $aus['conf'].=table_output($lang['L_FTP'],sprintf($lang['L_FTP_SEND_TO'],$config['ftp_server'][$x],$config['ftp_dir'][$x])); } } $aus['conf'].='</table></td><td>'; $aus['conf'].='<a href="config_overview.php?config=' . urlencode($c) . '">' . $icon['edit'] . '</a>'; if ($c != 'mysqldumper') // && $old_config['config_file']!=$c) $aus['conf'].='<a href="config_overview.php?config_delete=' . urlencode($c) . '" onclick="if(!confirm(\'' . sprintf($lang['L_CONFIRM_CONFIGFILE_DELETE'],$c) . '\')) return false;">' . $icon['delete'] . '</a>'; else $aus['conf'].=' '; $aus['conf'].='</td></tr>'; } } $configfile=$old_config['config_file']; $config=$old_config;
} echo '<tr><td>' . $lang['L_GZIP'] . ":</td><td><strong>" . ($config['cron_compression'] == 1 ? $lang['L_ACTIVATED'] : $lang['L_NOT_ACTIVATED']); echo '</strong></td></tr>'; echo '<tr><td>' . $lang['L_MULTI_PART'] . ":</td><td><strong>" . ($config['multi_part'] == 1 ? $lang['L_YES'] : $lang['L_NO']); echo '</strong></td></tr>'; if ($config['multi_part'] == 1) { echo '<tr><td>' . $lang['L_MULTI_PART_GROESSE'] . ':</td><td><strong>' . byte_output($config['multipart_groesse']) . '</td></tr>'; } echo '<tr><td>' . $lang['L_CRON_PRINTOUT'] . ':</td><td><strong>' . ($config['cron_printout'] == 1 ? $lang['L_ACTIVATED'] : $lang['L_NOT_ACTIVATED']) . '</strong></td></tr>'; if ($config['send_mail'] == 1) { $t = $config['email_recipient'] . ($config['send_mail_dump'] == 1 ? $lang['L_WITHATTACH'] : $lang['L_WITHOUTATTACH']); } echo '<tr><td>' . $lang['L_SEND_MAIL_FORM'] . ':</td><td><strong>' . ($config['send_mail'] == 1 ? $t : $lang['L_NOT_ACTIVATED']) . '</strong></td></tr>'; for ($x = 0; $x < 3; $x++) { if (isset($config['ftp_transfer'][$x]) && $config['ftp_transfer'][$x] > 0) { echo table_output($lang['L_FTP_TRANSFER'], sprintf(str_replace('<br>', ' ', $lang['L_FTP_SEND_TO']), $config['ftp_server'][$x], $config['ftp_dir'][$x]), 1, 2); } } //echo '</td></tr>'; echo '</table>'; // Eintraege fuer Perl echo '<br><p class="small">' . $lang['L_PERLOUTPUT1'] . ':<br> <strong>' . $scriptentry . '</strong><br>'; echo $lang['L_PERLOUTPUT2'] . ':<br> <strong>' . $scriptref . '</strong><br>'; echo $lang['L_PERLOUTPUT3'] . ':<br> <strong>' . $cronref . '</strong></p>'; echo '</div>'; break; case 'restore': echo headline(sprintf($lang['L_FM_RESTORE_HEADER'], $databases['db_actual'])); echo $msg > '' ? $msg : ''; echo $autodel; echo '<form name="fm" id="fm" method="post" action="' . $href . '">';
function table_output($result, $item_class = '', $title = '', $level = 0) { # template cache for detect previouse loaded template global $template_cache; # the local template cache is for detecting endless loops global $template_cache_local; # handling the local template cache #reseting it if level is 0 if ($level == 0) { $template_cache_local = array(); } elseif ($level == 20) { # this is a hardcoded loop stopper, should come into action, but prevents that the page will endless load # normaly there will never be templates on 20 level inherited return; } # output will catch the content until return $output = ''; if (!empty($result)) { if (is_array($result) and !empty($result) and !empty($title)) { $output .= '<tr><td colspan=2><br>'; if ($item_class == 'template_inheritance') { $output .= '<b>inherited from</b> ' . $title; } else { $output .= '<b>' . $title . '</b>'; } $output .= '</td></tr>'; } $last_fname = ''; foreach ($result as $entry) { if (!empty($entry["config_class"]) and $entry["config_class"] == "service") { $host_query = 'SELECT attr_value AS hostname FROM ConfigValues,ConfigAttrs,ConfigClasses,ItemLinks WHERE fk_item_linked2=ConfigValues.fk_id_item AND id_attr=ConfigValues.fk_id_attr AND naming_attr="yes" AND fk_id_class = id_class AND config_class="host" AND ItemLinks.fk_id_item=' . $entry["item_id"]; $hostname = db_handler($host_query, "getOne", "Get linked hostnames (if service)"); } if (!empty($entry["friendly_name"])) { $group_name = $entry["friendly_name"]; } // group same attributes if (!empty($group_name) and $last_fname != $group_name) { $show_fname = $group_name; //$bgcolor = 'class="color_list2"'; } else { $show_fname = ''; } $output .= '<tr>'; //$output .= '<td '.$bgcolor.'>'.$show_fname.'</td>'; $output .= '<td class="color_list2">' . $show_fname . '</td>'; # print template (and detect repetitive) if ($item_class == 'template_inheritance') { $template_status = apply_template($template_cache, $entry["item_id"]); $local_template_status = apply_template($template_cache_local, $entry["item_id"]); NConf_DEBUG::set($local_template_status, 'DEBUG', "local repetitive status"); NConf_DEBUG::set($template_cache_local, 'DEBUG', "local template cache"); } else { $template_status = FALSE; $local_template_status = FALSE; } if (!empty($entry["config_class"]) and $entry["config_class"] == "service" && $item_class != "host") { $output .= '<td class="color_list1 highlight">'; $output .= '<a href="detail.php?id=' . $entry["item_id"] . '">'; $output .= $hostname . ': ' . $entry["attr_value"]; $output .= '</td>'; } else { $level_label = ''; for ($i = $level; $i > 1; $i--) { $level_label .= '<div style="width: 9px; display: inline-block;"></div>'; } if ($i == 1 and $level != 0) { ## add a mark $level_label .= '<span class="link_with_tag2"></span>'; } # mark previously applied templates if ($template_status === "repetitive") { # detect previously applied or template loop if ($local_template_status === "repetitive") { # endless loop $repetitive_text = "(circular template chain detected)"; $class = "ui-state-error highlight"; } else { $repetitive_text = "(previously applied)"; $class = "color_list1 highlight"; } $output .= '<td class="' . $class . '">'; $output .= $level_label . '<a href="detail.php?id=' . $entry["item_id"] . '">'; $output .= $entry["attr_value"] . '</a>'; $output .= '<span id="' . $entry["item_id"] . '" class="previously_applied" style="float: right;"><i>' . $repetitive_text . '</i></span>'; $output .= '</td>'; } else { # set id for coming repetitive if ($item_class == 'template_inheritance') { $output .= '<td id="' . $entry["item_id"] . '_first" class="color_list1 highlight">'; } else { $output .= '<td class="color_list1 highlight">'; } if (!empty($entry["item_id"])) { $output .= $level_label; $output .= '<a href="detail.php?id=' . $entry["item_id"] . '">'; $output .= $entry["attr_value"] . '</a>'; } else { $output .= $entry["attr_value"]; } $output .= '</td>'; } } $output .= '</tr>'; if (!empty($group_name)) { $last_fname = $group_name; $show_fname = ''; $bgcolor = ''; } # lookup template himself if ($item_class == 'template_inheritance') { if ($local_template_status === "repetitive") { NConf_DEBUG::set('', 'DEBUG', 'template is repetitive, stopping inheritance to prevent endless loop'); } else { $template_on_template = db_templates("template_inheritance_direct", $entry["item_id"]); if (!empty($template_on_template)) { //$output .= '<tr><td colspan=2><br><b>directly linked to service</b></td></tr>'; $output .= table_output($template_on_template, 'template_inheritance', '', ++$level); } } } } } return $output; }