" . gettext("Try reinstalling the package."), 'danger', false); include("foot.inc"); die; } if (file_exists($pkg_full_path)) { $pkg = parse_xml_config_pkg($pkg_full_path, "packagegui"); } else { include("head.inc"); print_info_box(sprintf(gettext("File not found %s."), htmlspecialchars($xml)), 'danger', false); include("foot.inc"); exit; } } if ($pkg['donotsave'] != "") { header("Location: pkg_edit.php?xml=" . $xml); exit; } if ($pkg['include_file'] != "") { require_once($pkg['include_file']); } if ($_REQUEST['startdisplayingat']) { $startdisplayingat = $_REQUEST['startdisplayingat']; } if ($_REQUEST['display_maximum_rows']) { if ($_REQUEST['display_maximum_rows']) { $display_maximum_rows = $_REQUEST['display_maximum_rows']; } } $evaledvar = $config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config']; if ($_GET['act'] == "update") { if (is_array($config['installedpackages'][$pkg['name']]) && $pkg['name'] != "" && $_REQUEST['ids'] !="") { #get current values $current_values=$config['installedpackages'][$pkg['name']]['config']; #get updated ids parse_str($_REQUEST['ids'], $update_list); #sort ids to know what to change #useful to do not lose data when using sorting and paging $sort_list=$update_list['ids']; sort($sort_list); #apply updates foreach ($update_list['ids'] as $key=> $value) { $config['installedpackages'][$pkg['name']]['config'][$sort_list[$key]]=$current_values[$update_list['ids'][$key]]; } #save current config write_config(); #sync package eval ("{$pkg['custom_php_resync_config_command']}"); } #function called via jquery, no need to continue after save changes. exit; } if ($_GET['act'] == "del") { // loop through our fieldnames and automatically setup the fieldnames // in the environment. ie: a fieldname of username with a value of // testuser would automatically eval $username = "testuser"; foreach ($evaledvar as $ip) { if ($pkg['adddeleteeditpagefields']['columnitem']) { foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) { ${xml_safe_fieldname($column['fielddescr'])} = $ip[xml_safe_fieldname($column['fieldname'])]; } } } $a_pkg = &$config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config']; if ($a_pkg[$_GET['id']]) { unset($a_pkg[$_GET['id']]); write_config(); if ($pkg['custom_delete_php_command'] != "") { if ($pkg['custom_php_command_before_form'] != "") { eval($pkg['custom_php_command_before_form']); } eval($pkg['custom_delete_php_command']); } header("Location: pkg.php?xml=" . $xml); exit; } } ob_start(); $iflist = get_configured_interface_with_descr(false, true); $evaledvar = $config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config']; if ($pkg['custom_php_global_functions'] != "") { eval($pkg['custom_php_global_functions']); } if ($pkg['custom_php_command_before_form'] != "") { eval($pkg['custom_php_command_before_form']); } // Breadcrumb if ($pkg['title'] != "") { /*if (!$only_edit) { // Is any package still making use of this?? Is this something that is still wanted, considering the breadcrumb policy https://redmine.pfsense.org/issues/5527 $pkg['title'] = $pkg['title'] . '/Edit'; // If this needs to live on, then it has to be moved to run AFTER "foreach ($pkg['tabs']['tab'] as $tab)"-loop. This due to $pgtitle[] = $tab['text']; }*/ if (strpos($pkg['title'], '/')) { $title = explode('/', $pkg['title']); foreach ($title as $subtitle) { $pgtitle[] = gettext($subtitle); } } else { $pgtitle = array(gettext("Package"), gettext($pkg['title'])); } } else { $pgtitle = array(gettext("Package"), gettext("Editor")); } if ($pkg['tabs'] != "") { $tab_array = array(); foreach ($pkg['tabs']['tab'] as $tab) { if ($tab['tab_level']) { $tab_level = $tab['tab_level']; } else { $tab_level = 1; } if (isset($tab['active'])) { $active = true; $pgtitle[] = $tab['text']; } else { $active = false; } if (isset($tab['no_drop_down'])) { $no_drop_down = true; } $urltmp = ""; if ($tab['url'] != "") { $urltmp = $tab['url']; } if ($tab['xml'] != "") { $urltmp = "pkg_edit.php?xml=" . $tab['xml']; } $addresswithport = getenv("HTTP_HOST"); $colonpos = strpos($addresswithport, ":"); if ($colonpos !== False) { //my url is actually just the IP address of the pfsense box $myurl = substr($addresswithport, 0, $colonpos); } else { $myurl = $addresswithport; } // eval url so that above $myurl item can be processed if need be. $url = str_replace('$myurl', $myurl, $urltmp); $tab_array[$tab_level][] = array( $tab['text'], $active, $url ); } ksort($tab_array); } include("head.inc"); if (isset($tab_array)) { foreach ($tab_array as $tabid => $tab) { display_top_tabs($tab); //, $no_drop_down, $tabid); } } ?>
' />
"; echo ""; } } } ?> "; } $cols = 0; if ($pkg['adddeleteeditpagefields']['columnitem'] != "") { foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) { echo ""; $cols++; } } ?> "; preg_match($filter_regex, $fieldname, $filter_matches); break; } } } } if (!$filter_matches) { $i++; continue; } } if ($pkg['adddeleteeditpagefields']['movable']) { echo "\n"; } else { echo "\n"; } if ($pkg['adddeleteeditpagefields']['columnitem'] != "") { foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) { if ($column['fieldname'] == "description") { $class = "listbg"; } else { $class = "listlr"; } ?> \n"; // Pairs with an echo tr some way above // Handle pagination and display_maximum_rows if ($display_maximum_rows) { if ($pagination_counter == ($display_maximum_rows-1) or $i == (count($evaledvar)-1)) { $colcount = count($pkg['adddeleteeditpagefields']['columnitem']); $final_footer = ""; $final_footer .= ""; $i = count($evaledvar); break; } } $i++; $pagination_counter++; } // foreach evaledvar } // if evaledvar ?>
"; echo gettext("Filter by: "); $isfirst = true; for ($char = 65; $char < 91; $char++) { if (!$isfirst) { echo " | "; } echo "" . chr($char) . ""; $isfirst = false; } echo "
"; if ($field['sortablefields']) { echo gettext("Filter field: ") . ""; } if ($include_filtering_inputbox) { echo '  ' . gettext("Filter text: ") . ''; echo ' "; } echo "
 
"; echo ""; echo ""; echo ""; echo ""; echo "
" . sprintf(gettext('Displaying page %1$s of %2$s'), $page, $totalpages) . "" . gettext("Rows per page: ") . "
"; echo "
" . $column['fielddescr'] . "
 
"; $final_footer .= ""; $final_footer .= "
"; $startingat = $startdisplayingat - $display_maximum_rows; if ($startingat > -1) { $final_footer .= ""; } else if ($startdisplayingat > 1) { $final_footer .= ""; } $final_footer .= "<< " . gettext("Previous page") . ""; if ($tmppp + $display_maximum_rows > count($evaledvar)) { $endingrecord = count($evaledvar); } else { $endingrecord = $tmppp + $display_maximum_rows; } $final_footer .= ""; $tmppp++; $final_footer .= "Displaying {$tmppp} - {$endingrecord} / " . count($evaledvar) . " records"; $final_footer .= " "; if (($i+1) < count($evaledvar)) { $final_footer .= ""; } $final_footer .= "" . gettext("Next page") . " >>"; $final_footer .= "
"; echo ""; include("foot.inc"); ?>