Open-AudIT
https://www.open-audit.org/phpBB3/

Add a config page for the include_dia_config.php ...
https://www.open-audit.org/phpBB3/viewtopic.php?f=9&t=2466
Page 1 of 1

Author:  A_Hull [ Wed Nov 07, 2007 10:55 pm ]
Post subject:  Add a config page for the include_dia_config.php ...

We need to add a config page for the diagrams configs.


[color=#BF0040]**** UPDATED code below.... Looks better (IMHO) but still only displays a table, not a dynamic form...
Take care with this, as you can pass a filename to this version, so you can view any file on the web server with this... it is test code after all.. :P

Call it with http://{myserver}/show_inkscape_config.php?show_file=include_dia_config.php for example and it shows the dia config
[/color]


As per viewtopic.php?f=10&t=2419&start=15

:oops: Since I simply haven't had time to add pages to the admin tab for the inkscape and dia configs. I was intending refining this area, but too much "real" work and not enough time I'm afraid.

The way I intended doing this was to read the config page in to an array, create the admin_x_config form page from the array, and post back to the config page from the dynamically created form page. Doing this dynamically would allow me to change the config.php pages without having to re-code the admin page too much.

This is about as far as I managed to progress... (save this as show_include_inkscape_config.php)
So far it just makes a table from the current config, but the idea is to create a form instead, using the same basic methods, probably using the comments to control how the form will look, (data typing, acceptable values etc). Since the form once updated will then re-create the php page, we can keep the same config files and variable names. Sounds like a workable idea, but as ever feel free to shoot it down.

Any comments,:?: I thought the idea might even expand to a new admin>config page for OA's config. Try substituting show_file=include_config.php as per the above example..... You get the idea...

[code]
<?php
//
/**
*
* @version $Id: show_include_inkscape_config.php 6th November 2007
*
* @author The Open Audit Developer Team (Andrew Hull)
* @objective Configuration File for inkscape inkscapegram Creator Page for Open Audit.
* @package open-audit (www.open-audit.org)
* @copyright Copyright (C) open-audit.org All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see ../gpl.txt
* Open-Audit is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See www.open-audit.org for further copyright notices and details.
*
*/
//
// Quick and dirty hack to read a config file to an array and output the array to a table..
// Not pretty, but hey.. it works.

$page = "";
$extra = "";
$software = "";
$count = 0;
$total_rows = 0;
$latest_version = "07.10.25";

// Check for config, otherwise run setup
@(include_once "include_config.php") OR die(header("Location: setup.php"));

if (isset($_GET['software'])) {$software = $_GET['software'];} else {}
if (isset($_GET['sort'])) {$sort = $_GET['sort'];} else {$sort= "system_name";}
if (isset($_GET['validate'])) {$validate = $_GET['validate'];} else {$validate= "n";}
if (isset($_GET['show_file'])) {$show_file = $_GET['show_file'];} else {$show_file = 'include_inkscape_config.php';}


include "include.php";

$title = "";
if (isset($_GET["show_all"])){ $count_system = '10000'; } else {}
if (isset($_GET["page_count"])){ $page_count = $_GET["page_count"]; } else { $page_count = 0;}
$page_prev = $page_count - 1;
if ($page_prev < 0){ $page_prev = 0; } else {}
$page_next = $page_count + 1;
$page_current = $page_count;
$page_count = $page_count * $count_system;
// End of layout Now the form... or in this case the array as a table.
echo "<td>\n";

// File to show
echo "<div class=\"main_each\">";

$file_contents = array_map('rtrim',file($show_file));

html_show_array($file_contents);

function do_offset($level){
$offset = ""; // offset for subarry
for ($i=1; $i<$level;$i++){
$offset = $offset . "<td></td>";
}
return $offset;
}

function show_array($array, $level, $sub){
if (is_array($array) == 1){ // check if input is an array
foreach($array as $key_val => $value) {
$offset = "";
$firstchar = $value;
//if ($firstchar <> '*' and $fistchar <>'y') {
if (is_array($value) == 1){ // array is multidimensional

echo "<tr>";
$offset = do_offset($level);
echo $offset . "<td>" . $key_val . "</td>";
show_array($value, $level+1, 1);

}else { // (sub)array is not multidimensional
if ($sub != 1){ // first entry for subarray
echo "<tr nosub>";
$offset = do_offset($level);
}
$sub = 0;
echo $offset . "<td main ".$sub." width=\"30\">" . $key_val .
"</td><td width=\"150\">" . $value . "</td>";
echo "</tr>\n";
}

} //foreach $array
}
else{ // argument $array is not an array
return;
}
}

function html_show_array($array){
echo "<table cellspacing=\"0\" border=\"0\">\n";
show_array($array, 1, 0);
echo "</table>\n";
}


include "include_right_column.php";
?>

[/code]

Page 1 of 1 All times are UTC + 10 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/