Changeset 3904 for trunk/tools/database/www/Odin32DBHelpers.php3
- Timestamp:
- Aug 1, 2000, 3:49:16 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/database/www/Odin32DBHelpers.php3
r3903 r3904 1 1 <?php 2 3 /** 4 * Profiling function for mysql queries. 5 * @returns same as mysql_query 6 * @param $sSql SQL statement. 7 * @param $db Database connection. 8 * @sketch 9 * Get time. 10 * Execute query. 11 * Get time. 12 * Calc time ellapsed. 13 * Start a HTML comment. 14 * Log time and sql statement in the HTML comment. 15 * EXPLAIN sql statement and log it in the HTML comment. 16 * End the HTML comment. 17 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 18 */ 19 function _mysql_query($sSql, $db) 20 { 21 $sMsStart = microtime(); 22 23 $Result = mysql_query($sSql, $db); 24 25 $sMsEnd = microtime(); 26 27 /* 28 * Format: 0.mmmmmmmm sssssssss 29 * 0.00322252 965056018 30 * 31 * 01234567890123456789 32 * 0 1 33 */ 34 $sMsStart = substr($sMsStart,11) . substr($sMsStart,1,9); 35 $sMsEnd = substr($sMsEnd,11) . substr($sMsEnd,1,9); 36 $sMsTime = (double)$sMsEnd - (double)$sMsStart; 37 38 echo 39 "\n<!-- start: $sMsStart end: $sMsEnd time: $sMsTime". 40 "\nSQL:\n". 41 $sSql. 42 "\n". 43 "rows: ". mysql_num_rows($Result) ."\n"; 44 45 $ResultExplain = mysql_query("EXPLAIN ".$sSql, $db); 46 if ($ResultExplain) 47 { 48 echo "Explain:\n"; 49 printf("%-15s %-17 %-20s %-12s %-10s %-20s %-8s %s\n", 50 "Table", 51 "Type", 52 "Possible keys", 53 "Key", 54 "Key length", 55 "Ref", 56 "Rows", 57 "Extra"); 58 59 while ($aExplain = mysql_fetch_array($ResultExplain)) 60 { 61 printf("%-15s %-17 %-20s %-12s %-10s %-20s %-8s %s\n", 62 isset($aExplain["0"]) ? $aExplain["0"] : "NULL", 63 isset($aExplain["1"]) ? $aExplain["1"] : "NULL", 64 isset($aExplain["2"]) ? $aExplain["2"] : "NULL", 65 isset($aExplain["3"]) ? $aExplain["3"] : "NULL", 66 isset($aExplain["4"]) ? $aExplain["4"] : "NULL", 67 isset($aExplain["5"]) ? $aExplain["5"] : "NULL", 68 isset($aExplain["6"]) ? $aExplain["6"] : "NULL", 69 isset($aExplain["7"]) ? $aExplain["7"] : "NULL"); 70 } 71 mysql_free_result($ResultExplain); 72 } 73 else 74 echo "\nexplain failed\n"; 75 76 echo "-->\n"; 77 78 return $Result; 79 } 80 81 82 /** 83 * Starts a timer. Writes a nag in the file. 84 * @returns 85 * @param $sText Log text. 86 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 87 */ 88 function Odin32DBTimerStart($sText) 89 { 90 $sMsStart = microtime(); 91 $sMsStart = substr($sMsStart,11) . substr($sMsStart,1,9); 92 echo "\n<!-- Timer started: $sMsStart $sText -->\n"; 93 return $sMsStart.$sText; 94 } 95 96 97 /** 98 * Stops the timer $sMsStart. And writes the elapsed time. 99 * @returns Nothing. 100 * @param $sTimer The timer handle returned by Odin32DBTimerStart. 101 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 102 */ 103 function Odin32DBTimerStop($sTimer) 104 { 105 $sMsEnd = microtime(); 106 $sMsEnd = substr($sMsEnd,11) . substr($sMsEnd,1,9); 107 $sMsStart= substr($sTimer,0,18); 108 $sMsTime = (double)$sMsEnd - (double)$sMsStart; 109 $sText = substr($sTimer,18); 110 echo "\n<!-- Timer stopped: $sMsEnd ($sMsStart) Elapsed: $sMsTime $sText -->\n"; 111 } 112 2 113 3 114 /** … … 127 238 * Make 128 239 */ 129 echo " 130 <table width=100% border=0 cellspacing=0 cellpadding=0> 131 "; 240 echo "\n<table width=100% border=0 cellspacing=0 cellpadding=0>"; 132 241 if ($sAuthorName != '') 133 echo " 134 <tr> 135 <td width=90%> 136 <font size=-1 color=000099> 137 <tt>".$sAuthorName."</tt> 138 </font> 139 </td> 140 <td width=10%></td> 141 </tr>"; 142 echo " 143 <tr> 144 <td width=90%> 145 <table width=100% border=0 cellspacing=0 cellpadding=0> 146 <tr> 147 "; 148 242 echo " <tr><td width=90%><font size=-1 color=#000099><tt>".$sAuthorName."</tt></font></td><td width=10%></td></tr>\n"; 243 echo " <tr><td width=90%>\n". 244 " <table width=100% border=0 cellspacing=0 cellpadding=0>\n". 245 " <tr>\n"; 149 246 150 247 /* … … 153 250 $sql = "SELECT\n". 154 251 " COUNT(f.refcode) AS count,\n". 155 " f.stateAS state,\n".252 " s.refcode AS state,\n". 156 253 " s.color AS color,\n". 157 254 " s.weight AS weight\n". … … 164 261 " fa.function = f.refcode AND\n". 165 262 " f.state = s.refcode\n". 166 "GROUP BY f.state\n".263 "GROUP BY s.refcode\n". 167 264 "ORDER BY state\n"; 168 265 $rdCompletePercent = 0.0; … … 170 267 Odin32DBSqlError($sql); 171 268 else if (mysql_num_rows($result) < 1) 172 { 173 echo " 174 <td colspan=2 bgcolor=dddddd> 175 <font size=-1> 176 177 </font> 178 </td> 179 "; 180 } 269 echo " <td colspan=2 bgcolor=#dddddd><font size=-1> </font></td>\n"; 181 270 else 182 271 { … … 186 275 if ($iPercent == 0) 187 276 $iPercent = 1; 188 echo " 189 <td width=".$iPercent." bgcolor=".$row[2]."> 190 <font size=-1> 191 192 </font> 193 </td> 194 "; 277 echo " <td width=".$iPercent." bgcolor=".$row[2]."><font size=-1> </font></td>\n"; 195 278 196 279 $rdCompletePercent += ((double)$row[3] * (double)$row[0]) / $cFunctions; … … 203 286 * Complete bar with a total completion percent. 204 287 */ 205 echo " 206 <td width=10% align=right> 207 <font size=-1 color=000099> 208 ".(int)$rdCompletePercent."% 209 </font> 210 </td> 211 </tr> 212 </table> 213 </td> 214 </tr> 215 </table> 216 "; 217 288 echo " <td width=10% align=right><font size=-1 color=#000099>".(int)$rdCompletePercent."%</font></td>\n". 289 " </tr>\n". 290 " </table>\n". 291 "</td></tr>\n". 292 "</table>\n"; 218 293 } 219 294 … … 248 323 249 324 /* 250 * Make325 * Double table. Eventually write the name. 251 326 */ 252 echo " 253 <table width=100% border=0 cellspacing=0 cellpadding=0> 254 "; 255 if ($sName != '') 256 echo " 257 <tr> 258 <td width=90%> 259 <font size=-1 color=000099> 260 <tt>".$sName."</tt> 261 </font> 262 </td> 263 <td width=10%></td> 264 </tr>"; 265 echo " 266 <tr> 267 <td width=90%> 268 <table width=100% border=0 cellspacing=0 cellpadding=0> 269 <tr> 270 "; 271 327 echo "\n<table width=100% border=0 cellspacing=0 cellpadding=0>\n"; 328 if ($sName != "") 329 echo "<tr><td width=90%><font size=-1 color=#000099><tt>".$sName."</tt></font></td><td width=10%></td></tr>\n"; 330 echo "<tr><td width=90%>\n". 331 " <table width=100% border=0 cellspacing=0 cellpadding=0>\n". 332 " <tr>\n"; 272 333 273 334 /* … … 277 338 $sql = "SELECT\n". 278 339 " COUNT(f.refcode) AS count,\n". 279 " f.stateAS state,\n".340 " s.refcode AS state,\n". 280 341 " s.color AS color,\n". 281 342 " s.weight AS weight\n". … … 286 347 " ".$sCondition."\n". 287 348 " s.refcode = f.state\n". 288 "GROUP BY f.state\n".349 "GROUP BY s.refcode\n". 289 350 "ORDER BY state\n"; 290 351 $rdCompletePercent = 0.0; … … 292 353 Odin32DBSqlError($sql); 293 354 else if (mysql_num_rows($result) < 1) 294 { 295 echo " 296 <td colspan=2 bgcolor=dddddd> 297 <font size=-1> 298 299 </font> 300 </td> 301 "; 302 303 } 355 echo " <td colspan=2 bgcolor=#dddddd><font size=-1> </font></td>\n"; 304 356 else 305 357 { … … 309 361 if ($iPercent == 0) 310 362 $iPercent = 1; 311 echo " 312 <td width=".$iPercent." bgcolor=".$row[2]."> 313 <font size=-1> 314 315 </font> 316 </td> 317 "; 318 363 echo " <td width=".$iPercent." bgcolor=".$row[2]."><font size=-1> </font></td>\n"; 319 364 $rdCompletePercent += ((double)$row[3] * (double)$row[0]) / $cFunctions; 320 365 } … … 326 371 * Complete bar with a total completion percent. 327 372 */ 328 echo " 329 <td width=10% align=right> 330 <font size=-1 color=000099> 331 ".(int)$rdCompletePercent."% 332 </font> 333 </td> 334 </tr> 335 </table> 336 </td> 337 </tr> 338 </table> 339 "; 373 echo " <td width=10% align=right><font size=-1 color=#000099>".(int)$rdCompletePercent."%</font></td>\n". 374 " </tr>\n". 375 " </table>\n". 376 "</td></tr>\n". 377 "</table>\n"; 340 378 } 341 379 … … 368 406 else 369 407 { 370 echo " 371 <tr><td></td></tr> 372 <tr> 373 <td> 374 <center><B><font face=\"WarpSans, Arial\" color=\"#990000\"> 375 Status Legend: 376 </font></b></center> 377 </td> 378 </tr> 379 <tr> 380 <td> 381 <table width=100% border=0 cellspacing=2 cellpadding=0 align=right> 382 "; 408 echo "\n". 409 "<tr><td></td></tr>\n". 410 "<tr><td><center><B><font face=\"WarpSans, Arial\" color=\"#990000\">Status Legend:</font></b></center></td></tr>\n". 411 "<tr><td>\n". 412 " <table width=100% border=0 cellspacing=2 cellpadding=0 align=right>\n"; 413 383 414 while ($row = mysql_fetch_row($result)) 384 { 385 if (1) 386 { 387 echo " 388 <tr> 389 <td width=85% align=right> 390 <font size=1 color=000099> 391 ".$row[0]." 392 </font> 393 </td> 394 <td width=15% bgcolor=".$row[1]."> 395 <font size=-1> 396 <br> 397 398 </font> 399 </td> 400 </tr> 401 "; 402 } 403 else 404 { 405 echo " 406 <tr> 407 <td align=left bgcolor=".$row[1]."> 408 <font size=1 color=000000> 409 ".$row[0]." 410 </font> 411 </td> 412 </tr> 413 "; 414 } 415 } 416 417 echo " 418 </table> 419 </p> 420 </td> 421 </tr> 422 "; 415 echo " <tr><td width=85% align=right><font size=1 color=#000099>".$row[0]."</font></td>\n". 416 " <td width=15% bgcolor=".$row[1]."><font size=-1> <br> </font></td>\n". 417 " </tr>\n"; 418 419 echo " </table>\n". 420 "</td></tr>\n"; 423 421 } 424 422 … … 469 467 function Odin32DBInfoRow1($sName, $array, $sValueName, $sRefName, $sOdin32DBArg, $sNullText, $sPostText) 470 468 { 471 echo " 472 <tr> 473 <td width=35%><tt>".$sName."</tt></td> 474 <td valign=top>"; 469 echo " <tr>\n". 470 " <td width=35%><tt>".$sName."</tt></td>\n". 471 " <td valign=top>"; 475 472 if (isset($array[$sValueName])) 476 473 { … … 486 483 echo "<i>".$sNullText."</i>"; 487 484 488 echo " 489 </td> 490 <tr>\n"; 485 echo "</td>\n". 486 " </tr>\n"; 491 487 } 492 488 … … 505 501 function Odin32DBInfoRow1NoArray($sName, $sValue, $sRef, $sOdin32DBArg, $sNullText, $sPostText) 506 502 { 507 echo " 508 <tr> 509 <td width=35%><tt>".$sName."</tt></td> 510 <td valign=top>"; 503 echo " <tr>\n". 504 " <td width=35%><tt>".$sName."</tt></td>\n". 505 " <td valign=top>"; 511 506 if (isset($sValue) && $sValue != "") 512 507 { … … 521 516 echo "<i>".$sNullText."</i>"; 522 517 523 echo " 524 </td> 525 <tr>\n"; 518 echo "</td>\n". 519 " </tr>\n"; 526 520 } 527 521 … … 546 540 $sValueName2, $sRefName2, $sOdin32DBArg2) 547 541 { 548 echo " 549 <tr> 550 <td width=35%><tt>".$sName."</tt></td> 551 <td valign=top>"; 542 echo " <tr>\n". 543 " <td width=35%><tt>".$sName."</tt></td>\n". 544 " <td valign=top>"; 552 545 if (isset($array[$sValueName1])) 553 546 { … … 574 567 echo "<i>".$sNullText."</i>"; 575 568 576 echo "</td> 577 <tr>\n";569 echo "</td>\n". 570 " </tr>\n"; 578 571 } 579 572 … … 610 603 * @remark Displays <i>not available</i> if empty field. 611 604 */ 612 function Odin32DBDocRow( &$aContent,$sName, $sLabel, $array, $sValueName)613 { 614 Odin32DBNaslov($ aContent, $sName, $sLabel);605 function Odin32DBDocRow($sName, $sLabel, $array, $sValueName) 606 { 607 Odin32DBNaslov($sName, $sLabel); 615 608 if (isset($array[$sValueName])) 616 609 { … … 619 612 else 620 613 echo "<i>not available</i>"; 614 } 615 616 617 /** 618 * Writes a state section based on a sqlstatment returning the following values (ordered): 619 * 0. state 620 * 1. functions 621 * 622 * @returns nothing. 623 * @param $cFunctions Number of functions. 624 * @param $sql Sql statement. 625 * @param $db Database connection. 626 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 627 */ 628 function Odin32DBWriteStates($cFunctions, $sql, $db) 629 { 630 Odin32DBNaslov("Status", "status"); 631 if ($result2 = mysql_query($sql, $db)) 632 { 633 $result = mysql_query("SELECT refcode, name, color FROM state ORDER BY refcode", $db); 634 if ($result) 635 { 636 echo "\n<table width=100% border=0 cellpadding=0>\n"; 637 638 $aState2 = mysql_fetch_array($result2); 639 while ($aState = mysql_fetch_row($result)) 640 { 641 if ($aState2 && $aState[0] == $aState2[0]) 642 { 643 $cStateFunctions = (int)$aState2[1]; 644 $aState2 = mysql_fetch_array($result2); 645 } 646 else 647 $cStateFunctions = 0; 648 printf("<tr>\n". 649 " <td width=75%%><font size=-1 color=%s>%s</font></td>\n". 650 " <td align=right><font size=-1 color=%s>%s</font></td>\n". 651 " <td align=right><font size=-1 color=%s>%d%%</font></td>\n". 652 "</tr>\n", 653 $aState[2], $aState[1], 654 $aState[2], $cStateFunctions, 655 $aState[2], @(int)($cStateFunctions * 100 / $cFunctions)); 656 } 657 658 echo "</table>\n"; 659 } 660 else 661 Odin32DBSqlError($sql); 662 } 663 else 664 Odin32DBSqlError($sql); 665 } 666 667 668 /** 669 * Writes the a function listing base sqlstatement with these columns (ordered): 670 * 0. dll refcode 671 * 1. dll name 672 * 2. number of functions 673 * 674 * @returns nothing 675 * @param $sql SQL statement. 676 * @param $db Database connection. 677 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 678 */ 679 function Odin32DBWriteDlls($sql, $db) 680 { 681 if ($result2 = mysql_query($sql, $db)) 682 { 683 if (mysql_num_rows($result2) > 0) 684 { 685 echo "\n<table width=100% border=0 cellpadding=0>\n". 686 "<tr>\n". 687 " <td width=75%><font size=-1><b>Dlls</b></font></td>\n". 688 " <td align=right><font size=-1><b>Functions</b></font></td>\n". 689 "</tr>\n"; 690 while ($aFunction = mysql_fetch_array($result2)) 691 printf("<tr>". 692 "<td><font size=-1><a href=\"Odin32DB.phtml?dllrefcode=%s\">%s</a></font></td>". 693 "<td align=right><font size=-1>%s</font></td>". 694 "</tr>\n", 695 $aFunction[0], $aFunction[1], $aFunction[2]); 696 697 echo "</table>\n"; 698 } 699 else 700 echo "<i>No Files.</i><br>\n"; 701 } 702 else 703 Odin32DBSqlError($sql); 704 } 705 706 707 /** 708 * Writes the a function listing base sqlstatement with these columns (ordered): 709 * 0. function refcode 710 * 1. function name 711 * 2. state color 712 * 3. state name 713 * 714 * @returns nothing 715 * @param $sql SQL statement. 716 * @param $db Database connection. 717 * @param $sURLArgs URL arguments. 718 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 719 */ 720 function Odin32DBWriteFunctions($sql, $db, $sURLArgs) 721 { 722 if ($result2 = mysql_query($sql, $db)) 723 { 724 if (mysql_num_rows($result2) > 0) 725 { 726 echo 727 "<table width=100% border=0 cellpadding=0>\n", 728 "<tr>\n", 729 " <td width=75%><font size=-1><b>Function Name</b></font></td>\n", 730 " <td><font size=-1><b>State</b></font></td>\n", 731 "</tr>\n"; 732 733 while ($aFunction = mysql_fetch_row($result2)) 734 printf("<tr>". 735 "<td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=%s\">%s</a></font></td>". 736 "<td><font size=-1 color=%s>%s</font></td></tr>\n", 737 $aFunction[0], $aFunction[1], $aFunction[2], $aFunction[3]); 738 739 echo "</table></font>\n"; 740 741 /* 742 * Sort text. 743 */ 744 $fSortByState = strstr($sURLArgs, "&fSortByState=1"); 745 if ($fSortByState) 746 $sURLArgs = str_replace("&fSortByState=1", "", $sURLArgs); 747 else 748 $sURLArgs = $sURLArgs."&fSortByState=1"; 749 750 echo "<p>Click <a href=\"Odin32DB.phtml#functions?".$sURLArgs."\">here</a> to view functions sorted ". 751 ($fSortByState ? "alphabetical" : "by state"). ".<br>"; 752 } 753 else 754 echo "<i>No Functions.</i><br>\n"; 755 mysql_free_result($result2); 756 } 757 else 758 Odin32DBSqlError($sql); 759 } 760 761 762 /** 763 * Writes the a function listing base sqlstatement with these columns (ordered): 764 * 0. dll refcode 765 * 1. dll name 766 * 2. function refcode 767 * 3. function name 768 * 4. state color 769 * 5. state name 770 * 771 * @returns nothing 772 * @param $sql SQL statement. 773 * @param $db Database connection. 774 * @param $sURLArgs URL arguments. 775 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 776 */ 777 function Odin32DBWriteFunctionsWithDlls($sql, $db, $sURLArgs) 778 { 779 if ($result2 = mysql_query($sql, $db)) 780 { 781 if (mysql_num_rows($result2) > 0) 782 { 783 echo "\n<table width=100% border=0 cellpadding=0>\n". 784 "<tr>\n". 785 " <td width=30%><font size=-1><b>Dll Name</b></font></td>\n". 786 " <td width=45%><font size=-1><b>Function Name</b></font></td>\n". 787 " <td><font size=-1><b>State</b></font></td>\n". 788 "</tr>\n"; 789 while ($aFunction = mysql_fetch_row($result2)) 790 printf("<tr>". 791 "<td><font size=-1><a href=\"Odin32DB.phtml?dllrefcode=%s\">%s</a></font></td>". 792 "<td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=%s\">%s</a></font></td>". 793 "<td><font size=-1 color=%s>%s</font></td>". 794 "</tr>\n", 795 $aFunction[2], $aFunction[3], 796 $aFunction[0], $aFunction[1], 797 $aFunction[4], $aFunction[5]); 798 799 echo "</table>\n"; 800 801 /* 802 * Sort text. 803 */ 804 $fSortByState = strstr($sURLArgs, "&fSortByState=1"); 805 if ($fSortByState) 806 $sURLArgs = str_replace("&fSortByState=1", "", $sURLArgs); 807 else 808 $sURLArgs = $sURLArgs."&fSortByState=1"; 809 810 echo "<p>Click <a href=\"Odin32DB.phtml#functions?".$sURLArgs."\">here</a> to view functions sorted ". 811 ($fSortByState ? "alphabetical by dll" : "by state"). ".<br>"; 812 } 813 else 814 echo "<i>No functions found</i><br>\n"; 815 } 816 else 817 Odin32DBSqlError($sql); 818 } 819 820 821 /** 822 * Writes the a file listing base sqlstatement with these columns (ordered): 823 * 0. file refcode 824 * 1. file name 825 * 2. number of functions 826 * 827 * @returns nothing 828 * @param $sql SQL statement. 829 * @param $db Database connection. 830 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 831 */ 832 function Odin32DBWriteFiles($sql, $db) 833 { 834 if ($result2 = mysql_query($sql, $db)) 835 { 836 if (mysql_num_rows($result2) > 0) 837 { 838 echo "\n<table width=100% border=0 cellpadding=0>\n". 839 "<tr>\n". 840 " <td><font size=-1><b>Filename</b></font></td>\n". 841 " <td align=right><font size=-1><b>Functions</b></font></td>\n". 842 "</tr>\n"; 843 while ($aFile = mysql_fetch_row($result2)) 844 printf("<tr>". 845 "<td width=75%%><font size=-1><a href=\"Odin32DB.phtml?filerefcode=%s\">%s</a></font></td>". 846 "<td align=right><font size=-1>%s</font></td>". 847 "</tr>\n", 848 $aFile[0], $aFile[1], $aFile[2]); 849 850 echo "</table>\n"; 851 } 852 else 853 echo "<i>No Files.</i><br>\n"; 854 } 855 else 856 Odin32DBSqlError($sql); 857 } 858 859 860 /** 861 * Writes the an API Group listing base sqlstatement with these columns (ordered): 862 * 0. apigroup refcode 863 * 1. apigroup name 864 * 2. number of functions 865 * 866 * @returns nothing 867 * @param $sql SQL statement. 868 * @param $db Database connection. 869 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 870 */ 871 function Odin32DBWriteAPIGroups($sql, $db) 872 { 873 if ($result2 = mysql_query($sql, $db)) 874 { 875 if (mysql_num_rows($result2) > 0) 876 { 877 echo "\n<table width=100% border=0 cellpadding=0>\n". 878 "<tr>\n". 879 " <td width=75%><font size=-1><b>Group Name</b></font></td>\n". 880 " <td align=right><font size=-1><b>Functions</b></font></td>\n". 881 "</tr>\n"; 882 while ($aAPIGroup = mysql_fetch_row($result2)) 883 printf("<tr>". 884 "<td><font size=-1><a href=\"Odin32DB.phtml?apigrouprefcode=%s\">%s</a></font></td>". 885 "<td align=right><font size=-1>%s</font></td>". 886 "</tr>\n", 887 $aAPIGroup[0], $aAPIGroup[1], $aAPIGroup[2]); 888 echo "</table>\n"; 889 } 890 else 891 echo "<i>No API Groups.</i><br>\n"; 892 mysql_free_result($result2); 893 } 894 else 895 Odin32DBSqlError($sql); 896 } 897 898 899 900 /** 901 * Writes the a author listing base sqlstatement with these columns (ordered): 902 * 0. author refcode 903 * 1. author name 904 * 2. number of functions 905 * 906 * @returns nothing 907 * @param $sql SQL statement. 908 * @param $db Database connection. 909 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 910 */ 911 function Odin32DBWriteAuthors($sql, $db) 912 { 913 if ($result2 = mysql_query($sql, $db)) 914 { 915 if (mysql_num_rows($result2) > 0) 916 { 917 echo "\n<table width=100% border=0 cellpadding=0>\n". 918 "<tr>\n". 919 " <td width=75%><font size=-1><b>Author</b></font></td>\n". 920 " <td align=right><font size=-1><b>Functions</b></font></td>\n". 921 "</tr>\n"; 922 while ($aAuthor = mysql_fetch_row($result2)) 923 printf("<tr>". 924 "<td><font size=-1><a href=\"Odin32DB.phtml?authorrefcode=%s\">%s</a></font></td>". 925 "<td align=right><font size=-1>%s</font></td>". 926 "</tr>\n", 927 $aAuthor[0], $aAuthor[1], $aAuthor[2]); 928 929 echo "</table>\n"; 930 } 931 else 932 echo "<i>No Authors</i>.<br>\n"; 933 mysql_free_result($result2); 934 } 935 else 936 Odin32DBSqlError($sql); 621 937 } 622 938 … … 643 959 if ($sExpand != "" && $sCollapse != "") 644 960 { 645 echo "<br><a href=\"Odin32DB.phtml?".$sExpand."\">Expand </a> - \n".646 "<a href=\"Odin32DB.phtml?".$sCollapse."\">Collapse </a>\n";961 echo "<br><a href=\"Odin32DB.phtml?".$sExpand."\">Expand All</a> - \n". 962 "<a href=\"Odin32DB.phtml?".$sCollapse."\">Collapse All</a>\n"; 647 963 } 648 964 … … 664 980 if ($sExpand != "" && $sCollapse != "") 665 981 { 666 echo "<a href=\"Odin32DB.phtml?".$sExpand."\">Expand </a> - \n".667 "<a href=\"Odin32DB.phtml?".$sCollapse."\">Collapse </a><br>\n";982 echo "<a href=\"Odin32DB.phtml?".$sExpand."\">Expand All</a> - \n". 983 "<a href=\"Odin32DB.phtml?".$sCollapse."\">Collapse All</a><br>\n"; 668 984 } 669 985 … … 673 989 " - <a href=\"Odin32DB.phtml?authors=1\">Authors</a>\n". 674 990 " - <a href=\"Odin32DB.phtml?apigroups=1\">API Groups</a>\n"; 675 echo "</font></ <center>\n";991 echo "</font></center>\n"; 676 992 } 677 993 … … 687 1003 * 688 1004 * @returns void 689 * @param $aContent Contents array. (input/output)690 1005 * @param $db Database handle. 691 1006 * @param $iRefcode Function reference code. … … 694 1009 * @remark 695 1010 */ 696 function Odin32DBFunctionInfo( &$aContent,$db, $iRefcode)1011 function Odin32DBFunctionInfo($db, $iRefcode) 697 1012 { 698 1013 Odin32DBNavigationTop("",""); … … 739 1054 * General 740 1055 */ 741 Odin32DBNaslov( $aContent,"General", "general");1056 Odin32DBNaslov("General", "general"); 742 1057 echo "\n<table width=100% border=3 cellpadding=0>\n"; 743 1058 Odin32DBInfoRow1("Name", $array, "name","","","",""); … … 792 1107 Odin32DBSqlError($sql); 793 1108 } 794 echo " \n</table>\n";1109 echo "</table>\n"; 795 1110 796 1111 /* 797 1112 * Completion 798 1113 */ 799 Odin32DBNaslov( $aContent,"Completion", "completion");1114 Odin32DBNaslov("Completion", "completion"); 800 1115 Odin32DBCompletionBarFunction($iRefcode, "", $db); 801 1116 … … 804 1119 * Declaration 805 1120 */ 806 Odin32DBNaslov( $aContent,"Declaration", "declaration");1121 Odin32DBNaslov("Declaration", "declaration"); 807 1122 echo "\n<pre>"; 808 1123 if (isset($array["return"])) … … 838 1153 * Description 839 1154 */ 840 Odin32DBDocRow( $aContent,"Description", "desc", $array, "description");1155 Odin32DBDocRow("Description", "desc", $array, "description"); 841 1156 842 1157 … … 844 1159 * Parameters 845 1160 */ 846 Odin32DBNaslov( $aContent,"Parameters", "params");1161 Odin32DBNaslov("Parameters", "params"); 847 1162 if ($result2 && mysql_num_rows($result2) > 0 && mysql_data_seek($result2, 0)) 848 1163 { … … 858 1173 $sDescription = str_replace("<BR>", "", str_replace("<BR><BR>\n","<br>",$param["description"])); 859 1174 echo " <td width=90%><font size=-1>".$sDescription."</font></td></tr>\n"; 860 echo " \n</table>\n";1175 echo "</table>\n"; 861 1176 } 862 1177 else … … 876 1191 * Returns 877 1192 */ 878 Odin32DBDocRow( $aContent,"Returns", "return", $array, "returndesc");1193 Odin32DBDocRow("Returns", "return", $array, "returndesc"); 879 1194 880 1195 /* 881 1196 * Sketch/Algorithm 882 1197 */ 883 Odin32DBDocRow( $aContent,"Sketch/Algorithm", "sketch", $array, "sketch");1198 Odin32DBDocRow("Sketch/Algorithm", "sketch", $array, "sketch"); 884 1199 885 1200 /* 886 1201 * Remark 887 1202 */ 888 Odin32DBDocRow( $aContent,"Remarks", "remark", $array, "remark");1203 Odin32DBDocRow("Remarks", "remark", $array, "remark"); 889 1204 890 1205 /* 891 1206 * Authors 892 1207 */ 893 Odin32DBNaslov( $aContent,"Authors", "Authors");1208 Odin32DBNaslov("Authors", "Authors"); 894 1209 $sql = sprintf("SELECT\n". 895 1210 " a.name AS name,\n". … … 927 1242 * 928 1243 * @returns void 929 * @param $aContent Contents array. (input/output)930 1244 * @param $db Database handle. 931 1245 * @param $iRefcode Dll reference code. … … 940 1254 * @remark 941 1255 */ 942 function Odin32DBDllInfo(&$aContent, $db, $iRefcode, $fFunctions, $fFiles, $fAPIGroups, $fAuthors, $fSortByState) 943 { 1256 function Odin32DBDllInfo($db, $iRefcode, $fFunctions, $fFiles, $fAPIGroups, $fAuthors, $fSortByState) 1257 { 1258 $sURLArgs = "dllrefcode=".$iRefcode. 1259 ($fFunctions ? "&fFunctions=1" : ""). 1260 ($fFiles ? "&fFiles=1" : ""). 1261 ($fAPIGroups ? "&fAPIGroups=1" : ""). 1262 ($fAuthors ? "&fAuthors=1" : ""). 1263 ($fSortByState ? "&fSortByState=1" : ""); 1264 944 1265 /* 945 1266 * Navigation - TOP … … 970 1291 * General 971 1292 */ 972 Odin32DBNaslov( $aContent,"General", "general");1293 Odin32DBNaslov("General", "general"); 973 1294 echo "\n<table width=100% border=3 cellpadding=0>\n"; 974 1295 Odin32DBInfoRow1("Name", $array, "name","","","",""); … … 1017 1338 } 1018 1339 1019 echo " \n</table>\n";1340 echo "</table>\n"; 1020 1341 1021 1342 … … 1023 1344 * Completion 1024 1345 */ 1025 Odin32DBNaslov( $aContent,"Completion", "completion");1346 Odin32DBNaslov("Completion", "completion"); 1026 1347 Odin32DBCompletionBarDll($iRefcode, "", $db); 1027 1348 … … 1029 1350 * States 1030 1351 */ 1031 Odin32DBNaslov($aContent, "Status", "status");1032 1352 $sql = sprintf("SELECT\n". 1033 " s.name AS state,\n". 1034 " s.color AS color,\n". 1035 " COUNT(f.state) AS functions\n". 1353 " state,\n". 1354 " COUNT(state)\n". 1036 1355 "FROM\n". 1037 " state s\n". 1038 " LEFT OUTER JOIN function f ON s.refcode = f.state AND f.dll = %d\n". 1039 "GROUP BY s.refcode\n". 1040 "ORDER BY s.refcode", 1356 " function\n". 1357 "WHERE\n". 1358 " dll = %d\n". 1359 "GROUP BY state\n". 1360 "ORDER BY state", 1041 1361 $iRefcode); 1042 if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0) 1043 { 1044 echo "\n<table width=100% border=0 cellpadding=0>\n"; 1045 while ($aState = mysql_fetch_array($result2)) 1046 { 1047 echo "<tr>\n". 1048 " <td width=75%><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["state"]."</b></font></td>\n". 1049 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["functions"]."</b></font></td>\n". 1050 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".@(int)((int)$aState["functions"] * 100 / $cFunctions)."%</b></font></td>\n". 1051 "</tr>\n"; 1052 } 1053 1054 echo "\n</table>\n"; 1055 } 1056 else 1057 Odin32DBSqlError($sql); 1058 1362 Odin32DBWriteStates($cFunctions, $sql, $db); 1059 1363 1060 1364 /* 1061 1365 * Functions 1062 1366 */ 1063 Odin32DBNaslov( $aContent,"Functions", "functions");1367 Odin32DBNaslov("Functions", "functions"); 1064 1368 if ($fFunctions) 1065 1369 { 1066 1370 $sql = sprintf("SELECT\n". 1067 " f. name AS name,\n".1068 " f. refcode AS refcode,\n".1069 " s. name AS state,\n".1070 " s. color AS color\n".1371 " f.refcode,\n". 1372 " f.name,\n". 1373 " s.color,\n". 1374 " s.name\n". 1071 1375 "FROM\n". 1072 1376 " function f\n". … … 1074 1378 "WHERE\n". 1075 1379 " f.dll = %d\n", 1076 1380 $iRefcode); 1077 1381 if ($fSortByState) 1078 1382 $sql = $sql."ORDER BY s.refcode, f.name"; 1079 1383 else 1080 1384 $sql = $sql."ORDER BY f.name"; 1081 if ($result2 = mysql_query($sql, $db)) 1082 { 1083 if (mysql_num_rows($result2) > 0) 1084 { 1085 echo "\n<table width=100% border=0 cellpadding=0>\n". 1086 "<tr>\n". 1087 " <td width=75%><font size=-1><b>Function Name</b></font></td>\n". 1088 " <td><font size=-1><b>State</b></font></td>\n". 1089 "</tr>\n"; 1090 while ($aFunction = mysql_fetch_array($result2)) 1091 { 1092 echo "<tr>\n". 1093 " <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n". 1094 " <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n". 1095 "</tr>\n"; 1096 } 1097 echo "\n</table>\n". 1098 "<p>Click <a href=\"Odin32DB.phtml#functions?dllrefcode=".$iRefcode."&fFunctions=1"; 1099 if ($fFiles) echo "&fFiles=".$fFiles; 1100 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups; 1101 if ($fAuthors) echo "&fAuthors=".$fAuthors; 1102 if ($fSortByState) echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted alphabetical.<br>\n"; 1103 else echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted by state.<br>\n"; 1104 } 1105 else 1106 echo "<i>No Functions.</i><br>\n"; 1107 } 1108 else 1109 Odin32DBSqlError($sql); 1385 Odin32DBWriteFunctions($sql, $db, $sURLArgs); 1110 1386 } 1111 1387 else 1112 { 1113 echo "Click <a href=\"Odin32DB.phtml#functions?dllrefcode=".$iRefcode."&fFunctions=1"; 1114 if ($fFiles) echo "&fFiles=".$fFiles; 1115 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups; 1116 if ($fAuthors) echo "&fAuthors=".$fAuthors; 1117 if ($fSortByState) echo "&fSortByState=".$fSortByState; 1118 echo "\">here</a> to see all functions.\n"; 1119 } 1388 echo "Click <a href=\"Odin32DB.phtml#functions?".$sURLArgs."&fFunctions=1". 1389 "\">here</a> to see all functions.\n"; 1120 1390 1121 1391 … … 1123 1393 * Files 1124 1394 */ 1125 Odin32DBNaslov( $aContent,"Files", "files");1395 Odin32DBNaslov("Files", "files"); 1126 1396 if ($fFiles) 1127 1397 { 1128 1398 $sql = sprintf("SELECT\n". 1129 " f. name AS name,\n".1130 " f. refcode AS refcode,\n".1131 " COUNT(fn.refcode) AS functions\n".1399 " f.refcode,\n". 1400 " f.name,\n". 1401 " COUNT(fn.refcode)\n". 1132 1402 "FROM\n". 1133 1403 " file f\n". … … 1137 1407 "GROUP BY f.refcode\n". 1138 1408 "ORDER BY f.name\n", 1139 $iRefcode); 1140 1141 if ($result2 = mysql_query($sql, $db)) 1142 { 1143 if (mysql_num_rows($result2) > 0) 1144 { 1145 echo "\n<table width=100% border=0 cellpadding=0>\n". 1146 "<tr>\n". 1147 " <td><font size=-1><b>Filename</b></font></td>\n". 1148 " <td align=right><font size=-1><b>Functions</b></font></td>\n". 1149 "</tr>\n"; 1150 while ($aFunction = mysql_fetch_array($result2)) 1151 { 1152 echo "<tr>\n". 1153 " <td width=75%><font size=-1><a href=\"Odin32DB.phtml?filerefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n". 1154 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n". 1155 "</tr>\n"; 1156 } 1157 echo "\n</table>\n"; 1158 } 1159 else 1160 echo "<i>No Files.</i><br>\n"; 1161 } 1162 else 1163 Odin32DBSqlError($sql); 1409 $iRefcode); 1410 Odin32DBWriteFiles($sql, $db); 1164 1411 } 1165 1412 else 1166 { 1167 echo "Click <a href=\"Odin32DB.phtml#files?dllrefcode=".$iRefcode."&fFiles=1"; 1168 if ($fFunctions) echo "&fFunctions=".$fFunctions; 1169 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups; 1170 if ($fAuthors) echo "&fAuthors=".$fAuthors; 1171 if ($fSortByState) echo "&fSortByState=".$fSortByState; 1172 echo "\">here</a> to see all files.\n"; 1173 } 1413 echo "Click <a href=\"Odin32DB.phtml#files?".$sURLArgs."&fFiles=1". 1414 "\">here</a> to see all files.\n"; 1174 1415 1175 1416 … … 1179 1420 if ($cAPIGroups > 0) 1180 1421 { 1181 Odin32DBNaslov( $aContent,"API Groups", "apigroups");1422 Odin32DBNaslov("API Groups", "apigroups"); 1182 1423 if ($fAPIGroups) 1183 1424 { 1184 1425 $sql = sprintf("SELECT\n". 1185 " g. name AS name,\n".1186 " g. refcode AS refcode,\n".1187 " COUNT(f.refcode) AS functions\n".1426 " g.refcode,\n". 1427 " g.name,\n". 1428 " COUNT(f.refcode)\n". 1188 1429 "FROM\n". 1189 1430 " apigroup g\n". … … 1197 1438 $iRefcode, 1198 1439 $iRefcode); 1199 if ($result2 = mysql_query($sql, $db)) 1200 { 1201 if (mysql_num_rows($result2) > 0) 1202 { 1203 echo "\n<table width=100% border=0 cellpadding=0>\n". 1204 "<tr>\n". 1205 " <td width=75%><font size=-1><b>Group Name</b></font></td>\n". 1206 " <td align=right><font size=-1><b>Functions</b></font></td>\n". 1207 "</tr>\n"; 1208 while ($aFunction = mysql_fetch_array($result2)) 1209 { 1210 echo "<tr>\n". 1211 " <td><font size=-1><a href=\"Odin32DB.phtml?apigrouprefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n". 1212 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n". 1213 "</tr>\n"; 1214 } 1215 echo "\n</table>\n"; 1216 } 1217 else 1218 echo "<i>No API Groups.</i><br>\n"; 1219 } 1220 else 1221 Odin32DBSqlError($sql); 1440 Odin32DBWriteAPIGroups($sql, $db); 1222 1441 } 1223 1442 else 1224 { 1225 echo "Click <a href=\"Odin32DB.phtml#apigroups?dllrefcode=".$iRefcode."&fAPIGroups=1"; 1226 if ($fFunctions) echo "&fFunctions=".$fFunctions; 1227 if ($fFiles) echo "&fFiles=".$fFiles; 1228 if ($fAuthors) echo "&fAuthors=".$fAuthors; 1229 if ($fSortByState) echo "&fSortByState=".$fSortByState; 1230 echo "\">here</a> to see all the API Groups.\n"; 1231 } 1443 echo "Click <a href=\"Odin32DB.phtml#apigroups?".$sURLArgs."&fAPIGroups=1". 1444 "\">here</a> to see all the API Groups.\n"; 1232 1445 } 1233 1446 … … 1236 1449 * Authors 1237 1450 */ 1238 Odin32DBNaslov( $aContent,"Authors", "authors");1451 Odin32DBNaslov("Authors", "authors"); 1239 1452 if ($fAuthors) 1240 1453 { 1241 1454 $sql = sprintf("SELECT\n". 1242 " a. name AS name,\n".1243 " a. refcode AS refcode,\n".1244 " COUNT(f.refcode) AS functions\n".1455 " a.refcode,\n". 1456 " a.name,\n". 1457 " COUNT(f.refcode)\n". 1245 1458 "FROM\n". 1246 1459 " fnauthor fa\n". … … 1253 1466 "GROUP BY a.refcode\n". 1254 1467 "ORDER BY a.name\n", 1255 $iRefcode 1256 ); 1257 if ($result2 = mysql_query($sql, $db)) 1258 { 1259 if (mysql_num_rows($result2) > 0) 1260 { 1261 echo "\n<table width=100% border=0 cellpadding=0>\n". 1262 "<tr>\n". 1263 " <td width=75%><font size=-1><b>Author</b></font></td>\n". 1264 " <td align=right><font size=-1><b>Functions</b></font></td>\n". 1265 "</tr>\n"; 1266 while ($aFunction = mysql_fetch_array($result2)) 1267 { 1268 echo "<tr>\n". 1269 " <td><font size=-1><a href=\"Odin32DB.phtml?authorrefcode=".$aFunction["refcode"]."&dll=".$iRefcode."\">".$aFunction["name"]."</a></font></td>\n". 1270 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n". 1271 "</tr>\n"; 1272 } 1273 echo "\n</table>\n"; 1274 } 1275 else 1276 echo "<i>No Authors</i>.<br>\n"; 1277 } 1278 else 1279 Odin32DBSqlError($sql); 1468 $iRefcode); 1469 Odin32DBWriteAuthors($sql, $db); 1280 1470 } 1281 1471 else 1282 { 1283 echo "Click <a href=\"Odin32DB.phtml#authors?dllrefcode=".$iRefcode."&fAuthors=1"; 1284 if ($fFunctions) echo "&fFunctions=".$fFunctions; 1285 if ($fFiles) echo "&fFiles=".$fFiles; 1286 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups; 1287 if ($fSortByState) echo "&fSortByState=".$fSortByState; 1288 echo "\">here</a> to see all authors.\n"; 1289 } 1472 echo "Click <a href=\"Odin32DB.phtml#authors?".$sURLArgs."&fAuthors=1". 1473 "\">here</a> to see all authors.\n"; 1290 1474 } 1291 1475 else … … 1307 1491 * 1308 1492 * @returns void 1309 * @param $aContent Contents array. (input/output)1310 1493 * @param $db Database handle. 1311 1494 * @param $iRefcode File reference code. … … 1319 1502 * @remark 1320 1503 */ 1321 function Odin32DBFileInfo(&$aContent, $db, $iRefcode, $fFunctions, $fAPIGroups, $fAuthors, $fSortByState) 1322 { 1504 function Odin32DBFileInfo($db, $iRefcode, $fFunctions, $fAPIGroups, $fAuthors, $fSortByState) 1505 { 1506 $sURLArgs = "filerefcode=".$iRefcode. 1507 ($fFunctions ? "&fFunctions=1" : ""). 1508 ($fAuthors ? "&fAuthors=1" : ""). 1509 ($fAPIGroups ? "&fAPIGroups=1" : ""). 1510 ($fSortByState ? "&fSortByState=1" : ""); 1511 1323 1512 /* 1324 1513 * Navigation - TOP … … 1356 1545 * General 1357 1546 */ 1358 Odin32DBNaslov( $aContent,"General", "general");1547 Odin32DBNaslov("General", "general"); 1359 1548 echo "\n<table width=100% border=3 cellpadding=0>\n"; 1360 1549 Odin32DBInfoRow1("Name", $array, "name","","","",""); … … 1392 1581 Odin32DBSqlError($sql); 1393 1582 1394 echo " \n</table>\n";1583 echo "</table>\n"; 1395 1584 1396 1585 /* 1397 1586 * Description 1398 1587 */ 1399 Odin32DBDocRow( $aContent,"Description", "description", $array, "description");1588 Odin32DBDocRow("Description", "description", $array, "description"); 1400 1589 1401 1590 /* 1402 1591 * Completion 1403 1592 */ 1404 Odin32DBNaslov( $aContent,"Completion", "completion");1593 Odin32DBNaslov("Completion", "completion"); 1405 1594 Odin32DBCompletionBarFile($iRefcode, "", $db); 1406 1595 … … 1408 1597 * States 1409 1598 */ 1410 Odin32DBNaslov($aContent, "Status", "status");1411 1599 $sql = sprintf("SELECT\n". 1412 " s.name AS state,\n". 1413 " s.color AS color,\n". 1414 " COUNT(f.state) AS functions\n". 1600 " state,\n". 1601 " COUNT(state)\n". 1415 1602 "FROM\n". 1416 " state s\n". 1417 " LEFT OUTER JOIN function f ON s.refcode = f.state AND f.file = %d\n". 1418 "GROUP BY s.refcode\n". 1419 "ORDER BY s.refcode", 1603 " function\n". 1604 "WHERE\n". 1605 " file = %d\n". 1606 "GROUP BY state\n". 1607 "ORDER BY state", 1420 1608 $iRefcode); 1421 if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0) 1422 { 1423 echo "\n<table width=100% border=0 cellpadding=0>\n"; 1424 while ($aState = mysql_fetch_array($result2)) 1425 { 1426 echo "<tr>\n". 1427 " <td width=75%><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["state"]."</b></font></td>\n". 1428 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["functions"]."</b></font></td>\n". 1429 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".@(int)((int)$aState["functions"] * 100 / $cFunctions)."%</b></font></td>\n". 1430 "</tr>\n"; 1431 } 1432 1433 echo "\n</table>\n"; 1434 } 1435 else 1436 Odin32DBSqlError($sql); 1609 Odin32DBWriteStates($cFunctions, $sql, $db); 1437 1610 1438 1611 … … 1440 1613 * Functions 1441 1614 */ 1442 Odin32DBNaslov( $aContent,"Functions", "functions");1615 Odin32DBNaslov("Functions", "functions"); 1443 1616 if ($fFunctions) 1444 1617 { 1445 1618 $sql = sprintf("SELECT\n". 1446 " f. name AS name,\n".1447 " f. refcode AS refcode,\n".1448 " s. name AS state,\n".1449 " s. color AS color\n".1619 " f.refcode,\n". 1620 " f.name,\n". 1621 " s.color,\n". 1622 " s.name\n". 1450 1623 "FROM\n". 1451 1624 " function f\n". … … 1458 1631 else 1459 1632 $sql = $sql."ORDER BY f.name"; 1460 if ($result2 = mysql_query($sql, $db)) 1461 { 1462 if (mysql_num_rows($result2) > 0) 1463 { 1464 echo "\n<table width=100% border=0 cellpadding=0>\n". 1465 "<tr>\n". 1466 " <td width=75%><font size=-1><b>Function Name</b></font></td>\n". 1467 " <td><font size=-1><b>State</b></font></td>\n". 1468 "</tr>\n"; 1469 while ($aFunction = mysql_fetch_array($result2)) 1470 { 1471 echo "<tr>\n". 1472 " <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n". 1473 " <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n". 1474 "</tr>\n"; 1475 } 1476 echo "\n</table>\n". 1477 "<p>Click <a href=\"Odin32DB.phtml#functions?filerefcode=".$iRefcode."&fFunctions=1"; 1478 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups; 1479 if ($fAuthors) echo "&fAuthors=".$fAuthors; 1480 if ($fSortByState) echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted alphabetical.<br>\n"; 1481 else echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted by state.<br>\n"; 1482 } 1483 else 1484 echo "<i>No functions found</i><br>\n"; 1485 } 1486 else 1487 Odin32DBSqlError($sql); 1633 Odin32DBWriteFunctions($sql, $db, $sURLArgs); 1488 1634 } 1489 1635 else 1490 { 1491 echo "Click <a href=\"Odin32DB.phtml#functions?filerefcode=".$iRefcode."&fFunctions=1"; 1492 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups; 1493 if ($fAuthors) echo "&fAuthors=".$fAuthors; 1494 if ($fSortByState) echo "&fSortByState=".$fSortByState; 1495 echo "\">here</a> to see all functions.\n"; 1496 } 1636 echo "Click <a href=\"Odin32DB.phtml#functions?".$sURLArgs."&fFunctions=1". 1637 "\">here</a> to see all functions.\n"; 1497 1638 1498 1639 … … 1502 1643 if ($cAPIGroups > 0) 1503 1644 { 1504 Odin32DBNaslov( $aContent,"API Groups", "apigroups");1645 Odin32DBNaslov("API Groups", "apigroups"); 1505 1646 if ($fAPIGroups) 1506 1647 { 1507 1648 $sql = sprintf("SELECT\n". 1508 " g. name AS name,\n".1509 " g. refcode AS refcode,\n".1510 " COUNT(f.refcode) AS functions\n".1649 " g.refcode,\n". 1650 " g.name,\n". 1651 " COUNT(f.refcode)\n". 1511 1652 "FROM\n". 1512 1653 " apigroup g\n". … … 1518 1659 "ORDER BY g.name\n", 1519 1660 $iRefcode); 1520 if ($result2 = mysql_query($sql, $db)) 1521 { 1522 if (mysql_num_rows($result2) > 0) 1523 { 1524 echo "\n<table width=100% border=0 cellpadding=0>\n". 1525 "<tr>\n". 1526 " <td width=75%><font size=-1><b>Group Name</b></font></td>\n". 1527 " <td align=right><font size=-1><b>Functions</b></font></td>\n". 1528 "</tr>\n"; 1529 while ($aFunction = mysql_fetch_array($result2)) 1530 { 1531 echo "<tr>\n". 1532 " <td><font size=-1><a href=\"Odin32DB.phtml?apigrouprefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n". 1533 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n". 1534 "</tr>\n"; 1535 } 1536 echo "\n</table>\n"; 1537 } 1538 else 1539 echo "<i>Not API Groups found.</i><br>\n"; 1540 } 1541 else 1542 Odin32DBSqlError($sql); 1661 Odin32DBWriteAPIGroups($sql, $db); 1543 1662 } 1544 1663 else 1545 { 1546 echo "Click <a href=\"Odin32DB.phtml#apigroups?filerefcode=".$iRefcode."&fAPIGroups=1"; 1547 if ($fFunctions) echo "&fFunctions=".$fFunctions; 1548 if ($fAuthors) echo "&fAuthors=".$fAuthors; 1549 if ($fSortByState) echo "&fSortByState=".$fSortByState; 1550 echo "\">here</a> to see all the API Groups.\n"; 1551 } 1664 echo "Click <a href=\"Odin32DB.phtml#apigroups?".$sURLArgs."&fAPIGroups=1". 1665 "\">here</a> to see all the API Groups.\n"; 1552 1666 } 1553 1667 … … 1556 1670 * Authors 1557 1671 */ 1558 Odin32DBNaslov( $aContent,"Authors", "authors");1672 Odin32DBNaslov("Authors", "authors"); 1559 1673 if ($fAuthors) 1560 1674 { 1561 1675 $sql = sprintf("SELECT\n". 1562 " a. name AS name,\n".1563 " a. refcode AS refcode,\n".1564 " COUNT(f.refcode) AS functions\n".1676 " a.refcode,\n". 1677 " a.name,\n". 1678 " COUNT(f.refcode)\n". 1565 1679 "FROM\n". 1566 1680 " fnauthor fa\n". … … 1575 1689 $iRefcode 1576 1690 ); 1577 if ($result2 = mysql_query($sql, $db)) 1578 { 1579 if (mysql_num_rows($result2) > 0) 1580 { 1581 echo "\n<table width=100% border=0 cellpadding=0>\n". 1582 "<tr>\n". 1583 " <td width=75%><font size=-1><b>Author</b></font></td>\n". 1584 " <td align=right><font size=-1><b>Functions</b></font></td>\n". 1585 "</tr>\n"; 1586 while ($aFunction = mysql_fetch_array($result2)) 1587 { 1588 echo "<tr>\n". 1589 " <td><font size=-1><a href=\"Odin32DB.phtml?authorrefcode=".$aFunction["refcode"]."&file=".$iRefcode."\">".$aFunction["name"]."</a></font></td>\n". 1590 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n". 1591 "</tr>\n"; 1592 } 1593 echo "\n</table>\n"; 1594 } 1595 else 1596 echo "<i>Not authors found.</i><br>\n"; 1597 } 1598 else 1599 Odin32DBSqlError($sql); 1691 Odin32DBWriteAuthors($sql, $db); 1600 1692 } 1601 1693 else 1602 { 1603 echo "Click <a href=\"Odin32DB.phtml#authors?filerefcode=".$iRefcode."&fAuthors=1"; 1604 if ($fFunctions) echo "&fFunctions=".$fFunctions; 1605 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups; 1606 if ($fSortByState) echo "&fSortByState=".$fSortByState; 1607 echo "\">here</a> to see all authors.\n"; 1608 } 1694 echo "Click <a href=\"Odin32DB.phtml#authors?".$sURLArgs."&fAuthors=1". 1695 "\">here</a> to see all authors.\n"; 1609 1696 } 1610 1697 else … … 1626 1713 * 1627 1714 * @returns void 1628 * @param $aContent Contents array. (input/output)1629 1715 * @param $db Database handle. 1630 1716 * @param $iRefcode Author reference code. … … 1641 1727 * @remark 1642 1728 */ 1643 function Odin32DBAuthorInfo(&$aContent, $db, $iRefcode, $fDlls, $fFunctions, $fFiles, $fAPIGroups, $fSortByState, $iDllRefcode) 1644 { 1729 function Odin32DBAuthorInfo($db, $iRefcode, $fDlls, $fFunctions, $fFiles, $fAPIGroups, $fSortByState, $iDllRefcode) 1730 { 1731 $sURLArgs = "authorrefcode=".$iRefcode. 1732 ($fDlls ? "&fDlls=1" : ""). 1733 ($fFunctions ? "&fFunctions=1" : ""). 1734 ($fFiles ? "&fFiles=1" : ""). 1735 ($fAPIGroups ? "&fAPIGroups=1" : ""). 1736 ($fSortByState ? "&fSortByState=1" : ""); 1737 1645 1738 /* 1646 1739 * Navigation - TOP … … 1673 1766 * General 1674 1767 */ 1675 Odin32DBNaslov( $aContent,"General", "general");1768 Odin32DBNaslov("General", "general"); 1676 1769 echo "\n<table width=100% border=3 cellpadding=0>\n"; 1677 1770 Odin32DBInfoRow1("Name", $array, "name","","","",""); … … 1740 1833 Odin32DBInfoRow1NoArray("# API Groups", $cAPIGroups, "","","",""); 1741 1834 1742 echo " \n</table>\n";1835 echo "</table>\n"; 1743 1836 1744 1837 /* 1745 1838 * Completion 1746 1839 */ 1747 Odin32DBNaslov( $aContent,"Completion", "completion");1840 Odin32DBNaslov("Completion", "completion"); 1748 1841 Odin32DBCompletionBarAuthor($iRefcode, "", $db); 1749 1842 … … 1751 1844 * States 1752 1845 */ 1753 Odin32DBNaslov($aContent, "Status", "status");1846 //TODO: optimize this further. 1754 1847 $sql = sprintf("SELECT\n". 1755 " s.name AS state,\n". 1756 " s.color AS color,\n". 1757 " COUNT(f.refcode) AS functions\n". 1848 " f.state,\n". 1849 " COUNT(f.refcode)\n". 1758 1850 "FROM\n". 1759 " state s\n". 1760 " LEFT OUTER JOIN fnauthor fa ON fa.author = %d\n". 1761 " LEFT OUTER JOIN function f ON s.refcode = f.state AND fa.function = f.refcode\n". 1762 "GROUP BY s.refcode\n". 1763 "ORDER BY s.refcode", 1851 " function f,\n". 1852 " fnauthor fa\n". 1853 "WHERE\n". 1854 " fa.author = %d AND\n". 1855 " fa.function = f.refcode\n". 1856 "GROUP BY f.state\n". 1857 "ORDER BY f.state", 1764 1858 $iRefcode); 1765 if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0) 1766 { 1767 echo "\n<table width=100% border=0 cellpadding=0>\n"; 1768 while ($aState = mysql_fetch_array($result2)) 1769 { 1770 echo "<tr>\n". 1771 " <td width=75%><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["state"]."</b></font></td>\n". 1772 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["functions"]."</b></font></td>\n". 1773 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".@(int)((int)$aState["functions"] * 100 / $cFunctions)."%</b></font></td>\n". 1774 "</tr>\n"; 1775 } 1776 1777 echo "\n</table>\n"; 1778 } 1779 else 1780 Odin32DBSqlError($sql); 1859 Odin32DBWriteStates($cFunctions, $sql, $db); 1781 1860 1782 1861 /* 1783 1862 * Dlls 1784 1863 */ 1785 Odin32DBNaslov( $aContent,"Dlls", "dlls");1864 Odin32DBNaslov("Dlls", "dlls"); 1786 1865 if ($fDlls) 1787 1866 { 1788 1867 $sql = sprintf("SELECT\n". 1789 " d. name AS name,\n".1790 " d. refcode AS refcode,\n".1791 " COUNT(f.refcode) AS functions\n".1868 " d.refcode,\n". 1869 " d.name,\n". 1870 " COUNT(f.refcode)\n". 1792 1871 "FROM\n". 1793 1872 " fnauthor fa,\n". … … 1801 1880 "ORDER BY d.name\n", 1802 1881 $iRefcode); 1803 if ($result2 = mysql_query($sql, $db)) 1804 { 1805 if (mysql_num_rows($result2) > 0) 1806 { 1807 echo "\n<table width=100% border=0 cellpadding=0>\n". 1808 "<tr>\n". 1809 " <td><font size=-1><b>Dlls</b></font></td>\n". 1810 " <td align=right><font size=-1><b>Functions</b></font></td>\n". 1811 "</tr>\n"; 1812 while ($aFunction = mysql_fetch_array($result2)) 1813 { 1814 echo "<tr>\n". 1815 " <td width=75%><font size=-1><a href=\"Odin32DB.phtml?dllrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n". 1816 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n". 1817 "</tr>\n"; 1818 } 1819 echo "\n</table>\n"; 1820 } 1821 else 1822 echo "<i>No Files.</i><br>\n"; 1823 } 1824 else 1825 Odin32DBSqlError($sql); 1882 Odin32DBWriteDlls($sql, $db, $sURLArgs); 1826 1883 } 1827 1884 else 1828 { 1829 echo "Click <a href=\"Odin32DB.phtml#dlls?authorrefcode=".$iRefcode."&fDlls=1"; 1830 if ($fFunctions) echo "&fFunctions=".$fFunctions; 1831 if ($fFiles) echo "&fFiles=".$fFiles; 1832 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups; 1833 if ($fSortByState) echo "&fSortByState=".$fSortByState; 1834 echo "\">here</a> to see all files.\n"; 1835 } 1885 echo "Click <a href=\"Odin32DB.phtml#dlls?".$sURLArgs."&fDlls=1". 1886 "\">here</a> to see all files.\n"; 1836 1887 1837 1888 … … 1839 1890 * Functions 1840 1891 */ 1841 Odin32DBNaslov( $aContent,"Functions", "functions");1892 Odin32DBNaslov("Functions", "functions"); 1842 1893 if ($fFunctions) 1843 1894 { 1844 1895 $sql = sprintf("SELECT\n". 1845 " f. name AS name,\n".1846 " f. refcode AS refcode,\n".1847 " d. name AS dllname,\n".1848 " d. refcode AS dllrefcode,\n".1849 " s. name AS state,\n".1850 " s. color AS color\n".1896 " f.refcode,\n". 1897 " f.name,\n". 1898 " d.refcode,\n". 1899 " d.name,\n". 1900 " s.color,\n". 1901 " s.name\n". 1851 1902 "FROM\n". 1852 1903 " fnauthor fa\n". … … 1863 1914 else 1864 1915 $sql = $sql."ORDER BY d.name, f.name"; 1865 if ($result2 = mysql_query($sql, $db)) 1866 { 1867 if (mysql_num_rows($result2) > 0) 1868 { 1869 echo "\n<table width=100% border=0 cellpadding=0>\n". 1870 "<tr>\n". 1871 " <td width=30%><font size=-1><b>Dll Name</b></font></td>\n". 1872 " <td width=45%><font size=-1><b>Function Name</b></font></td>\n". 1873 " <td><font size=-1><b>State</b></font></td>\n". 1874 "</tr>\n"; 1875 while ($aFunction = mysql_fetch_array($result2)) 1876 { 1877 echo "<tr>\n". 1878 " <td><font size=-1><a href=\"Odin32DB.phtml?dllrefcode=".$aFunction["dllrefcode"]."\">".$aFunction["dllname"]."</a></font></td>\n". 1879 " <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n". 1880 " <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n". 1881 "</tr>\n"; 1882 } 1883 echo "\n</table>\n". 1884 "<p>Click <a href=\"Odin32DB.phtml#function?authorrefcode=".$iRefcode."&fFunctions=1"; 1885 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups; 1886 if ($fFiles) echo "&fAuthors=".$fFiles; 1887 if ($fSortByState) echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted alphabetical by dll.<br>\n"; 1888 else echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted by state.<br>\n"; 1889 } 1890 else 1891 echo "<i>No functions found</i><br>\n"; 1892 } 1893 else 1894 Odin32DBSqlError($sql); 1916 Odin32DBWriteFunctionsWithDlls($sql, $db, $sURLArgs); 1895 1917 } 1896 1918 else 1897 { 1898 echo "Click <a href=\"Odin32DB.phtml#functions?authorrefcode=".$iRefcode."&fFunctions=1"; 1899 if ($fDlls) echo "&fDlls=".$fDlls; 1900 if ($fFiles) echo "&fAuthors=".$fFiles; 1901 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups; 1902 if ($fSortByState) echo "&fSortByState=".$fSortByState; 1903 echo "\">here</a> to see all functions.\n"; 1904 } 1919 echo "Click <a href=\"Odin32DB.phtml#functions?".$sURLArgs."&fFunctions=1". 1920 "\">here</a> to see all functions.\n"; 1905 1921 1906 1922 … … 1908 1924 * Files 1909 1925 */ 1910 Odin32DBNaslov( $aContent,"Files", "files");1926 Odin32DBNaslov("Files", "files"); 1911 1927 if ($fFiles) 1912 1928 { 1913 //TODO: OPTMIZE THIS SQL!!!1914 1929 $sql = sprintf("SELECT\n". 1915 " f. name AS name,\n".1916 " f. refcode AS refcode,\n".1917 " COUNT(fn.refcode) AS functions\n".1930 " f.refcode,\n". 1931 " f.name,\n". 1932 " COUNT(fn.refcode)\n". 1918 1933 "FROM\n". 1919 1934 " fnauthor fa,\n". 1920 " file f\n". 1921 " LEFT OUTER JOIN function fn\n". 1922 " ON fn.file = f.refcode\n". 1935 " file f,\n". 1936 " function fn\n". 1923 1937 "WHERE\n". 1924 " fa.author = %d AND fa.function = fn.refcode\n". 1938 " fa.author = %d AND\n". 1939 " fa.function = fn.refcode AND\n". 1940 " fn.file = f.refcode\n". 1925 1941 "GROUP BY f.refcode\n". 1926 1942 "ORDER BY f.name\n", 1927 $iRefcode); 1928 if ($result2 = mysql_query($sql, $db)) 1929 { 1930 if (mysql_num_rows($result2) > 0) 1931 { 1932 echo "\n<table width=100% border=0 cellpadding=0>\n". 1933 "<tr>\n". 1934 " <td><font size=-1><b>Filename</b></font></td>\n". 1935 " <td align=right><font size=-1><b>Functions</b></font></td>\n". 1936 "</tr>\n"; 1937 while ($aFunction = mysql_fetch_array($result2)) 1938 { 1939 echo "<tr>\n". 1940 " <td width=75%><font size=-1><a href=\"Odin32DB.phtml?filerefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n". 1941 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n". 1942 "</tr>\n"; 1943 } 1944 echo "\n</table>\n"; 1945 } 1946 else 1947 echo "<i>No Files.</i><br>\n"; 1948 } 1949 else 1950 Odin32DBSqlError($sql); 1943 $iRefcode); 1944 Odin32DBWriteFiles($sql, $db); 1951 1945 } 1952 1946 else 1953 { 1954 echo "Click <a href=\"Odin32DB.phtml#files?authorrefcode=".$iRefcode."&fFiles=1"; 1955 if ($fDlls) echo "&fDlls=".$fDlls; 1956 if ($fFunctions) echo "&fFunctions=".$fFunctions; 1957 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups; 1958 if ($fSortByState) echo "&fSortByState=".$fSortByState; 1959 echo "\">here</a> to see all files.\n"; 1960 } 1947 echo "Click <a href=\"Odin32DB.phtml#files?".$sURLArgs."&fFiles=1". 1948 "\">here</a> to see all files.\n"; 1961 1949 1962 1950 … … 1966 1954 if ($cAPIGroups > 0) 1967 1955 { 1968 Odin32DBNaslov( $aContent,"API Groups", "apigroups");1956 Odin32DBNaslov("API Groups", "apigroups"); 1969 1957 if ($fAPIGroups) 1970 1958 { 1971 1959 $sql = sprintf("SELECT\n". 1972 " g. name AS name,\n".1973 " g. refcode AS refcode,\n".1974 " COUNT(f.refcode) AS functions\n".1960 " g.refcode,\n". 1961 " g.name,\n". 1962 " COUNT(f.refcode)\n". 1975 1963 "FROM\n". 1976 1964 " fnauthor fa\n". … … 1984 1972 "ORDER BY g.name\n", 1985 1973 $iRefcode); 1986 if ($result2 = mysql_query($sql, $db)) 1987 { 1988 if (mysql_num_rows($result2) > 0) 1989 { 1990 echo "\n<table width=100% border=0 cellpadding=0>\n". 1991 "<tr>\n". 1992 " <td width=75%><font size=-1><b>Group Name</b></font></td>\n". 1993 " <td align=right><font size=-1><b>Functions</b></font></td>\n". 1994 "</tr>\n"; 1995 while ($aFunction = mysql_fetch_array($result2)) 1996 { 1997 echo "<tr>\n". 1998 " <td><font size=-1><a href=\"Odin32DB.phtml?apigrouprefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n". 1999 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n". 2000 "</tr>\n"; 2001 } 2002 echo "\n</table>\n"; 2003 } 2004 else 2005 echo "<i>Not API Groups found.</i><br>\n"; 2006 } 2007 else 2008 Odin32DBSqlError($sql); 1974 Odin32DBWriteAPIGroups($sql, $db); 2009 1975 } 2010 1976 else 2011 { 2012 echo "Click <a href=\"Odin32DB.phtml#apigroups?authorrefcode=".$iRefcode."&fAPIGroups=1"; 2013 if ($fDlls) echo "&fDlls=".$fDlls; 2014 if ($fFunctions) echo "&fFunctions=".$fFunctions; 2015 if ($fFiles) echo "&fFiles=".$fFiles; 2016 if ($fSortByState) echo "&fSortByState=".$fSortByState; 2017 echo "\">here</a> to see all the API Groups.\n"; 2018 } 1977 echo "Click <a href=\"Odin32DB.phtml#apigroups?".$sURLArgs."&fAPIGroups=1". 1978 "\">here</a> to see all the API Groups.\n"; 2019 1979 } 2020 1980 } … … 2037 1997 * 2038 1998 * @returns void 2039 * @param $aContent Contents array. (input/output)2040 1999 * @param $db Database handle. 2041 2000 * @param $iRefcode Author reference code. … … 2049 2008 * @remark 2050 2009 */ 2051 function Odin32DBAPIGroupInfo(&$aContent, $db, $iRefcode, $fFunctions, $fFiles, $fAuthors, $fSortByState) 2052 { 2010 function Odin32DBAPIGroupInfo($db, $iRefcode, $fFunctions, $fFiles, $fAuthors, $fSortByState) 2011 { 2012 $sURLArgs = "apigrouprefcode=".$iRefcode. 2013 ($fFunctions ? "&fFunctions=1" : ""). 2014 ($fFiles ? "&fFiles=1" : ""). 2015 ($fAuthors ? "&fAuthors=1" : ""). 2016 ($fSortByState ? "&fSortByState=1" : ""); 2017 2053 2018 /* 2054 2019 * Navigation - TOP … … 2080 2045 * General 2081 2046 */ 2082 Odin32DBNaslov( $aContent,"General", "general");2047 Odin32DBNaslov("General", "general"); 2083 2048 echo "\n<table width=100% border=3 cellpadding=0>\n"; 2084 2049 Odin32DBInfoRow1("Name", $array, "name","","","",""); … … 2126 2091 Odin32DBInfoRow1NoArray("# Authors", $cAuthors, "","","",""); 2127 2092 2128 echo " \n</table>\n";2093 echo "</table>\n"; 2129 2094 2130 2095 /* 2131 2096 * Completion 2132 2097 */ 2133 Odin32DBNaslov( $aContent,"Completion", "completion");2098 Odin32DBNaslov("Completion", "completion"); 2134 2099 Odin32DBCompletionBarAPIGroup($iRefcode, "", $db); 2135 2100 … … 2137 2102 * States 2138 2103 */ 2139 Odin32DBNaslov($aContent, "Status", "status");2140 2104 $sql = sprintf("SELECT\n". 2141 " s.name AS state,\n". 2142 " s.color AS color,\n". 2143 " COUNT(f.state) AS functions\n". 2105 " f.state,\n". 2106 " COUNT(f.state)\n". 2144 2107 "FROM\n". 2145 " state s\n". 2146 " LEFT OUTER JOIN function f ON s.refcode = f.state AND f.apigroup = %d\n". 2147 "GROUP BY s.refcode\n". 2148 "ORDER BY s.refcode", 2108 " function\n". 2109 "WHERE\n". 2110 " f.apigroup = %d\n". 2111 "GROUP BY f.state\n". 2112 "ORDER BY f.state", 2149 2113 $iRefcode); 2150 if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0) 2151 { 2152 echo "\n<table width=100% border=0 cellpadding=0>\n"; 2153 while ($aState = mysql_fetch_array($result2)) 2154 { 2155 echo "<tr>\n". 2156 " <td width=75%><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["state"]."</b></font></td>\n". 2157 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["functions"]."</b></font></td>\n". 2158 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".@(int)((int)$aState["functions"] * 100 / $cFunctions)."%</b></font></td>\n". 2159 "</tr>\n"; 2160 } 2161 2162 echo "\n</table>\n"; 2163 } 2164 else 2165 Odin32DBSqlError($sql); 2114 Odin32DBWriteStates($cFunctions, $sql, $db); 2166 2115 2167 2116 /* 2168 2117 * Functions 2169 2118 */ 2170 Odin32DBNaslov( $aContent,"Functions", "functions");2119 Odin32DBNaslov("Functions", "functions"); 2171 2120 if ($fFunctions) 2172 2121 { 2122 //TODO: optimize this... 2173 2123 $sql = sprintf("SELECT\n". 2174 " f. name AS name,\n".2175 " f. refcode AS refcode,\n".2176 " s. name AS state,\n".2177 " s. color AS color\n".2124 " f.refcode,\n". 2125 " f.name,\n". 2126 " s.color,\n". 2127 " s.name\n". 2178 2128 "FROM\n". 2179 2129 " function f\n". … … 2186 2136 else 2187 2137 $sql = $sql."ORDER BY f.name"; 2188 if ($result2 = mysql_query($sql, $db)) 2189 { 2190 if (mysql_num_rows($result2) > 0) 2191 { 2192 echo "\n<table width=100% border=0 cellpadding=0>\n". 2193 "<tr>\n". 2194 " <td width=75%><font size=-1><b>Function Name</b></font></td>\n". 2195 " <td><font size=-1><b>State</b></font></td>\n". 2196 "</tr>\n"; 2197 while ($aFunction = mysql_fetch_array($result2)) 2198 { 2199 echo "<tr>\n". 2200 " <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n". 2201 " <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n". 2202 "</tr>\n"; 2203 } 2204 echo "\n</table>\n". 2205 "<p>Click <a href=\"Odin32DB.phtml#function?apigrouprefcode=".$iRefcode."&fFunctions=1"; 2206 if ($fAuthors) echo "&fAuthors=".$fAuthors; 2207 if ($fFiles) echo "&fAuthors=".$fFiles; 2208 if ($fSortByState) echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted alphabetical.<br>\n"; 2209 else echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted by state.<br>\n"; 2210 } 2211 else 2212 echo "<i>No functions found</i><br>\n"; 2213 } 2214 else 2215 Odin32DBSqlError($sql); 2138 Odin32DBWriteFunctions($sql, $db, $sURLArgs); 2216 2139 } 2217 2140 else 2218 { 2219 echo "Click <a href=\"Odin32DB.phtml#functions?apigrouprefcode=".$iRefcode."&fFunctions=1"; 2220 if ($fFiles) echo "&fAuthors=".$fFiles; 2221 if ($fAuthors) echo "&fAuthors=".$fAuthors; 2222 if ($fSortByState) echo "&fSortByState=".$fSortByState; 2223 echo "\">here</a> to see all functions.\n"; 2224 } 2141 echo "Click <a href=\"Odin32DB.phtml#functions?".$sURLArgs."&fFunctions=1". 2142 "\">here</a> to see all functions.\n"; 2225 2143 2226 2144 … … 2228 2146 * Files 2229 2147 */ 2230 Odin32DBNaslov( $aContent,"Files", "files");2148 Odin32DBNaslov("Files", "files"); 2231 2149 if ($fFiles) 2232 2150 { 2151 //TODO: optimize this... 2233 2152 $sql = sprintf("SELECT\n". 2234 " f. name AS name,\n".2235 " f. refcode AS refcode,\n".2236 " COUNT(fn.refcode) AS functions\n".2153 " f.refcode,\n". 2154 " f.name,\n". 2155 " COUNT(fn.refcode)\n". 2237 2156 "FROM\n". 2238 2157 " file f\n". … … 2242 2161 "GROUP BY f.refcode\n". 2243 2162 "ORDER BY f.name\n", 2244 $iRefcode); 2245 2246 if ($result2 = mysql_query($sql, $db)) 2247 { 2248 if (mysql_num_rows($result2) > 0) 2249 { 2250 echo "\n<table width=100% border=0 cellpadding=0>\n". 2251 "<tr>\n". 2252 " <td><font size=-1><b>Filename</b></font></td>\n". 2253 " <td align=right><font size=-1><b>Functions</b></font></td>\n". 2254 "</tr>\n"; 2255 while ($aFunction = mysql_fetch_array($result2)) 2256 { 2257 echo "<tr>\n". 2258 " <td width=75%><font size=-1><a href=\"Odin32DB.phtml?filerefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n". 2259 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n". 2260 "</tr>\n"; 2261 } 2262 echo "\n</table>\n"; 2263 } 2264 else 2265 echo "<i>No Files.</i><br>\n"; 2266 } 2267 else 2268 Odin32DBSqlError($sql); 2163 $iRefcode); 2164 Odin32DBWriteFiles($sql, $db); 2269 2165 } 2270 2166 else 2271 { 2272 echo "Click <a href=\"Odin32DB.phtml#files?apigrouprefcode=".$iRefcode."&fFiles=1"; 2273 if ($fFunctions) echo "&fFunctions=".$fFunctions; 2274 if ($fAuthors) echo "&fAuthors=".$fAuthors; 2275 if ($fSortByState) echo "&fSortByState=".$fSortByState; 2276 echo "\">here</a> to see all files.\n"; 2277 } 2167 echo "Click <a href=\"Odin32DB.phtml#files?".$sURLArgs."&fFiles=1". 2168 "\">here</a> to see all files.\n"; 2278 2169 2279 2170 … … 2281 2172 * Authors 2282 2173 */ 2283 Odin32DBNaslov( $aContent,"Authors", "authors");2174 Odin32DBNaslov("Authors", "authors"); 2284 2175 if ($fAuthors) 2285 2176 { 2177 //TODO: optimize this... 2286 2178 $sql = sprintf("SELECT\n". 2287 " a. name AS name,\n".2288 " a. refcode AS refcode,\n".2289 " COUNT(f.refcode) AS functions\n".2179 " a.refcode,\n". 2180 " a.name,\n". 2181 " COUNT(f.refcode)\n". 2290 2182 "FROM\n". 2291 2183 " fnauthor fa\n". … … 2298 2190 "GROUP BY a.refcode\n". 2299 2191 "ORDER BY a.name\n", 2300 $iRefcode 2301 ); 2302 if ($result2 = mysql_query($sql, $db)) 2303 { 2304 if (mysql_num_rows($result2) > 0) 2305 { 2306 echo "\n<table width=100% border=0 cellpadding=0>\n". 2307 "<tr>\n". 2308 " <td width=75%><font size=-1><b>Author</b></font></td>\n". 2309 " <td align=right><font size=-1><b>Functions</b></font></td>\n". 2310 "</tr>\n"; 2311 while ($aFunction = mysql_fetch_array($result2)) 2312 { 2313 echo "<tr>\n". 2314 " <td><font size=-1><a href=\"Odin32DB.phtml?authorrefcode=".$aFunction["refcode"]."&apigroup=".$iRefcode."\">".$aFunction["name"]."</a></font></td>\n". 2315 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n". 2316 "</tr>\n"; 2317 } 2318 echo "\n</table>\n"; 2319 } 2320 else 2321 echo "<i>Not authors found.</i><br>\n"; 2322 } 2323 else 2324 Odin32DBSqlError($sql); 2192 $iRefcode 2193 ); 2194 Odin32DBWriteAuthors($sql, $db); 2325 2195 } 2326 2196 else 2327 { 2328 echo "Click <a href=\"Odin32DB.phtml#authors?apigrouprefcode=".$iRefcode."&fAuthors=1"; 2329 if ($fFunctions) echo "&fFunctions=".$fFunctions; 2330 if ($fFiles) echo "&fFiles=".$fFiles; 2331 if ($fSortByState) echo "&fSortByState=".$fSortByState; 2332 echo "\">here</a> to see all authors.\n"; 2333 } 2197 echo "Click <a href=\"Odin32DB.phtml#authors?".$sURLArgs."&fAuthors=1". 2198 "\">here</a> to see all authors.\n"; 2334 2199 } 2335 2200 else … … 2352 2217 /* TEXT FORMATTING OVERLOADS */ 2353 2218 /* TEXT FORMATTING OVERLOADS */ 2219 $aContent = array(); 2354 2220 2355 2221 /** … … 2357 2223 * @sketch Writes the headers present in the contents array. 2358 2224 */ 2359 function Odin32DBWriteContents(&$aContent) 2360 { 2225 function Odin32DBWriteContents() 2226 { 2227 global $aContent; 2228 2361 2229 TocBeg(); 2362 2230 for ($i = 0; $i < sizeof($aContent); $i += 2) … … 2368 2236 * Forwarder which also maintains the contents array. 2369 2237 */ 2370 function Odin32DBNaslov(&$aContent, $sFull, $sShort) 2371 { 2238 function Odin32DBNaslov($sFull, $sShort) 2239 { 2240 global $aContent; 2241 2372 2242 $aContent[] = $sFull; 2373 2243 $aContent[] = $sShort;
Note:
See TracChangeset
for help on using the changeset viewer.