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.
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");
18 } elseif ($_GET['method'] == "disable") {
19 updateRegistered($_GET['id'], "state=0");
20 } elseif ($_GET['method'] == "install_db") {
21 $dir = getRegistryEntry($_GET['id'], "directory");
22 if (installSQL("$srcdir/../interface/forms/{$dir['directory']}")) {
23 updateRegistered($_GET['id'], "sql_run=1");
25 $err = xl('ERROR: could not open table.sql, broken form?');
27 } elseif ($_GET['method'] == "register") {
28 registerForm($_GET['name']) or $err=xl('error while registering form!');
31 $bigdata = getRegistered("%") or $bigdata = false;
33 //START OUT OUR PAGE....
37 <?php
html_header_show();?
>
38 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
40 <body
class="body_top">
41 <span
class="title"><?php
xl('Forms Administration', 'e');?
></span
>
44 foreach ($_POST as $key => $val) {
45 if (preg_match('/nickname_(\d+)/', $key, $matches)) {
46 sqlQuery("update registry set nickname = ? where id = ?", array($val, $matches[1]));
47 } else if (preg_match('/category_(\d+)/', $key, $matches)) {
48 sqlQuery("update registry set category = ? where id = ?", array($val, $matches[1]));
49 } else if (preg_match('/priority_(\d+)/', $key, $matches)) {
50 sqlQuery("update registry set priority = ? where id = ?", array($val, $matches[1]));
51 } else if (preg_match('/aco_spec_(\d+)/', $key, $matches)) {
52 sqlQuery("update registry set aco_spec = ? where id = ?", array($val, $matches[1]));
57 <?php
//ERROR REPORTING
59 echo "<span class=bold>" . text($err) . "</span><br><br>\n";
63 <?php
//REGISTERED SECTION ?>
64 <span
class=bold
><?php
xl('Registered', 'e');?
></span
><br
>
65 <form method
=POST action
='./forms_admin.php'>
66 <i
><?php
echo xlt('click here to update priority, category, nickname and access control settings'); ?
></i
>
67 <input type
='submit' name
='update' value
='<?php echo xla('update
'); ?>'><br
>
68 <table border
=0 cellpadding
=1 cellspacing
=2 width
="500">
75 <td
><?php
echo xlt('Priority'); ?
> </td
>
76 <td
><?php
echo xlt('Category'); ?
> </td
>
77 <td
><?php
echo xlt('Nickname'); ?
> </td
>
78 <td
><?php
echo xlt('Access Control'); ?
></td
>
82 if ($bigdata != false) {
83 foreach ($bigdata as $registry) {
84 $priority_category = sqlQuery(
85 "select priority, category, nickname, aco_spec from registry where id = ?",
86 array($registry['id'])
90 <td bgcolor
="<?php echo $color; ?>" width
="2%">
91 <span
class='text'><?php
echo text($registry['id']); ?
></span
>
93 <td bgcolor
="<?php echo attr($color); ?>" width
="30%">
94 <span
class='bold'><?php
echo xl_form_title($registry['name']); ?
></span
>
97 if ($registry['sql_run'] == 0) {
98 echo "<td bgcolor='" . attr($color) . "' width='10%'><span class='text'>" . xlt('registered') . "</span>";
99 } elseif ($registry['state'] == "0") {
100 echo "<td bgcolor='#FFCCCC' width='10%'><a class='link_submit' href='./forms_admin.php?id={$registry['id']}&method=enable'>" . xlt('disabled') . "</a>";
102 echo "<td bgcolor='#CCFFCC' width='10%'><a class='link_submit' href='./forms_admin.php?id={$registry['id']}&method=disable'>" . xlt('enabled') . "</a>";
105 <td bgcolor
="<?php echo attr($color); ?>" width
="10%">
106 <span
class='text'><?php
107 if ($registry['unpackaged']) {
108 echo xlt('PHP extracted');
110 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>";
124 echo "<td><input type='text' size='4' name='priority_" . attr($registry['id']) . "' value='" . attr($priority_category['priority']) . "'></td>";
125 echo "<td><input type='text' size='10' name='category_" . attr($registry['id']) . "' value='" . attr($priority_category['category']) . "'></td>";
126 echo "<td><input type='text' size='10' name='nickname_" . attr($registry['id']) . "' value='" . attr($priority_category['nickname']) . "'></td>";
128 echo "<select name='aco_spec_" . attr($registry['id']) . "'>";
129 echo "<option value=''></option>";
130 echo gen_aco_html_options($priority_category['aco_spec']);
136 if ($color=="#CCCCCC") {
147 <?php
//UNREGISTERED SECTION ?>
148 <span
class='bold'><?php
echo xlt('Unregistered'); ?
></span
><br
>
149 <table border
=0 cellpadding
=1 cellspacing
=2 width
="500">
151 $dpath = "$srcdir/../interface/forms/";
152 $dp = opendir($dpath);
154 for ($i=0; false != ($fname = readdir($dp)); $i++
) {
155 if ($fname != "." && $fname != ".." && $fname != "CVS" && $fname != "LBF" &&
156 (is_dir($dpath.$fname) ||
stristr($fname, ".tar.gz") ||
157 stristr($fname, ".tar") ||
stristr($fname, ".zip") ||
158 stristr($fname, ".gz"))) {
163 // ballards 11/05/2005 fixed bug in removing registered form from the list
164 if ($bigdata != false) {
165 foreach ($bigdata as $registry) {
166 $key = array_search($registry['directory'], $inDir) ; /* returns integer or FALSE */
171 foreach ($inDir as $fname) {
172 if (stristr($fname, ".tar.gz") ||
stristr($fname, ".tar") ||
stristr($fname, ".zip") ||
stristr($fname, ".gz")) {
173 $phpState = "PHP compressed";
175 $phpState = "PHP extracted";
179 <td bgcolor
="<?php echo $color?>" width
="1%">
180 <span
class=text
> </span
>
182 <td bgcolor
="<?php echo $color?>" width
="20%">
184 $form_title_file = @file
($GLOBALS['srcdir']."/../interface/forms/$fname/info.txt");
185 if ($form_title_file) {
186 $form_title = $form_title_file[0];
188 $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>';
200 <td bgcolor
="<?php echo $color?>" width
="20%">
201 <span
class=text
><?php
echo xl($phpState); ?
></span
>
203 <td bgcolor
="<?php echo $color?>" width
="10%">
204 <span
class=text
><?php
xl('n/a', 'e'); ?
></span
>
208 if ($color=="#CCCCCC") {