source: trunk/tools/database/www/Odin32DB.phtml@ 5655

Last change on this file since 5655 was 3904, checked in by bird, 25 years ago

Preview II.

File size: 12.2 KB
Line 
1<?php
2
3require "stilovi.php3";
4require "Odin32DBHelpers.php3";
5
6/* Profiling */
7$sPageTimer = Odin32DBTimerStart("page timer");
8/* Profiling */
9
10$Title ="The Odin32 API Database";
11
12
13/*
14 * Connect to database
15 */
16require "Odin32DBConnect.php3";
17
18
19/*
20 * Global Variables
21 */
22$iRefcode = -1; /* Reference number. (< 0 is all members in the category) */
23$sCategory = "root"; /* Category name for internal use (equal to table name). */
24$sCategoryName = "Root Menu"; /* Category name for presentation. */
25$fNoData = 0; /* Flag which is set if refcode don't give matches in the DB. */
26
27
28/*
29 * What are we up to? We'll parse the input parameter (if any) to find out.
30 */
31if (isset($dllrefcode))
32{ /* DLLs by refcode */
33 $sCategory = "dll";
34 $sCategoryName = "Dll";
35 if ($dllrefcode != "")
36 $iRefcode = (int)$dllrefcode;
37 $fFunctions = (isset($fFunctions) && $fFunctions != '0');
38 $fFiles = (isset($fFiles) && $fFiles != '0');
39 $fAPIGroups = (isset($fAPIGroups) && $fAPIGroups != '0');
40 $fAuthors = (isset($fAuthors) && $fAuthors != '0');
41 $fSortByState=(isset($fSortByState) && $fSortByState!= '0');
42}
43else if (isset($filerefcode))
44{ /* Files by refcode */
45 $sCategory = "file";
46 $sCategoryName = "File";
47 if ($filerefcode != "")
48 $iRefcode = (int)$filerefcode;
49 $fFunctions = (isset($fFunctions) && $fFunctions != '0');
50 $fAPIGroups = (isset($fAPIGroups) && $fAPIGroups != '0');
51 $fAuthors = (isset($fAuthors) && $fAuthors != '0');
52 $fSortByState=(isset($fSortByState) && $fSortByState!= '0');
53}
54else if (isset($functionrefcode))
55{ /* Functions by refcode */
56 $sCategory = "function";
57 $sCategoryName = "Function";
58 if ($functionrefcode != "")
59 $iRefcode = (int)$functionrefcode;
60}
61else if (isset($apigrouprefcode))
62{ /* Api Group by refcode */
63 $sCategory = "apigroup";
64 $sCategoryName = "API Group";
65 if ($apigrouprefcode != "")
66 $iRefcode = (int)$apigrouprefcode;
67 $fFunctions = (isset($fFunctions) && $fFunctions != '0');
68 $fFiles = (isset($fFiles) && $fFiles != '0');
69 $fAuthors = (isset($fAuthors) && $fAuthors != '0');
70 $fSortByState=(isset($fSortByState) && $fSortByState!= '0');
71}
72else if (isset($authorrefcode))
73{ /* Author by refcode */
74 $sCategory = "author";
75 $sCategoryName = "Author";
76 if ($authorrefcode != "")
77 $iRefcode = (int)$authorrefcode;
78 $fDlls = (isset($fDlls) && $fDlls != '0');
79 $fFunctions = (isset($fFunctions) && $fFunctions != '0');
80 $fFiles = (isset($fFiles) && $fFiles != '0');
81 $fAPIGroups = (isset($fAPIGroups) && $fAPIGroups != '0');
82 $fSortByState=(isset($fSortByState) && $fSortByState!= '0');
83 if (!(isset($authordll) && $authordll != "" && @(int)$authordll >= 0))
84 $authordll = -1;
85}
86else if (isset($dlls))
87{ /* All dlls */
88 $sCategory = "dlls";
89 $sCategoryName = "Dlls";
90}
91else if (isset($apigroups))
92{ /* All API Groups */
93 $sCategory = "apigroups";
94 $sCategoryName = "API Groups";
95}
96else if (isset($authors))
97{ /* All authors */
98 $sCategory = "authors";
99 $sCategoryName = "Authors";
100} /* else: root page */
101
102
103/*
104 * Get name of the item we're to display data on.
105 */
106if ($iRefcode < 0)
107 $sName = ""; //FIXME
108else
109{
110 $sql = sprintf("SELECT name FROM %s WHERE refcode = %d",
111 $sCategory, $iRefcode);
112 $result = mysql_query($sql, $db);
113 if (@mysql_num_rows($result) > 0 &&
114 ($aName = @mysql_fetch_row($result))
115 )
116 {
117 $sName = $aName[0];
118 }
119 else
120 {
121 $fNoData = 1;
122 $sName = "!Invalid Refcode!";
123 }
124 @mysql_free_result($result);
125}
126
127require "01-PreTitle.php3";
128if ($sName == "") echo $Title." - ".$sCategoryName;
129else echo $Title." - ".$sCategoryName.": ".$sName;
130require "02-PostTitle.php3";
131
132require "03-MainTableBeg.php3";
133require "04-ColumnOne.php3";
134
135require "05-ColumnTwoHeader.php3";
136if ($sName == "") echo $Title."<br>".$sCategoryName;
137else echo $Title."<br>".$sCategoryName.": ".$sName;
138require "06-ColumnTwoHeader2.php3";
139
140
141TekstBeg();
142
143if (!$fNoData)
144{
145 switch ($sCategory)
146 {
147 case "dll":
148 {
149 Odin32DBDllInfo($db, $iRefcode, $fFunctions, $fFiles, $fAPIGroups, $fAuthors, $fSortByState);
150 break;
151 }
152
153 case "file":
154 {
155 Odin32DBFileInfo($db, $iRefcode, $fFunctions, $fAPIGroups, $fAuthors, $fSortByState);
156 break;
157 }
158
159 case "function":
160 {
161 Odin32DBFunctionInfo($db, $iRefcode);
162 break;
163 }
164
165 case "apigroup":
166 {
167 Odin32DBAPIGroupInfo($db, $iRefcode, $fFunctions, $fFiles, $fAuthors, $fSortByState);
168 break;
169 }
170
171 case "author":
172 {
173 Odin32DBAuthorInfo($db, $iRefcode, $fDlls, $fFunctions, $fFiles, $fAPIGroups, $fSortByState, $authordll);
174 break;
175 }
176
177 case "root":
178 {
179 /*
180 * The root page.
181 */
182 Odin32DBNavigationTop("","");
183 Odin32DBNaslov("Welcome to the Odin32 API Database", "welcome", "");
184 echo "This is the first Beta edition of the Odin32 API Database.<br>\n".
185 "There might be dead or non-functioning links. Currently feedback is <i>NOT</i> needed.\n".
186 "<p>\n".
187 "Please note that the quality of the data avilable is quite poor\n".
188 "for the time being. This will improve within some months.<br>\n".
189 "-Enjoy!<br>\n";
190
191 Odin32DBNaslov("Root Menu", "menu", "");
192 echo "<font size=3>".
193 "<ul>\n".
194 " <li><b><a href=\"Odin32DB.phtml?dlls=1\">Dlls</a></b>\n".
195 " <li><b><a href=\"Odin32DB.phtml?apigroups=1\">API Groups</a></b>\n".
196 " <li><b><a href=\"Odin32DB.phtml?authors=1\">Authors</a></b>\n".
197 " <li><i><a href=\"Odin32DB.phtml?searchapi=1\">Search API (not implemeted)</a></i>\n".
198 "</ul>\n";
199 "</font>\n";
200 Odin32DBNavigationBottom("","");
201 break;
202 }
203
204 case "dlls":
205 {
206 /*
207 * List all dlls.
208 */
209 Odin32DBNavigationTop("","");
210 Odin32DBNaslov("Welcome to the Odin32 API Database", "welcome", "");
211 echo "This is the first Beta edition of the Odin32 API Database.<br>\n".
212 "There might be dead or non-functioning links. Currently feedback is <i>NOT</i> needed.\n".
213 "<p>\n".
214 "Please note that the quality of the data avilable is quite poor\n".
215 "for the time being. This will improve within some months.<br>\n".
216 "-Enjoy!<br>\n";
217
218 Odin32DBNaslov("All Dlls", "dlls", "");
219 $sql = "SELECT\n".
220 " d.name AS name,\n".
221 " d.refcode AS refcode,\n".
222 " COUNT(f.refcode) AS functions\n".
223 "FROM\n".
224 " dll d\n".
225 " JOIN function f\n".
226 "WHERE\n".
227 " f.dll = d.refcode\n".
228 "GROUP BY d.refcode\n".
229 "ORDER BY d.name\n";
230 if ($result = mysql_query($sql, $db))
231 {
232 if (mysql_num_rows($result) <= 0)
233 echo "<i>No dlls!</i>\n";
234 else
235 {
236 echo "\n<font size=-1><ul><b>";
237 while ($aDll = mysql_fetch_array($result))
238 {
239 echo "<li><a href=\"Odin32DB.phtml?dllrefcode=".$aDll["refcode"].
240 "\">".$aDll["name"]."</a> (".$aDll["functions"].")\n";
241 }
242 echo "</b></ul></font>\n";
243 }
244 }
245 else
246 Odin32DBSqlError($sql);
247 Odin32DBNavigationBottom("","");
248 break;
249 }
250
251 case "authors":
252 {
253 /*
254 * List all authors.
255 */
256 Odin32DBNavigationTop("","");
257 Odin32DBNaslov("Welcome to the Odin32 API Database", "welcome", "");
258 echo "This is the first Beta edition of the Odin32 API Database.<br>\n".
259 "There might be dead or non-functioning links. Currently feedback is <i>NOT</i> needed.\n".
260 "<p>\n".
261 "Please note that the quality of the data avilable is quite poor\n".
262 "for the time being. This will improve within some months.<br>\n".
263 "-Enjoy!<br>\n";
264
265 Odin32DBNaslov("All Authors", "authors", "");
266 $sql = "SELECT\n".
267 " name,\n".
268 " refcode, \n".
269 " COUNT(fa.function) AS functions\n".
270 "FROM\n".
271 " author a\n".
272 " LEFT OUTER JOIN fnauthor fa ON a.refcode = fa.author\n".
273 "GROUP BY name\n".
274 "ORDER BY name\n";
275 if ($result = mysql_query($sql, $db))
276 {
277 if (mysql_num_rows($result) <= 0)
278 echo "<i>No dlls!</i>\n";
279 else
280 {
281 echo "\n<font size=-1><ul><b>";
282 while ($aAuthor = mysql_fetch_array($result))
283 {
284 echo "<li><a href=\"Odin32DB.phtml?authorrefcode=".$aAuthor["refcode"].
285 "\">".$aAuthor["name"]."</a> (".$aAuthor["functions"].")\n";
286 }
287 echo "</ul></b></font>\n";
288 }
289 }
290 else
291 Odin32DBSqlError($sql);
292 Odin32DBNavigationBottom("","");
293 break;
294 }
295
296 case "apigroups":
297 {
298 /*
299 * List all API Groups.
300 */
301 Odin32DBNavigationTop("","");
302 Odin32DBNaslov("Welcome to the Odin32 API Database", "welcome", "");
303 echo "This is the first Beta edition of the Odin32 API Database.<br>\n".
304 "There might be dead or non-functioning links. Currently feedback is <i>NOT</i> needed.\n".
305 "<p>\n".
306 "Please note that the quality of the data avilable is quite poor\n".
307 "for the time being. This will improve within some months.<br>\n".
308 "-Enjoy!<br>\n";
309
310 Odin32DBNaslov("All API Groups", "apigroups", "");
311 $sql = "SELECT\n".
312 " a.name AS name,\n".
313 " a.refcode AS refcode,\n".
314 " COUNT(f.refcode) AS functions\n".
315 "FROM\n".
316 " apigroup a\n".
317 " JOIN function f\n".
318 "WHERE\n".
319 " f.apigroup = a.refcode\n".
320 "GROUP BY a.name\n".
321 "ORDER BY a.name\n";
322 if ($result = mysql_query($sql, $db))
323 {
324 if (mysql_num_rows($result) <= 0)
325 echo "<i>No dlls!</i>\n";
326 else
327 {
328 echo "\n<font size=-1><ul><b>";
329 while ($aAPIGroup = mysql_fetch_array($result))
330 {
331 echo "<li><a href=\"Odin32DB.phtml?apigrouprefcode=".$aAPIGroup["refcode"].
332 "\">".$aAPIGroup["name"]."</a> (".$aAPIGroup["functions"].")\n";
333 }
334 echo "</ul></b></font>\n";
335 }
336 }
337 else
338 Odin32DBSqlError($sql);
339 Odin32DBNavigationBottom("","");
340 break;
341 }
342
343 default:
344 echo "!IPE!"; //FIXME
345 }
346}
347else
348{
349}
350
351
352TekstEnd();
353
354require "07-ColumnTwoFooter.php3";
355require "08-News.php3";
356require "09-ContentsTitle.php3";
357
358Odin32DBWriteContents();
359
360require "10-EndOfContent.php3";
361require "11-NetlabsContact.php3";
362
363$Kada=date ("j M Y", filemtime(__file__));
364require "12-OdinBanner.php3";
365
366require "13-Closing.php3";
367
368
369/* Profiling */
370Odin32DBTimerStop($sPageTimer);
371/* Profiling */
372?>
373
Note: See TracBrowser for help on using the repository browser.