2 //these are the functions used to access the forms registry database
4 //include_once("../../globals.php");
5 include_once("{$GLOBALS['srcdir']}/sql.inc");
7 function registerForm ( $directory , $sql_run=0 , $unpackaged=1 , $state=0 )
9 $check = sqlQuery("select state from registry where directory='$directory'");
12 $lines = @file($GLOBALS['srcdir']."/../interface/forms/$directory/info.txt");
17 return sqlInsert("insert into registry set
20 directory='".add_escape_custom($directory)."',
22 unpackaged='$unpackaged',
29 function updateRegistered ( $id, $mod )
31 return sqlInsert("update registry set
39 function getRegistered ( $state="1", $limit="unlimited", $offset="0")
41 $sql = "select * from registry where state like \"$state\" order by priority, name";
42 if ($limit != "unlimited")
43 $sql .= " limit $limit, $offset";
44 $res = sqlStatement($sql);
46 for($iter=0; $row=sqlFetchArray($res); $iter++)
55 function getRegistryEntry ( $id, $cols = "*" )
57 $sql = "select $cols from registry where id='$id'";
58 return sqlQuery($sql);
61 function installSQL ( $dir )
63 $sqltext = $dir."/table.sql";
64 if ($sqlarray = @file($sqltext))
66 $sql = implode("", $sqlarray);
67 //echo "<br>$sql<br><br>";
68 $sqla = explode(";",$sql);
69 foreach ($sqla as $sqlq) {
70 if (strlen($sqlq) > 5) {
71 sqlStatement(rtrim("$sqlq"));
82 * is a form registered
83 * (optional - and active)
86 * NOTE - sometimes the Name of a form has a line-break at the end, thus this function might be better
88 * INPUT = directory => form directory
89 * state => 0=inactive / 1=active
90 * OUTPUT = true or false
92 function isRegistered ( $directory, $state = 1)
94 $sql = "select id from registry where ".
95 "directory='".$directory.
96 "' and state=".$state;
97 $result = sqlQuery($sql);
98 if ($result['id'] != '') return true;