2 //these are the functions used to access the forms registry database
6 function registerForm ( $directory , $sql_run=0 , $unpackaged=1 , $state=0 )
8 $check = sqlQuery("select state from registry where directory='$directory'");
11 $lines = @file($GLOBALS['srcdir']."/../interface/forms/$directory/info.txt");
16 return sqlInsert("insert into registry set
19 directory='".add_escape_custom($directory)."',
21 unpackaged='$unpackaged',
28 function updateRegistered ( $id, $mod )
30 return sqlInsert("update registry set
38 function getRegistered ( $state="1", $limit="unlimited", $offset="0")
40 $sql = "select * from registry where state like \"$state\" order by priority, name";
41 if ($limit != "unlimited")
42 $sql .= " limit $limit, $offset";
43 $res = sqlStatement($sql);
45 for($iter=0; $row=sqlFetchArray($res); $iter++)
54 function getRegistryEntry ( $id, $cols = "*" )
56 $sql = "select $cols from registry where id='$id'";
57 return sqlQuery($sql);
60 function installSQL ( $dir )
62 $sqltext = $dir."/table.sql";
63 if ($sqlarray = @file($sqltext))
65 $sql = implode("", $sqlarray);
66 //echo "<br>$sql<br><br>";
67 $sqla = explode(";",$sql);
68 foreach ($sqla as $sqlq) {
69 if (strlen($sqlq) > 5) {
70 sqlStatement(rtrim("$sqlq"));
81 * is a form registered
82 * (optional - and active)
85 * NOTE - sometimes the Name of a form has a line-break at the end, thus this function might be better
87 * INPUT = directory => form directory
88 * state => 0=inactive / 1=active
89 * OUTPUT = true or false
91 function isRegistered ( $directory, $state = 1)
93 $sql = "select id from registry where ".
94 "directory='".$directory.
95 "' and state=".$state;
96 $result = sqlQuery($sql);
97 if ($result['id'] != '') return true;