2 // This program is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU General Public License
4 // as published by the Free Software Foundation; either version 2
5 // of the License, or (at your option) any later version.
7 $sanitize_all_escapes = true;
8 $fake_register_globals = false;
10 //INCLUDES, DO ANY ACTIONS, THEN GET OUR DATA
11 require_once("../globals.php");
12 require_once("$srcdir/acl.inc");
13 require_once("$phpgacl_location/gacl_api.class.php");
14 require_once("$srcdir/registry.inc");
16 if ($_GET['method'] == "enable"){
17 updateRegistered ( $_GET['id'], "state=1" );
19 elseif ($_GET['method'] == "disable"){
20 updateRegistered ( $_GET['id'], "state=0" );
22 elseif ($_GET['method'] == "install_db"){
23 $dir = getRegistryEntry ( $_GET['id'], "directory" );
24 if (installSQL ("$srcdir/../interface/forms/{$dir['directory']}"))
25 updateRegistered ( $_GET['id'], "sql_run=1" );
27 $err = xl('ERROR: could not open table.sql, broken form?');
29 elseif ($_GET['method'] == "register"){
30 registerForm ( $_GET['name'] ) or $err=xl('error while registering form!');
32 $bigdata = getRegistered("%") or $bigdata = false;
34 //START OUT OUR PAGE....
38 <?php
html_header_show();?
>
39 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
41 <body
class="body_top">
42 <span
class="title"><?php
xl('Forms Administration','e');?
></span
>
45 foreach($_POST as $key => $val) {
46 if (preg_match('/nickname_(\d+)/', $key, $matches)) {
47 sqlQuery("update registry set nickname = ? where id = ?", array($val, $matches[1]));
49 else if (preg_match('/category_(\d+)/', $key, $matches)) {
50 sqlQuery("update registry set category = ? where id = ?", array($val, $matches[1]));
52 else if (preg_match('/priority_(\d+)/', $key, $matches)) {
53 sqlQuery("update registry set priority = ? where id = ?", array($val, $matches[1]));
55 else if (preg_match('/aco_spec_(\d+)/', $key, $matches)) {
56 sqlQuery("update registry set aco_spec = ? where id = ?", array($val, $matches[1]));
61 <?php
//ERROR REPORTING
63 echo "<span class=bold>" . text($err) . "</span><br><br>\n";
66 <?php
//REGISTERED SECTION ?>
67 <span
class=bold
><?php
xl('Registered','e');?
></span
><br
>
68 <form method
=POST action
='./forms_admin.php'>
69 <i
><?php
echo xlt('click here to update priority, category, nickname and access control settings'); ?
></i
>
70 <input type
='submit' name
='update' value
='<?php echo xla('update
'); ?>'><br
>
71 <table border
=0 cellpadding
=1 cellspacing
=2 width
="500">
78 <td
><?php
echo xlt('Priority'); ?
> </td
>
79 <td
><?php
echo xlt('Category'); ?
> </td
>
80 <td
><?php
echo xlt('Nickname'); ?
> </td
>
81 <td
><?php
echo xlt('Access Control'); ?
></td
>
85 if ($bigdata != false)
86 foreach($bigdata as $registry)
88 $priority_category = sqlQuery("select priority, category, nickname, aco_spec from registry where id = ?",
89 array($registry['id']));
92 <td bgcolor
="<?php echo $color; ?>" width
="2%">
93 <span
class='text'><?php
echo text($registry['id']); ?
></span
>
95 <td bgcolor
="<?php echo attr($color); ?>" width
="30%">
96 <span
class='bold'><?php
echo xl_form_title($registry['name']); ?
></span
>
99 if ($registry['sql_run'] == 0)
100 echo "<td bgcolor='" . attr($color) . "' width='10%'><span class='text'>" . xlt('registered') . "</span>";
101 elseif ($registry['state'] == "0")
102 echo "<td bgcolor='#FFCCCC' width='10%'><a class='link_submit' href='./forms_admin.php?id={$registry['id']}&method=enable'>" . xlt('disabled') . "</a>";
104 echo "<td bgcolor='#CCFFCC' width='10%'><a class='link_submit' href='./forms_admin.php?id={$registry['id']}&method=disable'>" . xlt('enabled') . "</a>";
106 <td bgcolor
="<?php echo attr($color); ?>" width
="10%">
107 <span
class='text'><?php
108 if ($registry['unpackaged'])
109 echo xlt('PHP extracted');
111 echo xlt('PHP compressed');
114 <td bgcolor
="<?php echo attr($color); ?>" width
="10%">
116 if ($registry['sql_run'])
117 echo "<span class='text'>" . xlt('DB installed') . "</span>";
119 echo "<a class='link_submit' href='./forms_admin.php?id=" . attr($registry['id']) . "&method=install_db'>" . xlt('install DB') . "</a>";
123 echo "<td><input type='text' size='4' name='priority_" . attr($registry['id']) . "' value='" . attr($priority_category['priority']) . "'></td>";
124 echo "<td><input type='text' size='10' name='category_" . attr($registry['id']) . "' value='" . attr($priority_category['category']) . "'></td>";
125 echo "<td><input type='text' size='10' name='nickname_" . attr($registry['id']) . "' value='" . attr($priority_category['nickname']) . "'></td>";
127 echo "<select name='aco_spec_" . attr($registry['id']) . "'>";
128 echo "<option value=''></option>";
129 echo gen_aco_html_options($priority_category['aco_spec']);
135 if ($color=="#CCCCCC")
144 <?php
//UNREGISTERED SECTION ?>
145 <span
class='bold'><?php
echo xlt('Unregistered'); ?
></span
><br
>
146 <table border
=0 cellpadding
=1 cellspacing
=2 width
="500">
148 $dpath = "$srcdir/../interface/forms/";
149 $dp = opendir($dpath);
151 for ($i=0; false != ($fname = readdir($dp)); $i++
)
152 if ($fname != "." && $fname != ".." && $fname != "CVS" && $fname != "LBF" &&
153 (is_dir($dpath.$fname) ||
stristr($fname, ".tar.gz") ||
154 stristr($fname, ".tar") ||
stristr($fname, ".zip") ||
155 stristr($fname, ".gz")))
158 // ballards 11/05/2005 fixed bug in removing registered form from the list
159 if ($bigdata != false)
161 foreach ( $bigdata as $registry )
163 $key = array_search($registry['directory'], $inDir) ; /* returns integer or FALSE */
168 foreach ( $inDir as $fname )
170 // added 8-2009 by BM - do not show the metric vitals form as option since deprecated
171 // also added a toggle in globals.php in case user wants the option to add this deprecated form
172 if (($fname == "vitalsM") && ($GLOBALS['disable_deprecated_metrics_form'])) continue;
174 if (stristr($fname, ".tar.gz") ||
stristr($fname, ".tar") ||
stristr($fname, ".zip") ||
stristr($fname, ".gz"))
175 $phpState = "PHP compressed";
177 $phpState = "PHP extracted";
180 <td bgcolor
="<?php echo $color?>" width
="1%">
181 <span
class=text
> </span
>
183 <td bgcolor
="<?php echo $color?>" width
="20%">
185 $form_title_file = @file
($GLOBALS['srcdir']."/../interface/forms/$fname/info.txt");
186 if ($form_title_file)
187 $form_title = $form_title_file[0];
189 $form_title = $fname;
191 <span
class=bold
><?php
echo xl_form_title($form_title); ?
></span
>
193 <td bgcolor
="<?php echo $color?>" width
="10%"><?php
194 if ($phpState == "PHP extracted")
195 echo '<a class=link_submit href="./forms_admin.php?name=' . urlencode($fname) . '&method=register">' . xl('register') . '</a>';
197 echo '<span class=text>' . xl('n/a') . '</span>';
199 <td bgcolor
="<?php echo $color?>" width
="20%">
200 <span
class=text
><?php
echo xl($phpState); ?
></span
>
202 <td bgcolor
="<?php echo $color?>" width
="10%">
203 <span
class=text
><?php
xl('n/a','e'); ?
></span
>
207 if ($color=="#CCCCCC")