Remove old web site files.

pull/193/head
Michael Sweet 7 years ago
parent 37a03874c9
commit 8f4d870657
  1. 1
      www/.htaccess
  2. BIN
      www/0.gif
  3. BIN
      www/1.gif
  4. BIN
      www/2.gif
  5. BIN
      www/3.gif
  6. BIN
      www/4.gif
  7. BIN
      www/A.gif
  8. BIN
      www/B.gif
  9. BIN
      www/C.gif
  10. BIN
      www/D.gif
  11. 653
      www/account.php
  12. 857
      www/articles.php
  13. 377
      www/comment.php
  14. 3
      www/data/.htaccess
  15. 598
      www/data/make-form.php
  16. 12
      www/data/makedb
  17. 242
      www/data/mxml.sql
  18. 4
      www/data/software.md5
  19. 2
      www/docfiles/.htaccess
  20. BIN
      www/docfiles/0.gif
  21. BIN
      www/docfiles/1.gif
  22. BIN
      www/docfiles/2.gif
  23. BIN
      www/docfiles/3.gif
  24. BIN
      www/docfiles/4.gif
  25. BIN
      www/docfiles/A.gif
  26. BIN
      www/docfiles/B.gif
  27. BIN
      www/docfiles/C.gif
  28. BIN
      www/docfiles/D.gif
  29. 581
      www/docfiles/advanced.html
  30. 520
      www/docfiles/basics.html
  31. 210
      www/docfiles/index.html
  32. 115
      www/docfiles/install.html
  33. 175
      www/docfiles/intro.html
  34. 467
      www/docfiles/license.html
  35. 187
      www/docfiles/mxmldoc.html
  36. 1747
      www/docfiles/reference.html
  37. 329
      www/docfiles/relnotes.html
  38. 223
      www/docfiles/schema.html
  39. BIN
      www/docfiles/search.index
  40. 267
      www/documentation.php
  41. 1199
      www/forums.php
  42. 2
      www/images/.htaccess
  43. BIN
      www/images/black.gif
  44. BIN
      www/images/favicon.xcf.gz
  45. BIN
      www/images/graph.gif
  46. BIN
      www/images/logo-large.gif
  47. BIN
      www/images/logo.gif
  48. BIN
      www/images/private.gif
  49. 93
      www/index.php
  50. 264
      www/login.php
  51. 4222
      www/mxml.html
  52. 189
      www/mxmldoc.xsd
  53. 16
      www/org.minixml.atom
  54. BIN
      www/org.minixml.xar
  55. 3
      www/phplib/.htaccess
  56. 183
      www/phplib/auth.php
  57. 681
      www/phplib/common.php
  58. 159
      www/phplib/db.php
  59. 49
      www/phplib/globals.php
  60. 465
      www/phplib/html.php
  61. 71
      www/phplib/mirrors.php
  62. 114
      www/phplib/poll.php
  63. 82
      www/phplib/str.php
  64. 395
      www/poll.php
  65. 182
      www/software.php
  66. 1934
      www/str.php
  67. 2
      www/strfiles/.htaccess
  68. 241
      www/style.css
  69. 2
      www/swfiles/.htaccess

@ -1 +0,0 @@
RewriteEngine Off

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

@ -1,653 +0,0 @@
<?php
//
// "$Id$"
//
// Account management page...
//
//
// Include necessary headers...
//
include_once "phplib/html.php";
include_once "phplib/common.php";
include_once "phplib/str.php";
//
// Access levels...
//
$levels = array(
AUTH_USER => "User",
AUTH_DEVEL => "Devel",
AUTH_ADMIN => "Admin"
);
//
// 'account_header()' - Show standard account page header...
//
function
account_header($title)
{
global $PHP_SELF, $LOGIN_USER, $LOGIN_LEVEL;
html_header("$title");
html_start_links(1);
html_link("$LOGIN_USER", "$PHP_SELF");
html_link("Change Password", "$PHP_SELF?P");
if ($LOGIN_LEVEL == AUTH_ADMIN)
html_link("Manage Accounts", "$PHP_SELF?A");
if ($LOGIN_LEVEL > AUTH_USER)
html_link("New/Pending", "$PHP_SELF?L");
html_link("Logout", "$PHP_SELF?X");
html_end_links();
}
if ($argc == 1 && $argv[0] == "X")
auth_logout();
if ($LOGIN_USER == "")
{
header("Location: login.php");
exit(0);
}
if ($argc >= 1)
{
$op = $argv[0][0];
$data = substr($argv[0], 1);
}
else
$op = "";
switch ($op)
{
case 'A' :
// Manage accounts...
if ($LOGIN_LEVEL < AUTH_ADMIN)
{
header("Location: $PHP_SELF");
exit();
}
if ($data == "add")
{
if ($REQUEST_METHOD == "POST")
{
// Get data from form...
if (array_key_exists("IS_PUBLISHED", $_POST))
$is_published = (int)$_POST["IS_PUBLISHED"];
else
$is_published = 1;
if (array_key_exists("NAME", $_POST))
$name = $_POST["NAME"];
else
$name = "";
if (array_key_exists("EMAIL", $_POST))
$email = $_POST["EMAIL"];
else
$email = "";
if (array_key_exists("PASSWORD", $_POST))
$password = $_POST["PASSWORD"];
else
$password = "";
if (array_key_exists("PASSWORD2", $_POST))
$password2 = $_POST["PASSWORD2"];
else
$password2 = "";
if (array_key_exists("LEVEL", $_POST))
$level = (int)$_POST["LEVEL"];
else
$level = AUTH_USER;
if ($name != "" && $email != "" &&
(($password == "" && $password2 == "") ||
$password == $password2))
$havedata = 1;
else
$havedata = 0;
}
else
{
// Use blank account info...
$name = "";
$is_published = 0;
$email = $row["email"];
$level = $row["level"];
$password = "";
$password2 = "";
$havedata = 0;
}
account_header("Add Account");
if ($havedata)
{
// Store new data...
$hash = md5("$name:$password");
$name = db_escape($name);
$email = db_escape($email);
$date = time();
db_query("INSERT INTO users VALUES(NULL,$is_published,"
."'$name','$email','$hash',$level,$date,'$LOGIN_USER',"
."$date,'$LOGIN_USER')");
print("<p>Account added successfully!</p>\n");
html_start_links(1);
html_link("Return to Manage Accounts", "$PHP_SELF?A");
html_end_links();
}
else
{
$name = htmlspecialchars($name, ENT_QUOTES);
$email = htmlspecialchars($email, ENT_QUOTES);
print("<form method='POST' action='$PHP_SELF?Aadd'>"
."<table width='100%'>\n"
."<tr><th align='right'>Published:</th>"
."<td>");
select_is_published($is_published);
print("</td></tr>\n"
."<tr><th align='right'>Username:</th>"
."<td><input type='text' name='NAME' size='40' "
."maxsize='255' value='$name'></td></tr>\n"
."<tr><th align='right'>EMail:</th>"
."<td><input type='text' name='EMAIL' size='40' "
."maxsize='255' value='$email'></td></tr>\n"
."<tr><th align='right'>Access Level:</th>"
."<td><select name='LEVEL'>");
reset($levels);
while (list($key, $val) = each($levels))
{
if ($level == $key)
print("<option value='$key' selected>$val</option>");
else
print("<option value='$key'>$val</option>");
}
print("</select></td></tr>\n"
."<tr><th align='right'>Password:</th>"
."<td><input type='password' name='PASSWORD' size='16' "
."maxsize='255'></td></tr>\n"
."<tr><th align='right'>Password Again:</th>"
."<td><input type='password' name='PASSWORD2' size='16' "
."maxsize='255'></td></tr>\n"
."<tr><th></th><td><input type='submit' value='Add Account'>"
."</td></tr>\n"
."</table></form>\n");
}
html_footer();
}
else if ($data == "batch")
{
// Disable/enable/expire/etc. accounts...
if ($REQUEST_METHOD == "POST" && array_key_exists("OP", $_POST))
{
$op = $_POST["OP"];
db_query("BEGIN TRANSACTION");
reset($_POST);
while (list($key, $val) = each($_POST))
if (substr($key, 0, 3) == "ID_")
{
$id = (int)substr($key, 3);
if ($op == "disable")
db_query("UPDATE users SET is_published = 0 WHERE id = $id");
else if ($op == "enable")
db_query("UPDATE users SET is_published = 1 WHERE id = $id");
}
db_query("COMMIT TRANSACTION");
}
header("Location: $PHP_SELF?A");
}
else if ($data == "modify")
{
// Modify account...
if ($argc != 2 || $argv[1] == "")
{
header("Location: $PHP_SELF?A");
exit();
}
$name = $argv[1];
if ($REQUEST_METHOD == "POST")
{
// Get data from form...
if (array_key_exists("IS_PUBLISHED", $_POST))
$is_published = (int)$_POST["IS_PUBLISHED"];
else
$is_published = 1;
if (array_key_exists("EMAIL", $_POST))
$email = $_POST["EMAIL"];
else
$email = "";
if (array_key_exists("PASSWORD", $_POST))
$password = $_POST["PASSWORD"];
else
$password = "";
if (array_key_exists("PASSWORD2", $_POST))
$password2 = $_POST["PASSWORD2"];
else
$password2 = "";
if (array_key_exists("LEVEL", $_POST))
$level = (int)$_POST["LEVEL"];
else
$level = AUTH_USER;
if ($email != "" &&
(($password == "" && $password2 == "") ||
$password == $password2))
$havedata = 1;
else
$havedata = 0;
}
else
{
// Get data from existing account...
$result = db_query("SELECT * FROM users WHERE "
."name='" . db_escape($name) ."'");
if (db_count($result) != 1)
{
header("Location: $PHP_SELF?A");
exit();
}
$row = db_next($result);
$is_published = $row["is_published"];
$email = $row["email"];
$level = $row["level"];
$password = "";
$password2 = "";
$havedata = 0;
db_free($result);
}
account_header("Modify $name");
if ($havedata)
{
// Store new data...
if ($password != "")
$hash = ", hash='" . md5("$name:$password") . "'";
else
$hash = "";
$name = db_escape($name);
$email = db_escape($email);
$date = time();
db_query("UPDATE users SET "
."email='$email'$hash, level='$level', "
."is_published=$is_published, modify_user='$LOGIN_USER', "
."modify_date = $date WHERE name='$name'");
print("<p>Account modified successfully!</p>\n");
html_start_links(1);
html_link("Return to Manage Accounts", "$PHP_SELF?A");
html_end_links();
}
else
{
$name = htmlspecialchars($name, ENT_QUOTES);
$email = htmlspecialchars($email, ENT_QUOTES);
print("<form method='POST' action='$PHP_SELF?Amodify+$name'>"
."<table width='100%'>\n"
."<tr><th align='right'>Published:</th>"
."<td>");
select_is_published($is_published);
print("</td></tr>\n"
."<tr><th align='right'>Username:</th>"
."<td>$name</td></tr>\n"
."<tr><th align='right'>EMail:</th>"
."<td><input type='text' name='EMAIL' size='40' "
."maxsize='255' value='$email'></td></tr>\n"
."<tr><th align='right'>Access Level:</th>"
."<td>");
if ($LOGIN_USER == $name)
print("<input type='hidden' name='LEVEL' value='$level'>"
. $levels[$level]);
else
{
print("<select name='LEVEL'>");
reset($levels);
while (list($key, $val) = each($levels))
{
if ($level == $key)
print("<option value='$key' selected>$val</option>");
else
print("<option value='$key'>$val</option>");
}
print("</select>");
}
print("</td></tr>\n"
."<tr><th align='right'>Password:</th>"
."<td><input type='password' name='PASSWORD' size='16' "
."maxsize='255'></td></tr>\n"
."<tr><th align='right'>Password Again:</th>"
."<td><input type='password' name='PASSWORD2' size='16' "
."maxsize='255'></td></tr>\n"
."<tr><th></th><td><input type='submit' value='Modify Account'>"
."</td></tr>\n"
."</table></form>\n");
}
html_footer();
}
else
{
// List accounts...
account_header("Manage Accounts");
$result = db_query("SELECT * FROM users ORDER BY name");
print("<form method='POST' action='$PHP_SELF?Abatch'>\n");
html_start_table(array("Username", "EMail", "Level"));
while ($row = db_next($result))
{
$name = htmlspecialchars($row["name"], ENT_QUOTES);
$email = htmlspecialchars($row["email"], ENT_QUOTES);
$level = $levels[$row["level"]];
if ($row["is_published"] == 0)
$email .= " <img src='images/private.gif' width='16' height='16' "
."border='0' align='middle' alt='Private'>";
html_start_row();
print("<td nowrap><input type='checkbox' name='ID_$row[id]'>"
."<a href='$PHP_SELF?Amodify+$name'>$name</a></td>"
."<td align='center'><a href='$PHP_SELF?Amodify+$name'>"
."$email</a></td>"
."<td align='center'><a href='$PHP_SELF?Amodify+$name'>"
."$level</a></td>");
html_end_row();
}
html_end_table();
print("<p align='center'><select name='OP'>"
."<option value='disable'>Disable</option>"
."<option value='enable'>Enable</option>"
."</select>"
."<input type='submit' value='Checked Accounts'></p>");
html_start_links(1);
html_link("Add Account", "$PHP_SELF?Aadd");
html_end_links();
html_footer();
}
break;
case 'L' :
// List
if ($LOGIN_LEVEL < AUTH_DEVEL)
{
header("Location: $PHP_SELF");
exit();
}
account_header("New/Pending");
$email = db_escape($_COOKIE["FROM"]);
print("<h2>New/Pending Articles:</h2>\n");
$result = db_query("SELECT * FROM article WHERE is_published = 0 "
."ORDER BY modify_date");
$count = db_count($result);
if ($count == 0)
print("<p>No new/pending articles found.</p>\n");
else
{
html_start_table(array("Id", "Title", "Last Updated"));
while ($row = db_next($result))
{
$id = $row['id'];
$title = htmlspecialchars($row['title'], ENT_QUOTES) .
" <img src='images/private.gif' width='16' height='16' "
."border='0' align='middle' alt='Private'>";
$abstract = htmlspecialchars($row['abstract'], ENT_QUOTES);
$date = date("M d, Y", $row['modify_date']);
html_start_row();
print("<td align='center' nowrap><a "
."href='articles.php?L$id$options'>$id</a></td>"
."<td width='67%' align='center'><a "
."href='articles.php?L$id$options'>$title</a></td>"
."<td align='center'><a "
."href='articles.php?L$id$options'>$date</a></td>");
html_end_row();
html_start_row();
print("<td></td><td colspan='2'>$abstract</td>");
html_end_row();
}
html_end_table();
}
db_free($result);
print("<h2>New/Pending Links:</h2>\n");
$result = db_query("SELECT * FROM link WHERE is_published = 0 "
."ORDER BY modify_date");
$count = db_count($result);
if ($count == 0)
print("<p>No new/pending links found.</p>\n");
else
{
html_start_table(array("Id", "Name/Version", "Last Updated"));
while ($row = db_next($result))
{
$id = $row['id'];
$title = htmlspecialchars($row['name'], ENT_QUOTES) . " " .
htmlspecialchars($row['version'], ENT_QUOTES) .
" <img src='images/private.gif' width='16' height='16' "
."border='0' align='middle' alt='Private'>";
$date = date("M d, Y", $row['modify_date']);
if ($row["is_category"])
$link = "<a href='links.php?UC$id'>";
else
$link = "<a href='links.php?UL$id'>";
html_start_row();
print("<td align='center' nowrap>$link$id</a></td>"
."<td width='67%' align='center'>$link$title</a></td>"
."<td align='center'>$link$date</a></td>");
html_end_row();
}
html_end_table();
}
db_free($result);
print("<h2>New/Pending STRs:</h2>\n");
$result = db_query("SELECT * FROM str WHERE status >= $STR_STATUS_PENDING "
."AND (manager_email == '' OR manager_email = '$email') "
."ORDER BY status DESC, priority DESC, scope DESC, "
."modify_date");
$count = db_count($result);
if ($count == 0)
print("<p>No new/pending STRs found.</p>\n");
else
{
html_start_table(array("Id", "Priority", "Status", "Scope",
"Summary", "Version", "Last Updated",
"Assigned To"));
while ($row = db_next($result))
{
$date = date("M d, Y", $row['modify_date']);
$summary = htmlspecialchars($row['summary'], ENT_QUOTES);
$summabbr = htmlspecialchars(abbreviate($row['summary'], 80), ENT_QUOTES);
$prtext = $priority_text[$row['priority']];
$sttext = $status_text[$row['status']];
$sctext = $scope_text[$row['scope']];
if ($row['is_published'] == 0)
$summabbr .= " <img src='images/private.gif' width='16' height='16' "
."border='0' align='middle' alt='Private'>";
html_start_row();
print("<td nowrap>"
."<a href='str.php?L$row[id]$options' alt='STR #$row[id]: $summary'>"
."$row[id]</a></td>"
."<td align='center'>$prtext</td>"
."<td align='center'>$sttext</td>"
."<td align='center'>$sctext</td>"
."<td align='center'><a href='str.php?L$row[id]$options' "
."alt='STR #$row[id]: $summary'>$summabbr</a></td>"
."<td align='center'>$row[str_version]</td>"
."<td align='center'>$date</td>");
if ($row['manager_email'] != "")
$email = sanitize_email($row['manager_email']);
else
$email = "<i>Unassigned</i>";
print("<td align='center'>$email</td>");
html_end_row();
}
html_end_table();
}
db_free($result);
// Show hidden comments...
print("<h2>Hidden Comments:</h2>\n");
$result = db_query("SELECT * FROM comment WHERE status = 0 ORDER BY id");
if (db_count($result) == 0)
print("<p>No hidden comments.</p>\n");
else
{
print("<ul>\n");
while ($row = db_next($result))
{
$create_date = date("M d, Y", $row['create_date']);
$create_user = sanitize_email($row['create_user']);
$contents = sanitize_text($row['contents']);
$location = str_replace("_", "?", $row['url']);
print("<li><a href='$location'>$row[url]</a> "
." by $create_user on $create_date "
."<a href='comment.php?e$row[id]+p$row[url]'>Edit</a> "
."&middot; <a href='comment.php?d$row[id]+p$row[url]'>Delete</a>"
."<br><tt>$contents</tt></li>\n");
}
print("</ul>\n");
}
db_free($result);
html_footer();
break;
case 'P' :
// Change password
account_header("Change Password");
if ($REQUEST_METHOD == "POST" &&
array_key_exists("PASSWORD", $_POST) &&
array_key_exists("PASSWORD2", $_POST) &&
$_POST["PASSWORD"] == $_POST["PASSWORD2"])
{
// Store new password and re-login...
print("<p>Password changed successfully!</p>\n");
}
else
{
print("<form method='POST' action='$PHP_SELF?P'>"
."<table width='100%'>\n"
."<tr><th align='right'>Password:</th>"
."<td><input type='password' name='PASSWORD' size='16' "
."maxsize='255'></td></tr>\n"
."<tr><th align='right'>Password Again:</th>"
."<td><input type='password' name='PASSWORD2' size='16' "
."maxsize='255'></td></tr>\n"
."<tr><th></th><td><input type='submit' value='Change Password'>"
."</td></tr>\n"
."</table></form>\n");
}
html_footer();
break;
default :
// Show account info...
account_header($LOGIN_USER);
if (array_key_exists("FROM", $_COOKIE))
$email = htmlspecialchars($_COOKIE["FROM"]);
else
$email = "<i>unknown</i>";
print("<center><table border='0'>\n"
."<tr><th align='right'>Username:</th><td>$LOGIN_USER</td></tr>\n"
."<tr><th align='right'>EMail:</th><td>$email</td></tr>\n"
."<tr><th align='right'>Access Level:</th>"
."<td>$levels[$LOGIN_LEVEL]</td></tr>\n"
."</table></center>\n");
html_footer();
break;
}
//
// End of "$Id$".
//
?>

@ -1,857 +0,0 @@
<?php
//
// "$Id$"
//
// Web form for the article table...
//
// Contents:
//
// notify_users() - Notify users of new/updated articles...
//
//
// Include necessary headers...
//
include_once "phplib/html.php";
include_once "phplib/common.php";
//
// 'notify_users()' - Notify users of new/updated articles...
//
function
notify_users($id, // I - Article #
$what = "created") // I - Reason for notification
{
global $PHP_URL, $PROJECT_EMAIL, $PROJECT_NAME;
$result = db_query("SELECT * FROM article WHERE id = $id");
if (db_count($result) == 1)
{
$row = db_next($result);
mail($PROJECT_EMAIL, "$PROJECT_NAME Article #$id $what",
wordwrap("$row[create_user] has $what an article titled, "
."'$row[title]' with the following abstract:\n\n"
." $row[abstract]\n\n"
."Please approve or delete this article via the following "
."page:\n\n"
." $PHP_URL?L$id\n"),
"From: $PROJECT_EMAIL\r\n");
}
}
// Get command-line options...
//
// Usage: article.php [operation] [options]
//
// Operations:
//
// B - Batch update selected articles
// D# - Delete article
// L = List all
// L# = List article #
// M# = Modify article #
// N = Create new article
//
// Options:
//
// I# = Set first article
// Qtext = Set search text
$search = "";
$index = 0;
if ($argc)
{
$op = $argv[0][0];
$id = (int)substr($argv[0], 1);
if ($op != 'D' && $op != 'L' && $op != 'M' && $op != 'N' && $op != 'B')
{
html_header("Article Error");
print("<p>Bad command '$op'!\n");
html_footer();
exit();
}
if ($op != 'L' && $LOGIN_USER == "")
{
header("Location: login.php");
exit();
}
if (($op == 'D' || $op == 'M') && !$id)
{
html_header("Article Error");
print("<p>Command '$op' requires an ID!\n");
html_footer();
exit();
}
if ($op == 'B' && $LOGIN_LEVEL < AUTH_DEVEL)
{
html_header("Article Error");
print("<p>You don't have permission to use command '$op'!\n");
html_footer();
exit();
}
if (($op == 'D' || $op == 'M') && $LOGIN_LEVEL < AUTH_DEVEL)
{
$result = db_query("SELECT * FROM article WHERE id = $id");
if (db_count($result) != 1)
{
db_free($result);
html_header("Article Error");
print("<p>Article #$id does not exist!\n");
html_footer();
exit();
}
$row = db_next($result);
if ($row['create_user'] != $LOGIN_USER &&
$row['create_user'] != $LOGIN_EMAIL)
{
db_free($result);
html_header("Article Error");
print("<p>You don't have permission to use command '$op'!\n");
html_footer();
exit();
}
db_free($result);
}
if ($op == 'N' && $id)
{
html_header("Article Error");
print("<p>Command '$op' may not have an ID!\n");
html_footer();
exit();
}
for ($i = 1; $i < $argc; $i ++)
{
$option = substr($argv[$i], 1);
switch ($argv[$i][0])
{
case 'Q' : // Set search text
$search = urldecode($option);
$i ++;
while ($i < $argc)
{
$search .= urldecode(" $argv[$i]");
$i ++;
}
break;
case 'I' : // Set first STR
$index = (int)$option;
if ($index < 0)
$index = 0;
break;
default :
html_header("Article Error");
print("<p>Bad option '$argv[$i]'!</p>\n");
html_footer();
exit();
break;
}
}
}
else
{
$op = 'L';
$id = 0;
}
if ($REQUEST_METHOD == "POST")
{
if (array_key_exists("SEARCH", $_POST))
$search = $_POST["SEARCH"];
}
$options = "+I$index+Q" . urlencode($search);
switch ($op)
{
case 'B' : // Batch update selected articles
if ($REQUEST_METHOD != "POST")
{
header("Location: $PHP_SELF?L$options");
break;
}
if (array_key_exists("IS_PUBLISHED", $_POST) &&
$_POST["IS_PUBLISHED"] != "")
{
$modify_date = time();
$modify_user = db_escape($LOGIN_USER);
$is_published = (int)$_POST["IS_PUBLISHED"];
$query = "is_published = $is_published, modify_date = $modify_date, "
."modify_user = '$modify_user'";
db_query("BEGIN TRANSACTION");
reset($_POST);
while (list($key, $val) = each($_POST))
if (substr($key, 0, 3) == "ID_")
{
$id = (int)substr($key, 3);
db_query("UPDATE article SET $query WHERE id = $id");
}
db_query("COMMIT TRANSACTION");
}
header("Location: $PHP_SELF?L$options");
break;
case 'D' : // Delete Article
if ($REQUEST_METHOD == "POST")
{
db_query("DELETE FROM article WHERE id = $id");
header("Location: $PHP_SELF?L$options");
}
else
{
$result = db_query("SELECT * FROM article WHERE id = $id");
if (db_count($result) != 1)
{
print("<p><b>Error:</b> Article #$id was not found!</p>\n");
html_footer();
exit();
}
$row = db_next($result);
html_header("Delete Article #$id");
html_start_links(1);
html_link("Return to Articles", "$PHP_SELF?L$options");
html_link("View Article #$id", "$PHP_SELF?L$id$options");
html_link("Modify Article #$id", "$PHP_SELF?M$id$options");
html_end_links();
print("<form method='post' action='$PHP_SELF?D$id'>"
."<table width='100%' cellpadding='5' cellspacing='0' border='0'>\n");
if (!$row['is_published'])
print("<tr><th align='center' colspan='2'>This article is "
."currently hidden from public view.</td></tr>\n");
$temp = htmlspecialchars($row["title"]);
print("<tr><th align='right'>Title:</th><td class='left'>$temp</td></tr>\n");
$temp = htmlspecialchars($row["abstract"]);
print("<tr><th align='right'>Abstract:</th><td class='left'>$temp</td></tr>\n");
$temp = format_text($row["contents"]);
print("<tr><th align='right'>Contents:</th><td class='left'>$temp</td></tr>\n");
print("<tr><th colspan='2'>"
."<input type='submit' value='Confirm Delete Article'></th></tr>\n");
print("</table></form>\n");
html_footer();
}
break;
case 'L' : // List (all) Article(s)
if ($id)
{
$result = db_query("SELECT * FROM article WHERE id = $id");
if (db_count($result) != 1)
{
html_header("Article Error");
print("<p><b>Error:</b> Article #$id was not found!</p>\n");
html_footer();
exit();
}
$row = db_next($result);
$title = htmlspecialchars($row['title']);
$abstract = htmlspecialchars($row['abstract']);
$contents = format_text($row['contents']);
$create_user = sanitize_email($row['create_user']);
$date = date("H:i M d, Y", $row['modify_date']);
html_header("Article #$id: $title");
html_start_links(1);
html_link("Return to Articles", "$PHP_SELF?L$options");
html_link("Show Comments", "#_USER_COMMENTS");
html_link("Submit Comment", "comment.php?r0+particles.php_L$id");
if ($LOGIN_LEVEL >= AUTH_DEVEL ||
$row['create_user'] == $LOGIN_USER)
{
html_link("Modify Article", "$PHP_SELF?M$id$options");
html_link("Delete Article", "$PHP_SELF?D$id$options");
}
html_end_links();
if (!$row['is_published'])
print("<p align='center'><b>This article is currently hidden from "
."public view.</b></p>\n");
print("<p><i>$date by $create_user</i><br>$abstract</p>\n"
."$contents\n"
."<h1><a name='_USER_COMMENTS'>Comments</a></h1>\n");
html_start_links();
html_link("Submit Comment", "comment.php?r0+particles.php_L$id");
html_end_links();
show_comments("articles.php_L$id");
db_free($result);
}
else
{
html_header("Articles");
html_start_links(1);
html_link("Submit Article", "$PHP_SELF?N$options");
html_end_links();
$htmlsearch = htmlspecialchars($search, ENT_QUOTES);
print("<form method='POST' action='$PHP_SELF'><p align='center'>"
."Search&nbsp;Words: &nbsp;<input type='text' size='60' "
."name='SEARCH' value='$htmlsearch'>"
."<input type='submit' value='Search Articles'></p></form>\n");
$query = "";
$prefix = "WHERE ";
if ($LOGIN_LEVEL < AUTH_DEVEL)
{
$query .= "${prefix}(is_published = 1 OR create_user = '"
. db_escape($LOGIN_USER) . "')";
$prefix = " AND ";
}
if ($search)
{
$search_string = str_replace("'", " ", $search);
$search_string = str_replace("\"", " ", $search_string);
$search_string = str_replace("\\", " ", $search_string);
$search_string = str_replace("%20", " ", $search_string);
$search_string = str_replace("%27", " ", $search_string);
$search_string = str_replace(" ", " ", $search_string);
$search_words = explode(' ', $search_string);
// Loop through the array of words, adding them to the
$query .= "${prefix}(";
$prefix = "";
$next = " OR";
$logic = "";
reset($search_words);
while ($keyword = current($search_words))
{
next($search_words);
$keyword = db_escape(ltrim(rtrim($keyword)));
if (strcasecmp($keyword, 'or') == 0)
{
$next = ' OR';
if ($prefix != '')
$prefix = ' OR';
}
else if (strcasecmp($keyword, 'and') == 0)
{
$next = ' AND';
if ($prefix != '')
$prefix = ' AND';
}
else if (strcasecmp($keyword, 'not') == 0)
{
$logic = ' NOT';
}
else
{
$keyword = db_escape($keyword);
if ($keyword == (int)$keyword)
$idsearch = " OR id = " . (int)$keyword;
else
$idsearch = "";
$query .= "$prefix$logic (title LIKE \"%$keyword%\"$idsearch"
." OR abstract LIKE \"%$keyword%\""
." OR contents LIKE \"%$keyword%\")";
$prefix = $next;
$logic = '';
}
}
$query .= ")";
}
$result = db_query("SELECT * FROM article $query "
."ORDER BY modify_date DESC");
$count = db_count($result);
if ($count == 0)
{
print("<p>No Articles found.</p>\n");
html_footer();
exit();
}
if ($index >= $count)
$index = $count - ($count % $PAGE_MAX);
if ($index < 0)
$index = 0;
$start = $index + 1;
$end = $index + $PAGE_MAX;
if ($end > $count)
$end = $count;
$prev = $index - $PAGE_MAX;
if ($prev < 0)
$prev = 0;
$next = $index + $PAGE_MAX;
print("<p>$count article(s) found, showing $start to $end:</p>\n");
if ($LOGIN_LEVEL >= AUTH_DEVEL)
print("<form method='POST' action='$PHP_SELF?B$options'>\n");
if ($count > $PAGE_MAX)
{
print("<table border='0' cellspacing='0' cellpadding='0' "
."width='100%'>\n");
print("<tr><td>");
if ($index > 0)
print("<a href='$PHP_SELF?L+I$prev+Q" . urlencode($search)
."'>Previous&nbsp;$PAGE_MAX</a>");
print("</td><td align='right'>");
if ($end < $count)
{
$next_count = min($PAGE_MAX, $count - $end);
print("<a href='$PHP_SELF?L+I$next+Q" . urlencode($search)
."'>Next&nbsp;$next_count</a>");
}
print("</td></tr>\n");
print("</table>\n");
}
html_start_table(array("ID","Title","Last Modified", "Comment(s)"));
db_seek($result, $index);
for ($i = 0; $i < $PAGE_MAX && $row = db_next($result); $i ++)
{
html_start_row();
$id = $row['id'];
$link = "<a href='$PHP_SELF?L$id$options' alt='Article #$id'>";
print("<td nowrap>");
if ($LOGIN_LEVEL >= AUTH_DEVEL)
print("<input type='checkbox' name='ID_$row[id]'>");
print("$link$id</a></td>");
$temp = htmlspecialchars($row['title']);
if ($row['is_published'] == 0)
$temp .= " <img src='images/private.gif' width='16' height='16' "
."border='0' align='absmiddle' alt='Private'>";
print("<td align='center' width='67%'>$link$temp</a></td>");
$temp = date("M d, Y", $row['modify_date']);
print("<td align='center'>$link$temp</a></td>");
$ccount = count_comments("articles.php_L$id");
print("<td align='center'>$link$ccount</a></td>");
html_end_row();
html_start_row();
$temp = htmlspecialchars($row['abstract']);
print("<td></td><td colspan='3'>$temp</td>");
html_end_row();
}
html_end_table();
if ($LOGIN_LEVEL > 0)
{
print("<p>Published:&nbsp;");
select_is_published();
print("<input type='submit' value='Modify Selected Articles'></p>\n");
}
if ($count > $PAGE_MAX)
{
print("<table border='0' cellspacing='0' cellpadding='0' "
."width='100%'>\n");
print("<tr><td>");
if ($index > 0)
print("<a href='$PHP_SELF?L+I$prev+Q" . urlencode($search)
."'>Previous&nbsp;$PAGE_MAX</a>");
print("</td><td align='right'>");
if ($end < $count)
{
$next_count = min($PAGE_MAX, $count - $end);
print("<a href='$PHP_SELF?L+I$next+Q" . urlencode($search)
."'>Next&nbsp;$next_count</a>");
}
print("</td></tr>\n");
print("</table>\n");
}
print("<p><img src='images/private.gif' width='16' height='16' "
."align='absmiddle' alt='private'> = hidden from public view</p>\n");
}
html_footer();
break;
case 'M' : // Modify Article
if ($REQUEST_METHOD == "POST")
{
if ($LOGIN_LEVEL < AUTH_DEVEL)
$is_published = 0;
else if (array_key_exists("IS_PUBLISHED", $_POST))
$is_published = (int)$_POST["IS_PUBLISHED"];
else
$is_published = 0;
if (array_key_exists("TITLE", $_POST))
$title = $_POST["TITLE"];
else
$title = "";
if (array_key_exists("ABSTRACT", $_POST))
$abstract = $_POST["ABSTRACT"];
else
$abstract = "";
if (array_key_exists("CONTENTS", $_POST))
$contents = $_POST["CONTENTS"];
else
$contents = "";
if (($is_published == 0 || $LOGIN_LEVEL >= AUTH_DEVEL) &&
$title != "" && $abstract != "" && $contents != "")
$havedata = 1;
else
$havedata = 0;
}
else
{
$result = db_query("SELECT * FROM article WHERE id = $id");
if (db_count($result) != 1)
{
print("<p><b>Error:</b> Article #$id was not found!</p>\n");
html_footer();
exit();
}
$row = db_next($result);
$is_published = $row["is_published"];
$title = $row["title"];
$abstract = $row["abstract"];
$contents = $row["contents"];
db_free($row);
$havedata = 0;
}
if ($havedata)
{
$title = db_escape($title);
$abstract = db_escape($abstract);
$contents = db_escape($contents);
$modify_date = time();
db_query("UPDATE article SET "
."is_published = $is_published, "
."title = '$title', "
."abstract = '$abstract', "
."contents = '$contents', "
."modify_date = $modify_date, "
."modify_user = '$LOGIN_USER' "
."WHERE id = $id");
if (!$is_published)
notify_users($id, "modified");
header("Location: $PHP_SELF?L$id$options");
}
else
{
html_header("Modify Article #$id");
html_start_links(1);
html_link("Return to Articles", "$PHP_SELF?L$options");
html_link("Article #$id", "$PHP_SELF?L$id$options");
html_end_links();
if ($REQUEST_METHOD == "POST")
{
print("<p><b>Error:</b> Please fill in the fields marked in "
."<b><font color='red'>bold red</font></b> below and resubmit "
."your article.</p>\n");
$hstart = "<font color='red'>";
$hend = "</font>";
}
else
{
$hstart = "";
$hend = "";
}
print("<form method='post' action='$PHP_SELF?M$id$options'>"
."<table width='100%' cellpadding='5' cellspacing='0' border='0'>\n");
if ($LOGIN_LEVEL >= AUTH_DEVEL)
{
print("<tr><th align='right'>Published:</th><td>");
select_is_published($is_published);
print("</td></tr>\n");
}
else
print("<input type='hidden' name='IS_PUBLISHED' value='0'>\n");
$title = htmlspecialchars($title, ENT_QUOTES);
if ($title == "")
print("<tr><th align='right'>${hstart}Title:${hend}</th>");
else
print("<tr><th align='right'>Title:</th>");
print("<td><input type='text' name='TITLE' "
."size='80' value='$title'></td></tr>\n");
$abstract = htmlspecialchars($abstract, ENT_QUOTES);
if ($abstract == "")
print("<tr><th align='right'>${hstart}Abstract:${hend}</th>");
else
print("<tr><th align='right'>Abstract:</th>");
print("<td><input type='text' name='ABSTRACT' "
."size='80' value='$abstract'></td></tr>\n");
$contents = htmlspecialchars($contents, ENT_QUOTES);
if ($contents == "")
print("<tr><th align='right' valign='top'>${hstart}Contents:${hend}</th>");
else
print("<tr><th align='right' valign='top'>Contents:</th>");
print("<td><textarea name='CONTENTS' "
."cols='72' rows='12' wrap='virtual'>"
."$contents</textarea>\n"
."<p>The contents of the article may contain the following "
."HTML elements: <tt>A</tt>, <tt>B</tt>, <tt>BLOCKQUOTE</tt>, "
."<tt>CODE</tt>, <tt>EM</tt>, <tt>H1</tt>, <tt>H2</tt>, "
."<tt>H3</tt>, <tt>H4</tt>, <tt>H5</tt>, <tt>H6</tt>, <tt>I</tt>, "
."<tt>IMG</tt>, <tt>LI</tt>, <tt>OL</tt>, <tt>P</tt>, <tt>PRE</tt>, "
."<tt>TT</tt>, <tt>U</tt>, <tt>UL</tt></p></td></tr>\n");
print("<tr><th colspan='2'>"
."<input type='submit' value='Motify Article'></th></tr>\n");
print("</table></form>\n");
html_footer();
}
break;
case 'N' : // Post new Article
if ($REQUEST_METHOD == "POST")
{
if ($LOGIN_LEVEL < AUTH_DEVEL)
$is_published = 0;
else if (array_key_exists("IS_PUBLISHED", $_POST))
$is_published = (int)$_POST["IS_PUBLISHED"];
else
$is_published = 0;
if (array_key_exists("TITLE", $_POST))
$title = $_POST["TITLE"];
else
$title = "";
if (array_key_exists("ABSTRACT", $_POST))
$abstract = $_POST["ABSTRACT"];
else
$abstract = "";
if (array_key_exists("CONTENTS", $_POST))
$contents = $_POST["CONTENTS"];
else
$contents = "";
if ($LOGIN_USER != "" && $LOGIN_LEVEL < AUTH_DEVEL)
$create_user = $LOGIN_USER;
else if (array_key_exists("CREATE_USER", $_POST))
$create_user = $_POST["CREATE_USER"];
else
$create_user = "";
if (($is_published == 0 || $LOGIN_LEVEL >= AUTH_DEVEL) &&
$title != "" && $abstract != "" && $contents != "" &&
$create_user != "")
$havedata = 1;
else
$havedata = 0;
}
else
{
$is_published = 0;
$title = "";
$abstract = "";
$contents = "";
if ($LOGIN_USER != "")
$create_user = $LOGIN_USER;
else if (array_key_exists("FROM", $_COOKIE))
$create_user = $_COOKIE["FROM"];
else
$create_user = "";
$havedata = 0;
}
if ($havedata)
{
$title = db_escape($title);
$abstract = db_escape($abstract);
$contents = db_escape($contents);
$create_date = time();
$create_user = db_escape($create_user);
db_query("INSERT INTO article VALUES(NULL,"
."$is_published,'$title','$abstract','$contents',"
."$create_date,'$create_user',$create_date,'$create_user')");
$id = db_insert_id();
if (!$is_published)
notify_users($id);
header("Location: $PHP_SELF?L$id$options");
break;
}
html_header("Submit Article");
html_start_links(1);
html_link("Return to Articles", "$PHP_SELF?L$options");
html_end_links();
if ($REQUEST_METHOD == "POST")
{
print("<p><b>Error:</b> Please fill in the fields marked in "
."<b><font color='red'>bold red</font></b> below and resubmit "
."your article.</p>\n");
$hstart = "<font color='red'>";
$hend = "</font>";
}
else
{
print("<p>Please use this form to post announcements, how-to's, "
."examples, and case studies showing how you use $PROJECT_NAME. "
."We will proofread your article, and if we determine it is "
."appropriate for the site, we will make the article public "
."on the site. <i>Thank you</i> for supporting $PROJECT_NAME!</p>\n");
$hstart = "";
$hend = "";
}
print("<form method='post' action='$PHP_SELF?N$options'>"
."<table width='100%' cellpadding='5' cellspacing='0' border='0'>\n");
if ($LOGIN_LEVEL >= AUTH_DEVEL)
{
print("<tr><th align='right'>Published:</th><td>");
select_is_published($is_published);
print("</td></tr>\n");
}
else
print("<input type='hidden' name='IS_PUBLISHED' value='0'>\n");
$title = htmlspecialchars($title, ENT_QUOTES);
if ($title == "")
print("<tr><th align='right'>${hstart}Title:${hend}</th>");
else
print("<tr><th align='right'>Title:</th>");
print("<td><input type='text' name='TITLE' "
."size='80' value='$title'></td></tr>\n");
$abstract = htmlspecialchars($abstract, ENT_QUOTES);
if ($abstract == "")
print("<tr><th align='right'>${hstart}Abstract:${hend}</th>");
else
print("<tr><th align='right'>Abstract:</th>");
print("<td><input type='text' name='ABSTRACT' "
."size='80' value='$abstract'></td></tr>\n");
$create_user = htmlspecialchars($create_user, ENT_QUOTES);
if ($create_user == "")
print("<tr><th align='right'>${hstart}Author:${hend}</th>");
else
print("<tr><th align='right'>Author:</th>");
if ($LOGIN_USER != "" && $LOGIN_LEVEL < AUTH_DEVEL)
print("<td><input type='hidden' name='CREATE_USER' "
."value='$create_user'>$create_user</td></tr>\n");
else
print("<td><input type='text' name='CREATE_USER' "
."size='40' value='$create_user'></td></tr>\n");
$contents = htmlspecialchars($contents, ENT_QUOTES);
if ($contents == "")
print("<tr><th align='right' valign='top'>${hstart}Contents:${hend}</th>");
else
print("<tr><th align='right' valign='top'>Contents:</th>");
print("<td><textarea name='CONTENTS' "
."cols='72' rows='12' wrap='virtual'>"
."$contents</textarea>\n"
."<p>The contents of the article may contain the following "
."HTML elements: <tt>A</tt>, <tt>B</tt>, <tt>BLOCKQUOTE</tt>, "
."<tt>CODE</tt>, <tt>EM</tt>, <tt>H1</tt>, <tt>H2</tt>, "
."<tt>H3</tt>, <tt>H4</tt>, <tt>H5</tt>, <tt>H6</tt>, <tt>I</tt>, "
."<tt>IMG</tt>, <tt>LI</tt>, <tt>OL</tt>, <tt>P</tt>, <tt>PRE</tt>, "
."<tt>TT</tt>, <tt>U</tt>, <tt>UL</tt></p></td></tr>\n");
print("<tr><th colspan='2'>"
."<input type='submit' value='Submit Article'></th></tr>\n");
print("</table></form>\n");
html_footer();
break;
}
//
// End of "$Id$".
//
?>

@ -1,377 +0,0 @@
<?php
//
// "$Id$"
//
// Comment and moderation interface for PHP pages...
//
//
// Include necessary headers...
//
include_once "phplib/html.php";
include_once "phplib/common.php";
//
// Parse arguments...
//
$op = "";
$path = "";
$refer_id = 0;
$id = 0;
for ($i = 0; $i < $argc; $i ++)
{
switch ($argv[$i][0])
{
case 'L' : // List all comments...
case 'l' : // List unapproved comments...
$op = $argv[$i][0];
$listpath = substr($argv[$i], 1);
break;
case 'r' : // Respond/add comment
$op = "r";
$refer_id = (int)substr($argv[$i], 1);
break;
case 'd' : // Delete comment
case 'D' : // Delete comment (confirmed)
case 'e' : // Edit comment
$op = $argv[$i][0];
$id = (int)substr($argv[$i], 1);
break;
case 'm' : // Moderate comment
$op = "m";
$dir = $argv[$i][1];
$id = (int)substr($argv[$i], 2);
break;
case 'p' : // Set path
$path = urldecode(substr($argv[$i], 1));
break;
}
}
if ($op == "" || ($path == "" && $op != "l" && $op != "L") ||
(($op == 'd' || $op == 'D' || $op == 'l') && $LOGIN_LEVEL < AUTH_DEVEL))
{
header("Location: index.php");
}
else
{
switch ($op)
{
case 'd' : // Delete comment
html_header("Delete Comment #$id");
print("<p>Click the button below to confirm the deletion.</p>\n"
."<form method='POST' action='$PHP_SELF?D$id+p$path'>"
."<center><input type='submit' value='Delete Comment'></center>"
."</form>\n");
html_footer();
break;
case 'D' : // Delete comment (confirmed)
db_query("DELETE FROM comment WHERE id = $id");
header("Location: $PHP_SELF");
break;
case 'e' : // Edit comment
case 'r' : // New comment
if ($LOGIN_USER == "")
{
header("Location: login.php?PAGE=comment.php?$op$id+p" .
urlencode($path));
return;
}
$havedata = 0;
if ($REQUEST_METHOD == "POST")
{
if ($LOGIN_USER != "" && $LOGIN_LEVEL < AUTH_DEVEL)
$create_user = $LOGIN_USER;
else if (array_key_exists("AUTHOR", $_POST))
$create_user = trim($_POST["AUTHOR"]);
else
$create_user = "";
if (array_key_exists("FILE", $_POST))
$file = $_POST["FILE"];
else
$file = "";
if (array_key_exists("STATUS", $_POST))
$status = (int)$_POST["STATUS"];
else
$status = 2;
if (array_key_exists("MESSAGE", $_POST))
$contents = trim($_POST["MESSAGE"]);
else
$contents = "";
if (strpos($contents, "http:") === FALSE &&
strpos($contents, "https:") === FALSE &&
strpos($contents, "ftp:") === FALSE &&
strpos($contents, "mailto:") === FALSE &&
$contents != "" && $create_user != "" && $file != "")
$havedata = 1;
if ($create_user != "" && $id == 0 && !$LOGIN_USER)
setcookie("FROM", $create_user, time() + 90 * 86400, "/");
}
else
{
if ($id)
{
$result = db_query("SELECT * FROM comment WHERE id = $id");
if (db_count($result) > 0)
{
$row = db_next($result);
$create_user = $row['create_user'];
$contents = $row['contents'];
$status = $row['status'];
}
else
{
if ($LOGIN_USER != "")
$create_user = $LOGIN_USER;
else if (array_key_exists("FROM", $_COOKIE))
$create_user = $_COOKIE["FROM"];
else
$create_user = "Anonymous <anonymous@easysw.com>";
$contents = "";
$status = 2;
}
db_free($result);
}
else
{
if ($LOGIN_USER != "")
$create_user = $LOGIN_USER;
else if (array_key_exists("FROM", $_COOKIE))
$create_user = $_COOKIE["FROM"];
else
$create_user = "Anonymous <anonymous@easysw.com>";
$contents = "";
$status = 2;
}
}
if ($havedata)
{
$create_user = db_escape($create_user);
$file = db_escape($file);
$contents = db_escape($contents);
if ($id)
{
// Update existing record.
db_query("UPDATE comment SET create_user='$create_user',url='$file',"
."status=$status,contents='$contents' WHERE id = $id");
}
else
{
// Add new record.
$create_date = time();
db_query("INSERT INTO comment VALUES(NULL,$refer_id,2,'$file',"
."'$contents',$create_date,'$create_user')");
$id = db_insert_id();
}
$location = str_replace("_", "?", $path);
header("Location: $location#_USER_COMMENT_$id");
}
else
{
if ($id)
html_header("Edit Comment");
else
html_header("Add Comment");
if ($REQUEST_METHOD == "POST")
{
print("<p>Your comment posting is missing required information. "
."Please fill in all fields marked in "
."<font color='red'>red</font> and resubmit your comments.</p>\n");
$hstart = "<font color='red'>";
$hend = "</font>";
}
else
{
$hstart = "";
$hend = "";
}
if ($op == "e")
print("<form method='POST' action='$PHP_SELF?e$id+p$path'>\n"
."<center><table border='0'>\n");
else
print("<form method='POST' action='$PHP_SELF?r$refer_id+p$path'>\n"
."<center><table border='0'>\n");
$create_user = htmlspecialchars($create_user);
if ($create_user == "")
print("<tr><th align='right'>${hstart}Author:${hend}</th>"
."<td><input type='text' name='AUTHOR' value='$create_user' "
."size='40'></td></tr>\n");
else
print("<tr><th align='right'>Author:</th>"
."<td><input type='text' name='AUTHOR' value='$create_user' "
."size='40'></td></tr>\n");
$contents = htmlspecialchars($contents);
if ($contents == "")
print("<tr><th align='right' valign='top'>${hstart}Message:${hend}</th>"
."<td><textarea name='MESSAGE' cols='70' rows='8' "
."wrap='virtual'>$contents</textarea>");
else
print("<tr><th align='right' valign='top'>Message:</th>"
."<td><textarea name='MESSAGE' cols='70' rows='8' "
."wrap='virtual'>$contents</textarea>");
print("<p>Comments may contain the following "
."HTML elements: <tt>A</tt>, <tt>B</tt>, <tt>BLOCKQUOTE</tt>, "
."<tt>CODE</tt>, <tt>EM</tt>, <tt>H1</tt>, <tt>H2</tt>, "
."<tt>H3</tt>, <tt>H4</tt>, <tt>H5</tt>, <tt>H6</tt>, <tt>I</tt>, "
."<tt>IMG</tt>, <tt>LI</tt>, <tt>OL</tt>, <tt>P</tt>, <tt>PRE</tt>, "
."<tt>TT</tt>, <tt>U</tt>, <tt>UL</tt></p></td></tr>\n");
if ($LOGIN_LEVEL >= AUTH_DEVEL)
{
print("<tr><th align='right' nowrap>File Path:</th>"
."<td><input type='text' name='FILE' value='$path' "
."size='40'></td></tr>\n");
print("<tr><th align='right'>Score:</th>"
."<td><select name='STATUS'>");
for ($i = 0; $i <= 5; $i ++)
if ($i == $status)
print("<option value='$i' selected>$i</option>");
else
print("<option value='$i'>$i</option>");
print("</select></td></tr>\n");
}
else
{
print("<input type='hidden' name='FILE' value='$path'>\n");
print("<input type='hidden' name='STATUS' value='2'>\n");
}
if ($id)
print("<tr><th></th><td><input type='submit' value='Update Comment'></td></tr>\n");
else
print("<tr><th></th><td><input type='submit' value='Add Comment'></td></tr>\n");
print("</table></center>\n"
."</form>\n");
html_footer();
}
break;
case 'L' : // List all comments...
case 'l' : // List unapproved comments...
html_header("Comments");
if ($LOGIN_LEVEL < AUTH_DEVEL)
{
$result = db_query("SELECT * FROM comment WHERE status = 1 AND "
."url LIKE '${listpath}%' ORDER BY id");
}
else
{
if ($op == 'L')
{
$result = db_query("SELECT * FROM comment WHERE "
."url LIKE '${listpath}%' ORDER BY id");
print("<p><a href='$PHP_SELF?l'>Show Hidden Comments</a></p>\n");
}
else
{
$result = db_query("SELECT * FROM comment WHERE status = 0 AND "
."url LIKE '${listpath}%' ORDER BY id");
print("<p><a href='$PHP_SELF?L'>Show All Comments</a></p>\n");
}
}
if (db_count($result) == 0)
{
if ($LOGIN_LEVEL >= AUTH_DEVEL && $op == 'l')
print("<p>No hidden comments.</p>\n");
else
print("<p>No visible comments.</p>\n");
}
else
{
print("<ul>\n");
while ($row = db_next($result))
{
$create_date = date("M d, Y", $row['create_date']);
$create_user = sanitize_email($row['create_user']);
$contents = sanitize_text($row['contents']);
$location = str_replace("_", "?", $row['url']);
print("<li><a href='$location'>$row[url]</a> "
." by $create_user on $create_date "
."<a href='$PHP_SELF?e$row[id]+p$row[url]'>Edit</a> "
."&middot; <a href='$PHP_SELF?d$row[id]+p$row[url]'>Delete</a>"
."<br><tt>$contents</tt></li>\n");
}
print("</ul>\n");
}
db_free($result);
html_footer();
break;
case 'm' : // Moderate
if (array_key_exists("MODPOINTS", $_COOKIE))
$modpoints = $_COOKIE["MODPOINTS"];
else
$modpoints = 5;
if ($modpoints > 0)
{
$modpoints --;
setcookie("MODPOINTS", $modpoints, time() + 2 * 86400, "/");
$result = db_query("SELECT status FROM comment WHERE id=$id");
$row = db_next($result);
if ($dir == 'd')
{
// Moderate down...
if ($row['status'] > 0)
db_query("UPDATE comment SET status = status - 1 WHERE id=$id");
}
else
{
// Moderate down...
if ($row['status'] < 5)
db_query("UPDATE comment SET status = status + 1 WHERE id=$id");
}
db_free($result);
}
$location = str_replace("_", "?", $path);
header("Location: $location#_USER_COMMENT_$id");
break;
}
}
//
// End of "$Id$".
//
?>

@ -1,3 +0,0 @@
Order deny,allow
Allow from none

@ -1,598 +0,0 @@
#!/usr/bin/php -q
<?php
// Make sure that the module is loaded...
if (!extension_loaded("sqlite"))
{
dl("sqlite.so");
}
// Validate args...
global $_SERVER;
$argc = $_SERVER["argc"];
$argv = $_SERVER["argv"];
if ($argc != 4)
{
$fp = fopen("php://stderr", "w");
fwrite($fp, "Usage: ./make-form.php filename.db tablename \"Table Name\"\n");
exit();
}
// Open the database connection...
$db = sqlite_open($argv[1]);
$table = $argv[2];
$tname = $argv[3];
$result = sqlite_query($db, "PRAGMA table_info('$table')");
//sqlite_seek($result, 0);
//while ($row = sqlite_fetch_array($result))
// print_r($row);
//exit();
print("<?php\n");
print("//\n");
print("// \"\$Id\$\"\n");
print("//\n");
print("// Web form for the $table table...\n");
print("//\n");
print("\n");
print("\n");
print("//\n");
print("// Include necessary headers...\n");
print("//\n");
print("\n");
print("include_once \"phplib/html.php\";\n");
print("include_once \"phplib/common.php\";\n");
print("\n");
print("\n");
print("// Get command-line options...\n");
print("//\n");
print("// Usage: $table.php [operation]\n");
print("//\n");
print("// Operations:\n");
print("//\n");
print("// D# - Delete $tname\n");
print("// L = List all $tnames\n");
print("// L# = List $tname #\n");
print("// M# = Modify $tname #\n");
print("// N = Create new $tname\n");
print("\n");
print("\n");
print("if (\$argc)\n");
print("{\n");
print(" \$op = \$argv[0][0];\n");
print(" \$id = (int)substr(\$argv[0], 1);\n");
print("\n");
print(" if (\$op != 'D' && \$op != 'L' && \$op != 'M' && \$op != 'N')\n");
print(" {\n");
print(" html_header(\"$tname Error\");\n");
print(" print(\"<p>Bad command '\$op'!\\n\");\n");
print(" html_footer();\n");
print(" exit();\n");
print(" }\n");
print("\n");
print(" if ((\$op == 'D' || \$op == 'M') && !\$id)\n");
print(" {\n");
print(" html_header(\"$tname Error\");\n");
print(" print(\"<p>Command '\$op' requires an ID!\\n\");\n");
print(" html_footer();\n");
print(" exit();\n");
print(" }\n");
print("\n");
print(" if ((\$op == 'D' || \$op == 'M') && \$LOGIN_USER == \"\")\n");
print(" {\n");
print(" html_header(\"$tname Error\");\n");
print(" print(\"<p>Command '\$op' requires a login!\\n\");\n");
print(" html_footer();\n");
print(" exit();\n");
print(" }\n");
print("\n");
print(" if (\$op == 'N' && \$id)\n");
print(" {\n");
print(" html_header(\"$tname Error\");\n");
print(" print(\"<p>Command '\$op' may not have an ID!\\n\");\n");
print(" html_footer();\n");
print(" exit();\n");
print(" }\n");
print("}\n");
print("else\n");
print("{\n");
print(" \$op = 'L';\n");
print(" \$id = 0;\n");
print("}\n");
print("\n");
print("switch (\$op)\n");
print("{\n");
print(" case 'D' : // Delete $tname\n");
print(" if (\$REQUEST_METHOD == \"POST\")\n");
print(" {\n");
print(" db_query(\"DELETE FROM $table WHERE id = \$id\");\n");
print("\n");
print(" header(\"Location: \$PHP_SELF?L\");\n");
print(" }\n");
print(" else\n");
print(" {\n");
print(" \$result = db_query(\"SELECT * FROM $table WHERE id = \$id\");\n");
print(" if (db_count(\$result) != 1)\n");
print(" {\n");
print(" print(\"<p><b>Error:</b> $tname #\$id was not found!</p>\\n\");\n");
print(" html_footer();\n");
print(" exit();\n");
print(" }\n");
print("\n");
print(" \$row = db_next(\$result);\n");
print("\n");
print(" html_header(\"Delete $tname #\$id\");\n");
print("\n");
print(" html_start_links(1);\n");
print(" html_link(\"Return to $tname List\", \"\$PHP_SELF?L\");\n");
print(" html_link(\"View $tname #\$id</A>\", \"\$PHP_SELF?L\$id\");\n");
print(" html_link(\"Modify $tname #\$id</A>\", \"\$PHP_SELF?M\$id\");\n");
print(" html_end_links();\n");
print("\n");
print(" print(\"<h1>Delete $tname #\$id</h1>\\n\");\n");
print(" print(\"<form method='post' action='\$PHP_SELF?D\$id'>\"\n");
print(" .\"<p><table width='100%' cellpadding='5' cellspacing='0' border='0'>\\n\");\n");
print("\n");
print(" if (!\$row['is_published'])\n");
print(" print(\"<tr><th align='center' colspan='2'>This $tname is \"\n");
print(" .\"currently hidden from public view.</td></tr>\\n\");\n");
print("\n");
sqlite_seek($result, 0);
while ($row = sqlite_fetch_array($result))
{
switch ($row['name'])
{
case "id" :
case "create_date" :
case "create_user" :
case "modify_date" :
case "modify_user" :
case "is_published" :
break;
default :
$name = ucwords(str_replace('_', ' ', $row['name']));
print(" \$temp = htmlspecialchars(\$row[\"$row[name]\"]);\n");
print(" print(\"<tr><th align='right'>$name:</th>"
."<td class='left'>\$temp</td></tr>\\n\");\n");
print("\n");
break;
}
}
print(" print(\"<tr><th colspan='2'>\"\n");
print(" .\"<input type='submit' value='Confirm Delete $tname'></th></tr>\\n\");\n");
print(" print(\"</table></p></form>\\n\");\n");
print("\n");
print(" html_footer();\n");
print(" }\n");
print(" break;\n");
print("\n");
print(" case 'L' : // List (all) $tname(s)\n");
print(" if (\$id)\n");
print(" {\n");
print(" html_header(\"$tname #\$id\");\n");
print("\n");
print(" \$result = db_query(\"SELECT * FROM $table WHERE id = \$id\");\n");
print(" if (db_count(\$result) != 1)\n");
print(" {\n");
print(" print(\"<p><b>Error:</b> $tname #\$id was not found!</p>\\n\");\n");
print(" html_footer();\n");
print(" exit();\n");
print(" }\n");
print("\n");
print(" \$row = db_next(\$result);\n");
print("\n");
print(" html_start_links(1);\n");
print(" html_link(\"Return to $tname List\", \"\$PHP_SELF?L\");\n");
print(" html_link(\"Modify $tname</A>\", \"\$PHP_SELF?M\$id\");\n");
print(" html_link(\"Delete $tname #\$id</A>\", \"\$PHP_SELF?D\$id\");\n");
print(" html_end_links();\n");
print("\n");
print(" print(\"<h1>$tname #\$id</h1>\\n\");\n");
print(" print(\"<p><table width='100%' cellpadding='5' cellspacing='0' \"\n");
print(" .\"border='0'>\\n\");\n");
print("\n");
print(" if (!\$row['is_published'])\n");
print(" print(\"<tr><th align='center' colspan='2'>This $tname is \"\n");
print(" .\"currently hidden from public view.</td></tr>\\n\");\n");
print("\n");
sqlite_seek($result, 0);
while ($row = sqlite_fetch_array($result))
{
switch ($row['name'])
{
case "id" :
case "create_date" :
case "create_user" :
case "modify_date" :
case "modify_user" :
case "is_published" :
break;
default :
$name = ucwords(str_replace('_', ' ', $row['name']));
if ($row['type'] == "TEXT")
print(" \$temp = format_text(\$row['$row[name]']);\n");
else
print(" \$temp = htmlspecialchars(\$row['$row[name]']);\n");
print(" print(\"<tr><th align='right' valign='top'>$name:</th>"
."<td class='left'>\$temp</td></tr>\\n\");\n");
print("\n");
break;
}
}
print(" print(\"</table></p>\\n\");\n");
print(" db_free(\$result);\n");
print(" }\n");
print(" else\n");
print(" {\n");
print(" html_header(\"$tname List\");\n");
print("\n");
print(" html_start_links(1);\n");
print(" html_link(\"New $tname\", \"\$PHP_SELF?N\");\n");
print(" html_end_links();\n");
print("\n");
print(" \$result = db_query(\"SELECT * FROM $table\");\n");
print(" \$count = db_count(\$result);\n");
print("\n");
print(" print(\"<h1>$tname List</h1>\\n\");\n");
print(" if (\$count == 0)\n");
print(" {\n");
print(" print(\"<p>No ${tname}s found.</p>\\n\");\n");
print("\n");
print(" html_footer();\n");
print(" exit();\n");
print(" }\n");
print("\n");
print(" html_start_table(array(\"ID\"");
sqlite_seek($result, 0);
$list_columns = 0;
while ($row = sqlite_fetch_array($result))
switch ($row['name'])
{
case "id" :
case "create_date" :
case "create_user" :
case "modify_user" :
case "is_published" :
case "abstract" :
case "contents" :
break;
case "modify_date" :
print(",\"Last Modified\"");
$list_columns ++;
break;
default :
$name = ucwords(str_replace('_', ' ', $row['name']));
print(",\"$name\"");
$list_columns ++;
break;
}
print("));\n");
print("\n");
print(" while (\$row = db_next(\$result))\n");
print(" {\n");
print(" html_start_row();\n");
print("\n");
sqlite_seek($result, 0);
while ($row = sqlite_fetch_array($result))
switch ($row['name'])
{
case "id" :
print(" \$id = \$row['id'];\n\n");
print(" print(\"<td align='center'><a href='\$PHP_SELF?L\$id' \"\n");
print(" .\"alt='$tname #\$id'>\"\n");
print(" .\"\$id</a></td>\");\n");
print("\n");
break;
case "modify_date" :
print(" \$temp = date(\"M d, Y\", \$row['modify_date']);\n");
print(" print(\"<td align='center'><a href='\$PHP_SELF?L\$id' \"\n");
print(" .\"alt='$tname #\$id'>\"\n");
print(" .\"\$temp</a></td>\");\n");
print("\n");
break;
case "create_date" :
case "create_user" :
case "modify_user" :
case "is_published" :
case "contents" :
case "abstract" :
break;
default :
print(" \$temp = htmlspecialchars(\$row['$row[name]']);\n");
print(" print(\"<td align='center'><a href='\$PHP_SELF?L\$id' \"\n");
print(" .\"alt='$tname #\$id'>\"\n");
print(" .\"\$temp</a></td>\");\n");
print("\n");
break;
}
print(" html_end_row();\n");
sqlite_seek($result, 0);
while ($row = sqlite_fetch_array($result))
if ($row['name'] == "abstract")
{
print("\n");
print(" html_start_row();\n");
print(" \$temp = htmlspecialchars(\$row['abstract']);\n");
print(" print(\"<td></td><td colspan='$list_columns'>\$temp</td>\");\n");
print(" html_end_row();\n");
}
print(" }\n");
print("\n");
print(" html_end_table();\n");
print(" }\n");
print("\n");
print(" html_footer();\n");
print(" break;\n");
print("\n");
print(" case 'M' : // Modify $tname\n");
print(" if (\$REQUEST_METHOD == \"POST\")\n");
print(" {\n");
print(" \$date = time();\n");
sqlite_seek($result, 0);
while ($row = sqlite_fetch_array($result))
switch ($row['name'])
{
case "id" :
case "create_date" :
case "create_user" :
case "modify_date" :
case "modify_user" :
break;
default :
$form = strtoupper($row['name']);
print(" \$$row[name] = db_escape(\$_POST[\"$form\"]);\n");
break;
}
print("\n");
print(" db_query(\"UPDATE $table SET \"\n");
sqlite_seek($result, 0);
while ($row = sqlite_fetch_array($result))
switch ($row['name'])
{
case "id" :
case "create_date" :
case "create_user" :
case "modify_date" :
case "modify_user" :
break;
default :
if ($row['type'] == "INTEGER")
print(" .\"$row[name] = \$$row[name], \"\n");
else
print(" .\"$row[name] = '\$$row[name]', \"\n");
break;
}
print(" .\"modify_date = \$date, \"\n");
print(" .\"modify_user = '\$LOGIN_USER' \"\n");
print(" .\"WHERE id = \$id\");\n");
print("\n");
print(" header(\"Location: \$PHP_SELF?L\$id\");\n");
print(" }\n");
print(" else\n");
print(" {\n");
print(" html_header(\"Modify $tname #\$id\");\n");
print("\n");
print(" html_start_links(1);\n");
print(" html_link(\"Return to $tname List\", \"\$PHP_SELF?L\");\n");
print(" html_link(\"$tname #\$id\", \"\$PHP_SELF?L\$id\");\n");
print(" html_end_links();\n");
print("\n");
print(" print(\"<h1>Modify $tname #\$id</h1>\\n\");\n");
print(" \$result = db_query(\"SELECT * FROM $table WHERE id = \$id\");\n");
print(" if (db_count(\$result) != 1)\n");
print(" {\n");
print(" print(\"<p><b>Error:</b> $tname #\$id was not found!</p>\\n\");\n");
print(" html_footer();\n");
print(" exit();\n");
print(" }\n");
print("\n");
print(" \$row = db_next(\$result);\n");
print("\n");
print(" print(\"<form method='post' action='\$PHP_SELF?M\$id'>\"\n");
print(" .\"<p><table width='100%' cellpadding='5' cellspacing='0' border='0'>\\n\");\n");
print("\n");
print(" print(\"<tr><th align='right'>Published:</th><td>\");\n");
print(" select_is_published(\$row['is_published']);\n");
print(" print(\"</td></tr>\\n\");\n");
print("\n");
sqlite_seek($result, 0);
while ($row = sqlite_fetch_array($result))
switch ($row['name'])
{
case "id" :
case "create_date" :
case "create_user" :
case "modify_date" :
case "modify_user" :
case "is_published" :
break;
default :
$form = strtoupper($row['name']);
$name = ucwords(str_replace('_', ' ', $row['name']));
print(" \$temp = htmlspecialchars(\$row['$row[name]'], ENT_QUOTES);\n");
print(" print(\"<tr><th align='right'>$name:</th>\"\n");
if ($row['type'] == "TEXT")
{
print(" .\"<td><textarea name='$form' \"\n");
print(" .\"cols='80' rows='10' wrap='virtual'>\"\n");
print(" .\"\$temp</textarea></td></tr>\\n\");\n");
}
else
{
print(" .\"<td><input type='text' name='$form' \"\n");
print(" .\"value='\$temp' size='40'></td></tr>\\n\");\n");
}
print("\n");
break;
}
print(" print(\"<tr><th colspan='2'>\"\n");
print(" .\"<input type='submit' value='Update $tname'></th></tr>\\n\");\n");
print(" print(\"</table></p></form>\\n\");\n");
print("\n");
print(" html_footer();\n");
print(" }\n");
print(" break;\n");
print("\n");
print(" case 'N' : // Post new $tname\n");
print(" if (\$REQUEST_METHOD == \"POST\")\n");
print(" {\n");
print(" \$date = time();\n");
sqlite_seek($result, 0);
while ($row = sqlite_fetch_array($result))
switch ($row['name'])
{
case "id" :
case "create_date" :
case "create_user" :
case "modify_date" :
case "modify_user" :
break;
default :
$form = strtoupper($row['name']);
if ($row['type'] == "INTEGER")
print(" \$$row[name] = db_escape(\$_POST[\"$form\"]);\n");
else
print(" \$$row[name] = db_escape(\$_POST[\"$form\"]);\n");
break;
}
print("\n");
print(" db_query(\"INSERT INTO $table VALUES(NULL,\"\n");
sqlite_seek($result, 0);
while ($row = sqlite_fetch_array($result))
switch ($row['name'])
{
case "id" :
case "create_date" :
case "create_user" :
case "modify_date" :
case "modify_user" :
break;
default :
if ($row['type'] == "INTEGER")
print(" .\"\$$row[name],\"\n");
else
print(" .\"'\$$row[name]',\"\n");
break;
}
print(" .\"\$date,'\$LOGIN_USER',\$date,'\$LOGIN_USER')\");\n");
print("\n");
print(" \$id = db_insert_id();\n");
print("\n");
print(" header(\"Location: \$PHP_SELF?L\$id\");\n");
print(" break;\n");
print(" }\n");
print("\n");
print(" html_header(\"New $tname\");\n");
print("\n");
print(" html_start_links(1);\n");
print(" html_link(\"Return to $tname List\", \"\$PHP_SELF?L\");\n");
print(" html_end_links();\n");
print("\n");
print(" print(\"<h1>New $tname</h1>\\n\");\n");
print(" print(\"<form method='post' action='\$PHP_SELF?N'>\"\n");
print(" .\"<p><table width='100%' cellpadding='5' cellspacing='0' border='0'>\\n\");\n");
print("\n");
print(" if (\$LOGIN_USER != \"\")\n");
print(" {\n");
print(" print(\"<tr><th align='right'>Published:</th><td>\");\n");
print(" select_is_published();\n");
print(" print(\"</td></tr>\\n\");\n");
print(" }\n");
print(" else\n");
print(" print(\"<input type='hidden' name='IS_PUBLISHED' value='0'/>\\n\");\n");
print("\n");
sqlite_seek($result, 0);
while ($row = sqlite_fetch_array($result))
switch ($row['name'])
{
case "id" :
case "create_date" :
case "create_user" :
case "modify_date" :
case "modify_user" :
case "is_published" :
break;
default :
$form = strtoupper($row['name']);
$name = ucwords(str_replace('_', ' ', $row['name']));
print(" print(\"<tr><th align='right'>$name:</th>\"\n");
if ($row['type'] == "TEXT")
{
print(" .\"<td><textarea name='$form' \"\n");
print(" .\"cols='80' rows='10' wrap='virtual'>\"\n");
print(" .\"</textarea></td></tr>\\n\");\n");
}
else
{
print(" .\"<td><input type='text' name='$form' \"\n");
print(" .\"size='40'></td></tr>\\n\");\n");
}
print("\n");
break;
}
print(" print(\"<tr><th colspan='2'>\"\n");
print(" .\"<input type='submit' value='Create $tname'></th></tr>\\n\");\n");
print(" print(\"</table></p></form>\\n\");\n");
print("\n");
print(" html_footer();\n");
print(" break;\n");
print("}\n");
print("\n");
print("\n");
print("//\n");
print("// End of \"\$Id\$\".\n");
print("//\n");
print("?>\n");
?>

@ -1,12 +0,0 @@
#!/bin/sh
if test -f mxml.db; then
rm -f mxml.db.old
mv mxml.db mxml.db.old
fi
sqlite mxml.db <mxml.sql
chmod 775 .
chmod 664 mxml.db
chgrp apache . mxml.db

@ -1,242 +0,0 @@
--
-- "$Id: mxml.sql,v 1.7 2004/05/21 03:59:17 mike Exp $"
--
-- Database schema for the Mini-XML web pages.
--
-- This SQL file is specifically for use with the SQLite database
-- engine, but is probably portable to other databases like MySQL
-- and Postgresql.
--
-- Revision History:
--
-- M. Sweet 05/17/2004 Initial revision.
-- M. Sweet 05/19/2004 Added link, poll, and vote tables.
-- M. Sweet 05/20/2004 Changes for MySQL
--
-- Schema for table 'article'
--
-- This table lists the available articles for each application.
-- Articles correspond roughly to FAQs, HOWTOs, and news announcements,
-- and they can be searched.
--
CREATE TABLE article (
id INTEGER PRIMARY KEY AUTO_INCREMENT,-- Article number
is_published INTEGER, -- 0 = private, 1 = public
title VARCHAR(255), -- Title of article
abstract VARCHAR(255), -- Plain text abstract of article
contents TEXT, -- Contents of article
create_date INTEGER, -- Time/date of creation
create_user VARCHAR(255), -- User that created the article
modify_date INTEGER, -- Time/date of last change
modify_user VARCHAR(255) -- User that made the last change
);
--
-- Schema for table 'carboncopy'
--
-- This table tracks users that want to be notified when a resource is
-- modified. Resources are tracked by filename/URL...
--
-- This is used to notify users whenever a STR or article is updated.
--
CREATE TABLE carboncopy (
id INTEGER PRIMARY KEY AUTO_INCREMENT,-- Carbon copy ID
url VARCHAR(255), -- File or URL
email VARCHAR(255) -- Email address
);
--
-- Schema for table 'comment'
--
-- This table tracks comments that are added to a page on the web site.
-- Comments are associated with a specific URL, so you can make comments
-- on any page on the site...
--
CREATE TABLE comment (
id INTEGER PRIMARY KEY AUTO_INCREMENT,-- Comment ID number
parent_id INTEGER, -- Parent comment ID number (reply-to)
status INTEGER, -- Moderation status, 0 = dead to 5 = great
url VARCHAR(255), -- File/link this comment applies to
contents text, -- Comment message
create_date INTEGER, -- Date the comment was posted
create_user VARCHAR(255) -- Author name/email
);
--
-- Table structure for table 'link'
--
-- This table lists links to external applications, web pages, etc.
-- Basically, we end up providing a hierachical, searchable link list,
-- complete with comments from users...
--
CREATE TABLE link (
id INTEGER PRIMARY KEY AUTO_INCREMENT,-- Link ID number
parent_id INTEGER, -- Parent link ID or 0 for top-level
is_category INTEGER, -- 0 = listing, 1 = category
is_published INTEGER, -- 0 = private, 1 = public
name VARCHAR(255), -- Link name
version VARCHAR(255), -- Current version number string
license VARCHAR(255), -- Current license
author VARCHAR(255), -- Current author
email VARCHAR(255), -- Public email address
homepage_url VARCHAR(255), -- Home page
download_url VARCHAR(255), -- Download page
description TEXT, -- Description of link
rating_total INTEGER, -- Total of all ratings
rating_count INTEGER, -- Number of ratings
homepage_visits INTEGER, -- Number of clicks to the home page
download_visits INTEGER, -- Number of clicks to the download page
create_date INTEGER, -- Creation time/date
create_user VARCHAR(255), -- User that created the link
modify_date INTEGER, -- Last time/date changed
modify_user VARCHAR(255) -- User that made the last change
);
--
-- Table structure for table 'poll'
--
-- This table provides a very simple single question, multiple choice poll
-- interface for the main page. Used successfully for a couple years now
-- on the CUPS and FLTK sites, the main twist is the new poll_type field
-- to control whether it is pick-one or pick-many poll.
--
CREATE TABLE poll (
id INTEGER PRIMARY KEY AUTO_INCREMENT,-- Poll ID number
is_published INTEGER, -- 0 = private, 1 = public
poll_type INTEGER, -- 0 = pick one, 1 = pick many
question VARCHAR(255), -- Question plain text
answer0 VARCHAR(255), -- Answer #1 plain text
count0 INTEGER, -- Number of votes for #1
answer1 VARCHAR(255), -- Answer #2 plain text
count1 INTEGER, -- Number of votes for #2
answer2 VARCHAR(255), -- Answer #3 plain text
count2 INTEGER, -- Number of votes for #3
answer3 VARCHAR(255), -- Answer #4 plain text
count3 INTEGER, -- Number of votes for #4
answer4 VARCHAR(255), -- Answer #5 plain text
count4 INTEGER, -- Number of votes for #5
answer5 VARCHAR(255), -- Answer #6 plain text
count5 INTEGER, -- Number of votes for #6
answer6 VARCHAR(255), -- Answer #7 plain text
count6 INTEGER, -- Number of votes for #7
answer7 VARCHAR(255), -- Answer #8 plain text
count7 INTEGER, -- Number of votes for #8
answer8 VARCHAR(255), -- Answer #9 plain text
count8 INTEGER, -- Number of votes for #9
answer9 VARCHAR(255), -- Answer #10 plain text
count9 INTEGER, -- Number of votes for #10
votes INTEGER, -- Total votes
create_date INTEGER, -- Time/date of creation
create_user VARCHAR(255), -- User that created the poll
modify_date INTEGER, -- Time/date of last change
modify_user VARCHAR(255) -- User that made the last change
);
--
-- Schema for table 'str'
--
-- This table stores software trouble reports.
--
CREATE TABLE str (
id INTEGER PRIMARY KEY AUTO_INCREMENT,-- STR number
master_id INTEGER, -- "Duplicate of" number
is_published INTEGER, -- 0 = private, 1 = public
status INTEGER, -- 1 = closed/resolved,
-- 2 = closed/unresolved,
-- 3 = active, 4 = pending, 5 = new
priority INTEGER, -- 1 = rfe, 2 = low, 3 = moderate,
-- 4 = high, 5 = critical
scope INTEGER, -- 1 = unit, 2 = function, 3 = software
summary text, -- Plain text summary
subsystem VARCHAR(255), -- Subsystem name
str_version VARCHAR(16), -- Software version for STR
fix_version VARCHAR(16), -- Software version for fix
manager_email VARCHAR(255), -- Manager of STR
create_date INTEGER, -- Time/date of creation
create_user VARCHAR(255), -- User that created the STR
modify_date INTEGER, -- Time/date of last change
modify_user VARCHAR(255) -- User that made the last change
);
--
-- Schema for table 'strfile'
--
-- This table tracks the files that are attached to a STR.
--
CREATE TABLE strfile (
id INTEGER PRIMARY KEY AUTO_INCREMENT,-- File ID
str_id INTEGER, -- STR number
is_published INTEGER, -- 0 = private, 1 = public
filename VARCHAR(255), -- Name of file
create_date INTEGER, -- Time/date of creation
create_user VARCHAR(255) -- User that posted the file
);
--
-- Schema for table 'strtext'
--
-- This table tracks the text messages that are attached to a STR.
--
CREATE TABLE strtext (
id INTEGER PRIMARY KEY AUTO_INCREMENT,-- Text ID
str_id INTEGER, -- STR number
is_published INTEGER, -- 0 = private, 1 = public
contents TEXT, -- Text message
create_date INTEGER, -- Time/date of creation
create_user VARCHAR(255) -- User that posted the text
);
--
-- Schema for table 'users'
--
-- This table lists the users that work on Mini-XML. Various pages use
-- this table when doing login/logout stuff and when listing the available
-- users to assign stuff to.
--
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTO_INCREMENT,-- ID
is_published INTEGER, -- 0 = private, 1 = public
name VARCHAR(255), -- Login name
email VARCHAR(255), -- Name/email address
hash CHAR(32), -- MD5 hash of name:password
level INTEGER, -- 0 = normal user, 100 = admin user
create_date INTEGER, -- Time/date of creation
create_user VARCHAR(255), -- User that created the user
modify_date INTEGER, -- Time/date of last change
modify_user VARCHAR(255) -- User that made the last change
);
--
-- Table structure for table 'vote'
--
-- This table is used to track ratings, poll votes, etc. that are made on
-- the links and poll pages.
--
CREATE TABLE vote (
type_id_ip VARCHAR(255) PRIMARY KEY -- type_id_ip
);
--
-- End of "$Id: mxml.sql,v 1.7 2004/05/21 03:59:17 mike Exp $".
--

@ -1,4 +0,0 @@
76f2ae49bf0f5745d5cb5d9507774dc9 2.7 mxml/2.7/mxml-2.7.tar.gz
68977789ae64985dddbd1a1a1652642e 2.6 mxml/2.6/mxml-2.6.tar.gz
f706377fba630b39fa02fd63642b17e5 2.5 mxml/2.5/mxml-2.5.tar.gz
9b116daa370bf647447d6ffe70e73534 1.3 mxml/1.3/mxml-1.3.tar.gz

@ -1,2 +0,0 @@
DirectoryIndex off

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

@ -1,581 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>Mini-XML Programmers Manual, Version 2.7</TITLE>
<META NAME="author" CONTENT="Michael R. Sweet">
<META NAME="copyright" CONTENT="Copyright 2003-2011">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
<LINK REL="Start" HREF="index.html">
<LINK REL="Contents" HREF="index.html">
<LINK REL="Prev" HREF="basics.html">
<LINK REL="Next" HREF="mxmldoc.html">
<STYLE TYPE="text/css"><!--
BODY { font-family: sans-serif }
H1 { font-family: sans-serif }
H2 { font-family: sans-serif }
H3 { font-family: sans-serif }
H4 { font-family: sans-serif }
H5 { font-family: sans-serif }
H6 { font-family: sans-serif }
SUB { font-size: smaller }
SUP { font-size: smaller }
PRE { font-family: monospace }
A { text-decoration: none }
--></STYLE>
</HEAD>
<BODY>
<A HREF="index.html">Contents</A>
<A HREF="basics.html">Previous</A>
<A HREF="mxmldoc.html">Next</A>
<HR NOSHADE>
<H1 align="right"><A name="ADVANCED"><IMG align="right" alt="3" height="100"
hspace="10" src="3.gif" width="100"></A>More Mini-XML Programming
Techniques</H1>
<P>This chapter shows additional ways to use the Mini-XML library in
your programs.</P>
<H2><A name="LOAD_CALLBACKS">Load Callbacks</A></H2>
<P><A href="#LOAD_XML">Chapter 2</A> introduced the <A href="reference.html#mxmlLoadFile">
<TT>mxmlLoadFile()</TT></A> and <A href="reference.html#mxmlLoadString"><TT>
mxmlLoadString()</TT></A> functions. The last argument to these
functions is a callback function which is used to determine the value
type of each data node in an XML document.</P>
<P>Mini-XML defines several standard callbacks for simple XML data
files:</P>
<UL>
<LI><TT>MXML_INTEGER_CALLBACK</TT> - All data nodes contain
whitespace-separated integers.</LI>
<LI><TT>MXML_OPAQUE_CALLBACK</TT> - All data nodes contain opaque
strings (&quot;CDATA&quot;).</LI>
<LI><TT>MXML_REAL_CALLBACK</TT> - All data nodes contain
whitespace-separated floating-point numbers.</LI>
<LI><TT>MXML_TEXT_CALLBACK</TT> - All data nodes contain
whitespace-separated strings.</LI>
</UL>
<P>You can provide your own callback functions for more complex XML
documents. Your callback function will receive a pointer to the current
element node and must return the value type of the immediate children
for that element node: <TT>MXML_INTEGER</TT>, <TT>MXML_OPAQUE</TT>, <TT>
MXML_REAL</TT>, or <TT>MXML_TEXT</TT>. The function is called<I> after</I>
the element and its attributes have been read, so you can look at the
element name, attributes, and attribute values to determine the proper
value type to return.</P>
<!-- NEED 2in -->
<P>The following callback function looks for an attribute named &quot;type&quot;
or the element name to determine the value type for its child nodes:</P>
<PRE>
mxml_type_t
type_cb(mxml_node_t *node)
{
const char *type;
/*
* You can lookup attributes and/or use the
* element name, hierarchy, etc...
*/
type = mxmlElementGetAttr(node, &quot;type&quot;);
if (type == NULL)
type = mxmlGetElement(node);
if (!strcmp(type, &quot;integer&quot;))
return (MXML_INTEGER);
else if (!strcmp(type, &quot;opaque&quot;))
return (MXML_OPAQUE);
else if (!strcmp(type, &quot;real&quot;))
return (MXML_REAL);
else
return (MXML_TEXT);
}
</PRE>
<P>To use this callback function, simply use the name when you call any
of the load functions:</P>
<PRE>
FILE *fp;
mxml_node_t *tree;
fp = fopen(&quot;filename.xml&quot;, &quot;r&quot;);
tree = mxmlLoadFile(NULL, fp, <B>type_cb</B>);
fclose(fp);
</PRE>
<H2><A name="SAVE_CALLBACKS">Save Callbacks</A></H2>
<P><A href="#LOAD_XML">Chapter 2</A> also introduced the <A href="reference.html#mxmlSaveFile">
<TT>mxmlSaveFile()</TT></A>, <A href="reference.html#mxmlSaveString"><TT>
mxmlSaveString()</TT></A>, and <A href="reference.html#mxmlSaveAllocString">
<TT>mxmlSaveAllocString()</TT></A> functions. The last argument to these
functions is a callback function which is used to automatically insert
whitespace in an XML document.</P>
<P>Your callback function will be called up to four times for each
element node with a pointer to the node and a &quot;where&quot; value of <TT>
MXML_WS_BEFORE_OPEN</TT>, <TT>MXML_WS_AFTER_OPEN</TT>, <TT>
MXML_WS_BEFORE_CLOSE</TT>, or <TT>MXML_WS_AFTER_CLOSE</TT>. The callback
function should return <TT>NULL</TT> if no whitespace should be added
and the string to insert (spaces, tabs, carriage returns, and newlines)
otherwise.</P>
<P>The following whitespace callback can be used to add whitespace to
XHTML output to make it more readable in a standard text editor:</P>
<PRE>
const char *
whitespace_cb(mxml_node_t *node,
int where)
{
const char *name;
/*
* We can conditionally break to a new line
* before or after any element. These are
* just common HTML elements...
*/
name = mxmlGetElement(node);
if (!strcmp(name, &quot;html&quot;) ||
!strcmp(name, &quot;head&quot;) ||
!strcmp(name, &quot;body&quot;) ||
!strcmp(name, &quot;pre&quot;) ||
!strcmp(name, &quot;p&quot;) ||
!strcmp(name, &quot;h1&quot;) ||
!strcmp(name, &quot;h2&quot;) ||
!strcmp(name, &quot;h3&quot;) ||
!strcmp(name, &quot;h4&quot;) ||
!strcmp(name, &quot;h5&quot;) ||
!strcmp(name, &quot;h6&quot;))
{
/*
* Newlines before open and after
* close...
*/
if (where == MXML_WS_BEFORE_OPEN ||
where == MXML_WS_AFTER_CLOSE)
return (&quot;\n&quot;);
}
else if (!strcmp(name, &quot;dl&quot;) ||
!strcmp(name, &quot;ol&quot;) ||
!strcmp(name, &quot;ul&quot;))
{
/*
* Put a newline before and after list
* elements...
*/
return (&quot;\n&quot;);
}
else if (!strcmp(name, &quot;dd&quot;) ||
!strcmp(name, &quot;dt&quot;) ||
!strcmp(name, &quot;li&quot;))
{
/*
* Put a tab before &lt;li&gt;'s, * &lt;dd&gt;'s,
* and &lt;dt&gt;'s, and a newline after them...
*/
if (where == MXML_WS_BEFORE_OPEN)
return (&quot;\t&quot;);
else if (where == MXML_WS_AFTER_CLOSE)
return (&quot;\n&quot;);
}
/*
* Return NULL for no added whitespace...
*/
return (NULL);
}
</PRE>
<P>To use this callback function, simply use the name when you call any
of the save functions:</P>
<PRE>
FILE *fp;
mxml_node_t *tree;
fp = fopen(&quot;filename.xml&quot;, &quot;w&quot;);
mxmlSaveFile(tree, fp, <B>whitespace_cb</B>);
fclose(fp);
</PRE>
<!-- NEED 10 -->
<H2><A NAME="4_3">Custom Data Types</A></H2>
<P>Mini-XML supports custom data types via global load and save
callbacks. Only a single set of callbacks can be active at any time,
however your callbacks can store additional information in order to
support multiple custom data types as needed. The <TT>MXML_CUSTOM</TT>
node type identifies custom data nodes.</P>
<P>The load callback receives a pointer to the current data node and a
string of opaque character data from the XML source with character
entities converted to the corresponding UTF-8 characters. For example,
if we wanted to support a custom date/time type whose value is encoded
as &quot;yyyy-mm-ddThh:mm:ssZ&quot; (ISO format), the load callback would look
like the following:</P>
<PRE>
typedef struct
{
unsigned year, /* Year */
month, /* Month */
day, /* Day */
hour, /* Hour */
minute, /* Minute */
second; /* Second */
time_t unix; /* UNIX time */
} iso_date_time_t;
int
load_custom(mxml_node_t *node,
const char *data)
{
iso_date_time_t *dt;
struct tm tmdata;
/*
* Allocate data structure...
*/
dt = calloc(1, sizeof(iso_date_time_t));
/*
* Try reading 6 unsigned integers from the
* data string...
*/
if (sscanf(data, &quot;%u-%u-%uT%u:%u:%uZ&quot;,
&amp;(dt-&gt;year), &amp;(dt-&gt;month),
&amp;(dt-&gt;day), &amp;(dt-&gt;hour),
&amp;(dt-&gt;minute),
&amp;(dt-&gt;second)) != 6)
{
/*
* Unable to read numbers, free the data
* structure and return an error...
*/
free(dt);
return (-1);
}
/*
* Range check values...
*/
if (dt-&gt;month &lt;1 || dt-&gt;month &gt; 12 ||
dt-&gt;day &lt;1 || dt-&gt;day &gt; 31 ||
dt-&gt;hour &lt;0 || dt-&gt;hour &gt; 23 ||
dt-&gt;minute &lt;0 || dt-&gt;minute &gt; 59 ||
dt-&gt;second &lt;0 || dt-&gt;second &gt; 59)
{
/*
* Date information is out of range...
*/
free(dt);
return (-1);
}
/*
* Convert ISO time to UNIX time in
* seconds...
*/
tmdata.tm_year = dt-&gt;year - 1900;
tmdata.tm_mon = dt-&gt;month - 1;
tmdata.tm_day = dt-&gt;day;
tmdata.tm_hour = dt-&gt;hour;
tmdata.tm_min = dt-&gt;minute;
tmdata.tm_sec = dt-&gt;second;
dt-&gt;unix = gmtime(&amp;tmdata);
/*
* Assign custom node data and destroy
* function pointers...
*/
mxmlSetCustom(node, data, destroy);
/*
* Return with no errors...
*/
return (0);
}
</PRE>
<P>The function itself can return 0 on success or -1 if it is unable to
decode the custom data or the data contains an error. Custom data nodes
contain a <TT>void</TT> pointer to the allocated custom data for the
node and a pointer to a destructor function which will free the custom
data when the node is deleted.</P>
<!-- NEED 15 -->
<P>The save callback receives the node pointer and returns an allocated
string containing the custom data value. The following save callback
could be used for our ISO date/time type:</P>
<PRE>
char *
save_custom(mxml_node_t *node)
{
char data[255];
iso_date_time_t *dt;
dt = (iso_date_time_t *)mxmlGetCustom(node);
snprintf(data, sizeof(data),
&quot;%04u-%02u-%02uT%02u:%02u:%02uZ&quot;,
dt-&gt;year, dt-&gt;month, dt-&gt;day,
dt-&gt;hour, dt-&gt;minute, dt-&gt;second);
return (strdup(data));
}
</PRE>
<P>You register the callback functions using the <A href="reference.html#mxmlSetCustomHandlers">
<TT>mxmlSetCustomHandlers()</TT></A> function:</P>
<PRE>
mxmlSetCustomHandlers(<B>load_custom</B>,
<B>save_custom</B>);
</PRE>
<!-- NEED 20 -->
<H2><A NAME="4_4">Changing Node Values</A></H2>
<P>All of the examples so far have concentrated on creating and loading
new XML data nodes. Many applications, however, need to manipulate or
change the nodes during their operation, so Mini-XML provides functions
to change node values safely and without leaking memory.</P>
<P>Existing nodes can be changed using the <A href="reference.html#mxmlSetElement">
<TT>mxmlSetElement()</TT></A>, <A href="reference.html#mxmlSetInteger"><TT>
mxmlSetInteger()</TT></A>, <A href="reference.html#mxmlSetOpaque"><TT>
mxmlSetOpaque()</TT></A>, <A href="reference.html#mxmlSetReal"><TT>
mxmlSetReal()</TT></A>, <A href="reference.html#mxmlSetText"><TT>
mxmlSetText()</TT></A>, and <A href="reference.html#mxmlSetTextf"><TT>
mxmlSetTextf()</TT></A> functions. For example, use the following
function call to change a text node to contain the text &quot;new&quot; with
leading whitespace:</P>
<PRE>
mxml_node_t *node;
mxmlSetText(node, 1, &quot;new&quot;);
</PRE>
<H2><A NAME="4_5">Formatted Text</A></H2>
<P>The <A href="reference.html#mxmlNewTextf"><TT>mxmlNewTextf()</TT></A>
and <A href="reference.html#mxmlSetTextf"><TT>mxmlSetTextf()</TT></A>
functions create and change text nodes, respectively, using <TT>printf</TT>
-style format strings and arguments. For example, use the following
function call to create a new text node containing a constructed
filename:</P>
<PRE>
mxml_node_t *node;
node = mxmlNewTextf(node, 1, &quot;%s/%s&quot;,
path, filename);
</PRE>
<H2><A NAME="4_6">Indexing</A></H2>
<P>Mini-XML provides functions for managing indices of nodes. The
current implementation provides the same functionality as <A href="reference.html#mxmlFindElement">
<TT>mxmlFindElement()</TT></A>. The advantage of using an index is that
searching and enumeration of elements is significantly faster. The only
disadvantage is that each index is a static snapshot of the XML
document, so indices are not well suited to XML data that is updated
more often than it is searched. The overhead of creating an index is
approximately equal to walking the XML document tree. Nodes in the
index are sorted by element name and attribute value.</P>
<P>Indices are stored in <A href="reference.html#mxml_index_t"><TT>
mxml_index_t</TT></A> structures. The <A href="reference.html#mxmlIndexNew">
<TT>mxmlIndexNew()</TT></A> function creates a new index:</P>
<PRE>
mxml_node_t *tree;
mxml_index_t *ind;
ind = mxmlIndexNew(tree, &quot;element&quot;,
&quot;attribute&quot;);
</PRE>
<P>The first argument is the XML node tree to index. Normally this will
be a pointer to the <TT>?xml</TT> element.</P>
<P>The second argument contains the element to index; passing <TT>NULL</TT>
indexes all element nodes alphabetically.</P>
<P>The third argument contains the attribute to index; passing <TT>NULL</TT>
causes only the element name to be indexed.</P>
<P>Once the index is created, the <A href="reference.html#mxmlIndexEnum">
<TT>mxmlIndexEnum()</TT></A>, <A href="reference.html#mxmlIndexFind"><TT>
mxmlIndexFind()</TT></A>, and <A href="reference.html#mxmlIndexReset"><TT>
mxmlIndexReset()</TT></A> functions are used to access the nodes in the
index. The <A href="reference.html#mxmlIndexReset"><TT>mxmlIndexReset()</TT>
</A> function resets the &quot;current&quot; node pointer in the index, allowing
you to do new searches and enumerations on the same index. Typically
you will call this function prior to your calls to <A href="reference.html#mxmlIndexEnum">
<TT>mxmlIndexEnum()</TT></A> and <A href="reference.html#mxmlIndexFind"><TT>
mxmlIndexFind()</TT></A>.</P>
<P>The <A href="reference.html#mxmlIndexEnum"><TT>mxmlIndexEnum()</TT></A>
function enumerates each of the nodes in the index and can be used in a
loop as follows:</P>
<PRE>
mxml_node_t *node;
mxmlIndexReset(ind);
while ((node = mxmlIndexEnum(ind)) != NULL)
{
// do something with node
}
</PRE>
<P>The <A href="reference.html#mxmlIndexFind"><TT>mxmlIndexFind()</TT></A>
function locates the next occurrence of the named element and attribute
value in the index. It can be used to find all matching elements in an
index, as follows:</P>
<PRE>
mxml_node_t *node;
mxmlIndexReset(ind);
while ((node = mxmlIndexFind(ind, &quot;element&quot;,
&quot;attr-value&quot;))
!= NULL)
{
// do something with node
}
</PRE>
<P>The second and third arguments represent the element name and
attribute value, respectively. A <TT>NULL</TT> pointer is used to
return all elements or attributes in the index. Passing <TT>NULL</TT>
for both the element name and attribute value is equivalent to calling <TT>
mxmlIndexEnum</TT>.</P>
<P>When you are done using the index, delete it using the <A href="#mxmlIndexDelete()">
<TT>mxmlIndexDelete()</TT></A> function:</P>
<PRE>
mxmlIndexDelete(ind);
</PRE>
<H2><A NAME="4_7">SAX (Stream) Loading of Documents</A></H2>
<P>Mini-XML supports an implementation of the Simple API for XML (SAX)
which allows you to load and process an XML document as a stream of
nodes. Aside from allowing you to process XML documents of any size,
the Mini-XML implementation also allows you to retain portions of the
document in memory for later processing.</P>
<P>The <A href="#mxmlSAXLoad"><TT>mxmlSAXLoadFd</TT></A>, <A href="reference.html#mxmlSAXLoadFile">
<TT>mxmlSAXLoadFile</TT></A>, and <A href="reference.html#mxmlSAXLoadString">
<TT>mxmlSAXLoadString</TT></A> functions provide the SAX loading APIs.
Each function works like the corresponding <TT>mxmlLoad</TT> function
but uses a callback to process each node as it is read.</P>
<P>The callback function receives the node, an event code, and a user
data pointer you supply:</P>
<PRE>
void
sax_cb(mxml_node_t *node,
mxml_sax_event_t event,
void *data)
{
... do something ...
}
</PRE>
<P>The event will be one of the following:</P>
<UL>
<LI><TT>MXML_SAX_CDATA</TT> - CDATA was just read</LI>
<LI><TT>MXML_SAX_COMMENT</TT> - A comment was just read</LI>
<LI><TT>MXML_SAX_DATA</TT> - Data (custom, integer, opaque, real, or
text) was just read</LI>
<LI><TT>MXML_SAX_DIRECTIVE</TT> - A processing directive was just read</LI>
<LI><TT>MXML_SAX_ELEMENT_CLOSE</TT> - A close element was just read (<TT>
&lt;/element&gt;</TT>)</LI>
<LI><TT>MXML_SAX_ELEMENT_OPEN</TT> - An open element was just read (<TT>
&lt;element&gt;</TT>)</LI>
</UL>
<P>Elements are<EM> released</EM> after the close element is processed.
All other nodes are released after they are processed. The SAX callback
can<EM> retain</EM> the node using the <A href="reference.html#mxmlRetain">
<TT>mxmlRetain</TT></A> function. For example, the following SAX
callback will retain all nodes, effectively simulating a normal
in-memory load:</P>
<PRE>
void
sax_cb(mxml_node_t *node,
mxml_sax_event_t event,
void *data)
{
if (event != MXML_SAX_ELEMENT_CLOSE)
mxmlRetain(node);
}
</PRE>
<P>More typically the SAX callback will only retain a small portion of
the document that is needed for post-processing. For example, the
following SAX callback will retain the title and headings in an XHTML
file. It also retains the (parent) elements like <TT>&lt;html&gt;</TT>, <TT>
&lt;head&gt;</TT>, and <TT>&lt;body&gt;</TT>, and processing directives like <TT>
&lt;?xml ... ?&gt;</TT> and <TT>&lt;!DOCTYPE ... &gt;</TT>:</P>
<!-- NEED 10 -->
<PRE>
void
sax_cb(mxml_node_t *node,
mxml_sax_event_t event,
void *data)
{
if (event == MXML_SAX_ELEMENT_OPEN)
{
/*
* Retain headings and titles...
*/
char *name = mxmlGetElement(node);
if (!strcmp(name, &quot;html&quot;) ||
!strcmp(name, &quot;head&quot;) ||
!strcmp(name, &quot;title&quot;) ||
!strcmp(name, &quot;body&quot;) ||
!strcmp(name, &quot;h1&quot;) ||
!strcmp(name, &quot;h2&quot;) ||
!strcmp(name, &quot;h3&quot;) ||
!strcmp(name, &quot;h4&quot;) ||
!strcmp(name, &quot;h5&quot;) ||
!strcmp(name, &quot;h6&quot;))
mxmlRetain(node);
}
else if (event == MXML_SAX_DIRECTIVE)
mxmlRetain(node);
else if (event == MXML_SAX_DATA)
{
if (mxmlGetRefCount(mxmlGetParent(node)) &gt; 1)
{
/*
* If the parent was retained, then retain
* this data node as well.
*/
mxmlRetain(node);
}
}
}
</PRE>
<P>The resulting skeleton document tree can then be searched just like
one loaded using the <TT>mxmlLoad</TT> functions. For example, a filter
that reads an XHTML document from stdin and then shows the title and
headings in the document would look like:</P>
<PRE>
mxml_node_t *doc, *title, *body, *heading;
doc = mxmlSAXLoadFd(NULL, 0,
MXML_TEXT_CALLBACK,
<B>sax_cb</B>, NULL);
title = mxmlFindElement(doc, doc, &quot;title&quot;,
NULL, NULL,
MXML_DESCEND);
if (title)
print_children(title);
body = mxmlFindElement(doc, doc, &quot;body&quot;,
NULL, NULL,
MXML_DESCEND);
if (body)
{
for (heading = mxmlGetFirstChild(body);
heading;
heading = mxmlGetNextSibling(heading))
print_children(heading);
}
</PRE>
<HR NOSHADE>
<A HREF="index.html">Contents</A>
<A HREF="basics.html">Previous</A>
<A HREF="mxmldoc.html">Next</A>
</BODY>
</HTML>

@ -1,520 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>Mini-XML Programmers Manual, Version 2.7</TITLE>
<META NAME="author" CONTENT="Michael R. Sweet">
<META NAME="copyright" CONTENT="Copyright 2003-2011">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
<LINK REL="Start" HREF="index.html">
<LINK REL="Contents" HREF="index.html">
<LINK REL="Prev" HREF="install.html">
<LINK REL="Next" HREF="advanced.html">
<STYLE TYPE="text/css"><!--
BODY { font-family: sans-serif }
H1 { font-family: sans-serif }
H2 { font-family: sans-serif }
H3 { font-family: sans-serif }
H4 { font-family: sans-serif }
H5 { font-family: sans-serif }
H6 { font-family: sans-serif }
SUB { font-size: smaller }
SUP { font-size: smaller }
PRE { font-family: monospace }
A { text-decoration: none }
--></STYLE>
</HEAD>
<BODY>
<A HREF="index.html">Contents</A>
<A HREF="install.html">Previous</A>
<A HREF="advanced.html">Next</A>
<HR NOSHADE>
<H1 align="right"><A name="BASICS"><IMG align="right" alt="2" height="100"
hspace="10" src="2.gif" width="100"></A>Getting Started with Mini-XML</H1>
<P>This chapter describes how to write programs that use Mini-XML to
access data in an XML file. Mini-XML provides the following
functionality:</P>
<UL>
<LI>Functions for creating and managing XML documents in memory.</LI>
<LI>Reading of UTF-8 and UTF-16 encoded XML files and strings.</LI>
<LI>Writing of UTF-8 encoded XML files and strings.</LI>
<LI>Support for arbitrary element names, attributes, and attribute
values with no preset limits, just available memory.</LI>
<LI>Support for integer, real, opaque (&quot;CDATA&quot;), and text data types in
&quot;leaf&quot; nodes.</LI>
<LI>&quot;Find&quot;, &quot;index&quot;, and &quot;walk&quot; functions for easily accessing data in
an XML document.</LI>
</UL>
<P>Mini-XML doesn't do validation or other types of processing on the
data based upon schema files or other sources of definition
information, nor does it support character entities other than those
required by the XML specification.</P>
<H2><A NAME="3_1">The Basics</A></H2>
<P>Mini-XML provides a single header file which you include:</P>
<PRE>
#include &lt;mxml.h&gt;
</PRE>
<P>The Mini-XML library is included with your program using the <KBD>
-lmxml</KBD> option:</P>
<PRE>
<KBD>gcc -o myprogram myprogram.c -lmxml ENTER</KBD>
</PRE>
<P>If you have the <TT>pkg-config(1)</TT> software installed, you can
use it to determine the proper compiler and linker options for your
installation:</P>
<PRE>
<KBD>pkg-config --cflags mxml ENTER</KBD>
<KBD>pkg-config --libs mxml ENTER</KBD>
</PRE>
<H2><A NAME="3_2">Nodes</A></H2>
<P>Every piece of information in an XML file is stored in memory in
&quot;nodes&quot;. Nodes are defined by the <A href="reference.html#mxml_node_t"><TT>
mxml_node_t</TT></A> structure. Each node has a typed value, optional
user data, a parent node, sibling nodes (previous and next), and
potentially child nodes.</P>
<P>For example, if you have an XML file like the following:</P>
<PRE>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;data&gt;
&lt;node&gt;val1&lt;/node&gt;
&lt;node&gt;val2&lt;/node&gt;
&lt;node&gt;val3&lt;/node&gt;
&lt;group&gt;
&lt;node&gt;val4&lt;/node&gt;
&lt;node&gt;val5&lt;/node&gt;
&lt;node&gt;val6&lt;/node&gt;
&lt;/group&gt;
&lt;node&gt;val7&lt;/node&gt;
&lt;node&gt;val8&lt;/node&gt;
&lt;/data&gt;
</PRE>
<P>the node tree for the file would look like the following in memory:</P>
<PRE>
?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?
|
data
|
node - node - node - group - node - node
| | | | | |
val1 val2 val3 | val7 val8
|
node - node - node
| | |
val4 val5 val6
</PRE>
<P>where &quot;-&quot; is a pointer to the sibling node and &quot;|&quot; is a pointer to
the first child or parent node.</P>
<P>The <A href="reference.html#mxmlGetType"><TT>mxmlGetType</TT></A>
function gets the type of a node, one of <TT>MXML_CUSTOM</TT>, <TT>
MXML_ELEMENT</TT>, <TT>MXML_INTEGER</TT>, <TT>MXML_OPAQUE</TT>, <TT>
MXML_REAL</TT>, or <TT>MXML_TEXT</TT>. The parent and sibling nodes are
accessed using the <A href="reference.html#mxmlGetParent"><TT>
mxmlGetParent</TT></A>, <A href="#mxmlGetNext"><TT>mxmlGetNext</TT></A>,
and <A href="#mxmlGetPrevious"><TT>mxmlGetPrevious</TT></A> functions.
The <A href="reference.html#mxmlGetUserData"><TT>mxmlGetUserData</TT></A>
function gets any user data associated with the node.</P>
<H3><A NAME="3_2_1">CDATA Nodes</A></H3>
<P>CDATA (<TT>MXML_ELEMENT</TT>) nodes are created using the <A href="reference.html#mxmlNewCDATA">
<TT>mxmlNewCDATA</TT></A> function. The <A href="reference.html#mxmlGetCDATA">
<TT>mxmlGetCDATA</TT></A> function retrieves the CDATA string pointer
for a node.</P>
<BLOCKQUOTE><B>Note:</B>
<P>CDATA nodes are currently stored in memory as special elements. This
will be changed in a future major release of Mini-XML.</P>
</BLOCKQUOTE>
<H3><A NAME="3_2_2">Custom Nodes</A></H3>
<P>Custom (<TT>MXML_CUSTOM</TT>) nodes are created using the <A href="reference.html#mxmlNewCustom">
<TT>mxmlNewCustom</TT></A> function or using a custom load callback
specified using the <A href="reference.html#mxmlSetCustomHandlers"><TT>
mxmlSetCustomHandlers</TT></A> function. The <A href="reference.html#mxmlGetCustom">
<TT>mxmlGetCustom</TT></A> function retrieves the custom value pointer
for a node.</P>
<H3><A NAME="3_2_3">Comment Nodes</A></H3>
<P>Comment (<TT>MXML_ELEMENT</TT>) nodes are created using the <A href="reference.html#mxmlNewElement">
<TT>mxmlNewElement</TT></A> function. The <A href="reference.html#mxmlGetElement">
<TT>mxmlGetElement</TT></A> function retrieves the comment string
pointer for a node, including the surrounding &quot;!--&quot; and &quot;--&quot;
characters.</P>
<BLOCKQUOTE><B>Note:</B>
<P>Comment nodes are currently stored in memory as special elements.
This will be changed in a future major release of Mini-XML.</P>
</BLOCKQUOTE>
<H3><A NAME="3_2_4">Element Nodes</A></H3>
<P>Element (<TT>MXML_ELEMENT</TT>) nodes are created using the <A href="reference.html#mxmlNewElement">
<TT>mxmlNewElement</TT></A> function. The <A href="reference.html#mxmlGetElement">
<TT>mxmlGetElement</TT></A> function retrieves the element name, the <A href="reference.html#mxmlElementGetAttr">
<TT>mxmlElementGetAttr</TT></A> function retrieves the value string for
a named attribute associated with the element, and the <A href="reference.html#mxmlGetFirstChild">
<TT>mxmlGetFirstChild</TT></A> and <A href="reference.html#mxmlGetLastChild">
<TT>mxmlGetLastChild</TT></A> functions retrieve the first and last
child nodes for the element, respectively.</P>
<H3><A NAME="3_2_5">Integer Nodes</A></H3>
<P>Integer (<TT>MXML_INTEGER</TT>) nodes are created using the <A href="reference.html#mxmlNewInteger">
<TT>mxmlNewInteger</TT></A> function. The <A href="reference.html#mxmlGetInteger">
<TT>mxmlGetInteger</TT></A> function retrieves the integer value for a
node.</P>
<H3><A NAME="3_2_6">Opaque Nodes</A></H3>
<P>Opaque (<TT>MXML_OPAQUE</TT>) nodes are created using the <A href="reference.html#mxmlNewOpaque">
<TT>mxmlNewOpaque</TT></A> function. The <A href="reference.html#mxmlGetOpaque">
<TT>mxmlGetOpaque</TT></A> function retrieves the opaque string pointer
for a node. Opaque nodes are like string nodes but preserve all
whitespace between nodes.</P>
<H3><A NAME="3_2_7">Text Nodes</A></H3>
<P>Text (<TT>MXML_TEXT</TT>) nodes are created using the <A href="reference.html#mxmlNewText">
<TT>mxmlNewText</TT></A> and <A href="reference.html#mxmlNewTextf"><TT>
mxmlNewTextf</TT></A> functions. Each text node consists of a text
string and (leading) whitespace value - the <A href="reference.html#mxmlGetText">
<TT>mxmlGetText</TT></A> function retrieves the text string pointer and
whitespace value for a node.</P>
<!-- NEED 12 -->
<H3><A NAME="3_2_8">Processing Instruction Nodes</A></H3>
<P>Processing instruction (<TT>MXML_ELEMENT</TT>) nodes are created
using the <A href="reference.html#mxmlNewElement"><TT>mxmlNewElement</TT>
</A> function. The <A href="reference.html#mxmlGetElement"><TT>
mxmlGetElement</TT></A> function retrieves the processing instruction
string for a node, including the surrounding &quot;?&quot; characters.</P>
<BLOCKQUOTE><B>Note:</B>
<P>Processing instruction nodes are currently stored in memory as
special elements. This will be changed in a future major release of
Mini-XML.</P>
</BLOCKQUOTE>
<H3><A NAME="3_2_9">Real Number Nodes</A></H3>
<P>Real number (<TT>MXML_REAL</TT>) nodes are created using the <A href="reference.html#mxmlNewReal">
<TT>mxmlNewReal</TT></A> function. The <A href="reference.html#mxmlGetReal">
<TT>mxmlGetReal</TT></A> function retrieves the CDATA string pointer for
a node.</P>
<!-- NEED 15 -->
<H3><A NAME="3_2_10">XML Declaration Nodes</A></H3>
<P>XML declaration (<TT>MXML_ELEMENT</TT>) nodes are created using the <A
href="reference.html#mxmlNewXML"><TT>mxmlNewXML</TT></A> function. The <A
href="reference.html#mxmlGetElement"><TT>mxmlGetElement</TT></A>
function retrieves the XML declaration string for a node, including the
surrounding &quot;?&quot; characters.</P>
<BLOCKQUOTE><B>Note:</B>
<P>XML declaration nodes are currently stored in memory as special
elements. This will be changed in a future major release of Mini-XML.</P>
</BLOCKQUOTE>
<!-- NEW PAGE -->
<H2><A NAME="3_3">Creating XML Documents</A></H2>
<P>You can create and update XML documents in memory using the various <TT>
mxmlNew</TT> functions. The following code will create the XML document
described in the previous section:</P>
<PRE>
mxml_node_t *xml; /* &lt;?xml ... ?&gt; */
mxml_node_t *data; /* &lt;data&gt; */
mxml_node_t *node; /* &lt;node&gt; */
mxml_node_t *group; /* &lt;group&gt; */
xml = mxmlNewXML(&quot;1.0&quot;);
data = mxmlNewElement(xml, &quot;data&quot;);
node = mxmlNewElement(data, &quot;node&quot;);
mxmlNewText(node, 0, &quot;val1&quot;);
node = mxmlNewElement(data, &quot;node&quot;);
mxmlNewText(node, 0, &quot;val2&quot;);
node = mxmlNewElement(data, &quot;node&quot;);
mxmlNewText(node, 0, &quot;val3&quot;);
group = mxmlNewElement(data, &quot;group&quot;);
node = mxmlNewElement(group, &quot;node&quot;);
mxmlNewText(node, 0, &quot;val4&quot;);
node = mxmlNewElement(group, &quot;node&quot;);
mxmlNewText(node, 0, &quot;val5&quot;);
node = mxmlNewElement(group, &quot;node&quot;);
mxmlNewText(node, 0, &quot;val6&quot;);
node = mxmlNewElement(data, &quot;node&quot;);
mxmlNewText(node, 0, &quot;val7&quot;);
node = mxmlNewElement(data, &quot;node&quot;);
mxmlNewText(node, 0, &quot;val8&quot;);
</PRE>
<!-- NEED 6 -->
<P>We start by creating the declaration node common to all XML files
using the <A href="reference.html#mxmlNewXML"><TT>mxmlNewXML</TT></A>
function:</P>
<PRE>
xml = mxmlNewXML(&quot;1.0&quot;);
</PRE>
<P>We then create the <TT>&lt;data&gt;</TT> node used for this document using
the <A href="reference.html#mxmlNewElement"><TT>mxmlNewElement</TT></A>
function. The first argument specifies the parent node (<TT>xml</TT>)
while the second specifies the element name (<TT>data</TT>):</P>
<PRE>
data = mxmlNewElement(xml, &quot;data&quot;);
</PRE>
<P>Each <TT>&lt;node&gt;...&lt;/node&gt;</TT> in the file is created using the <TT>
mxmlNewElement</TT> and <A href="reference.html#mxmlNewText"><TT>
mxmlNewText</TT></A> functions. The first argument of <TT>mxmlNewText</TT>
specifies the parent node (<TT>node</TT>). The second argument
specifies whether whitespace appears before the text - 0 or false in
this case. The last argument specifies the actual text to add:</P>
<PRE>
node = mxmlNewElement(data, &quot;node&quot;);
mxmlNewText(node, 0, &quot;val1&quot;);
</PRE>
<P>The resulting in-memory XML document can then be saved or processed
just like one loaded from disk or a string.</P>
<!-- NEED 15 -->
<H2><A NAME="3_4">Loading XML</A></H2>
<P>You load an XML file using the <A href="reference.html#mxmlLoadFile"><TT>
mxmlLoadFile</TT></A> function:</P>
<PRE>
FILE *fp;
mxml_node_t *tree;
fp = fopen(&quot;filename.xml&quot;, &quot;r&quot;);
tree = mxmlLoadFile(NULL, fp,
MXML_TEXT_CALLBACK);
fclose(fp);
</PRE>
<P>The first argument specifies an existing XML parent node, if any.
Normally you will pass <TT>NULL</TT> for this argument unless you are
combining multiple XML sources. The XML file must contain a complete
XML document including the <TT>?xml</TT> element if the parent node is <TT>
NULL</TT>.</P>
<P>The second argument specifies the stdio file to read from, as opened
by <TT>fopen()</TT> or <TT>popen()</TT>. You can also use <TT>stdin</TT>
if you are implementing an XML filter program.</P>
<P>The third argument specifies a callback function which returns the
value type of the immediate children for a new element node: <TT>
MXML_CUSTOM</TT>, <TT>MXML_IGNORE</TT>, <TT>MXML_INTEGER</TT>, <TT>
MXML_OPAQUE</TT>, <TT>MXML_REAL</TT>, or <TT>MXML_TEXT</TT>. Load
callbacks are described in detail in <A href="advanced.html#LOAD_CALLBACKS">
Chapter 3</A>. The example code uses the <TT>MXML_TEXT_CALLBACK</TT>
constant which specifies that all data nodes in the document contain
whitespace-separated text values. Other standard callbacks include <TT>
MXML_IGNORE_CALLBACK</TT>, <TT>MXML_INTEGER_CALLBACK</TT>, <TT>
MXML_OPAQUE_CALLBACK</TT>, and <TT>MXML_REAL_CALLBACK</TT>.</P>
<P>The <A href="reference.html#mxmlLoadString"><TT>mxmlLoadString</TT></A>
function loads XML node trees from a string:</P>
<!-- NEED 10 -->
<PRE>
char buffer[8192];
mxml_node_t *tree;
...
tree = mxmlLoadString(NULL, buffer,
MXML_TEXT_CALLBACK);
</PRE>
<P>The first and third arguments are the same as used for <TT>
mxmlLoadFile()</TT>. The second argument specifies the string or
character buffer to load and must be a complete XML document including
the <TT>?xml</TT> element if the parent node is <TT>NULL</TT>.</P>
<!-- NEED 15 -->
<H2><A NAME="3_5">Saving XML</A></H2>
<P>You save an XML file using the <A href="reference.html#mxmlSaveFile"><TT>
mxmlSaveFile</TT></A> function:</P>
<PRE>
FILE *fp;
mxml_node_t *tree;
fp = fopen(&quot;filename.xml&quot;, &quot;w&quot;);
mxmlSaveFile(tree, fp, MXML_NO_CALLBACK);
fclose(fp);
</PRE>
<P>The first argument is the XML node tree to save. It should normally
be a pointer to the top-level <TT>?xml</TT> node in your XML document.</P>
<P>The second argument is the stdio file to write to, as opened by <TT>
fopen()</TT> or <TT>popen()</TT>. You can also use <TT>stdout</TT> if
you are implementing an XML filter program.</P>
<P>The third argument is the whitespace callback to use when saving the
file. Whitespace callbacks are covered in detail in <A href="SAVE_CALLBACKS">
Chapter 3</A>. The previous example code uses the <TT>MXML_NO_CALLBACK</TT>
constant to specify that no special whitespace handling is required.</P>
<P>The <A href="reference.html#mxmlSaveAllocString"><TT>
mxmlSaveAllocString</TT></A>, and <A href="reference.html#mxmlSaveString">
<TT>mxmlSaveString</TT></A> functions save XML node trees to strings:</P>
<PRE>
char buffer[8192];
char *ptr;
mxml_node_t *tree;
...
mxmlSaveString(tree, buffer, sizeof(buffer),
MXML_NO_CALLBACK);
...
ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK);
</PRE>
<P>The first and last arguments are the same as used for <TT>
mxmlSaveFile()</TT>. The <TT>mxmlSaveString</TT> function takes pointer
and size arguments for saving the XML document to a fixed-size buffer,
while <TT>mxmlSaveAllocString()</TT> returns a string buffer that was
allocated using <TT>malloc()</TT>.</P>
<!-- NEED 15 -->
<H3><A NAME="3_5_1">Controlling Line Wrapping</A></H3>
<P>When saving XML documents, Mini-XML normally wraps output lines at
column 75 so that the text is readable in terminal windows. The <A href="reference.html#mxmlSetWrapMargin">
<TT>mxmlSetWrapMargin</TT></A> function overrides the default wrap
margin:</P>
<PRE>
/* Set the margin to 132 columns */
mxmlSetWrapMargin(132);
/* Disable wrapping */
mxmlSetWrapMargin(0);
</PRE>
<H2><A NAME="3_6">Memory Management</A></H2>
<P>Once you are done with the XML data, use the <A href="reference.html#mxmlDelete">
<TT>mxmlDelete</TT></A> function to recursively free the memory that is
used for a particular node or the entire tree:</P>
<PRE>
mxmlDelete(tree);
</PRE>
<P>You can also use reference counting to manage memory usage. The <A href="reference.html#mxmlRetain">
<TT>mxmlRetain</TT></A> and <A href="reference.html#mxmlRelease"><TT>
mxmlRelease</TT></A> functions increment and decrement a node's use
count, respectively. When the use count goes to 0, <TT>mxmlRelease</TT>
will automatically call <TT>mxmlDelete</TT> to actually free the memory
used by the node tree. New nodes automatically start with a use count
of 1.</P>
<!-- NEW PAGE-->
<H2><A NAME="3_7">Finding and Iterating Nodes</A></H2>
<P>The <A href="reference.html#mxmlWalkPrev"><TT>mxmlWalkPrev</TT></A>
and <A href="reference.html#mxmlWalkNext"><TT>mxmlWalkNext</TT></A>
functions can be used to iterate through the XML node tree:</P>
<PRE>
mxml_node_t *node;
node = mxmlWalkPrev(current, tree,
MXML_DESCEND);
node = mxmlWalkNext(current, tree,
MXML_DESCEND);
</PRE>
<P>In addition, you can find a named element/node using the <A href="reference.html#mxmlFindElement">
<TT>mxmlFindElement</TT></A> function:</P>
<PRE>
mxml_node_t *node;
node = mxmlFindElement(tree, tree, &quot;name&quot;,
&quot;attr&quot;, &quot;value&quot;,
MXML_DESCEND);
</PRE>
<P>The <TT>name</TT>, <TT>attr</TT>, and <TT>value</TT> arguments can be
passed as <TT>NULL</TT> to act as wildcards, e.g.:</P>
<!-- NEED 4 -->
<PRE>
/* Find the first &quot;a&quot; element */
node = mxmlFindElement(tree, tree, &quot;a&quot;,
NULL, NULL,
MXML_DESCEND);
</PRE>
<!-- NEED 5 -->
<PRE>
/* Find the first &quot;a&quot; element with &quot;href&quot;
attribute */
node = mxmlFindElement(tree, tree, &quot;a&quot;,
&quot;href&quot;, NULL,
MXML_DESCEND);
</PRE>
<!-- NEED 6 -->
<PRE>
/* Find the first &quot;a&quot; element with &quot;href&quot;
to a URL */
node = mxmlFindElement(tree, tree, &quot;a&quot;,
&quot;href&quot;,
&quot;http://www.easysw.com/&quot;,
MXML_DESCEND);
</PRE>
<!-- NEED 5 -->
<PRE>
/* Find the first element with a &quot;src&quot;
attribute */
node = mxmlFindElement(tree, tree, NULL,
&quot;src&quot;, NULL,
MXML_DESCEND);
</PRE>
<!-- NEED 5 -->
<PRE>
/* Find the first element with a &quot;src&quot;
= &quot;foo.jpg&quot; */
node = mxmlFindElement(tree, tree, NULL,
&quot;src&quot;, &quot;foo.jpg&quot;,
MXML_DESCEND);
</PRE>
<P>You can also iterate with the same function:</P>
<PRE>
mxml_node_t *node;
for (node = mxmlFindElement(tree, tree,
&quot;name&quot;,
NULL, NULL,
MXML_DESCEND);
node != NULL;
node = mxmlFindElement(node, tree,
&quot;name&quot;,
NULL, NULL,
MXML_DESCEND))
{
... do something ...
}
</PRE>
<!-- NEED 10 -->
<P>The <TT>MXML_DESCEND</TT> argument can actually be one of three
constants:</P>
<UL>
<LI><TT>MXML_NO_DESCEND</TT> means to not to look at any child nodes in
the element hierarchy, just look at siblings at the same level or
parent nodes until the top node or top-of-tree is reached.
<P>The previous node from &quot;group&quot; would be the &quot;node&quot; element to the
left, while the next node from &quot;group&quot; would be the &quot;node&quot; element to
the right.
<BR>
<BR></P>
</LI>
<LI><TT>MXML_DESCEND_FIRST</TT> means that it is OK to descend to the
first child of a node, but not to descend further when searching.
You'll normally use this when iterating through direct children of a
parent node, e.g. all of the &quot;node&quot; and &quot;group&quot; elements under the
&quot;?xml&quot; parent node in the example above.
<P>This mode is only applicable to the search function; the walk
functions treat this as <TT>MXML_DESCEND</TT> since every call is a
first time.
<BR>
<BR></P>
</LI>
<LI><TT>MXML_DESCEND</TT> means to keep descending until you hit the
bottom of the tree. The previous node from &quot;group&quot; would be the &quot;val3&quot;
node and the next node would be the first node element under &quot;group&quot;.
<P>If you were to walk from the root node &quot;?xml&quot; to the end of the tree
with <TT>mxmlWalkNext()</TT>, the order would be:</P>
<P><TT>?xml data node val1 node val2 node val3 group node val4 node val5
node val6 node val7 node val8</TT></P>
<P>If you started at &quot;val8&quot; and walked using <TT>mxmlWalkPrev()</TT>,
the order would be reversed, ending at &quot;?xml&quot;.</P>
</LI>
</UL>
<H2><A NAME="3_8">Finding Specific Nodes</A></H2>
<P>You can find specific nodes in the tree using the <A href="#mxmlFindValue">
<TT>mxmlFindPath</TT></A>, for example:</P>
<PRE>
mxml_node_t *value;
value = mxmlFindPath(tree, &quot;path/to/*/foo/bar&quot;);
</PRE>
<P>The second argument is a &quot;path&quot; to the parent node. Each component of
the path is separated by a slash (/) and represents a named element in
the document tree or a wildcard (*) path representing 0 or more
intervening nodes.</P>
<HR NOSHADE>
<A HREF="index.html">Contents</A>
<A HREF="install.html">Previous</A>
<A HREF="advanced.html">Next</A>
</BODY>
</HTML>

@ -1,210 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>Mini-XML Programmers Manual, Version 2.7</TITLE>
<META NAME="author" CONTENT="Michael R. Sweet">
<META NAME="copyright" CONTENT="Copyright 2003-2011">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
<LINK REL="Start" HREF="index.html">
<LINK REL="Contents" HREF="index.html">
<STYLE TYPE="text/css"><!--
BODY { font-family: sans-serif }
H1 { font-family: sans-serif }
H2 { font-family: sans-serif }
H3 { font-family: sans-serif }
H4 { font-family: sans-serif }
H5 { font-family: sans-serif }
H6 { font-family: sans-serif }
SUB { font-size: smaller }
SUP { font-size: smaller }
PRE { font-family: monospace }
A { text-decoration: none }
--></STYLE>
</HEAD>
<BODY>
<H1 ALIGN="CENTER"><A NAME="CONTENTS">Table of Contents</A></H1>
<BR>
<BR><B><A HREF="intro.html#INTRO">Introduction</A></B>
<UL>
<LI><A HREF="intro.html#1_1">Organization of This Document</A></LI>
<LI><A HREF="intro.html#1_2">Notation Conventions</A></LI>
<LI><A HREF="intro.html#1_3">Abbreviations</A></LI>
<LI><A HREF="intro.html#1_4">Other References</A></LI>
<LI><A HREF="intro.html#1_5">Legal Stuff</A></LI>
</UL>
<B><A HREF="install.html#INSTALL">Building, Installing, and Packaging
Mini-XML</A></B>
<UL>
<LI><A HREF="install.html#2_1">Compiling Mini-XML</A>
<UL>
<LI><A HREF="install.html#2_1_1">Compiling with Visual C++</A></LI>
<LI><A HREF="install.html#2_1_2">Compiling with Command-Line Tools</A></LI>
</UL>
</LI>
<LI><A HREF="install.html#2_2">Installing Mini-XML</A></LI>
<LI><A HREF="install.html#2_3">Creating Mini-XML Packages</A></LI>
</UL>
<B><A HREF="basics.html#BASICS">Getting Started with Mini-XML</A></B>
<UL>
<LI><A HREF="basics.html#3_1">The Basics</A></LI>
<LI><A HREF="basics.html#3_2">Nodes</A>
<UL>
<LI><A HREF="basics.html#3_2_1">CDATA Nodes</A></LI>
<LI><A HREF="basics.html#3_2_2">Custom Nodes</A></LI>
<LI><A HREF="basics.html#3_2_3">Comment Nodes</A></LI>
<LI><A HREF="basics.html#3_2_4">Element Nodes</A></LI>
<LI><A HREF="basics.html#3_2_5">Integer Nodes</A></LI>
<LI><A HREF="basics.html#3_2_6">Opaque Nodes</A></LI>
<LI><A HREF="basics.html#3_2_7">Text Nodes</A></LI>
<LI><A HREF="basics.html#3_2_8">Processing Instruction Nodes</A></LI>
<LI><A HREF="basics.html#3_2_9">Real Number Nodes</A></LI>
<LI><A HREF="basics.html#3_2_10">XML Declaration Nodes</A></LI>
</UL>
</LI>
<LI><A HREF="basics.html#3_3">Creating XML Documents</A></LI>
<LI><A HREF="basics.html#3_4">Loading XML</A></LI>
<LI><A HREF="basics.html#3_5">Saving XML</A>
<UL>
<LI><A HREF="basics.html#3_5_1">Controlling Line Wrapping</A></LI>
</UL>
</LI>
<LI><A HREF="basics.html#3_6">Memory Management</A></LI>
<LI><A HREF="basics.html#3_7">Finding and Iterating Nodes</A></LI>
<LI><A HREF="basics.html#3_8">Finding Specific Nodes</A></LI>
</UL>
<B><A HREF="advanced.html#ADVANCED">More Mini-XML Programming Techniques</A>
</B>
<UL>
<LI><A HREF="advanced.html#LOAD_CALLBACKS">Load Callbacks</A></LI>
<LI><A HREF="advanced.html#SAVE_CALLBACKS">Save Callbacks</A></LI>
<LI><A HREF="advanced.html#4_3">Custom Data Types</A></LI>
<LI><A HREF="advanced.html#4_4">Changing Node Values</A></LI>
<LI><A HREF="advanced.html#4_5">Formatted Text</A></LI>
<LI><A HREF="advanced.html#4_6">Indexing</A></LI>
<LI><A HREF="advanced.html#4_7">SAX (Stream) Loading of Documents</A></LI>
</UL>
<B><A HREF="mxmldoc.html#MXMLDOC">Using the mxmldoc Utility</A></B>
<UL>
<LI><A HREF="mxmldoc.html#5_1">The Basics</A>
<UL>
<LI><A HREF="mxmldoc.html#5_1_1">Creating Man Pages</A></LI>
<LI><A HREF="mxmldoc.html#5_1_2">Creating Xcode Documentation Sets</A></LI>
</UL>
</LI>
<LI><A HREF="mxmldoc.html#5_2">Commenting Your Code</A></LI>
<LI><A HREF="mxmldoc.html#5_3">Titles, Sections, and Introductions</A></LI>
</UL>
<B><A HREF="license.html#LICENSE">Mini-XML License</A></B>
<BR>
<BR><B><A HREF="relnotes.html#RELNOTES">Release Notes</A></B>
<UL></UL>
<B><A HREF="reference.html#REFERENCE">Library Reference</A></B>
<UL>
<LI><A HREF="reference.html#8_1">Contents</A></LI>
<LI><A HREF="reference.html#FUNCTIONS">Functions</A>
<UL>
<LI><A HREF="reference.html#mxmlAdd">mxmlAdd</A></LI>
<LI><A HREF="reference.html#mxmlDelete">mxmlDelete</A></LI>
<LI><A HREF="reference.html#8_2_3">mxmlElementDeleteAttr</A></LI>
<LI><A HREF="reference.html#mxmlElementGetAttr">mxmlElementGetAttr</A></LI>
<LI><A HREF="reference.html#mxmlElementSetAttr">mxmlElementSetAttr</A></LI>
<LI><A HREF="reference.html#8_2_6">mxmlElementSetAttrf</A></LI>
<LI><A HREF="reference.html#mxmlEntityAddCallback">mxmlEntityAddCallback</A>
</LI>
<LI><A HREF="reference.html#mxmlEntityGetName">mxmlEntityGetName</A></LI>
<LI><A HREF="reference.html#mxmlEntityGetValue">mxmlEntityGetValue</A></LI>
<LI><A HREF="reference.html#mxmlEntityRemoveCallback">
mxmlEntityRemoveCallback</A></LI>
<LI><A HREF="reference.html#mxmlFindElement">mxmlFindElement</A></LI>
<LI><A HREF="reference.html#8_2_12">mxmlFindPath</A></LI>
<LI><A HREF="reference.html#8_2_13">mxmlGetCDATA</A></LI>
<LI><A HREF="reference.html#8_2_14">mxmlGetCustom</A></LI>
<LI><A HREF="reference.html#8_2_15">mxmlGetElement</A></LI>
<LI><A HREF="reference.html#8_2_16">mxmlGetFirstChild</A></LI>
<LI><A HREF="reference.html#8_2_17">mxmlGetInteger</A></LI>
<LI><A HREF="reference.html#8_2_18">mxmlGetLastChild</A></LI>
<LI><A HREF="reference.html#mxmlGetNextSibling">mxmlGetNextSibling</A></LI>
<LI><A HREF="reference.html#8_2_20">mxmlGetOpaque</A></LI>
<LI><A HREF="reference.html#8_2_21">mxmlGetParent</A></LI>
<LI><A HREF="reference.html#8_2_22">mxmlGetPrevSibling</A></LI>
<LI><A HREF="reference.html#8_2_23">mxmlGetReal</A></LI>
<LI><A HREF="reference.html#8_2_24">mxmlGetRefCount</A></LI>
<LI><A HREF="reference.html#8_2_25">mxmlGetText</A></LI>
<LI><A HREF="reference.html#8_2_26">mxmlGetType</A></LI>
<LI><A HREF="reference.html#8_2_27">mxmlGetUserData</A></LI>
<LI><A HREF="reference.html#mxmlIndexDelete">mxmlIndexDelete</A></LI>
<LI><A HREF="reference.html#mxmlIndexEnum">mxmlIndexEnum</A></LI>
<LI><A HREF="reference.html#mxmlIndexFind">mxmlIndexFind</A></LI>
<LI><A HREF="reference.html#8_2_31">mxmlIndexGetCount</A></LI>
<LI><A HREF="reference.html#mxmlIndexNew">mxmlIndexNew</A></LI>
<LI><A HREF="reference.html#mxmlIndexReset">mxmlIndexReset</A></LI>
<LI><A HREF="reference.html#mxmlLoadFd">mxmlLoadFd</A></LI>
<LI><A HREF="reference.html#mxmlLoadFile">mxmlLoadFile</A></LI>
<LI><A HREF="reference.html#mxmlLoadString">mxmlLoadString</A></LI>
<LI><A HREF="reference.html#8_2_37">mxmlNewCDATA</A></LI>
<LI><A HREF="reference.html#8_2_38">mxmlNewCustom</A></LI>
<LI><A HREF="reference.html#mxmlNewElement">mxmlNewElement</A></LI>
<LI><A HREF="reference.html#mxmlNewInteger">mxmlNewInteger</A></LI>
<LI><A HREF="reference.html#mxmlNewOpaque">mxmlNewOpaque</A></LI>
<LI><A HREF="reference.html#mxmlNewReal">mxmlNewReal</A></LI>
<LI><A HREF="reference.html#mxmlNewText">mxmlNewText</A></LI>
<LI><A HREF="reference.html#mxmlNewTextf">mxmlNewTextf</A></LI>
<LI><A HREF="reference.html#8_2_45">mxmlNewXML</A></LI>
<LI><A HREF="reference.html#8_2_46">mxmlRelease</A></LI>
<LI><A HREF="reference.html#mxmlRemove">mxmlRemove</A></LI>
<LI><A HREF="reference.html#8_2_48">mxmlRetain</A></LI>
<LI><A HREF="reference.html#8_2_49">mxmlSAXLoadFd</A></LI>
<LI><A HREF="reference.html#8_2_50">mxmlSAXLoadFile</A></LI>
<LI><A HREF="reference.html#8_2_51">mxmlSAXLoadString</A></LI>
<LI><A HREF="reference.html#mxmlSaveAllocString">mxmlSaveAllocString</A></LI>
<LI><A HREF="reference.html#mxmlSaveFd">mxmlSaveFd</A></LI>
<LI><A HREF="reference.html#mxmlSaveFile">mxmlSaveFile</A></LI>
<LI><A HREF="reference.html#mxmlSaveString">mxmlSaveString</A></LI>
<LI><A HREF="reference.html#8_2_56">mxmlSetCDATA</A></LI>
<LI><A HREF="reference.html#8_2_57">mxmlSetCustom</A></LI>
<LI><A HREF="reference.html#mxmlSetCustomHandlers">mxmlSetCustomHandlers</A>
</LI>
<LI><A HREF="reference.html#mxmlSetElement">mxmlSetElement</A></LI>
<LI><A HREF="reference.html#mxmlSetErrorCallback">mxmlSetErrorCallback</A>
</LI>
<LI><A HREF="reference.html#mxmlSetInteger">mxmlSetInteger</A></LI>
<LI><A HREF="reference.html#mxmlSetOpaque">mxmlSetOpaque</A></LI>
<LI><A HREF="reference.html#mxmlSetReal">mxmlSetReal</A></LI>
<LI><A HREF="reference.html#mxmlSetText">mxmlSetText</A></LI>
<LI><A HREF="reference.html#mxmlSetTextf">mxmlSetTextf</A></LI>
<LI><A HREF="reference.html#8_2_66">mxmlSetUserData</A></LI>
<LI><A HREF="reference.html#8_2_67">mxmlSetWrapMargin</A></LI>
<LI><A HREF="reference.html#mxmlWalkNext">mxmlWalkNext</A></LI>
<LI><A HREF="reference.html#mxmlWalkPrev">mxmlWalkPrev</A></LI>
</UL>
</LI>
<LI><A HREF="reference.html#TYPES">Data Types</A>
<UL>
<LI><A HREF="reference.html#mxml_custom_destroy_cb_t">
mxml_custom_destroy_cb_t</A></LI>
<LI><A HREF="reference.html#mxml_custom_load_cb_t">mxml_custom_load_cb_t</A>
</LI>
<LI><A HREF="reference.html#mxml_custom_save_cb_t">mxml_custom_save_cb_t</A>
</LI>
<LI><A HREF="reference.html#mxml_entity_cb_t">mxml_entity_cb_t</A></LI>
<LI><A HREF="reference.html#mxml_error_cb_t">mxml_error_cb_t</A></LI>
<LI><A HREF="reference.html#mxml_index_t">mxml_index_t</A></LI>
<LI><A HREF="reference.html#mxml_load_cb_t">mxml_load_cb_t</A></LI>
<LI><A HREF="reference.html#mxml_node_t">mxml_node_t</A></LI>
<LI><A HREF="reference.html#mxml_save_cb_t">mxml_save_cb_t</A></LI>
<LI><A HREF="reference.html#mxml_sax_cb_t">mxml_sax_cb_t</A></LI>
<LI><A HREF="reference.html#mxml_sax_event_t">mxml_sax_event_t</A></LI>
<LI><A HREF="reference.html#mxml_type_t">mxml_type_t</A></LI>
</UL>
</LI>
<LI><A HREF="reference.html#ENUMERATIONS">Constants</A>
<UL>
<LI><A HREF="reference.html#mxml_sax_event_e">mxml_sax_event_e</A></LI>
<LI><A HREF="reference.html#mxml_type_e">mxml_type_e</A></LI>
</UL>
</LI>
</UL>
<B><A HREF="schema.html#SCHEMA">XML Schema</A></B>
<UL></UL>
</BODY>
</HTML>

@ -1,115 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>Mini-XML Programmers Manual, Version 2.7</TITLE>
<META NAME="author" CONTENT="Michael R. Sweet">
<META NAME="copyright" CONTENT="Copyright 2003-2011">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
<LINK REL="Start" HREF="index.html">
<LINK REL="Contents" HREF="index.html">
<LINK REL="Prev" HREF="intro.html">
<LINK REL="Next" HREF="basics.html">
<STYLE TYPE="text/css"><!--
BODY { font-family: sans-serif }
H1 { font-family: sans-serif }
H2 { font-family: sans-serif }
H3 { font-family: sans-serif }
H4 { font-family: sans-serif }
H5 { font-family: sans-serif }
H6 { font-family: sans-serif }
SUB { font-size: smaller }
SUP { font-size: smaller }
PRE { font-family: monospace }
A { text-decoration: none }
--></STYLE>
</HEAD>
<BODY>
<A HREF="index.html">Contents</A>
<A HREF="intro.html">Previous</A>
<A HREF="basics.html">Next</A>
<HR NOSHADE>
<H1 align="right"><A name="INSTALL"><IMG align="right" alt="1" height="100"
hspace="10" src="1.gif" width="100"></A>Building, Installing, and
Packaging Mini-XML</H1>
<P>This chapter describes how to build, install, and package Mini-XML on
your system from the source archive. You will need an ANSI/ISO-C
compatible compiler to build Mini-XML - GCC works, as do most vendors'
C compilers. If you are building Mini-XML on Windows, we recommend
using the Visual C++ environment with the supplied solution file. For
other operating systems, you'll need a POSIX-compatible shell and <TT>
make</TT> program in addition to the C compiler.</P>
<H2><A NAME="2_1">Compiling Mini-XML</A></H2>
<P>Mini-XML comes with both an autoconf-based configure script and a
Visual C++ solution that can be used to compile the library and
associated tools.</P>
<H3><A NAME="2_1_1">Compiling with Visual C++</A></H3>
<P>Open the<VAR> mxml.sln</VAR> solution in the<VAR> vcnet</VAR> folder.
Choose the desired build configuration, &quot;Debug&quot; (the default) or
&quot;Release&quot;, and then choose<VAR> Build Solution</VAR> from the<VAR>
Build</VAR> menu.</P>
<H3><A NAME="2_1_2">Compiling with Command-Line Tools</A></H3>
<P>Type the following command to configure the Mini-XML source code for
your system:</P>
<PRE>
<KBD>./configure ENTER</KBD>
</PRE>
<P>The default install prefix is<VAR> /usr/local</VAR>, which can be
overridden using the <KBD>--prefix</KBD> option:</P>
<PRE>
<KBD>./configure --prefix=/foo ENTER</KBD>
</PRE>
<P>Other configure options can be found using the <KBD>--help</KBD>
option:</P>
<PRE>
<KBD>./configure --help ENTER</KBD>
</PRE>
<P>Once you have configured the software, use the <TT>make(1)</TT>
program to do the build and run the test program to verify that things
are working, as follows:</P>
<PRE>
<KBD>make ENTER</KBD>
</PRE>
<H2><A NAME="2_2">Installing Mini-XML</A></H2>
<P>If you are using Visual C++, copy the<VAR> mxml.lib</VAR> and and<VAR>
mxml.h</VAR> files to the Visual C++<VAR> lib</VAR> and<VAR> include<VAR>
directories, respectively.</VAR></VAR></P>
<P>Otherwise, use the <TT>make</TT> command with the <KBD>install</KBD>
target to install Mini-XML in the configured directories:</P>
<PRE>
<KBD>make install ENTER</KBD>
</PRE>
<H2><A NAME="2_3">Creating Mini-XML Packages</A></H2>
<P>Mini-XML includes two files that can be used to create binary
packages. The first file is<VAR> mxml.spec</VAR> which is used by the <TT>
rpmbuild(8)</TT> software to create Red Hat Package Manager (&quot;RPM&quot;)
packages which are commonly used on Linux. Since <TT>rpmbuild</TT>
wants to compile the software on its own, you can provide it with the
Mini-XML tar file to build the package:</P>
<PRE>
<KBD>rpmbuild -ta mxml-<I>version</I>.tar.gz ENTER</KBD>
</PRE>
<P>The second file is<VAR> mxml.list</VAR> which is used by the <TT>
epm(1)</TT> program to create software packages in a variety of formats.
The <TT>epm</TT> program is available from the following URL:</P>
<PRE>
<A href="http://www.epmhome.org/">http://www.epmhome.org/</A>
</PRE>
<P>Use the <TT>make</TT> command with the <KBD>epm</KBD> target to
create portable and native packages for your system:</P>
<PRE>
<KBD>make epm ENTER</KBD>
</PRE>
<P>The packages are stored in a subdirectory named<VAR> dist</VAR> for
your convenience. The portable packages utilize scripts and tar files
to install the software on the target system. After extracting the
package archive, use the<VAR> mxml.install</VAR> script to install the
software.</P>
<P>The native packages will be in the local OS's native format: RPM for
Red Hat Linux, DPKG for Debian Linux, PKG for Solaris, and so forth.
Use the corresponding commands to install the native packages.</P>
<HR NOSHADE>
<A HREF="index.html">Contents</A>
<A HREF="intro.html">Previous</A>
<A HREF="basics.html">Next</A>
</BODY>
</HTML>

@ -1,175 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>Mini-XML Programmers Manual, Version 2.7</TITLE>
<META NAME="author" CONTENT="Michael R. Sweet">
<META NAME="copyright" CONTENT="Copyright 2003-2011">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
<LINK REL="Start" HREF="index.html">
<LINK REL="Contents" HREF="index.html">
<LINK REL="Next" HREF="install.html">
<STYLE TYPE="text/css"><!--
BODY { font-family: sans-serif }
H1 { font-family: sans-serif }
H2 { font-family: sans-serif }
H3 { font-family: sans-serif }
H4 { font-family: sans-serif }
H5 { font-family: sans-serif }
H6 { font-family: sans-serif }
SUB { font-size: smaller }
SUP { font-size: smaller }
PRE { font-family: monospace }
A { text-decoration: none }
--></STYLE>
</HEAD>
<BODY>
<A HREF="index.html">Contents</A>
<A HREF="install.html">Next</A>
<HR NOSHADE>
<H1 align="right"><A name="INTRO"><IMG align="right" alt="0" height="100"
hspace="10" src="0.gif" width="100"></A>Introduction</H1>
<P>This programmers manual describes Mini-XML version 2.7, a small XML
parsing library that you can use to read and write XML data files in
your C and C++ applications.</P>
<P>Mini-XML was initially developed for the <A href="http://gutenprint.sf.net/">
Gutenprint</A> project to replace the rather large and unwieldy <TT>
libxml2</TT> library with something substantially smaller and
easier-to-use. It all began one morning in June of 2003 when Robert
posted the following sentence to the developer's list:</P>
<BLOCKQUOTE><EM>It's bad enough that we require libxml2, but rolling our
own XML parser is a bit more than we can handle.</EM></BLOCKQUOTE>
<P>I then replied with:</P>
<BLOCKQUOTE><EM>Given the limited scope of what you use in XML, it
should be trivial to code a mini-XML API in a few hundred lines of
code.</EM></BLOCKQUOTE>
<P>I took my own challenge and coded furiously for two days to produced
the initial public release of Mini-XML, total lines of code: 696.
Robert promptly integrated Mini-XML into Gutenprint and removed
libxml2.</P>
<P>Thanks to lots of feedback and support from various developers,
Mini-XML has evolved since then to provide a more complete XML
implementation and now stands at a whopping 3,965 lines of code,
compared to 103,893 lines of code for libxml2 version 2.6.9.</P>
<P>Aside from Gutenprint, Mini-XML is used for the following
projects/software applications:</P>
<UL>
<LI><A href="http://www.cups.org/">CUPS</A></LI>
<LI><A href="http://zynaddsubfx.sourceforge.net">ZynAddSubFX</A></LI>
</UL>
<P>Please email me (mxml @ easysw . com) if you would like your project
added or removed from this list, or if you have any comments/quotes you
would like me to publish about your experiences with Mini-XML.</P>
<!-- NEED 1in -->
<H2><A NAME="1_1">Organization of This Document</A></H2>
<P>This manual is organized into the following chapters and appendices:</P>
<UL>
<LI>Chapter 1, &quot;<A href="install.html#INSTALL">Building, Installing, and
Packaging Mini-XML</A>&quot;, provides compilation, installation, and
packaging instructions for Mini-XML.</LI>
<LI>Chapter 2, &quot;<A href="basics.html#BASICS">Getting Started with
Mini-XML</A>&quot;, shows how to use the Mini-XML library in your programs.</LI>
<LI>Chapter 3, &quot;<A href="advanced.html#ADVANCED">More Mini-XML
Programming Techniques</A>&quot;, shows additional ways to use the Mini-XML
library.</LI>
<LI>Chapter 4, &quot;<A href="mxmldoc.html#MXMLDOC">Using the mxmldoc Utility</A>
&quot;, describes how to use the <TT>mxmldoc(1)</TT> program to generate
software documentation.</LI>
<LI>Appendix A, &quot;<A href="license.html#LICENSE">Mini-XML License</A>&quot;,
provides the terms and conditions for using and distributing Mini-XML.</LI>
<LI>Appendix B, &quot;<A href="relnotes.html#RELNOTES">Release Notes</A>&quot;,
lists the changes in each release of Mini-XML.</LI>
<LI>Appendix C, &quot;<A href="reference.html#REFERENCE">Library Reference</A>
&quot;, contains a complete reference for Mini-XML, generated by <TT>mxmldoc</TT>
.</LI>
<LI>Appendix D, &quot;<A href="schema.html#SCHEMA">XML Schema</A>&quot;, shows the
XML schema used for the XML files produced by <TT>mxmldoc</TT>.</LI>
</UL>
<!-- NEED 10 -->
<H2><A NAME="1_2">Notation Conventions</A></H2>
<P>Various font and syntax conventions are used in this guide. Examples
and their meanings and uses are explained below:</P>
<DL>
<DT><CODE>mxmldoc</CODE>
<BR> <CODE>mxmldoc(1)</CODE></DT>
<DD>The names of commands; the first mention of a command or function in
a chapter is followed by a manual page section number.
<BR>
<BR></DD>
<DT><VAR>/var</VAR>
<BR><VAR> /etc/hosts</VAR></DT>
<DD>File and directory names.
<BR>
<BR></DD>
<DT><TT>Request ID is Printer-123</TT></DT>
<DD>Screen output.
<BR>
<BR></DD>
<DT><KBD>lp -d printer filename ENTER</KBD></DT>
<DD>Literal user input; special keys like <KBD>ENTER</KBD> are in ALL
CAPS.
<BR>
<BR></DD>
<DT>12.3</DT>
<DD>Numbers in the text are written using the period (.) to indicate the
decimal point.
<BR>
<BR></DD>
</DL>
<!-- NEED 10 -->
<H2><A NAME="1_3">Abbreviations</A></H2>
<P>The following abbreviations are used throughout this manual:</P>
<DL>
<DT>Gb</DT>
<DD>Gigabytes, or 1073741824 bytes
<BR>
<BR></DD>
<DT>kb</DT>
<DD>Kilobytes, or 1024 bytes
<BR>
<BR></DD>
<DT>Mb</DT>
<DD>Megabytes, or 1048576 bytes
<BR>
<BR></DD>
<DT>UTF-8, UTF-16</DT>
<DD>Unicode Transformation Format, 8-bit or 16-bit
<BR>
<BR></DD>
<DT>W3C</DT>
<DD>World Wide Web Consortium
<BR>
<BR></DD>
<DT>XML</DT>
<DD>Extensible Markup Language
<BR>
<BR></DD>
</DL>
<!-- NEED 12 -->
<H2><A NAME="1_4">Other References</A></H2>
<DL>
<DT>The Unicode Standard, Version 4.0, Addison-Wesley, ISBN
0-321-18578-1</DT>
<DD>The definition of the Unicode character set which is used for XML.
<BR>
<BR></DD>
<DT><A href="http://www.w3.org/TR/2004/REC-xml-20040204/">Extensible
Markup Language (XML) 1.0 (Third Edition)</A></DT>
<DD>The XML specification from the World Wide Web Consortium (W3C)
<BR>
<BR></DD>
</DL>
<!-- NEED 6 -->
<H2><A NAME="1_5">Legal Stuff</A></H2>
<P>The Mini-XML library is copyright 2003-2011 by Michael Sweet. License
terms are described in <A href="license.html#LICENSE">Appendix A -
Mini-XML License</A>.</P>
<HR NOSHADE>
<A HREF="index.html">Contents</A>
<A HREF="install.html">Next</A>
</BODY>
</HTML>

@ -1,467 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>Mini-XML Programmers Manual, Version 2.7</TITLE>
<META NAME="author" CONTENT="Michael R. Sweet">
<META NAME="copyright" CONTENT="Copyright 2003-2011">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
<LINK REL="Start" HREF="index.html">
<LINK REL="Contents" HREF="index.html">
<LINK REL="Prev" HREF="mxmldoc.html">
<LINK REL="Next" HREF="relnotes.html">
<STYLE TYPE="text/css"><!--
BODY { font-family: sans-serif }
H1 { font-family: sans-serif }
H2 { font-family: sans-serif }
H3 { font-family: sans-serif }
H4 { font-family: sans-serif }
H5 { font-family: sans-serif }
H6 { font-family: sans-serif }
SUB { font-size: smaller }
SUP { font-size: smaller }
PRE { font-family: monospace }
A { text-decoration: none }
--></STYLE>
</HEAD>
<BODY>
<A HREF="index.html">Contents</A>
<A HREF="mxmldoc.html">Previous</A>
<A HREF="relnotes.html">Next</A>
<HR NOSHADE>
<H1 align="right"><A name="LICENSE"><IMG align="right" alt="A" height="100"
hspace="10" src="A.gif" width="100"></A>Mini-XML License</H1>
<P>The Mini-XML library and included programs are provided under the
terms of the GNU Library General Public License version 2 (LGPL2) with
the following exceptions:</P>
<P><B>1.</B> Static linking of applications to the Mini-XML library does
not constitute a derivative work and does not require the author to
provide source code for the application, use the shared Mini-XML
libraries, or link their applications against a user-supplied version
of Mini-XML.</P>
<P><I>If you link the application to a modified version of Mini-XML,
then the changes to Mini-XML must be provided under the terms of the
LGPL2 in sections 1, 2, and 4.</I></P>
<P><B>2.</B> You do not have to provide a copy of the Mini-XML license
with programs that are linked to the Mini-XML library, nor do you have
to identify the Mini-XML license in your program or documentation as
required by section 6 of the LGPL2.</P>
<P>&nbsp;</P>
<P align="center"><B>GNU LIBRARY GENERAL PUBLIC LICENSE</B></P>
<P align="center">Version 2, June 1991
<BR> Copyright (C) 1991 Free Software Foundation, Inc.
<BR> 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
<BR> Everyone is permitted to copy and distribute verbatim copies of
this license document, but changing it is not allowed.
<BR> [This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]</P>
<P><B>Preamble</B></P>
<P>The licenses for most software are designed to take away your freedom
to share and change it. By contrast, the GNU General Public Licenses
are intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.</P>
<P>This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for your
libraries, too.</P>
<P>When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it in
new free programs; and that you know you can do these things.</P>
<P>To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the library, or if you modify it.</P>
<P>For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide complete
object files to the recipients so that they can relink them with the
library, after making changes to the library and recompiling it. And
you must show them these terms so they know their rights.</P>
<P>Our method of protecting your rights has two steps: (1) copyright the
library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.</P>
<P>Also, for each distributor's protection, we want to make certain that
everyone understands that there is no warranty for this free library.
If the library is modified by someone else and passed on, we want its
recipients to know that what they have is not the original version, so
that any problems introduced by others will not reflect on the original
authors' reputations.</P>
<P>Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this, we
have made it clear that any patent must be licensed for everyone's free
use or not licensed at all.</P>
<P>Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License, which was designed for utility
programs. This license, the GNU Library General Public License, applies
to certain designated libraries. This license is quite different from
the ordinary one; be sure to read it in full, and don't assume that
anything in it is the same as in the ordinary license.</P>
<P>The reason we have a separate public license for some libraries is
that they blur the distinction we usually make between modifying or
adding to a program and simply using it. Linking a program with a
library, without changing the library, is in some sense simply using
the library, and is analogous to running a utility program or
application program. However, in a textual and legal sense, the linked
executable is a combined work, a derivative of the original library,
and the ordinary General Public License treats it as such.</P>
<P>Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.</P>
<P>However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended
to permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to
achieve this as regards changes in header files, but we have achieved
it as regards changes in the actual functions of the Library.) The hope
is that this will lead to faster development of free libraries.</P>
<P>The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
&quot;work based on the libary&quot; and a &quot;work that uses the library&quot;. The
former contains code derived from the library, while the latter only
works together with the library.</P>
<P>Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.</P>
<P align="center"><B>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
MODIFICATION</B></P>
<P><STRONG>0.</STRONG> This License Agreement applies to any software
library which contains a notice placed by the copyright holder or other
authorized party saying it may be distributed under the terms of this
Library General Public License (also called &quot;this License&quot;). Each
licensee is addressed as &quot;you&quot;.</P>
<P>A &quot;library&quot; means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.</P>
<P>The &quot;Library&quot;, below, refers to any such software library or work
which has been distributed under these terms. A &quot;work based on the
Library&quot; means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term &quot;modification&quot;.)</P>
<P>&quot;Source code&quot; for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control
compilation and installation of the library.</P>
<P>Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of running
a program using the Library is not restricted, and output from such a
program is covered only if its contents constitute a work based on the
Library (independent of the use of the Library in a tool for writing
it). Whether that is true depends on what the Library does and what the
program that uses the Library does.</P>
<P><STRONG>1.</STRONG> You may copy and distribute verbatim copies of
the Library's complete source code as you receive it, in any medium,
provided that you conspicuously and appropriately publish on each copy
an appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the Library.</P>
<P>You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.</P>
<P><STRONG>2.</STRONG> You may modify your copy or copies of the Library
or any portion of it, thus forming a work based on the Library, and
copy and distribute such modifications or work under the terms of
Section 1 above, provided that you also meet all of these conditions:</P>
<UL>
<P><STRONG>a)</STRONG> The modified work must itself be a software
library.</P>
<P><STRONG>b)</STRONG> You must cause the files modified to carry
prominent notices stating that you changed the files and the date of
any change.</P>
<P><STRONG>c)</STRONG> You must cause the whole of the work to be
licensed at no charge to all third parties under the terms of this
License.</P>
<P><STRONG>d)</STRONG> If a facility in the modified Library refers to a
function or a table of data to be supplied by an application program
that uses the facility, other than as an argument passed when the
facility is invoked, then you must make a good faith effort to ensure
that, in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of its
purpose remains meaningful.</P>
<P>(For example, a function in a library to compute square roots has a
purpose that is entirely well-defined independent of the application.
Therefore, Subsection 2d requires that any application-supplied
function or table used by this function must be optional: if the
application does not supply it, the square root function must still
compute square roots.)</P>
</UL>
<P>These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.</P>
<P>Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.</P>
<P>In addition, mere aggregation of another work not based on the
Library with the Library (or with a work based on the Library) on a
volume of a storage or distribution medium does not bring the other
work under the scope of this License.</P>
<P><STRONG>3.</STRONG> You may opt to apply the terms of the ordinary
GNU General Public License instead of this License to a given copy of
the Library. To do this, you must alter all the notices that refer to
this License, so that they refer to the ordinary GNU General Public
License, version 2, instead of to this License. (If a newer version
than version 2 of the ordinary GNU General Public License has appeared,
then you can specify that version instead if you wish.) Do not make any
other change in these notices.</P>
<P>Once this change is made in a given copy, it is irreversible for that
copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.</P>
<P>This option is useful when you wish to copy part of the code of the
Library into a program that is not a library.</P>
<P><STRONG>4.</STRONG> You may copy and distribute the Library (or a
portion or derivative of it, under Section 2) in object code or
executable form under the terms of Sections 1 and 2 above provided that
you accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections 1
and 2 above on a medium customarily used for software interchange.</P>
<P>If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to distribute
the source code, even though third parties are not compelled to copy
the source along with the object code.</P>
<P><STRONG>5.</STRONG> A program that contains no derivative of any
portion of the Library, but is designed to work with the Library by
being compiled or linked with it, is called a &quot;work that uses the
Library&quot;. Such a work, in isolation, is not a derivative work of the
Library, and therefore falls outside the scope of this License.</P>
<P>However, linking a &quot;work that uses the Library&quot; with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a &quot;work that uses the
library&quot;. The executable is therefore covered by this License. Section
6 states terms for distribution of such executables.</P>
<P>When a &quot;work that uses the Library&quot; uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.</P>
<P>If such an object file uses only numerical parameters, data structure
layouts and accessors, and small macros and small inline functions (ten
lines or less in length), then the use of the object file is
unrestricted, regardless of whether it is legally a derivative work.
(Executables containing this object code plus portions of the Library
will still fall under Section 6.)</P>
<P>Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6, whether
or not they are linked directly with the Library itself.</P>
<P><STRONG>6.</STRONG> As an exception to the Sections above, you may
also compile or link a &quot;work that uses the Library&quot; with the Library to
produce a work containing portions of the Library, and distribute that
work under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.</P>
<P>You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:</P>
<UL><STRONG> a)</STRONG> Accompany the work with the complete
corresponding machine-readable source code for the Library including
whatever changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked with
the Library, with the complete machine-readable &quot;work that uses the
Library&quot;, as object code and/or source code, so that the user can
modify the Library and then relink to produce a modified executable
containing the modified Library. (It is understood that the user who
changes the contents of definitions files in the Library will not
necessarily be able to recompile the application to use the modified
definitions.)
<P><STRONG>b)</STRONG> Accompany the work with a written offer, valid
for at least three years, to give the same user the materials specified
in Subsection 6a, above, for a charge no more than the cost of
performing this distribution.</P>
<P><STRONG>c)</STRONG> If distribution of the work is made by offering
access to copy from a designated place, offer equivalent access to copy
the above specified materials from the same place.</P>
<P><STRONG>d)</STRONG> Verify that the user has already received a copy
of these materials or that you have already sent this user a copy.</P>
</UL>
<P>For an executable, the required form of the &quot;work that uses the
Library&quot; must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major components
(compiler, kernel, and so on) of the operating system on which the
executable runs, unless that component itself accompanies the
executable.</P>
<P>It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.</P>
<P><STRONG>7.</STRONG> You may place library facilities that are a work
based on the Library side-by-side in a single library together with
other library facilities not covered by this License, and distribute
such a combined library, provided that the separate distribution of the
work based on the Library and of the other library facilities is
otherwise permitted, and provided that you do these two things:</P>
<UL><STRONG> a)</STRONG> Accompany the combined library with a copy of
the same work based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the Sections
above.
<P><STRONG>b)</STRONG> Give prominent notice with the combined library
of the fact that part of it is a work based on the Library, and
explaining where to find the accompanying uncombined form of the same
work.</P>
</UL>
<P><STRONG>8.</STRONG> You may not copy, modify, sublicense, link with,
or distribute the Library except as expressly provided under this
License. Any attempt otherwise to copy, modify, sublicense, link with,
or distribute the Library is void, and will automatically terminate
your rights under this License. However, parties who have received
copies, or rights, from you under this License will not have their
licenses terminated so long as such parties remain in full compliance.</P>
<P><STRONG>9.</STRONG> You are not required to accept this License,
since you have not signed it. However, nothing else grants you
permission to modify or distribute the Library or its derivative works.
These actions are prohibited by law if you do not accept this License.
Therefore, by modifying or distributing the Library (or any work based
on the Library), you indicate your acceptance of this License to do so,
and all its terms and conditions for copying, distributing or modifying
the Library or works based on it.</P>
<P><STRONG>10.</STRONG> Each time you redistribute the Library (or any
work based on the Library), the recipient automatically receives a
license from the original licensor to copy, distribute, link with or
modify the Library subject to these terms and conditions. You may not
impose any further restrictions on the recipients' exercise of the
rights granted herein. You are not responsible for enforcing compliance
by third parties to this License.</P>
<P><STRONG>11.</STRONG> If, as a consequence of a court judgment or
allegation of patent infringement or for any other reason (not limited
to patent issues), conditions are imposed on you (whether by court
order, agreement or otherwise) that contradict the conditions of this
License, they do not excuse you from the conditions of this License. If
you cannot distribute so as to satisfy simultaneously your obligations
under this License and any other pertinent obligations, then as a
consequence you may not distribute the Library at all. For example, if
a patent license would not permit royalty-free redistribution of the
Library by all those who receive copies directly or indirectly through
you, then the only way you could satisfy both it and this License would
be to refrain entirely from distribution of the Library.</P>
<P>If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply, and the section as a whole is intended to apply in other
circumstances.</P>
<P>It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is implemented
by public license practices. Many people have made generous
contributions to the wide range of software distributed through that
system in reliance on consistent application of that system; it is up
to the author/donor to decide if he or she is willing to distribute
software through any other system and a licensee cannot impose that
choice.</P>
<P>This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.</P>
<P><STRONG>12.</STRONG> If the distribution and/or use of the Library is
restricted in certain countries either by patents or by copyrighted
interfaces, the original copyright holder who places the Library under
this License may add an explicit geographical distribution limitation
excluding those countries, so that distribution is permitted only in or
among countries not thus excluded. In such case, this License
incorporates the limitation as if written in the body of this License.</P>
<P><STRONG>13.</STRONG> The Free Software Foundation may publish revised
and/or new versions of the Library General Public License from time to
time. Such new versions will be similar in spirit to the present
version, but may differ in detail to address new problems or concerns.</P>
<P>Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and &quot;any
later version&quot;, you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a license
version number, you may choose any version ever published by the Free
Software Foundation.</P>
<P><STRONG>14.</STRONG> If you wish to incorporate parts of the Library
into other free programs whose distribution conditions are incompatible
with these, write to the author to ask for permission. For software
which is copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.</P>
<P align="center"><B>NO WARRANTY</B></P>
<P><STRONG>15.</STRONG> BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE,
THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY &quot;AS IS&quot; WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU
ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</P>
<P><STRONG>16.</STRONG> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR
AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO
MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.</P>
<P align="center"><B>END OF TERMS AND CONDITIONS</B></P>
<P><B>How to Apply These Terms to Your New Libraries</B></P>
<P>If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of
the ordinary General Public License).</P>
<P>To apply these terms, attach the following notices to the library. It
is safest to attach them to the start of each source file to most
effectively convey the exclusion of warranty; and each file should have
at least the &quot;copyright&quot; line and a pointer to where the full notice is
found.</P>
<UL>
<P><VAR>one line to give the library's name and an idea of what it does.</VAR>
<BR> Copyright (C)<VAR> year</VAR><VAR> name of author</VAR></P>
<P>This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.</P>
<P>This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public License for more details.</P>
<P>You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</P>
</UL>
<P>Also add information on how to contact you by electronic and paper
mail.</P>
<P>You should also get your employer (if you work as a programmer) or
your school, if any, to sign a &quot;copyright disclaimer&quot; for the library,
if necessary. Here is a sample; alter the names:</P>
<UL>
<P>Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random
Hacker.</P>
<P><VAR>signature of Ty Coon</VAR>, 1 April 1990 Ty Coon, President of
Vice</P>
</UL>
<P>That's all there is to it!</P>
<HR NOSHADE>
<A HREF="index.html">Contents</A>
<A HREF="mxmldoc.html">Previous</A>
<A HREF="relnotes.html">Next</A>
</BODY>
</HTML>

@ -1,187 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>Mini-XML Programmers Manual, Version 2.7</TITLE>
<META NAME="author" CONTENT="Michael R. Sweet">
<META NAME="copyright" CONTENT="Copyright 2003-2011">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
<LINK REL="Start" HREF="index.html">
<LINK REL="Contents" HREF="index.html">
<LINK REL="Prev" HREF="advanced.html">
<LINK REL="Next" HREF="license.html">
<STYLE TYPE="text/css"><!--
BODY { font-family: sans-serif }
H1 { font-family: sans-serif }
H2 { font-family: sans-serif }
H3 { font-family: sans-serif }
H4 { font-family: sans-serif }
H5 { font-family: sans-serif }
H6 { font-family: sans-serif }
SUB { font-size: smaller }
SUP { font-size: smaller }
PRE { font-family: monospace }
A { text-decoration: none }
--></STYLE>
</HEAD>
<BODY>
<A HREF="index.html">Contents</A>
<A HREF="advanced.html">Previous</A>
<A HREF="license.html">Next</A>
<HR NOSHADE>
<H1 align="right"><A name="MXMLDOC"><IMG align="right" alt="4" height="100"
hspace="10" src="4.gif" width="100"></A>Using the mxmldoc Utility</H1>
<P>This chapter describes how to use <TT>mxmldoc(1)</TT> program to
automatically generate documentation from C and C++ source files.</P>
<H2><A NAME="5_1">The Basics</A></H2>
<P>Originally developed to generate the Mini-XML and CUPS API
documentation, <TT>mxmldoc</TT> is now a general-purpose utility which
scans C and C++ source files to produce HTML and man page documentation
along with an XML file representing the functions, types, and
definitions in those source files. Unlike popular documentation
generators like Doxygen or Javadoc, <TT>mxmldoc</TT> uses in-line
comments rather than comment headers, allowing for more &quot;natural&quot; code
documentation.</P>
<P>By default, <TT>mxmldoc</TT> produces HTML documentation. For
example, the following command will scan all of the C source and header
files in the current directory and produce a HTML documentation file
called<VAR> filename.html</VAR>:</P>
<PRE>
<KBD>mxmldoc *.h *.c &gt;filename.html ENTER</KBD>
</PRE>
<P>You can also specify an XML file to create which contains all of the
information from the source files. For example, the following command
creates an XML file called<VAR> filename.xml</VAR> in addition to the
HTML file:</P>
<PRE>
<KBD>mxmldoc filename.xml *.h *.c &gt;filename.html ENTER</KBD>
</PRE>
<P>The <TT>--no-output</TT> option disables the normal HTML output:</P>
<PRE>
<KBD>mxmldoc --no-output filename.xml *.h *.c ENTER</KBD>
</PRE>
<P>You can then run <TT>mxmldoc</TT> again with the XML file alone to
generate the HTML documentation:</P>
<PRE>
<KBD>mxmldoc filename.xml &gt;filename.html ENTER</KBD>
</PRE>
<H3><A NAME="5_1_1">Creating Man Pages</A></H3>
<P>The <TT>--man filename</TT> option tells <TT>mxmldoc</TT> to create a
man page instead of HTML documentation, for example:</P>
<PRE>
<KBD>mxmldoc --man filename filename.xml \
&gt;filename.man ENTER</KBD>
<KBD>mxmldoc --man filename *.h *.c \
&gt;filename.man ENTER</KBD>
</PRE>
<H3><A NAME="5_1_2">Creating Xcode Documentation Sets</A></H3>
<P>The <TT>--docset directory.docset</TT> option tells <TT>mxmldoc</TT>
to create an Xcode documentation set containing the HTML documentation,
for example:</P>
<PRE>
<KBD>mxmldoc --docset foo.docset *.h *.c foo.xml ENTER</KBD>
</PRE>
<P>Xcode documentation sets can only be built on Mac OS X with Xcode 3.0
or higher installed.</P>
<H2><A NAME="5_2">Commenting Your Code</A></H2>
<P>As noted previously, <TT>mxmldoc</TT> looks for in-line comments to
describe the functions, types, and constants in your code. <TT>Mxmldoc</TT>
will document all public names it finds in your source files - any
names starting with the underscore character (_) or names that are
documented with the <A HREF="#ATDIRECTIVES">@private@</A> directive are
treated as private and are not documented.</P>
<P>Comments appearing directly before a function or type definition are
used to document that function or type. Comments appearing after
argument, definition, return type, or variable declarations are used to
document that argument, definition, return type, or variable. For
example, the following code excerpt defines a key/value structure and a
function that creates a new instance of that structure:</P>
<PRE>
/* A key/value pair. This is used with the
dictionary structure. */
struct keyval
{
char *key; /* Key string */
char *val; /* Value string */
};
/* Create a new key/value pair. */
struct keyval * /* New key/value pair */
new_keyval(
const char *key, /* Key string */
const char *val) /* Value string */
{
...
}
</PRE>
<P><TT>Mxmldoc</TT> also knows to remove extra asterisks (*) from the
comment string, so the comment string:</P>
<PRE>
/*
* Compute the value of PI.
*
* The function connects to an Internet server
* that streams audio of mathematical monks
* chanting the first 100 digits of PI.
*/
</PRE>
<P>will be shown as:</P>
<PRE>
Compute the value of PI.
The function connects to an Internet server
that streams audio of mathematical monks
chanting the first 100 digits of PI.
</PRE>
<P><A name="ATDIRECTIVES">Comments</A> can also include the following
special <TT>@name ...@</TT> directive strings:</P>
<UL>
<LI><TT>@deprecated@</TT> - flags the item as deprecated to discourage
its use</LI>
<LI><TT>@private@</TT> - flags the item as private so it will not be
included in the documentation</LI>
<LI><TT>@since ...@</TT> - flags the item as new since a particular
release. The text following the <TT>@since</TT> up to the closing <TT>@</TT>
is highlighted in the generated documentation, e.g. <TT>@since Mini-XML
2.7@</TT>.</LI>
</UL>
<!-- NEED 10 -->
<H2><A NAME="5_3">Titles, Sections, and Introductions</A></H2>
<P><TT>Mxmldoc</TT> also provides options to set the title, section, and
introduction text for the generated documentation. The <TT>--title text</TT>
option specifies the title for the documentation. The title string is
usually put in quotes:</P>
<PRE>
<KBD>mxmldoc filename.xml \
--title &quot;My Famous Documentation&quot; \
&gt;filename.html ENTER</KBD>
</PRE>
<P>The <TT>--section name</TT> option specifies the section for the
documentation. For HTML documentation, the name is placed in a HTML
comment such as:</P>
<PRE>
&lt;!-- SECTION: name --&gt;
</PRE>
<P>For man pages, the section name is usually just a number (&quot;3&quot;), or a
number followed by a vendor name (&quot;3acme&quot;). The section name is used in
the <TT>.TH</TT> directive in the man page:</P>
<PRE>
.TH mylibrary 3acme &quot;My Title&quot; ...
</PRE>
<P>The default section name for man page output is &quot;3&quot;. There is no
default section name for HTML output.</P>
<P>Finally, the <TT>--intro filename</TT> option specifies a file to
embed after the title and section but before the generated
documentation. For HTML documentation, the file must consist of valid
HTML without the usual <TT>DOCTYPE</TT>, <TT>html</TT>, and <TT>body</TT>
elements. For man page documentation, the file must consist of valid <TT>
nroff(1)</TT> text.</P>
<HR NOSHADE>
<A HREF="index.html">Contents</A>
<A HREF="advanced.html">Previous</A>
<A HREF="license.html">Next</A>
</BODY>
</HTML>

File diff suppressed because it is too large Load Diff

@ -1,329 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>Mini-XML Programmers Manual, Version 2.7</TITLE>
<META NAME="author" CONTENT="Michael R. Sweet">
<META NAME="copyright" CONTENT="Copyright 2003-2011">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
<LINK REL="Start" HREF="index.html">
<LINK REL="Contents" HREF="index.html">
<LINK REL="Prev" HREF="license.html">
<LINK REL="Next" HREF="reference.html">
<STYLE TYPE="text/css"><!--
BODY { font-family: sans-serif }
H1 { font-family: sans-serif }
H2 { font-family: sans-serif }
H3 { font-family: sans-serif }
H4 { font-family: sans-serif }
H5 { font-family: sans-serif }
H6 { font-family: sans-serif }
SUB { font-size: smaller }
SUP { font-size: smaller }
PRE { font-family: monospace }
A { text-decoration: none }
--></STYLE>
</HEAD>
<BODY>
<A HREF="index.html">Contents</A>
<A HREF="license.html">Previous</A>
<A HREF="reference.html">Next</A>
<HR NOSHADE>
<H1 align="right"><A name="RELNOTES"><IMG align="right" alt="B" height="100"
hspace="10" src="B.gif" width="100"></A>Release Notes</H1>
<H2><A NAME="7_1">Changes in Mini-XML 2.7</A></H2>
<UL>
<LI>Fixed conformance of mxmldoc's HTML and CSS output.</LI>
<LI>Added data accessor (&quot;get&quot;) functions and made the mxml_node_t and
mxml_index_t structures private but still available in the Mini-XML
header to preserve source compatibility (STR #118)</LI>
<LI>Updated the source headers to reference the Mini-XML license and its
exceptions to the LGPL2 (STR #108)</LI>
<LI>Added a new mxmlFindPath() function to find the value node of a
named element (STR #110)</LI>
<LI>Building a static version of the library did not work on Windows
(STR #112)</LI>
<LI>The shared library did not include a destructor for the thread-
specific data key on UNIX-based operating systems (STR #103)</LI>
<LI>mxmlLoad* did not error out on XML with multiple root nodes (STR
#101)</LI>
<LI>Fixed an issue with the _mxml_vstrdupf function (STR #107)</LI>
<LI>mxmlSave* no longer write all siblings of the passed node, just that
node and its children (STR #109)</LI>
</UL>
<H2><A NAME="7_2">Changes in Mini-XML 2.6</A></H2>
<UL>
<LI>Documentation fixes (STR #91, STR #92)</LI>
<LI>The mxmldoc program did not handle typedef comments properly (STR
#72)</LI>
<LI>Added support for &quot;long long&quot; printf formats.</LI>
<LI>The XML parser now ignores BOMs in UTF-8 XML files (STR #89)</LI>
<LI>The mxmldoc program now supports generating Xcode documentation
sets.</LI>
<LI>mxmlSave*() did not output UTF-8 correctly on some platforms.</LI>
<LI>mxmlNewXML() now adds encoding=&quot;utf-8&quot; in the ?xml directive to
avoid problems with non-conformant XML parsers that assume something
other than UTF-8 as the default encoding.</LI>
<LI>Wrapping was not disabled when mxmlSetWrapMargin(0) was called, and
&quot;&lt;?xml ... ?&gt;&quot; was always followed by a newline (STR #76)</LI>
<LI>The mxml.pc.in file was broken (STR #79)</LI>
<LI>The mxmldoc program now handles &quot;typedef enum name {} name&quot;
correctly (STR #72)</LI>
</UL>
<H2><A NAME="7_3">Changes in Mini-XML 2.5</A></H2>
<UL>
<LI>The mxmldoc program now makes greater use of CSS and supports a
--css option to embed an alternate stylesheet.</LI>
<LI>The mxmldoc program now supports --header and --footer options to
insert documentation content before and after the generated content.</LI>
<LI>The mxmldoc program now supports a --framed option to generate
framed HTML output.</LI>
<LI>The mxmldoc program now creates a table of contents including any
headings in the --intro file when generating HTML output.</LI>
<LI>The man pages and man page output from mxmldoc did not use &quot;\-&quot; for
dashes (STR #68)</LI>
<LI>The debug version of the Mini-XML DLL could not be built (STR #65)</LI>
<LI>Processing instructions and directives did not work when not at the
top level of a document (STR #67)</LI>
<LI>Spaces around the &quot;=&quot; in attributes were not supported (STR #67)</LI>
</UL>
<H2><A NAME="7_4">Changes in Mini-XML 2.4</A></H2>
<UL>
<LI>Fixed shared library build problems on HP-UX and Mac OS X.</LI>
<LI>The mxmldoc program did not output argument descriptions for
functions properly.</LI>
<LI>All global settings (custom, error, and entity callbacks and the
wrap margin) are now managed separately for each thread.</LI>
<LI>Added mxmlElementDeleteAttr() function (STR #59)</LI>
<LI>mxmlElementSetAttrf() did not work (STR #57)</LI>
<LI>mxmlLoad*() incorrectly treated declarations as parent elements (STR
#56)</LI>
<LI>mxmlLoad*() incorrectly allowed attributes without values (STR #47)</LI>
<LI>Fixed Visual C++ build problems (STR #49)</LI>
<LI>mxmlLoad*() did not return NULL when an element contained an error
(STR #46)</LI>
<LI>Added support for the apos character entity (STR #54)</LI>
<LI>Fixed whitespace detection with Unicode characters (STR #48)</LI>
<LI>mxmlWalkNext() and mxmlWalkPrev() did not work correctly when called
with a node with no children as the top node (STR #53)</LI>
</UL>
<H2><A NAME="7_5">Changes in Mini-XML 2.3</A></H2>
<UL>
<LI>Added two exceptions to the LGPL to support static linking of
applications against Mini-XML</LI>
<LI>The mxmldoc utility can now generate man pages, too.</LI>
<LI>Added a mxmlNewXML() function</LI>
<LI>Added a mxmlElementSetAttrf() function (STR #43)</LI>
<LI>Added a snprintf() emulation function for the test program (STR #32)</LI>
<LI>Added the _CRT_SECURE_NO_DEPRECATE definition when building on VC++
2005 (STR #36)</LI>
<LI>mxmlLoad*() did not detect missing &gt; characters in elements (STR
#41)</LI>
<LI>mxmlLoad*() did not detect missing close tags at the end of an XML
document (STR #45)</LI>
<LI>Added user_data and ref_count members to mxml_node_t structure</LI>
<LI>Added mxmlReleaseNode() and mxmlRetainNode() APIs for
reference-counted nodes</LI>
<LI>Added mxmlSetWrapMargin() to control the wrapping of XML output</LI>
<LI>Added conditional check for EINTR error code for certain Windows
compilers that do not define it (STR #33)</LI>
<LI>The mxmldoc program now generates correct HTML 4.0 output -
previously it generated invalid XHTML</LI>
<LI>The mxmldoc program now supports &quot;@deprecated@, &quot;@private@&quot;, and
&quot;@since version@&quot; comments</LI>
<LI>Fixed function and enumeration type bugs in mxmldoc</LI>
<LI>Fixed the XML schema for mxmldoc</LI>
<LI>The mxmldoc program now supports --intro, --section, and --title
options</LI>
<LI>The mxmlLoad*() functions could leak a node on an error (STR #27)</LI>
<LI>The mxml_vsnprintf() function could get in an infinite loop on a
buffer overflow (STR #25)</LI>
<LI>Added new mxmlNewCDATA() and mxmlSetCDATA() functions to create and
set CDATA nodes, which are really just special element nodes</LI>
<LI>Added new MXML_IGNORE type and MXML_IGNORE_CB callback to ignore
non-element nodes, e.g. whitespace</LI>
<LI>mxmlLoad*() did not treat custom data as opaque, so whitespace
characters would be lost</LI>
</UL>
<H2><A NAME="7_6">Changes in Mini-XML 2.2.2</A></H2>
<UL>
<LI>mxmlLoad*() did not treat custom data as opaque, so whitespace
characters would be lost.</LI>
</UL>
<H2><A NAME="7_7">Changes in Mini-XML 2.2.1</A></H2>
<UL>
<LI>mxmlLoadFd(), mxmlLoadFile(), and mxmlLoadString() now correctly
return NULL on error (STR #21)</LI>
<LI>mxmlNewInteger(), mxmlNewOpaque(), mxmlNewReal(), mxmlNewText(), and
mxmlNewTextf() incorrectly required a parent node (STR #22)</LI>
<LI>Fixed an XML output bug in mxmldoc.</LI>
<LI>The &quot;make install&quot; target now uses the install command to set the
proper permissions on UNIX/Linux/OSX.</LI>
<LI>Fixed a MingW/Cygwin compilation problem (STR #18)</LI>
</UL>
<H2><A NAME="7_8">Changes in Mini-XML 2.2</A></H2>
<UL>
<LI>Added shared library support (STR #17)</LI>
<LI>mxmlLoad*() now returns an error when an XML stream contains illegal
control characters (STR #10)</LI>
<LI>mxmlLoad*() now returns an error when an element contains two
attributes with the same name in conformance with the XML spec (STR
#16)</LI>
<LI>Added support for CDATA (STR #14, STR #15)</LI>
<LI>Updated comment and processing instruction handling - no entity
support per XML specification.</LI>
<LI>Added checking for invalid comment termination (&quot;---&gt;&quot; is not
allowed)</LI>
</UL>
<H2><A NAME="7_9">Changes in Mini-XML 2.1</A></H2>
<UL>
<LI>Added support for custom data nodes (STR #6)</LI>
<LI>Now treat UTF-8 sequences which are longer than necessary as an
error (STR #4)</LI>
<LI>Fixed entity number support (STR #8)</LI>
<LI>Fixed mxmlLoadString() bug with UTF-8 (STR #7)</LI>
<LI>Fixed entity lookup bug (STR #5)</LI>
<LI>Added mxmlLoadFd() and mxmlSaveFd() functions.</LI>
<LI>Fixed multi-word UTF-16 handling.</LI>
</UL>
<H2><A NAME="7_10">Changes in Mini-XML 2.0</A></H2>
<UL>
<LI>New programmers manual.</LI>
<LI>Added Visual C++ project files for Microsoft Windows users.</LI>
<LI>Added optimizations to mxmldoc, mxmlSaveFile(), and mxmlIndexNew()
(STR #2)</LI>
<LI>mxmlEntityAddCallback() now returns an integer status (STR #2)</LI>
<LI>Added UTF-16 support (input only; all output is UTF-8)</LI>
<LI>Added index functions to build a searchable index of XML nodes.</LI>
<LI>Added character entity callback interface to support additional
character entities beyond those defined in the XHTML specification.</LI>
<LI>Added support for XHTML character entities.</LI>
<LI>The mxmldoc utility now produces XML output which conforms to an
updated XML schema, described in the file &quot;doc/mxmldoc.xsd&quot;.</LI>
<LI>Changed the whitespace callback interface to return strings instead
of a single character, allowing for greater control over the formatting
of XML files written using Mini-XML. THIS CHANGE WILL REQUIRE CHANGES
TO YOUR 1.x CODE IF YOU USE WHITESPACE CALLBACKS.</LI>
<LI>The mxmldoc utility now produces XML output which conforms to an
updated XML schema, described in the file &quot;doc/mxmldoc.xsd&quot;.</LI>
<LI>Changed the whitespace callback interface to return strings instead
of a single character, allowing for greater control over the formatting
of XML files written using Mini-XML. THIS CHANGE WILL REQUIRE CHANGES
TO YOUR 1.x CODE IF YOU USE WHITESPACE CALLBACKS.</LI>
<LI>The mxmldoc utility is now capable of documenting C++ classes,
functions, and structures, and correctly handles C++ comments.</LI>
<LI>Added new modular tests for mxmldoc.</LI>
<LI>Updated the mxmldoc output to be more compatible with embedding in
manuals produced with HTMLDOC.</LI>
<LI>The makefile incorrectly included a &quot;/&quot; separator between the
destination path and install path. This caused problems when building
and installing with MingW.</LI>
</UL>
<H2><A NAME="7_11">Changes in Mini-XML 1.3</A></H2>
<UL>
<LI>Fixes for mxmldoc.</LI>
<LI>Added support for reading standard HTML entity names.</LI>
<LI>mxmlLoadString/File() did not decode character entities in element
names, attribute names, or attribute values.</LI>
<LI>mxmlLoadString/File() would crash when loading non- conformant XML
data under an existing parent (top) node.</LI>
<LI>Fixed several bugs in the mxmldoc utility.</LI>
<LI>Added new error callback function to catch a variety of errors and
log them to someplace other than stderr.</LI>
<LI>The mxmlElementSetAttr() function now allows for NULL attribute
values.</LI>
<LI>The load and save functions now properly handle quoted element and
attribute name strings properly, e.g. for !DOCTYPE declarations.</LI>
</UL>
<H2><A NAME="7_12">Changes in Mini-XML 1.2</A></H2>
<UL>
<LI>Added new &quot;set&quot; methods to set the value of a node.</LI>
<LI>Added new formatted text methods mxmlNewTextf() and mxmlSetTextf()
to create/set a text node value using printf-style formats.</LI>
<LI>Added new standard callbacks for use with the mxmlLoad functions.</LI>
<LI>Updated the HTML documentation to include examples of the walk and
load function output.</LI>
<LI>Added --with/without-ansi configure option to control the strdup()
function check.</LI>
<LI>Added --with/without-snprintf configure option to control the
snprintf() and vsnprintf() function checks.</LI>
</UL>
<H2><A NAME="7_13">Changes in Mini-XML 1.1.2</A></H2>
<UL>
<LI>The mxml(3) man page wasn't updated for the string functions.</LI>
<LI>mxmlSaveString() returned the wrong number of characters.</LI>
<LI>mxml_add_char() updated the buffer pointer in the wrong place.</LI>
</UL>
<H2><A NAME="7_14">Changes in Mini-XML 1.1.1</A></H2>
<UL>
<LI>The private mxml_add_ch() function did not update the
start-of-buffer pointer which could cause a crash when using
mxmlSaveString().</LI>
<LI>The private mxml_write_ws() function called putc() instead of using
the proper callback which could cause a crash when using
mxmlSaveString().</LI>
<LI>Added a mxmlSaveAllocString() convenience function for saving an XML
node tree to an allocated string.</LI>
</UL>
<H2><A NAME="7_15">Changes in Mini-XML 1.1</A></H2>
<UL>
<LI>The mxmlLoadFile() function now uses dynamically allocated string
buffers for element names, attribute names, and attribute values.
Previously they were capped at 16383, 255, and 255 bytes, respectively.</LI>
<LI>Added a new mxmlLoadString() function for loading an XML node tree
from a string.</LI>
<LI>Added a new mxmlSaveString() function for saving an XML node tree to
a string.</LI>
<LI>Add emulation of strdup() if the local platform does not provide the
function.</LI>
</UL>
<H2><A NAME="7_16">Changes in Mini-XML 1.0</A></H2>
<UL>
<LI>The mxmldoc program now handles function arguments, structures,
unions, enumerations, classes, and typedefs properly.</LI>
<LI>Documentation provided via mxmldoc and more in-line comments in the
code.</LI>
<LI>Added man pages and packaging files.</LI>
</UL>
<H2><A NAME="7_17">Changes in Mini-XML 0.93</A></H2>
<UL>
<LI>New mxmldoc example program that is also used to create and update
code documentation using XML and produce HTML reference pages.</LI>
<LI>Added mxmlAdd() and mxmlRemove() functions to add and remove nodes
from a tree. This provides more flexibility over where the nodes are
inserted and allows nodes to be moved within the tree as needed.</LI>
<LI>mxmlLoadFile() now correctly handles comments.</LI>
<LI>mxmlLoadFile() now supports the required &quot;gt&quot;, &quot;quot&quot;, and &quot;nbsp&quot;
character entities.</LI>
<LI>mxmlSaveFile() now uses newlines as whitespace when valid to do so.</LI>
<LI>mxmlFindElement() now also takes attribute name and attribute value
string arguments to limit the search to specific elements with
attributes and/or values.</LI>
NULL pointers can be used as &quot;wildcards&quot;.
<LI>Added uninstall target to makefile, and auto-reconfig if Makefile.in
or configure.in are changed.</LI>
<LI>mxmlFindElement(), mxmlWalkNext(), and mxmlWalkPrev() now all
provide &quot;descend&quot; arguments to control whether they descend into child
nodes in the tree.</LI>
<LI>Fixed some whitespace issues in mxmlLoadFile().</LI>
<LI>Fixed Unicode output and whitespace issues in mxmlSaveFile().</LI>
<LI>mxmlSaveFile() now supports a whitespace callback to provide more
human-readable XML output under program control.</LI>
</UL>
<H2><A NAME="7_18">Changes in Mini-XML 0.92</A></H2>
<UL>
<LI>mxmlSaveFile() didn't return a value on success.</LI>
</UL>
<H2><A NAME="7_19">Changes in Mini-XML 0.91</A></H2>
<UL>
<LI>mxmlWalkNext() would go into an infinite loop.</LI>
</UL>
<H2><A NAME="7_20">Changes in Mini-XML 0.9</A></H2>
<UL>
<LI>Initial public release.</LI>
</UL>
<HR NOSHADE>
<A HREF="index.html">Contents</A>
<A HREF="license.html">Previous</A>
<A HREF="reference.html">Next</A>
</BODY>
</HTML>

@ -1,223 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>Mini-XML Programmers Manual, Version 2.7</TITLE>
<META NAME="author" CONTENT="Michael R. Sweet">
<META NAME="copyright" CONTENT="Copyright 2003-2011">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
<LINK REL="Start" HREF="index.html">
<LINK REL="Contents" HREF="index.html">
<LINK REL="Prev" HREF="reference.html">
<STYLE TYPE="text/css"><!--
BODY { font-family: sans-serif }
H1 { font-family: sans-serif }
H2 { font-family: sans-serif }
H3 { font-family: sans-serif }
H4 { font-family: sans-serif }
H5 { font-family: sans-serif }
H6 { font-family: sans-serif }
SUB { font-size: smaller }
SUP { font-size: smaller }
PRE { font-family: monospace }
A { text-decoration: none }
--></STYLE>
</HEAD>
<BODY>
<A HREF="index.html">Contents</A>
<A HREF="reference.html">Previous</A>
<HR NOSHADE>
<H1 align="right"><A name="SCHEMA"><IMG align="right" alt="D" height="100"
hspace="10" src="D.gif" width="100"></A>XML Schema</H1>
<P>This appendix provides the XML schema that is used for the XML files
produced by <TT>mxmldoc</TT>. This schema is available on-line at:</P>
<PRE>
http://www.minixml.org/mxmldoc.xsd
</PRE>
<H2><A NAME="9_1">mxmldoc.xsd</A></H2>
<PRE><SMALL>
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;xsd:schema xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;
&lt;xsd:annotation&gt;
&lt;xsd:documentation xml:lang=&quot;en&quot;&gt;
Mini-XML 2.7 documentation schema for mxmldoc output.
Copyright 2003-2011 by Michael Sweet.
&lt;/xsd:documentation&gt;
&lt;/xsd:annotation&gt;
&lt;!-- basic element definitions --&gt;
&lt;xsd:element name=&quot;argument&quot; type=&quot;argumentType&quot;/&gt;
&lt;xsd:element name=&quot;class&quot; type=&quot;classType&quot;/&gt;
&lt;xsd:element name=&quot;constant&quot; type=&quot;constantType&quot;/&gt;
&lt;xsd:element name=&quot;description&quot; type=&quot;xsd:string&quot;/&gt;
&lt;xsd:element name=&quot;enumeration&quot; type=&quot;enumerationType&quot;/&gt;
&lt;xsd:element name=&quot;function&quot; type=&quot;functionType&quot;/&gt;
&lt;xsd:element name=&quot;mxmldoc&quot; type=&quot;mxmldocType&quot;/&gt;
&lt;xsd:element name=&quot;namespace&quot; type=&quot;namespaceType&quot;/&gt;
&lt;xsd:element name=&quot;returnvalue&quot; type=&quot;returnvalueType&quot;/&gt;
&lt;xsd:element name=&quot;seealso&quot; type=&quot;identifierList&quot;/&gt;
&lt;xsd:element name=&quot;struct&quot; type=&quot;structType&quot;/&gt;
&lt;xsd:element name=&quot;typedef&quot; type=&quot;typedefType&quot;/&gt;
&lt;xsd:element name=&quot;type&quot; type=&quot;xsd:string&quot;/&gt;
&lt;xsd:element name=&quot;union&quot; type=&quot;unionType&quot;/&gt;
&lt;xsd:element name=&quot;variable&quot; type=&quot;variableType&quot;/&gt;
&lt;!-- descriptions of complex elements --&gt;
&lt;xsd:complexType name=&quot;argumentType&quot;&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element ref=&quot;type&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;/xsd:sequence&gt;
&lt;xsd:attribute name=&quot;default&quot; type=&quot;xsd:string&quot; use=&quot;optional&quot;/&gt;
&lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
&lt;xsd:attribute name=&quot;direction&quot; type=&quot;direction&quot; use=&quot;optional&quot;
default=&quot;I&quot;/&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:complexType name=&quot;classType&quot;&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;xsd:choice minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;&gt;
&lt;xsd:element ref=&quot;class&quot;/&gt;
&lt;xsd:element ref=&quot;enumeration&quot;/&gt;
&lt;xsd:element ref=&quot;function&quot;/&gt;
&lt;xsd:element ref=&quot;struct&quot;/&gt;
&lt;xsd:element ref=&quot;typedef&quot;/&gt;
&lt;xsd:element ref=&quot;union&quot;/&gt;
&lt;xsd:element ref=&quot;variable&quot;/&gt;
&lt;/xsd:choice&gt;
&lt;/xsd:sequence&gt;
&lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
&lt;xsd:attribute name=&quot;parent&quot; type=&quot;xsd:string&quot; use=&quot;optional&quot;/&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:complexType name=&quot;constantType&quot;&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;/xsd:sequence&gt;
&lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:complexType name=&quot;enumerationType&quot;&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;xsd:element ref=&quot;constant&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;unbounded&quot;/&gt;
&lt;/xsd:sequence&gt;
&lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:complexType name=&quot;functionType&quot;&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element ref=&quot;returnvalue&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;xsd:element ref=&quot;argument&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;unbounded&quot;/&gt;
&lt;xsd:element ref=&quot;seealso&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;/xsd:sequence&gt;
&lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
&lt;xsd:attribute name=&quot;scope&quot; type=&quot;scope&quot; use=&quot;optional&quot;/&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:complexType name=&quot;mxmldocType&quot;&gt;
&lt;xsd:choice minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;&gt;
&lt;xsd:element ref=&quot;class&quot;/&gt;
&lt;xsd:element ref=&quot;enumeration&quot;/&gt;
&lt;xsd:element ref=&quot;function&quot;/&gt;
&lt;xsd:element ref=&quot;namespace&quot;/&gt;
&lt;xsd:element ref=&quot;struct&quot;/&gt;
&lt;xsd:element ref=&quot;typedef&quot;/&gt;
&lt;xsd:element ref=&quot;union&quot;/&gt;
&lt;xsd:element ref=&quot;variable&quot;/&gt;
&lt;/xsd:choice&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:complexType name=&quot;namespaceType&quot;&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;xsd:choice minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;&gt;
&lt;xsd:element ref=&quot;class&quot;/&gt;
&lt;xsd:element ref=&quot;enumeration&quot;/&gt;
&lt;xsd:element ref=&quot;function&quot;/&gt;
&lt;xsd:element ref=&quot;struct&quot;/&gt;
&lt;xsd:element ref=&quot;typedef&quot;/&gt;
&lt;xsd:element ref=&quot;union&quot;/&gt;
&lt;xsd:element ref=&quot;variable&quot;/&gt;
&lt;/xsd:choice&gt;
&lt;/xsd:sequence&gt;
&lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:complexType name=&quot;returnvalueType&quot;&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element ref=&quot;type&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:complexType name=&quot;structType&quot;&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;xsd:choice minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;&gt;
&lt;xsd:element ref=&quot;variable&quot;/&gt;
&lt;xsd:element ref=&quot;function&quot;/&gt;
&lt;/xsd:choice&gt;
&lt;/xsd:sequence&gt;
&lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:complexType name=&quot;typedefType&quot;&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element ref=&quot;type&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;/xsd:sequence&gt;
&lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:complexType name=&quot;unionType&quot;&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;xsd:element ref=&quot;variable&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;/&gt;
&lt;/xsd:sequence&gt;
&lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:complexType name=&quot;variableType&quot;&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element ref=&quot;type&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
&lt;/xsd:sequence&gt;
&lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
&lt;/xsd:complexType&gt;
&lt;!-- data types --&gt;
&lt;xsd:simpleType name=&quot;direction&quot;&gt;
&lt;xsd:restriction base=&quot;xsd:string&quot;&gt;
&lt;xsd:enumeration value=&quot;I&quot;/&gt;
&lt;xsd:enumeration value=&quot;O&quot;/&gt;
&lt;xsd:enumeration value=&quot;IO&quot;/&gt;
&lt;/xsd:restriction&gt;
&lt;/xsd:simpleType&gt;
&lt;xsd:simpleType name=&quot;identifier&quot;&gt;
&lt;xsd:restriction base=&quot;xsd:string&quot;&gt;
&lt;xsd:pattern value=&quot;[a-zA-Z_(.]([a-zA-Z_(.,)* 0-9])*&quot;/&gt;
&lt;/xsd:restriction&gt;
&lt;/xsd:simpleType&gt;
&lt;xsd:simpleType name=&quot;identifierList&quot;&gt;
&lt;xsd:list itemType=&quot;identifier&quot;/&gt;
&lt;/xsd:simpleType&gt;
&lt;xsd:simpleType name=&quot;scope&quot;&gt;
&lt;xsd:restriction base=&quot;xsd:string&quot;&gt;
&lt;xsd:enumeration value=&quot;&quot;/&gt;
&lt;xsd:enumeration value=&quot;private&quot;/&gt;
&lt;xsd:enumeration value=&quot;protected&quot;/&gt;
&lt;xsd:enumeration value=&quot;public&quot;/&gt;
&lt;/xsd:restriction&gt;
&lt;/xsd:simpleType&gt;
&lt;/xsd:schema&gt;
</SMALL></PRE>
<HR NOSHADE>
<A HREF="index.html">Contents</A>
<A HREF="reference.html">Previous</A>
</BODY>
</HTML>

Binary file not shown.

@ -1,267 +0,0 @@
<?php
//
// "$Id$"
//
// Mini-XML documentation page...
//
//
// Include necessary headers...
//
include_once "phplib/html.php";
include_once "phplib/common.php";
//
// Get the web server path information and serve the named file as needed...
//
if (array_key_exists("PATH_INFO", $_SERVER) &&
$_SERVER["PATH_INFO"] != "/" &&
$_SERVER["PATH_INFO"] != "")
{
$path = "$_SERVER[PATH_INFO]";
if (fnmatch("*.gif", $path))
$type = "gif";
else if (fnmatch("*.jpg", $path))
$type = "jpeg";
else if (fnmatch("*.png", $path))
$type = "png";
else
$type = "html";
if (strstr($path, ".."))
{
if ($type == "html")
{
html_header("Documentation Error");
print("<p>The path '$path' is bad.</p>\n");
html_footer();
}
}
else
{
$fp = fopen("docfiles$path", "rb");
if (!$fp)
{
if ($type == "html")
{
html_header("Documentation Error");
print("<p>Unable to open path '$path'.</p>\n");
html_footer();
}
}
else if ($type == "html")
{
html_header("Documentation");
$saw_body = 0;
$last_nav = 0;
while ($line = fgets($fp, 1024))
{
if (strstr($line, "<BODY") || strstr($line, "<body"))
{
$saw_body = 1;
}
else if (strstr($line, "</BODY>") || strstr($line, "</body>"))
{
break;
}
else if ($saw_body)
{
if (strstr($line, "<A HREF=\"index.html\">Contents</A") ||
strstr($line, ">Previous</A>") ||
strstr($line, ">Next</A>"))
{
if ($last_nav)
print("&middot\n");
else
print("<p class='links'><A HREF='#_USER_COMMENTS'>Comments</a> "
."&middot;\n");
$last_nav = 1;
}
else if (strstr($line, "<HR"))
{
if ($last_nav)
print("</p>\n");
$last_nav = 0;
$line = "";
}
print($line);
}
}
fclose($fp);
if ($last_nav)
print("</p>\n");
print("<h1><a name='_USER_COMMENTS'>User Comments</a></h1>\n"
."<p><a href='$html_path/comment.php?r0+pdocumentation.php$path'>"
."Add&nbsp;Comment</a></p>\n");
$num_comments = show_comments("documentation.php$path");
if ($num_comments == 0)
print("<p>No comments for this page.</p>\n");
html_footer();
}
else
{
header("Content-Type: image/$type");
print(fread($fp, filesize("docfiles$path")));
fclose($fp);
}
}
}
else
{
html_header("Documentation");
if (array_key_exists("CLEAR", $_GET))
$q = "";
else if (array_key_exists("Q", $_GET))
$q = $_GET["Q"];
else
$q = "";
$html = htmlspecialchars($q, ENT_QUOTES);
if (stripos($_SERVER["HTTP_USER_AGENT"], "webkit") !== FALSE)
{
// Use Safari search box...
$search = "<input type='search' name='Q' value='$html' size='50' "
."autosave='com.easysw.mxml.search' results='5' "
."placeholder='Search'>";
}
else
{
// Use standard HTML text field...
$search = "<input type='text' name='Q' value='$html' size='40' "
."title='Search'> "
."<input type='submit' value='Search'> "
."<input type='submit' name='CLEAR' value='Clear'>";
}
print("<form action='$PHP_SELF' method='GET'>\n"
."<p align='center'>$search</p>\n"
."</form>\n");
if ($q != "")
{
// Run htmlsearch to search the documentation...
$matches = array();
$scores = array();
$maxscore = 0;
$fp = popen("/usr/local/bin/websearch docfiles " . escapeshellarg($q),
"r");
fgets($fp, 1024);
while ($line = fgets($fp, 1024))
{
$data = explode("|", $line);
$matches[$data[1]] = $data[2];
$scores[$data[1]] = $data[0];
if ($maxscore == 0)
$maxscore = $data[0];
}
pclose($fp);
// Show the results...
if (sizeof($matches) == 1)
$total = "1 match";
else
$total = sizeof($matches) . " matches";
print("<p>$total found:</p>\n"
."<table symmary=\"Search Results\">\n");
reset($matches);
foreach ($matches as $file => $text)
{
$link = "$PHP_SELF/$file";
$score = str_repeat("&#x2605;",
(int)(4 * $scores[$file] / $maxscore) + 1);
print("<tr><td style=\"font-size: 50%;\">$score&nbsp;&nbsp;&nbsp;</td>"
."<td><a href='$link'>$text</a></td></tr>\n");
}
print("</table>\n");
}
else
{
?>
<p>You can view the Mini-XML documentation in a single HTML file or in
multiple files with comments on-line:</p>
<ul>
<li><a href='mxml.html'>HTML in one file (169k)</a></li>
<li><a href='documentation.php/index.html'>HTML in
separate files with Comments</a>
<ul>
<li><a
href='documentation.php/intro.html'>Introduction</a></li>
<li><a
href='documentation.php/install.html'>Building,
Installing, and Packaging Mini-XML</a></li>
<li><a href='documentation.php/basics.html'>Getting
Started with Mini-XML</a></li>
<li><a href='documentation.php/advanced.html'>More
Mini-XML Programming Techniques</a></li>
<li><a href='documentation.php/mxmldoc.html'>Using
the mxmldoc Utility</a></li>
<li><a
href='documentation.php/license.html'>Mini-XML
License</a></li>
<li><a
href='documentation.php/relnotes.html'>Release
Notes</a></li>
<li><a href='documentation.php/reference.html'>Library
Reference</a></li>
</ul></li>
</ul>
<p>You can also get a printed version of the Mini-XML documentation on
<a href="http://www.lulu.com/content/820838">Lulu.com</a>.</p>
<?php
}
html_footer();
}
//
// End of "$Id$".
//
?>

File diff suppressed because it is too large Load Diff

@ -1,2 +0,0 @@
DirectoryIndex off

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 B

@ -1,93 +0,0 @@
<?php
//
// "$Id$"
//
// Mini-XML home page...
//
include_once "phplib/html.php";
include_once "phplib/common.php";
include_once "phplib/poll.php";
html_header();
$fp = fopen("data/software.md5", "r");
$line = fgets($fp, 255);
$data = explode(" ", $line);
fclose($fp);
$version = $data[1];
$file = $data[2];
?>
<div style='margin-left: 20px; float: right; line-height: 200%;
text-align: center;'><a
href='software.php?FILE=<?print($file);?>&amp;VERSION=<?print($version);?>'><img
src='images/logo-large.gif' width='150' height='150' alt='Mini-XML logo'><br>
Download v<?print($version);?></a></div>
<h1>Mini-XML: Lightweight XML Library</h1>
<p>Mini-XML is a small XML library that you can use to read and write XML and
XML-like data files in your application without requiring large non-standard
libraries. Mini-XML only requires an ANSI C compatible compiler (GCC works, as
do most vendors' ANSI C compilers) and a 'make' program.</p>
<p>Mini-XML supports reading of UTF-8 and UTF-16 and writing of UTF-8 encoded
XML files and strings. Data is stored in a linked-list tree structure,
preserving the XML data hierarchy, and arbitrary element names, attributes,
and attribute values are supported with no preset limits, just available
memory.</p>
<table width='100%' cellpadding='0' cellspacing='0' border='0' summary=''>
<tr><td valign='top' width='45%'>
<h2>Documentation</h2>
<p><a href='documentation.php/intro.html'>Introduction</a></p>
<p><a href='documentation.php/basics.html'>Getting Started with Mini-XML</a></p>
<p><a href='documentation.php/advanced.html'>More Mini-XML Programming
Techniques</a></p>
<p><a href='documentation.php/license.html'>Mini-XML License</a></p>
<p><a href='documentation.php/reference.html'>Library Reference</a></p>
</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td valign='top' width='55%'>
<h2>Recent News</h2>
<?
$result = db_query("SELECT * FROM article WHERE is_published = 1 "
."ORDER BY modify_date DESC LIMIT 3");
$count = db_count($result);
while ($row = db_next($result))
{
$id = $row['id'];
$title = htmlspecialchars($row['title']);
$abstract = htmlspecialchars($row['abstract']);
$date = date("H:i M d, Y", $row['modify_date']);
$count = count_comments("articles.php_L$id");
if ($count == 1)
$count .= " comment";
else
$count .= " comments";
print("<p><a href='articles.php?L$id'>$title</a> - $abstract<br>\n"
."<span class='dateinfo'>$date, $count</span></p>\n");
}
db_free($result);
?>
</td></tr>
</table>
<? html_footer(); ?>

@ -1,264 +0,0 @@
<?php
//
// "$Id$"
//
// Login/registration form...
//
//
// Include necessary headers...
//
include_once "phplib/html.php";
include_once "phplib/common.php";
$usererror = "";
if (array_key_exists("PAGE", $_GET))
$page = $_GET["PAGE"];
else if (array_key_exists("PAGE", $_POST))
$page = $_POST["PAGE"];
else
$page = "account.php";
if ($REQUEST_METHOD == "POST")
{
if (array_key_exists("USERNAME", $_POST))
$username = $_POST["USERNAME"];
else
$username = "";
if (array_key_exists("PASSWORD", $_POST))
$password = $_POST["PASSWORD"];
else
$password = "";
if (array_key_exists("PASSWORD2", $_POST))
$password2 = $_POST["PASSWORD2"];
else
$password2 = "";
if (array_key_exists("EMAIL", $_POST))
$email = $_POST["EMAIL"];
else
$email = "";
if (array_key_exists("REGISTER", $_POST))
$register = $_POST["REGISTER"];
else
$register = "";
if ($username != "" && !eregi("^[-a-z0-9._]+\$", $username))
$usererror = "Bad username - only letters, numbers, '.', '-', and '_' "
."are allowed!";
else if ($argc == 1 && $argv[0] == "A" && $username != "" &&
$password != "" && $password == $password2 &&
$email != "" && validate_email($email))
{
// Good new account request so far; see if account already
// exists...
$name = db_escape($username);
$result = db_query("SELECT * FROM users WHERE name='$name'");
if (db_count($result) == 0)
{
// Nope, add unpublished user account and send registration email.
db_free($result);
$hash = md5("$username:$password");
$demail = db_escape($email);
$date = time();
db_query("INSERT INTO users VALUES(NULL, 0, '$name', '$demail', '$hash', "
."0, $date, '$name', $date, '$name')");
$userid = db_insert_id();
$hash = md5("$userid:$hash");
mail($email, "$PROJECT_NAME User Registration",
wordwrap("Thank you for requesting an account on the $PROJECT_NAME "
."home page. To complete your registration, go to the "
."following URL:\n\n"
." $PHP_URL?E\n\n"
."and enter your username ($username), password, and the "
."following registration code:\n\n"
." $hash\n\n"
."You will then be able to access your account.\n"),
"From: $PROJECT_EMAIL\r\n");
html_header("Login Registration");
html_start_links(1);
html_link("Enable Account", "$PHP_SELF?E");
html_end_links();
print("Thank you for requesting an account. You should receive an "
."email from $PROJECT_EMAIL shortly with instructions on "
."completing your registration.</p>\n");
html_footer();
exit();
}
db_free($result);
$usererror = "Username already exists!";
}
else if ($argc == 1 && $argv[0] == "E" && $username != "" &&
$password != "" && $register != "")
{
// Check that we have an existing user account...
$name = db_escape($username);
$result = db_query("SELECT * FROM users WHERE name='$name'");
if (db_count($result) == 1)
{
// Yes, now check the registration code...
$row = db_next($result);
$hash = md5("$row[id]:$row[hash]");
if ($hash == $register)
{
// Good code, enable the account and login...
db_query("UPDATE users SET is_published = 1 WHERE name='$name'");
if (auth_login($username, $password) == "")
{
db_query("UPDATE users SET is_published = 0 WHERE name='$name'");
$usererror = "Login failed!";
}
}
else
$usererror = "Bad registration code!";
}
else
$usererror = "Username not found!";
db_free($result);
}
else if ($argc == 0 && $username != "" && $password != "")
if (auth_login($username, $password) == "")
$usererror = "Login failed!";
}
else
{
$username = "";
$password = "";
$password2 = "";
$email = "";
$register = "";
}
if ($LOGIN_USER != "")
header("Location: $page");
else if ($argc == 0 || $argv[0] != "E")
{
// Header + start of table...
html_header("Login");
print("<table width='100%' height='100%' border='0' cellpadding='0' "
."cellspacing='0'>\n"
."<tr><td valign='top'>\n");
// Existing users...
print("<h1>Current Users</h1>\n");
if ($argc == 0 && $usererror != "")
print("<p><b>$usererror</b></p>\n");
$page = htmlspecialchars($page, ENT_QUOTES);
print("<p>If you are a registered $PROJECT_NAME developer, please enter "
."your username and password to login:</p>\n"
."<form method='POST' action='$PHP_SELF'>"
."<input type='hidden' name='PAGE' value='$page'>"
."<table width='100%'>\n"
."<tr><th align='right'>Username:</th>"
."<td><input type='text' name='USERNAME' size='16' maxsize='255'");
if (array_key_exists("USERNAME", $_POST))
print(" value='" . htmlspecialchars($_POST["USERNAME"], ENT_QUOTES) . "'");
print("></td></tr>\n"
."<tr><th align='right'>Password:</th>"
."<td><input type='password' name='PASSWORD' size='16' maxsize='255'>"
."</td></tr>\n"
."<tr><th></th><td><input type='submit' value='Login'></td></tr>\n"
."</table></form>\n");
// Separator...
print("</td>"
."<td>&nbsp;&nbsp;&nbsp;&nbsp;"
."<img src='images/black.gif' width='1' height='80%' alt=''>"
."&nbsp;&nbsp;&nbsp;&nbsp;</td>"
."<td valign='top'>\n");
// New users...
print("<h1>New Users</h1>\n");
if ($argc == 1 && $usererror != "")
print("<p><b>$usererror</b></p>\n");
$username = htmlspecialchars($username, ENT_QUOTES);
$email = htmlspecialchars($email, ENT_QUOTES);
print("<p>If you are a not registered $PROJECT_NAME developer, please fill "
."in the form below to register. An email will be sent to the "
."address you supply to confirm the registration:</p>\n"
."<form method='POST' action='$PHP_SELF?A'>"
."<input type='hidden' name='PAGE' value='$page'>"
."<table width='100%'>\n"
."<tr><th align='right'>Username:</th>"
."<td><input type='text' name='USERNAME' size='16' maxsize='255' "
." value='$username'></td></tr>\n"
."<tr><th align='right'>EMail:</th>"
."<td><input type='text' name='EMAIL' size='16' maxsize='255' "
." value='$email'></td></tr>\n"
."<tr><th align='right'>Password:</th>"
."<td><input type='password' name='PASSWORD' size='16' maxsize='255'>"
."</td></tr>\n"
."<tr><th align='right'>Password Again:</th>"
."<td><input type='password' name='PASSWORD2' size='16' maxsize='255'>"
."</td></tr>\n"
."<tr><th></th><td><input type='submit' value='Request Account'></td></tr>\n"
."</table></form>\n");
// End table
print("</td></tr>\n"
."</table>\n");
html_footer();
}
else
{
html_header("Enable Account");
if ($usererror != NULL)
print("<p><b>$usererror</b></p>\n");
$username = htmlspecialchars($username, ENT_QUOTES);
$register = htmlspecialchars($register, ENT_QUOTES);
print("<p>Please enter the registration code that was emailed to you "
."with your username and password to enable your account and login:</p>\n"
."<form method='POST' action='$PHP_SELF?E'>"
."<center><table width='100%'>\n"
."<tr><th align='right'>Registration Code:</th>"
."<td><input type='text' name='REGISTER' size='32' maxsize='32' "
."value = '$register'>"
."</td></tr>\n"
."<tr><th align='right'>Username:</th>"
."<td><input type='text' name='USERNAME' size='16' maxsize='255' "
."value='$username'></td></tr>\n"
."<tr><th align='right'>Password:</th>"
."<td><input type='password' name='PASSWORD' size='16' maxsize='255'>"
."</td></tr>\n"
."<tr><th></th><td><input type='submit' value='Enable Account'></td></tr>\n"
."</table></center></form>\n");
html_footer();
}
//
// End of "$Id$".
//
?>

File diff suppressed because it is too large Load Diff

@ -1,189 +0,0 @@
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Mini-XML 2.7 documentation schema for mxmldoc output.
Copyright 2003-2011 by Michael Sweet.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
</xsd:documentation>
</xsd:annotation>
<!-- basic element definitions -->
<xsd:element name="argument" type="argumentType"/>
<xsd:element name="class" type="classType"/>
<xsd:element name="constant" type="constantType"/>
<xsd:element name="description" type="xsd:string"/>
<xsd:element name="enumeration" type="enumerationType"/>
<xsd:element name="function" type="functionType"/>
<xsd:element name="mxmldoc" type="mxmldocType"/>
<xsd:element name="namespace" type="namespaceType"/>
<xsd:element name="returnvalue" type="returnvalueType"/>
<xsd:element name="seealso" type="identifierList"/>
<xsd:element name="struct" type="structType"/>
<xsd:element name="typedef" type="typedefType"/>
<xsd:element name="type" type="xsd:string"/>
<xsd:element name="union" type="unionType"/>
<xsd:element name="variable" type="variableType"/>
<!-- descriptions of complex elements -->
<xsd:complexType name="argumentType">
<xsd:sequence>
<xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="default" type="xsd:string" use="optional"/>
<xsd:attribute name="name" type="identifier" use="required"/>
<xsd:attribute name="direction" type="direction" use="optional" default="I"/>
</xsd:complexType>
<xsd:complexType name="classType">
<xsd:sequence>
<xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="class"/>
<xsd:element ref="enumeration"/>
<xsd:element ref="function"/>
<xsd:element ref="struct"/>
<xsd:element ref="typedef"/>
<xsd:element ref="union"/>
<xsd:element ref="variable"/>
</xsd:choice>
</xsd:sequence>
<xsd:attribute name="name" type="identifier" use="required"/>
<xsd:attribute name="parent" type="xsd:string" use="optional"/>
</xsd:complexType>
<xsd:complexType name="constantType">
<xsd:sequence>
<xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="name" type="identifier" use="required"/>
</xsd:complexType>
<xsd:complexType name="enumerationType">
<xsd:sequence>
<xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="constant" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="name" type="identifier" use="required"/>
</xsd:complexType>
<xsd:complexType name="functionType">
<xsd:sequence>
<xsd:element ref="returnvalue" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="argument" minOccurs="1" maxOccurs="unbounded"/>
<xsd:element ref="seealso" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="name" type="identifier" use="required"/>
<xsd:attribute name="scope" type="scope" use="optional"/>
</xsd:complexType>
<xsd:complexType name="mxmldocType">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="class"/>
<xsd:element ref="enumeration"/>
<xsd:element ref="function"/>
<xsd:element ref="namespace"/>
<xsd:element ref="struct"/>
<xsd:element ref="typedef"/>
<xsd:element ref="union"/>
<xsd:element ref="variable"/>
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="namespaceType">
<xsd:sequence>
<xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="class"/>
<xsd:element ref="enumeration"/>
<xsd:element ref="function"/>
<xsd:element ref="struct"/>
<xsd:element ref="typedef"/>
<xsd:element ref="union"/>
<xsd:element ref="variable"/>
</xsd:choice>
</xsd:sequence>
<xsd:attribute name="name" type="identifier" use="required"/>
</xsd:complexType>
<xsd:complexType name="returnvalueType">
<xsd:sequence>
<xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="structType">
<xsd:sequence>
<xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="variable"/>
<xsd:element ref="function"/>
</xsd:choice>
</xsd:sequence>
<xsd:attribute name="name" type="identifier" use="required"/>
</xsd:complexType>
<xsd:complexType name="typedefType">
<xsd:sequence>
<xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="name" type="identifier" use="required"/>
</xsd:complexType>
<xsd:complexType name="unionType">
<xsd:sequence>
<xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="variable" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="name" type="identifier" use="required"/>
</xsd:complexType>
<xsd:complexType name="variableType">
<xsd:sequence>
<xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="name" type="identifier" use="required"/>
</xsd:complexType>
<!-- data types -->
<xsd:simpleType name="direction">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="I"/>
<xsd:enumeration value="O"/>
<xsd:enumeration value="IO"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="identifier">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[a-zA-Z_(.]([a-zA-Z_(.,)* 0-9])*"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="identifierList">
<xsd:list itemType="identifier"/>
</xsd:simpleType>
<xsd:simpleType name="scope">
<xsd:restriction base="xsd:string">
<xsd:enumeration value=""/>
<xsd:enumeration value="private"/>
<xsd:enumeration value="protected"/>
<xsd:enumeration value="public"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>

@ -1,16 +0,0 @@
<?xml version="1.0" standalone="no"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:docset="http://developer.apple.com/rss/docset_extensions" xml:lang="en">
<id>http://www.minixml.org/org.minixml.atom/20111220234804</id>
<title type="text">minixml.org</title>
<link rel="self" href="http://www.minixml.org/org.minixml.atom"></link>
<updated>2011-12-20T23:48:04-08:00</updated>
<entry>
<id>tag:www.minixml.org,2011-12-20:org.minixml.docset/2.7.0</id>
<title type="text">Mini-XML API Reference</title>
<updated>2011-12-20T23:48:04-08:00</updated>
<content type="text">Mini-XML API Reference (v2.7.0)</content>
<link rel="enclosure" type="application/octet-stream" href="http://www.minixml.org/org.minixml.xar" length="48828"></link>
<docset:identifier>org.minixml.docset</docset:identifier>
<docset:version>2.7.0</docset:version>
</entry>
</feed>

Binary file not shown.

@ -1,3 +0,0 @@
Order deny,allow
Allow from none

@ -1,183 +0,0 @@
<?
//
// "$Id: auth.php,v 1.8 2004/05/20 02:04:45 mike Exp $"
//
// Authentication functions for PHP pages...
//
// Contents:
//
// auth_current() - Return the currently logged in user...
// auth_login() - Log a user into the system.
// auth_logout() - Logout of the current user by clearing the session ID.
// auth_user_email() - Return the email address of a user...
//
//
// Include necessary headers...
//
include_once "db.php";
//
// Define authorization levels...
//
define("AUTH_USER", 0);
define("AUTH_DEVEL", 50);
define("AUTH_ADMIN", 100);
//
// Store the current user in the global variable LOGIN_USER...
//
$LOGIN_LEVEL = 0;
$LOGIN_USER = "";
$LOGIN_EMAIL = "";
auth_current();
//
// 'auth_current()' - Return the currently logged in user...
//
function // O - Current username or ""
auth_current()
{
global $_COOKIE, $_SERVER, $LOGIN_EMAIL, $LOGIN_LEVEL, $LOGIN_USER;
// See if the SID cookie is set; if not, the user is not logged in...
if (!array_key_exists("SID", $_COOKIE))
return ("");
// Extract the "username:hash" from the SID string...
$cookie = explode(':', $_COOKIE["SID"]);
// Don't allow invalid values...
if (count($cookie) != 2)
return ("");
// Lookup the username in the users table and compare...
$result = db_query("SELECT * FROM users WHERE "
."name='".db_escape($cookie[0])."' AND "
."is_published = 1");
if (db_count($result) == 1 && ($row = db_next($result)))
{
// Compute the session ID...
$sid = md5("$_SERVER[REMOTE_ADDR]:$row[hash]");
// See if it matches the cookie value...
if ($cookie[1] == $sid)
{
// Refresh the cookies so they don't expire...
setcookie("SID", "$cookie[0]:$sid", time() + 90 * 86400, "/");
setcookie("FROM", $row['email'], time() + 90 * 86400, "/");
// Set globals...
$LOGIN_USER = $cookie[0];
$LOGIN_LEVEL = $row["level"];
$LOGIN_EMAIL = $row["email"];
$_COOKIE["FROM"] = $row["email"];
// Return the current user...
return ($cookie[0]);
}
}
return ("");
}
//
// 'auth_login()' - Log a user into the system.
//
function // O - Current username or ""
auth_login($name, // I - Username
$password) // I - Password
{
global $_COOKIE, $_SERVER, $LOGIN_EMAIL, $LOGIN_LEVEL, $LOGIN_USER;
// Reset the user...
$LOGIN_USER = "";
// Lookup the username in the database...
$result = db_query("SELECT * FROM users WHERE "
."name='".db_escape($name)."' AND "
."is_published = 1");
if (db_count($result) == 1 && ($row = db_next($result)))
{
// Compute the hash of the name and password...
$hash = md5("$name:$password");
// See if they match...
if ($row["hash"] == $hash)
{
// Update the username and email...
$LOGIN_USER = $name;
$LOGIN_LEVEL = $row["level"];
$LOGIN_EMAIL = $row["email"];
$_COOKIE["FROM"] = $row["email"];
// Compute the session ID...
$sid = "$name:" . md5("$_SERVER[REMOTE_ADDR]:$hash");
// Save the SID and email address cookies...
setcookie("SID", $sid, time() + 90 * 86400, "/");
setcookie("FROM", $row['email'], time() + 90 * 86400, "/");
}
}
return ($LOGIN_USER);
}
//
// 'auth_logout()' - Logout of the current user by clearing the session ID.
//
function
auth_logout()
{
global $LOGIN_EMAIL, $LOGIN_LEVEL, $LOGIN_USER;
$LOGIN_USER = "";
$LOGIN_EMAIL = "";
$LOGIN_LEVEL = 0;
setcookie("SID", "", time() + 90 * 86400, "/");
}
//
// 'auth_user_email()' - Return the email address of a user...
//
function // O - Email address
auth_user_email($username) // I - Username
{
$result = db_query("SELECT * FROM users WHERE "
."name = '" . db_escape($username) . "'");
if (db_count($result) == 1)
{
$row = db_next($result);
$email = $row["email"];
}
else
$email = "";
db_free($result);
return ($email);
}
//
// End of "$Id: auth.php,v 1.8 2004/05/20 02:04:45 mike Exp $".
//
?>

@ -1,681 +0,0 @@
<?
//
// "$Id: common.php,v 1.12 2004/05/20 21:37:57 mike Exp $"
//
// Common utility functions for PHP pages...
//
// This file should be included using "include_once"...
//
// Contents:
//
// abbreviate() - Abbreviate long strings...
// format_text() - Convert plain text to HTML...
// quote_text() - Quote a string...
// sanitize_email() - Convert an email address to something a SPAMbot
// can't read...
// sanitize_text() - Sanitize text.
// select_is_published() - Do a <select> for the "is published" field...
// show_comments() - Show comments for the given path...
// validate_email() - Validate an email address...
//
//
// 'abbreviate()' - Abbreviate long strings...
//
function // O - Abbreviated string
abbreviate($text, // I - String
$maxlen = 32) // I - Maximum length of string
{
$newtext = "";
$textlen = strlen($text);
$inelement = 0;
for ($i = 0, $len = 0; $i < $textlen && $len < $maxlen; $i ++)
switch ($text[$i])
{
case '<' :
$inelement = 1;
break;
case '>' :
if ($inelement)
$inelement = 0;
else
{
$newtext .= "&gt;";
$len ++;
}
break;
case '&' :
$len ++;
while ($i < $textlen)
{
$newtext .= $text[$i];
if ($text[$i] == ';')
break;
$i ++;
}
break;
default :
if (!$inelement)
{
$newtext .= $text[$i];
$len ++;
}
break;
}
if ($i < $textlen)
return ($newtext . "...");
else
return ($newtext);
}
//
// 'count_comments()' - Count visible comments for the given path...
//
function // O - Number of comments
count_comments($url, // I - URL for comment
$parent_id = 0) // I - Parent comment
{
$result = db_query("SELECT * FROM comment WHERE "
."url = '" . db_escape($url) ."' "
."AND parent_id = $parent_id "
."ORDER BY id");
$num_comments = 0;
while ($row = db_next($result))
{
if ($row["status"] > 0)
$num_comments ++;
$num_comments += count_comments($url, $row['id']);
}
db_free($result);
return ($num_comments);
}
//
// 'format_text()' - Convert plain text to HTML...
//
function // O - Quoted string
format_text($text) // I - Original string
{
$len = strlen($text);
$col = 0;
$list = 0;
$bold = 0;
$pre = 0;
$ftext = "<p>";
for ($i = 0; $i < $len; $i ++)
{
switch ($text[$i])
{
case '<' :
$col ++;
if (strtolower(substr($text, $i, 8)) == "<a href=" ||
strtolower(substr($text, $i, 8)) == "<a name=" ||
strtolower(substr($text, $i, 4)) == "</a>" ||
strtolower(substr($text, $i, 3)) == "<b>" ||
strtolower(substr($text, $i, 4)) == "</b>" ||
strtolower(substr($text, $i, 12)) == "<blockquote>" ||
strtolower(substr($text, $i, 13)) == "</blockquote>" ||
strtolower(substr($text, $i, 6)) == "<code>" ||
strtolower(substr($text, $i, 7)) == "</code>" ||
strtolower(substr($text, $i, 4)) == "<em>" ||
strtolower(substr($text, $i, 5)) == "</em>" ||
strtolower(substr($text, $i, 4)) == "<h1>" ||
strtolower(substr($text, $i, 5)) == "</h1>" ||
strtolower(substr($text, $i, 4)) == "<h2>" ||
strtolower(substr($text, $i, 5)) == "</h2>" ||
strtolower(substr($text, $i, 4)) == "<h3>" ||
strtolower(substr($text, $i, 5)) == "</h3>" ||
strtolower(substr($text, $i, 4)) == "<h4>" ||
strtolower(substr($text, $i, 5)) == "</h4>" ||
strtolower(substr($text, $i, 4)) == "<h5>" ||
strtolower(substr($text, $i, 5)) == "</h5>" ||
strtolower(substr($text, $i, 4)) == "<h6>" ||
strtolower(substr($text, $i, 5)) == "</h6>" ||
strtolower(substr($text, $i, 3)) == "<i>" ||
strtolower(substr($text, $i, 4)) == "</i>" ||
strtolower(substr($text, $i, 5)) == "<img " ||
strtolower(substr($text, $i, 4)) == "<li>" ||
strtolower(substr($text, $i, 5)) == "</li>" ||
strtolower(substr($text, $i, 4)) == "<ol>" ||
strtolower(substr($text, $i, 5)) == "</ol>" ||
strtolower(substr($text, $i, 3)) == "<p>" ||
strtolower(substr($text, $i, 4)) == "</p>" ||
strtolower(substr($text, $i, 5)) == "<pre>" ||
strtolower(substr($text, $i, 6)) == "</pre>" ||
strtolower(substr($text, $i, 4)) == "<tt>" ||
strtolower(substr($text, $i, 5)) == "</tt>" ||
strtolower(substr($text, $i, 3)) == "<u>" ||
strtolower(substr($text, $i, 4)) == "</u>" ||
strtolower(substr($text, $i, 4)) == "<ul>" ||
strtolower(substr($text, $i, 5)) == "</ul>")
{
while ($i < $len && $text[$i] != '>')
{
$ftext .= $text[$i];
$i ++;
}
$ftext .= ">";
}
else
$ftext .= "&lt;";
break;
case '>' :
$col ++;
$ftext .= "&gt;";
break;
case '&' :
$col ++;
$ftext .= "&amp;";
break;
case "\n" :
if (($i + 1) < $len &&
($text[$i + 1] == "\n" || $text[$i + 1] == "\r"))
{
while (($i + 1) < $len &&
($text[$i + 1] == "\n" || $text[$i + 1] == "\r"))
$i ++;
if ($pre)
{
$ftext .= "</pre>";
$pre = 0;
}
if (($i + 1) < $len && $text[$i + 1] != '-' && $list)
{
$ftext .= "\n</ul>\n<p>";
$list = 0;
}
else
$ftext .= "\n<p>";
}
else if (($i + 1) < $len &&
($text[$i + 1] == " " || $text[$i + 1] == "\t"))
{
if ($pre)
{
$ftext .= "</pre>";
$pre = 0;
}
else
$ftext .= "<br />\n";
}
else
$ftext .= "\n";
$col = 0;
break;
case "\r" :
break;
case "\t" :
if ($col == 0)
$ftext .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
else
$ftext .= " ";
break;
case " " :
if ($col == 0 && !$pre)
{
for ($j = $i + 1; $j < $len; $j ++)
if ($text[$j] != " " && $text[$j] != "\t")
break;
if ($j < $len && $text[$j] == '%')
{
$ftext .= "\n<pre>";
$pre = 1;
}
$ftext .= "&nbsp;";
}
else if ($text[$i + 1] == " ")
$ftext .= "&nbsp;";
else
$ftext .= " ";
if ($col > 0)
$col ++;
break;
case '*' :
if ($bold)
$ftext .= "</b>";
else
$ftext .= "<b>";
$bold = 1 - $bold;
break;
case '-' :
// Possible list...
if ($col == 0)
{
if (!$list)
{
$ftext .= "\n<ul>";
$list = 1;
}
$ftext .= "\n<li>";
while (($i + 1) < $len && $text[$i + 1] == "-")
$i ++;
break;
}
$col ++;
$ftext .= $text[$i];
break;
case 'f' :
case 'h' :
if (substr($text, $i, 7) == "http://" ||
substr($text, $i, 8) == "https://" ||
substr($text, $i, 6) == "ftp://")
{
// Extract the URL and make this a link...
for ($j = $i; $j < $len; $j ++)
if ($text[$j] == " " || $text[$j] == "\n" || $text[$j] == "\r" ||
$text[$j] == "\t" || $text[$j] == "\'" || $text[$j] == "'")
break;
$count = $j - $i;
$url = substr($text, $i, $count);
$ftext .= "<a href='$url'>$url</a>";
$col += $count;
$i = $j - 1;
break;
}
default :
$col ++;
$ftext .= $text[$i];
break;
}
}
if ($bold)
$ftext .= "</b>";
if ($list)
$ftext .= "</ul>";
if ($pre)
$ftext .= "</pre>";
return ($ftext);
}
//
// 'quote_text()' - Quote a string...
//
function // O - Quoted string
quote_text($text, // I - Original string
$quote = 0) // I - Add ">" to front of message
{
$len = strlen($text);
$col = 0;
if ($quote)
$qtext = "&gt; ";
else
$qtext = "";
for ($i = 0; $i < $len; $i ++)
{
switch ($text[$i])
{
case '<' :
$col ++;
$qtext .= "&lt;";
break;
case '>' :
$col ++;
$qtext .= "&gt;";
break;
case '&' :
$col ++;
$qtext .= "&amp;";
break;
case "\n" :
if ($quote)
$qtext .= "\n&gt; ";
else
$qtext .= "<br />";
$col = 0;
break;
case "\r" :
break;
case "\t" :
if ($col == 0)
$qtext .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
else
$qtext .= " ";
break;
case " " :
if ($col == 0 || $text[$i + 1] == " ")
$qtext .= "&nbsp;";
else if ($col > 65 && $quote)
{
$qtext .= "\n&gt; ";
$col = 0;
}
else
$qtext .= " ";
if ($col > 0)
$col ++;
break;
case 'f' :
case 'h' :
if (substr($text, $i, 7) == "http://" ||
substr($text, $i, 8) == "https://" ||
substr($text, $i, 6) == "ftp://")
{
// Extract the URL and make this a link...
for ($j = $i; $j < $len; $j ++)
if ($text[$j] == " " || $text[$j] == "\n" || $text[$j] == "\r" ||
$text[$j] == "\t" || $text[$j] == "\'" || $text[$j] == "'")
break;
$count = $j - $i;
$url = substr($text, $i, $count);
$qtext .= "<a href='$url'>$url</a>";
$col += $count;
$i = $j - 1;
break;
}
default :
$col ++;
$qtext .= $text[$i];
break;
}
}
return ($qtext);
}
//
// 'sanitize_email()' - Convert an email address to something a SPAMbot
// can't read...
//
function // O - Sanitized email
sanitize_email($email, // I - Email address
$html = 1) // I - HTML format?
{
$nemail = "";
$len = strlen($email);
for ($i = 0; $i < $len; $i ++)
{
switch ($email[$i])
{
case '@' :
if ($i > 0)
$i = $len;
else if ($html)
$nemail .= " <I>at</I> ";
else
$nemail .= " at ";
break;
case '<' :
if ($i > 0)
$i = $len;
break;
case '>' :
break;
case '&' ;
$nemail .= "&amp;";
break;
default :
$nemail .= $email[$i];
break;
}
}
return (trim($nemail));
}
//
// 'sanitize_text()' - Sanitize text.
//
function // O - Sanitized text
sanitize_text($text) // I - Original text
{
$len = strlen($text);
$word = "";
$qtext = "";
for ($i = 0; $i < $len; $i ++)
{
switch ($text[$i])
{
case "\n" :
if (!strncmp($word, "http://", 7) ||
!strncmp($word, "https://", 8) ||
!strncmp($word, "ftp://", 6))
$qtext .= "<a href='$word'>$word</a>";
else if (strchr($word, '@'))
$qtext .= sanitize_email($word);
else
$qtext .= quote_text($word);
$qtext .= "<br />";
$word = "";
break;
case "\r" :
break;
case "\t" :
case " " :
if (!strncmp($word, "http://", 7) ||
!strncmp($word, "https://", 8) ||
!strncmp($word, "ftp://", 6))
$qtext .= "<a href='$word'>$word</a>";
else if (strchr($word, '@'))
$qtext .= sanitize_email($word);
else
$qtext .= quote_text($word);
if ($word)
$qtext .= " ";
else
$qtext .= "&nbsp;";
$word = "";
break;
default :
$word .= $text[$i];
break;
}
}
if (!strncmp($word, "http://", 7) ||
!strncmp($word, "https://", 8) ||
!strncmp($word, "ftp://", 6))
$qtext .= "<a href='$word'>$word</a>";
else if (strchr($word, '@'))
$qtext .= sanitize_email($word);
else
$qtext .= quote_text($word);
return ($qtext);
}
//
// 'select_is_published()' - Do a <select> for the "is published" field...
//
function
select_is_published($is_published = 1) // I - Default state
{
print("<select name='IS_PUBLISHED'>");
if ($is_published)
{
print("<option value='0'>No</option>");
print("<option value='1' selected>Yes</option>");
}
else
{
print("<option value='0' selected>No</option>");
print("<option value='1'>Yes</option>");
}
print("</select>");
}
//
// 'show_comments()' - Show comments for the given path...
//
function // O - Number of comments
show_comments($url, // I - URL for comment
$path = "", // I - Path component
$parent_id = 0, // I - Parent comment
$heading = 3) // I - Heading level
{
global $_COOKIE, $LOGIN_LEVEL;
$result = db_query("SELECT * FROM comment WHERE "
."url = '" . db_escape($url) ."' "
."AND parent_id = $parent_id "
."ORDER BY id");
if (array_key_exists("MODPOINTS", $_COOKIE))
$modpoints = $_COOKIE["MODPOINTS"];
else
$modpoints = 5;
if ($parent_id == 0 && $modpoints > 0)
print("<P>You have $modpoints moderation points available.</P>\n");
if ($heading > 6)
$heading = 6;
$safeurl = urlencode($url);
$num_comments = 0;
$div = 0;
while ($row = db_next($result))
{
if ($row["status"] > 0)
{
if ($heading > 3 && !$div)
{
print("<div style='margin-left: 3em;'>\n");
$div = 1;
}
$num_comments ++;
$create_date = date("H:i M d, Y", $row['create_date']);
$create_user = sanitize_email($row['create_user']);
$contents = format_text($row['contents']);
print("<h$heading><a name='_USER_COMMENT_$row[id]'>From</a> "
."$create_user, $create_date (score=$row[status])</h$heading>\n"
."$contents\n");
html_start_links();
if ($LOGIN_LEVEL >= AUTH_DEVEL)
{
html_link("Edit", "${path}comment.php?e$row[id]+p$safeurl");
html_link("Delete", "${path}comment.php?d$row[id]+p$safeurl");
}
html_link("Reply", "${path}comment.php?r$row[id]+p$safeurl");
if ($modpoints > 0)
{
if ($row['status'] > 0)
html_link("Moderate Down", "${path}comment.php?md$row[id]+p$safeurl");
if ($row['status'] < 5)
html_link("Moderate Up", "${path}comment.php?mu$row[id]+p$safeurl");
}
html_end_links();
}
$num_comments += show_comments($url, $path, $row['id'], $heading + 1);
}
db_free($result);
if ($div)
print("</div>\n");
return ($num_comments);
}
//
// 'validate_email()' - Validate an email address...
//
function // O - TRUE if OK, FALSE otherwise
validate_email($email) // I - Email address
{
// Check for both "name@domain.com" and "Full Name <name@domain.com>"
return (eregi("^[a-zA-Z0-9_\.+-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z]{2,4}$",
$email) ||
eregi("^[^<]*<[a-zA-Z0-9_\.+-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z]{2,4}>$",
$email));
}
//
// End of "$Id: common.php,v 1.12 2004/05/20 21:37:57 mike Exp $".
//
?>

@ -1,159 +0,0 @@
<?php
//
// "$Id: db.php,v 1.5 2004/05/21 03:59:17 mike Exp $"
//
// Common database include file for PHP web pages. This file can be used
// to abstract the specific database in use...
//
// This version is for the SQLite database and module.
//
// This file should be included using "include_once"...
//
// Contents:
//
// db_close() - Close the database.
// db_count() - Return the number of rows in a query result.
// db_escape() - Escape special chars in string for query.
// db_free() - Free a database query result...
// db_insert_id() - Return the ID of the last inserted record.
// db_next() - Fetch the next row of a result set and return it as
// an object.
// db_query() - Run a SQL query and return the result or 0 on error.
// db_seek() - Seek to a specific row within a result.
//
// Some static database access info.
$DB_ADMIN = "webmaster@easysw.com";
$DB_HOST = "localhost";
$DB_NAME = "mxml";
$DB_USER = "mike";
$DB_PASSWORD = "";
//
// Connect to the MySQL server using DB_HOST, DB_USER, DB_PASSWORD
// that are set above...
//
$DB_CONN = mysql_connect($DB_HOST, $DB_USER, $DB_PASSWORD);
if ($DB_CONN)
{
// Connected to server; select the database...
mysql_select_db($DB_NAME, $DB_CONN);
}
else
{
// Unable to connect; display an error message...
$sqlerrno = mysql_errno();
$sqlerr = mysql_error();
print("<p>Database error $sqlerrno: $sqlerr</p>\n");
print("<p>Please report the problem to <a href='mailto:webmaster@easysw.com'>"
."webmaster@easysw.com</a>.</p>\n");
}
//
// 'db_count()' - Return the number of rows in a query result.
//
function // O - Number of rows in result
db_count($result) // I - Result of query
{
if ($result)
return (mysql_num_rows($result));
else
return (0);
}
//
// 'db_escape()' - Escape special chars in string for query.
//
function // O - Quoted string
db_escape($str) // I - String
{
return (mysql_escape_string($str));
}
//
// 'db_free()' - Free a database query result...
//
function
db_free($result) // I - Result of query
{
if ($result)
mysql_free_result($result);
}
//
// 'db_insert_id()' - Return the ID of the last inserted record.
//
function // O - ID number
db_insert_id()
{
global $DB_CONN;
return (mysql_insert_id($DB_CONN));
}
//
// 'db_next()' - Fetch the next row of a result set and return it as an object.
//
function // O - Row object or NULL at end
db_next($result) // I - Result of query
{
if ($result)
return (mysql_fetch_array($result));
else
return (NULL);
}
//
// 'db_query()' - Run a SQL query and return the result or 0 on error.
//
function // O - Result of query or NULL
db_query($SQL_QUERY) // I - SQL query string
{
global $DB_NAME, $DB_CONN;
return (mysql_query($SQL_QUERY, $DB_CONN));
// print("<p>SQL_QUERY: $SQL_QUERY</p>\n");
//
// $result = mysql_query($SQL_QUERY, $DB_CONN);
// $count = db_count($result);
// print("<p>Result = $count rows...</p>\n");
//
// return ($result);
}
//
// 'db_seek()' - Seek to a specific row within a result.
//
function // O - TRUE on success, FALSE otherwise
db_seek($result, // I - Result of query
$index = 0) // I - Row number (0 = first row)
{
if ($result)
return (mysql_data_seek($result, $index));
else
return (FALSE);
}
//
// End of "$Id: db.php,v 1.5 2004/05/21 03:59:17 mike Exp $".
//
?>

@ -1,49 +0,0 @@
<?php
//
// "$Id$"
//
// Global PHP constants and variables...
//
// This file should be included using "include_once"...
//
//
// Global vars...
//
$PROJECT_NAME = "Mini-XML"; // Title of project
$PROJECT_EMAIL = "webmaster@minixml.org";
// Default notification address
$PROJECT_REGISTER = "webmaster@minixml.org";
// User registration email
$PROJECT_MODULE = "mxml"; // CVS module
$PAGE_MAX = 10; // Max items per page
//
// PHP transition stuff...
//
global $_COOKIE, $_FILES, $_POST, $_SERVER;
$argc = $_SERVER["argc"];
$argv = $_SERVER["argv"];
$REQUEST_METHOD = $_SERVER["REQUEST_METHOD"];
$SERVER_NAME = $_SERVER["SERVER_NAME"];
$REMOTE_ADDR = $_SERVER["REMOTE_ADDR"];
// Handle PHP_SELF differently - we need to quote it properly...
if (array_key_exists("PHP_SELF", $_SERVER))
$PHP_SELF = htmlspecialchars($_SERVER["PHP_SELF"], ENT_QUOTES);
else
$PHP_SELF = "";
if (array_key_exists("ISHTTPS", $_SERVER))
$PHP_URL = "https://$_SERVER[SERVER_NAME]$_SERVER[PHP_SELF]";
else
$PHP_URL = "http://$_SERVER[SERVER_NAME]:$_SERVER[SERVER_PORT]$_SERVER[PHP_SELF]";
//
// End of "$Id$".
//
?>

@ -1,465 +0,0 @@
<?php
//
// "$Id$"
//
// PHP functions for standardized HTML output...
//
// This file should be included using "include_once"...
//
// Contents:
//
// html_header() - Show the standard page header and navbar...
// html_footer() - Show the standard footer for a page.
// html_start_links() - Start of series of hyperlinks.
// html_end_links() - End of series of hyperlinks.
// html_link() - Show a single hyperlink.
// html_links() - Show an array of links.
// html_start_box() - Start a rounded, shaded box.
// html_end_box() - End a rounded, shaded box.
// html_start_table() - Start a rounded, shaded table.
// html_end_table() - End a rounded, shaded table.
// html_start_row() - Start a table row.
// html_end_row() - End a table row.
// html_search_words() - Generate an array of search words.
// html_select_is_published() - Do a <select> for the "is published" field...
//
//
// Include necessary headers...
//
include_once "globals.php";
include_once "auth.php";
// Check for a logout on the command-line...
if ($argc == 1 && $argv[0] == "logout")
{
auth_logout();
$argc = 0;
}
// Search keywords...
$html_keywords = array(
"documentation",
"functions",
"library",
"linux",
"macos x",
"mini-xml",
"mxml",
"mxmldoc",
"software",
"unix",
"windows",
"xml"
);
// Figure out the base path...
$html_path = dirname($PHP_SELF);
if (array_key_exists("PATH_INFO", $_SERVER))
{
$i = -1;
while (($i = strpos($_SERVER["PATH_INFO"], "/", $i + 1)) !== FALSE)
$html_path = dirname($html_path);
}
if ($html_path == "/")
$html_path = "";
//
// 'html_header()' - Show the standard page header and navbar...
//
function // O - User information
html_header($title = "", // I - Additional document title
$refresh = "") // I - Refresh URL
{
global $html_keywords, $html_path, $_GET, $LOGIN_USER, $PHP_SELF, $_SERVER;
// Common stuff...
// header("Cache-Control: no-cache");
print("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN' "
."'http://www.w3.org/TR/REC-html40/loose.dtd'>\n");
print("<html>\n");
print("<head>\n");
// Title...
if ($title != "")
$html_title = "$title -";
else
$html_title = "";
print(" <title>$html_title Mini-XML</title>\n"
." <meta http-equiv='Pragma' content='no-cache'>\n"
." <meta http-equiv='Content-Type' content='text/html; "
."charset=utf-8'>\n"
." <link rel='stylesheet' type='text/css' href='$html_path/style.css'>\n"
." <link rel='shortcut icon' href='$html_path/images/logo.gif' "
."type='image/x-icon'>\n");
// If refresh URL is specified, add the META tag...
if ($refresh != "")
print(" <meta http-equiv='refresh' content='3; $refresh'>\n");
// Search engine keywords...
reset($html_keywords);
list($key, $val) = each($html_keywords);
print("<meta name='keywords' content='$val");
while (list($key, $val) = each($html_keywords))
print(",$val");
print("'>\n");
print("</head>\n"
."<body>\n");
// Standard navigation stuff...
if (array_key_exists("Q", $_GET))
$q = htmlspecialchars($_GET["Q"], ENT_QUOTES);
else
$q = "";
if (stripos($_SERVER["HTTP_USER_AGENT"], "webkit") !== FALSE)
{
// Use Safari search box...
$search = "<input type='search' name='Q' value='$q' size='25' "
."autosave='com.easysw.mxml.search' results='5' "
."placeholder='Search'>";
}
else
{
// Use standard HTML text field...
$search = "<input type='text' name='Q' value='$q' size='15' "
."title='Search'><input type='submit' value='Search'>";
}
$classes = array("unsel", "unsel", "unsel", "unsel", "unsel", "unsel");
if (strpos($PHP_SELF, "/account.php") !== FALSE ||
strpos($PHP_SELF, "/login.php") !== FALSE)
$classes[0] = "sel";
else if (strpos($PHP_SELF, "/str.php") !== FALSE)
$classes[2] = "sel";
else if (strpos($PHP_SELF, "/documentation.php") !== FALSE ||
strpos($PHP_SELF, "/account.php") !== FALSE)
$classes[3] = "sel";
else if (strpos($PHP_SELF, "/software.php") !== FALSE)
$classes[4] = "sel";
else if (strpos($PHP_SELF, "/forums.php") !== FALSE)
$classes[5] = "sel";
else
$classes[1] = "sel";
print("<table width='100%' style='height: 100%;' border='0' cellspacing='0' "
."cellpadding='0' summary=''>\n"
."<tr>"
."<td class='unsel'><img src='$html_path/images/logo.gif' width='32' "
."height='32' alt=''></td>"
."<td class='$classes[0]'>");
if ($LOGIN_USER)
print("<a href='$html_path/account.php'>$LOGIN_USER</a>");
else
print("<a href='$html_path/login.php'>Login</a>");
print("</td>"
."<td class='$classes[1]'><a href='$html_path/index.php'>Home</a></td>"
."<td class='$classes[2]'><a href='$html_path/str.php'>Bugs&nbsp;&amp;&nbsp;Features</a></td>"
."<td class='$classes[3]'><a href='$html_path/documentation.php'>Documentation</a></td>"
."<td class='$classes[4]'><a href='$html_path/software.php'>Download</a></td>"
."<td class='$classes[5]'><a href='$html_path/forums.php'>Forums</a></td>"
."<td class='unsel' align='right' width='100%'>"
."<form action='$html_path/documentation.php' method='GET'>"
."$search</form></td>"
."</tr>\n"
."<tr><td class='page' colspan='8'>");
}
//
// 'html_footer()' - Show the standard footer for a page.
//
function
html_footer()
{
print("</td></tr>\n"
."<td class='footer' colspan='8'>"
."Copyright 2003-2011 by Michael Sweet. This library is free "
."software; you can redistribute it and/or modify it "
."under the terms of the <a href='$html_path/docfiles/license.html'>"
."Mini-XML License</a>.</td></tr>\n"
."</table>\n"
."</body>\n"
."</html>\n");
}
//
// 'html_start_links()' - Start of series of hyperlinks.
//
function
html_start_links($center = FALSE) // I - Center links?
{
global $html_firstlink;
$html_firstlink = 1;
if ($center)
print("<p class='links'>");
else
print("<p>");
}
//
// 'html_end_links()' - End of series of hyperlinks.
//
function
html_end_links()
{
print("</p>\n");
}
//
// 'html_link()' - Show a single hyperlink.
//
function
html_link($text, // I - Text for hyperlink
$link) // I - URL for hyperlink
{
global $html_firstlink;
if ($html_firstlink)
$html_firstlink = 0;
else
print(" &middot; ");
$safetext = str_replace(" ", "&nbsp;", $text);
print("<a href='$link'>$safetext</a>");
}
//
// 'html_links()' - Show an array of links.
//
function
html_links($links) // I - Associated array of hyperlinks
{
reset($links);
while (list($key, $val) = each($links))
html_link($key, $val);
}
//
// 'html_start_table()' - Start a rounded, shaded table.
//
function
html_start_table($headings, // I - Array of heading strings
$width = "100%", // I - Width of table
$height = "") // I - Height of table
{
global $html_row;
print("<table class='standard'");
if ($width != "")
print(" width='$width'");
if ($height != "")
print(" style='height: $height'");
print(" summary=''>"
."<tr class='header'>");
$html_row = 0;
reset($headings);
for ($i = 0; $i < count($headings); $i ++)
{
//
// Headings can be in the following forms:
//
// Mix and match as needed:
//
// "xxxxxxxx" -- Just a column heading.
// "xxxxxxxx:aa" -- Heading with align.
// "xxxxxxxx::cc" -- Heading with a colspan.
// "xxxxxxxx:::ww" -- Heading with a width.
// "xxxxxxxx::cc:ww" -- Heading with colspan and width.
// "xxxxxxxx:aa:cc:ww" -- Heading with align, colspan and width.
//
// etc, etc.
//
$s_header = "";
$s_colspan = "";
$s_width = "";
$s_align = "";
if (strstr($headings[$i], ":"))
{
$data = explode(":", $headings[$i]);
$s_header = $data[0];
if ($data[1] != "")
$s_align = "align=$data[1]";
if ($data[2] > 1)
$s_colspan = "colspan=$data[2]";
if ($data[3] > 0)
$s_width = "width=$data[3]%";
}
else
$s_header = $headings[$i];
if (strlen($s_header))
print("<th $s_align $s_colspan $s_width>$s_header</th>");
else
print("<th $s_colspan $s_width>&nbsp;</th>");
}
print("</tr>\n");
}
//
// 'html_end_table()' - End a rounded, shaded table.
//
function
html_end_table()
{
print("</table>\n");
}
//
// 'html_start_row()' - Start a table row.
//
function
html_start_row($classname = "") // I - HTML class to use
{
global $html_row;
if ($classname == "")
$classname = "data$html_row";
else
$html_row = 1 - $html_row;
print("<tr class='$classname'>");
}
//
// 'html_end_row()' - End a table row.
//
function
html_end_row()
{
global $html_row;
$html_row = 1 - $html_row;
print("</tr>\n");
}
//
// 'html_search_words()' - Generate an array of search words.
//
function // O - Array of words
html_search_words($search = "") // I - Search string
{
$words = array();
$temp = "";
$len = strlen($search);
for ($i = 0; $i < $len; $i ++)
{
switch ($search[$i])
{
case "\"" :
if ($temp != "")
{
$words[sizeof($words)] = strtolower($temp);
$temp = "";
}
$i ++;
while ($i < $len && $search[$i] != "\"")
{
$temp .= $search[$i];
$i ++;
}
$words[sizeof($words)] = strtolower($temp);
$temp = "";
break;
case " " :
case "\t" :
case "\n" :
if ($temp != "")
{
$words[sizeof($words)] = strtolower($temp);
$temp = "";
}
break;
default :
$temp .= $search[$i];
break;
}
}
if ($temp != "")
$words[sizeof($words)] = strtolower($temp);
return ($words);
}
//
// 'html_select_is_published()' - Do a <select> for the "is published" field...
//
function
html_select_is_published($is_published = 1)
// I - Default state
{
print("<select name='is_published'>");
if ($is_published)
{
print("<option value='0'>No</option>");
print("<option value='1' selected>Yes</option>");
}
else
{
print("<option value='0' selected>No</option>");
print("<option value='1'>Yes</option>");
}
print("</select>");
}
?>

@ -1,71 +0,0 @@
<?php
//
// "$Id$"
//
// Mirror selection functions (depends on GeoIP PECL interface).
//
// Contents:
//
// mirror_closest() - Return the closest mirror to the current IP.
//
//
// List of download servers...
//
$MIRRORS = array(
"http://ftp.easysw.com/pub" => array("California, USA", 37.7898, -122.3942),
"http://ftp2.easysw.com/pub" => array("New Jersey, USA", 40.4619, -74.3561),
"http://ftp.funet.fi/pub/mirrors/ftp.easysw.com/pub" => array("Espoo, Finland", 60.2167, 24.6667),
"http://ftp.rz.tu-bs.de/pub/mirror/ftp.easysw.com/ftp/pub" => array("Braunschweig, Germany", 52.2667, 10.5333),
);
//
// 'mirror_closest()' - Return the closest mirror to the current IP.
//
function // O - Closest mirror
mirror_closest()
{
global $_SERVER, $MIRRORS;
// Get the current longitude for the client...
if (!extension_loaded("geoip.so") ||
$_SERVER["REMOTE_ADDR"] == "::1" ||
$_SERVER["REMOTE_ADDR"] == "127.0.0.1")
$lon = -120;
else
{
$current = geoip_record_by_name($_SERVER["REMOTE_ADDR"]);
$lon = $current["longitude"];
}
// Loop through the mirrors to find the closest one, currently just using
// the longitude...
$closest_mirror = "";
$closest_distance = 999;
reset($MIRRORS);
foreach ($MIRRORS as $mirror => $data)
{
$distance = abs($lon - $data[2]);
if ($distance > 180)
$distance = 360 - $distance;
if ($distance < $closest_distance)
{
$closest_mirror = $mirror;
$closest_distance = $distance;
}
}
return ($closest_mirror);
}
//
// End of "$Id$".
//
?>

@ -1,114 +0,0 @@
<?
//
// "$Id: poll.php,v 1.1 2004/05/20 03:38:42 mike Exp $"
//
// Common poll interface functions...
//
// This file should be included using "include_once"...
//
// Contents:
//
// get_recent_poll() - Get the most recent poll...
// show_poll() - Show a poll...
//
//
// Include necessary headers...
//
include_once "db.php";
//
// Constants for poll_type column...
//
$POLL_TYPE_PICKONE = 0;
$POLL_TYPE_PICKMANY = 1;
//
// 'get_recent_poll()' - Get the most recent poll...
//
function // O - Poll ID or 0
get_recent_poll()
{
$result = db_query("SELECT id FROM poll WHERE is_published = 1 "
."ORDER BY id DESC LIMIT 1");
$row = db_next($result);
$id = (int)$row['id'];
db_free($result);
return ($id);
}
//
// 'show_poll()' - Show a poll...
//
function
show_poll($id) // I - Poll ID
{
global $PHP_SELF, $POLL_TYPE_PICKONE, $POLL_TYPE_PICKMANY;
$result = db_query("SELECT * FROM poll WHERE is_published = 1 AND id = $id");
if (db_count($result) == 1)
{
$row = db_next($result);
$id = $row['id'];
$question = htmlspecialchars($row['question']);
print("<p><form method='POST' action='poll.php?v$row[id]'>"
."<b>$question</b>\n");
if ($row['poll_type'] == $POLL_TYPE_PICKONE)
print("(please pick one)\n");
else
print("(pick all that apply)\n");
for ($i = 0; $i < 10; $i ++)
{
$answer = htmlspecialchars($row["answer$i"]);
if ($answer != "")
{
if ($row['poll_type'] == $POLL_TYPE_PICKONE)
print("<br /><input type='radio' name='ANSWER'");
else
print("<br /><input type='checkbox' name='ANSWER$i'");
print(" value='$i'/>$answer\n");
}
}
$votes = $row['votes'];
if ($votes == 1)
$votes .= "&nbsp;vote";
else
$votes .= "&nbsp;votes";
$ccount = count_comments("poll.php_r$id");
if ($ccount == 1)
$ccount .= "&nbsp;comment";
else
$ccount .= "&nbsp;comments";
print("<br /><input type='submit' value='Vote'/>\n"
."[&nbsp;<a href='poll.php?r$id'>Results</a>&nbsp;]\n");
print("<br />($votes, $ccount)</form></p>\n");
}
db_free($result);
}
//
// End of "$Id: poll.php,v 1.1 2004/05/20 03:38:42 mike Exp $".
//
?>

@ -1,82 +0,0 @@
<?php
//
// "$Id: str.php,v 1.2 2004/05/19 00:57:33 mike Exp $"
//
// Common STR definitions...
//
// This file should be included using "include_once"...
//
//
// STR constants...
//
$STR_STATUS_RESOLVED = 1;
$STR_STATUS_UNRESOLVED = 2;
$STR_STATUS_ACTIVE = 3;
$STR_STATUS_PENDING = 4;
$STR_STATUS_NEW = 5;
$STR_PRIORITY_RFE = 1;
$STR_PRIORITY_LOW = 2;
$STR_PRIORITY_MODERATE = 3;
$STR_PRIORITY_HIGH = 4;
$STR_PRIORITY_CRITICAL = 5;
$STR_SCOPE_UNIT = 1;
$STR_SCOPE_FUNCTION = 2;
$STR_SCOPE_SOFTWARE = 3;
//
// String definitions for STR constants...
//
$status_text = array(
1 => "Resolved",
2 => "Unresolved",
3 => "Active",
4 => "Pending",
5 => "New"
);
$status_long = array(
1 => "1 - Closed w/Resolution",
2 => "2 - Closed w/o Resolution",
3 => "3 - Active",
4 => "4 - Pending",
5 => "5 - New"
);
$priority_text = array(
1 => "RFE",
2 => "LOW",
3 => "MODERATE",
4 => "HIGH",
5 => "CRITICAL"
);
$priority_long = array(
1 => "1 - Request for Enhancement, e.g. asking for a feature",
2 => "2 - Low, e.g. a documentation error or undocumented side-effect",
3 => "3 - Moderate, e.g. unable to compile the software",
4 => "4 - High, e.g. key functionality not working",
5 => "5 - Critical, e.g. nothing working at all"
);
$scope_text = array(
1 => "MACH",
2 => "OS",
3 => "ALL"
);
$scope_long = array(
1 => "1 - Specific to a machine",
2 => "2 - Specific to an operating system",
3 => "3 - Applies to all machines and operating systems"
);
//
// End of "$Id: str.php,v 1.2 2004/05/19 00:57:33 mike Exp $".
//
?>

@ -1,395 +0,0 @@
<?php
//
// "$Id: poll.php,v 1.3 2004/05/20 15:45:55 mike Exp $"
//
// Poll page...
//
//
// Include necessary headers...
//
include_once "phplib/html.php";
include_once "phplib/poll.php";
include_once "phplib/common.php";
// Get the operation code:
//
// cN = show poll N
// eN = edit poll N
// l = list all polls
// n = new poll
// rN = show results of poll N
// uN = update poll N (POST)
// vN = vote for poll N (POST)
$poll = 0;
if ($argc > 0)
{
$op = $argv[0][0];
$argv[0][0] = ' ';
$poll = (int)$argv[0];
}
else if ($LOGIN_LEVEL >= AUTH_DEVEL)
$op = 'l';
else
$op = 'c';
if ($poll == 0 && $op != 'u' && $op != 'n')
$poll = get_recent_poll();
// Do it!
switch ($op)
{
case 'c' : // Show a poll
html_header("Poll #$poll");
print("<h1>Poll #$poll</h1>\n");
show_poll($poll);
html_footer();
break;
case 'l' : // List all polls
html_header("Polls");
if ($LOGIN_LEVEL > AUTH_USER)
{
// Show all polls and allow poll creation...
$result = db_query("SELECT * FROM poll ORDER BY id DESC");
html_start_links(1);
html_link("Add New Poll", "$PHP_SELF?n");
html_end_links(1);
}
else
{
// Only show published polls...
$result = db_query("SELECT * FROM poll WHERE is_published = 1 "
."ORDER BY id DESC");
}
print("<h1>Polls</h1>\n");
if (db_count($result) == 0)
{
print("<p>No polls found.</p>\n");
}
else
{
html_start_table(array("ID", "Question::2"));
while ($row = db_next($result))
{
$id = $row['id'];
$votes = $row['votes'];
$question = htmlspecialchars($row['question']);
$ccount = count_comments("poll.php_r$id");
if ($ccount == 1)
$ccount .= " comment";
else
$ccount .= " comments";
html_start_row();
print("<td align='center'>#$row[id]</td>"
."<td align='center' width='67%'>$question");
if (!$row['is_published'])
print(" <img src='images/private.gif' width='16' height='16' "
."align='middle' alt='private'/>");
print("</td><td nowrap><a href='$PHP_SELF?c$id'>Vote</a> | "
."<a href='$PHP_SELF?r$id'>Results</a>");
if ($LOGIN_LEVEL > AUTH_USER)
print(" | <a href='$PHP_SELF?e$id'>Edit</a>");
print(" ($votes total votes, $ccount)</td>");
html_end_row();
}
html_end_table();
}
db_free($result);
html_footer();
break;
case 'r' : // Show results
html_header("Poll #$poll");
html_start_links(1);
html_link("Show All Polls", "$PHP_SELF?l");
html_link("Show Comments", "#_USER_COMMENTS");
html_link("Submit Comment", "comment.php?r0+ppoll.php_r$poll");
html_end_links(1);
print("<h1>Poll #$poll</h1>\n");
$result = db_query("SELECT * FROM poll WHERE id = $poll");
$row = db_next($result);
$votes = $row['votes'];
for ($max_count = 0, $i = 0; $i < 10; $i ++)
{
if ($row["count$i"] > $max_count)
$max_count = $row["count$i"];
}
if ($votes == 0)
print("<p>No votes for this poll yet...</p>\n");
else
{
$question = htmlspecialchars($row['question']);
print("<center><table>\n");
print("<tr><td></td><th align='left'>$question</th></tr>\n");
for ($i = 0; $i < 10; $i ++)
{
if ($row["answer$i"] != "")
{
$percent = (int)(100 * $row["count$i"] / $votes);
$size = (int)(300 * $row["count$i"] / $max_count);
$answer = htmlspecialchars($row["answer$i"]);
$count = $row["count$i"];
print("<tr><td align='right'>$answer</td><td>"
."<img src='${rootpath}images/graph.gif' width='$size' "
."height='12'> $count / $percent%</td></tr>\n");
}
}
print("<tr><td></td><th align='right'>$votes total votes.</th></tr>\n");
print("</table></center>\n");
}
print("<hr noshade/>\n"
."<h2><a name='_USER_COMMENTS'>User Comments</a></h2>\n");
html_start_links();
html_link("Submit Comment", "comment.php?r0+ppoll.php_r$poll");
html_end_links();
show_comments("poll.php_r$poll");
db_free($result);
html_footer();
break;
case 'v' : // Vote on a poll
$answers = "";
if ($REQUEST_METHOD == "POST")
{
if (array_key_exists("ANSWER", $_POST))
{
$answer = (int)$_POST["ANSWER"];
$answers = ",count$answer=count$answer+1";
}
else
{
for ($i = 0; $i < 10; $i ++)
{
if (array_key_exists("ANSWER$i", $_POST))
$answers .= ",count$i=count$i+1";
}
}
}
if ($answers != "")
{
if (!db_query("INSERT INTO vote VALUES('poll_${poll}_${REMOTE_ADDR}')")
&& $LOGIN_LEVEL < AUTH_ADMIN)
{
html_header("Poll Error");
print("<h1>Poll Error</h1>\n");
print("<p>Sorry, it appears that you or someone else using your IP "
."address has already voted for "
."<a href='$PHP_SELF?r$poll'>poll #$poll</a>.\n");
html_footer();
}
else
{
db_query("UPDATE poll SET votes=votes+1$answers WHERE id = $poll");
header("Location: $PHP_SELF?r$poll");
}
}
else
{
header("Location: $PHP_SELF?c$poll");
}
break;
case 'n' : // New poll
case 'e' : // Edit poll
if (!$LOGIN_USER)
{
header("Location:$PHP_SELF?r$poll");
break;
}
if ($poll)
{
html_header("Poll #$poll");
print("<h1>Poll #$poll</h1>\n");
$result = db_query("SELECT * FROM poll WHERE id = $poll");
$row = db_next($result);
$question = htmlspecialchars($row['question']);
$poll_type = $row['poll_type'];
for ($i = 0; $i < 10; $i ++)
{
if ($row["answer$i"])
$answer[$i] = htmlspecialchars($row["answer$i"], ENT_QUOTES);
else
$answer[$i] = "";
}
$is_published = $row['is_published'];
db_free($result);
}
else
{
html_header("New Poll");
print("<h1>New Poll</h1>\n");
$question = "";
$poll_type = $POLL_TYPE_PICKONE;
$answer[0] = "";
$answer[1] = "";
$answer[2] = "";
$answer[3] = "";
$answer[4] = "";
$answer[5] = "";
$answer[6] = "";
$answer[7] = "";
$answer[8] = "";
$answer[9] = "";
$is_published = 0;
}
print("<form method='POST' action='$PHP_SELF?u$poll'>\n");
print("<center><table>\n"
."<tr><th align='right' valign='top'>Question:</th><td>"
."<textarea name='QUESTION' wrap='virtual' cols='40' rows='4'>"
."$question</textarea></td></tr>\n");
print("<tr><th align='right'>Type:</th><td>"
."<select name='POLLTYPE'>");
print("<option value='$POLL_TYPE_PICKONE'");
if ($poll_type == $POLL_TYPE_PICKONE)
print(" selected");
print(">Pick One</option>");
print("<option value='$POLL_TYPE_PICKMANY'");
if ($poll_type == $POLL_TYPE_PICKMANY)
print(" selected");
print(">Pick Many</option>");
print("</select></td></tr>\n");
print("<tr><th align='right'>Published:</th><td>");
select_is_published($is_published);
print("</td></tr>\n");
for ($i = 0; $i < 10; $i ++)
{
$number = $i + 1;
print("<tr><TH ALIGN='RIGHT'>Answer #$number</th><td>"
."<INPUT NAME='ANSWER$i' SIZE='45' MAXLENGTH='255' "
."VALUE='$answer[$i]'></td></tr>\n");
}
if ($poll)
print("<tr><th></th><td><input type='SUBMIT' VALUE='Update Poll'></td></tr>\n");
else
print("<tr><th></th><td><input type='SUBMIT' VALUE='Create Poll'></td></tr>\n");
print("</table></center>\n");
print("</form>\n");
html_footer();
break;
case 'u' : // Update poll
header("Location:$PHP_SELF?l");
if ($LOGIN_LEVEL < AUTH_DEVEL)
break;
$is_published = (int)$_POST["IS_PUBLISHED"];
$question = db_escape($_POST["QUESTION"]);
$poll_type = (int)$_POST["POLLTYPE"];
$answer0 = db_escape($_POST["ANSWER0"]);
$answer1 = db_escape($_POST["ANSWER1"]);
$answer2 = db_escape($_POST["ANSWER2"]);
$answer3 = db_escape($_POST["ANSWER3"]);
$answer4 = db_escape($_POST["ANSWER4"]);
$answer5 = db_escape($_POST["ANSWER5"]);
$answer6 = db_escape($_POST["ANSWER6"]);
$answer7 = db_escape($_POST["ANSWER7"]);
$answer8 = db_escape($_POST["ANSWER8"]);
$answer9 = db_escape($_POST["ANSWER9"]);
$date = time();
if ($poll)
{
// Update an existing poll...
db_query("UPDATE poll SET "
."question='$question',"
."is_published=$is_published,"
."poll_type=$poll_type,"
."answer0='$answer0',"
."answer1='$answer1',"
."answer2='$answer2',"
."answer3='$answer3',"
."answer4='$answer4',"
."answer5='$answer5',"
."answer6='$answer6',"
."answer7='$answer7',"
."answer8='$answer8',"
."answer9='$answer9',"
."modify_date=$date,"
."modify_user='$LOGIN_USER' "
."WHERE id = $poll");
}
else
{
// Create a new poll...
db_query("INSERT INTO poll VALUES(NULL,"
."$is_published,"
."$poll_type,"
."'$question',"
."'$answer0',0,"
."'$answer1',0,"
."'$answer2',0,"
."'$answer3',0,"
."'$answer4',0,"
."'$answer5',0,"
."'$answer6',0,"
."'$answer7',0,"
."'$answer8',0,"
."'$answer9',0,"
."0,"
."$date,'$LOGIN_USER',"
."$date,'$LOGIN_USER')");
}
break;
}
db_close();
//
// End of "$Id: poll.php,v 1.3 2004/05/20 15:45:55 mike Exp $".
//
?>

@ -1,182 +0,0 @@
<?php
//
// "$Id$"
//
// Software download page.
//
//
// Include necessary headers...
//
include_once "phplib/html.php";
include_once "phplib/mirrors.php";
// Get the list of software files...
$fp = fopen("data/software.md5", "r");
$files = array();
while ($line = fgets($fp, 255))
$files[sizeof($files)] = trim($line);
fclose($fp);
// Get form data, if any...
if (array_key_exists("FILE", $_GET))
{
$file = $_GET["FILE"];
if (strpos($file, "../") !== FALSE ||
!file_exists("/home/ftp.easysw.com/pub/$file"))
$file = "";
}
else
$file = "";
$site = mirror_closest();
if (array_key_exists("VERSION", $_GET))
$version = $_GET["VERSION"];
else
{
$data = explode(" ", $files[0]);
$version = $data[1];
}
// Show the standard header...
if ($site != "" && $file != "")
html_header("Download", "$site/$file");
else
html_header("Download");
html_start_links(1);
$curversion = "";
for ($i = 0; $i < sizeof($files); $i ++)
{
// Grab the data for the current file...
$data = explode(" ", $files[$i]);
$fversion = $data[1];
if ($fversion != $curversion)
{
$curversion = $fversion;
html_link("v$fversion", "$PHP_SELF?VERSION=$fversion");
}
}
html_link("Subversion", "$PHP_SELF#SVN");
html_end_links();
// Show files or sites...
if ($file != "")
{
print("<h1>Download</h1>\n");
print("<p>Your download should begin shortly. If not, please "
."<a href='$site/$file'>click here</a> to download the file "
."from the current mirror.</p>\n"
."<form action='$PHP_SELF' method='GET' name='download'>\n"
."<input type='hidden' name='FILE' value='"
. htmlspecialchars($file, ENT_QUOTES) . "'>\n"
."<input type='hidden' name='VERSION' value='"
. htmlspecialchars($version, ENT_QUOTES) . "'>\n");
reset($MIRRORS);
while (list($key, $val) = each($MIRRORS))
{
print("<input type='radio' name='SITE' value='$key' "
."onClick='document.download.submit();'");
if ($site == $key)
print(" checked");
print(">$val[0]<br>\n");
}
print("<p><input type='submit' value='Change Mirror Site'>\n"
."</form>\n");
}
else
{
// Show files...
print("<h1>Releases</h1>\n");
html_start_table(array("Version", "Filename", "Size", "MD5 Sum"));
$curversion = "";
for ($i = 0; $i < sizeof($files); $i ++)
{
// Grab the data for the current file...
$data = explode(" ", $files[$i]);
$md5 = $data[0];
$fversion = $data[1];
$filename = $data[2];
$basename = basename($filename);
if ($fversion == $version)
{
$cs = "<th>";
$ce = "</th>";
}
else
{
$cs = "<td align='center'>";
$ce = "</td>";
}
if ($fversion != $curversion)
{
if ($curversion != "")
{
html_start_row("header");
print("<th colspan='4'></th>");
html_end_row();
}
$curversion = $fversion;
html_start_row();
print("$cs<a name='$fversion'>$fversion</a>$ce");
}
else
{
html_start_row();
print("$cs$ce");
}
if (file_exists("/home/ftp.easysw.com/pub/$filename"))
$kbytes = (int)((filesize("/home/ftp.easysw.com/pub/$filename") + 1023) / 1024);
else
$kbytes = "???";
print("$cs<a href='$PHP_SELF?VERSION=$version&amp;FILE=$filename'>"
."<tt>$basename</tt></a>$ce"
."$cs${kbytes}k$ce"
."$cs<tt>$md5</tt>$ce");
html_end_row();
}
html_end_table();
print("<h1><a name='SVN'>Subversion Access</a></h1>\n"
."<p>The $PROJECT_NAME software is available via Subversion "
."using the following URL:</p>\n"
."<pre>\n"
." <a href='http://svn.easysw.com/public/$PROJECT_MODULE/'>"
."http://svn.easysw.com/public/$PROJECT_MODULE/</a>\n"
."</pre>\n"
."<p>The following command can be used to checkout the current "
."$PROJECT_NAME source from Subversion:</p>\n"
."<pre>\n"
." <kbd>svn co http://svn.easysw.com/public/$PROJECT_MODULE/trunk/ $PROJECT_MODULE</kbd>\n"
."</pre>\n");
}
// Show the standard footer...
html_footer();
//
// End of "$Id$".
//
?>

File diff suppressed because it is too large Load Diff

@ -1,2 +0,0 @@
DirectoryIndex off

@ -1,241 +0,0 @@
BODY {
background: #ffffff;
color: #000000;
font-family: sans-serif;
margin: 15px;
}
P, TD, TH {
color: #000000;
font-family: sans-serif;
}
H1, H2, H3, H4, H5, H6 {
color: #000000;
font-family: sans-serif;
}
H2, H3, H4, H5, H6 {
font-style: italic;
}
KBD {
color: #006600;
font-family: monospace;
font-weight: bold;
}
PRE {
color: #7f0000;
font-family: monospace;
}
SUB, SUP {
font-size: smaller;
}
FORM {
display: inline;
}
INPUT[TYPE="TEXT"], INPUT[TYPE="PASSWORD"], INPUT[TYPE="SEARCH"], TEXTAREA {
font-family: monospace;
}
A:link {
font-family: sans-serif;
text-decoration: none;
color: #00007f;
}
A:visited {
font-family: sans-serif;
text-decoration: none;
color: #0000bf;
}
A:hover {
font-family: sans-serif;
text-decoration: none;
color: #7f0000;
}
A:active {
font-family: sans-serif;
text-decoration: underline;
color: #bf0000;
}
TD.unsel, TD.sel {
border-bottom: solid 1px black;
padding: 1px 10px;
vertical-align: bottom;
}
TD.unsel A, TD.sel A {
font-weight: bold;
padding: 1px 10px;
}
TD.sel A {
border-bottom: solid 3px black;
}
TD.unsel A:hover, TD.sel A:hover {
background: #f4f4f4;
border-bottom: solid 3px #999999;
}
TD.page {
height: 100%;
padding: 10px 0px;
vertical-align: top;
}
TD.footer {
border-top: solid thin #666666;
color: #666666;
font-size: 80%;
padding: 5px;
}
P.links {
border-bottom: solid 1px #999999;
margin-left: auto;
margin-right: auto;
padding: 0px 10px;
text-align: center;
vertical-align: bottom;
width: 80%;
}
P.links A {
padding: 0px 5px;
}
P.links A:hover {
background: #f8f8f8;
border-bottom: solid 3px #cccccc;
}
TABLE.standard {
border-bottom: solid thin black;
border-collapse: collapse;
}
TR.header TH {
border-bottom: solid thin black;
padding: 0px 5px;
vertical-align: bottom;
}
TR.data0 TD, TR.data0 TH {
background-color: #f8f8f8;
padding: 2px;
}
TR.data1 TD, TR.data1 TH {
background-color: #f4f4f4;
padding: 2px;
}
.dateinfo {
font-size: 80%;
font-style: italic;
}
.invalid {
background: red;
color: white;
font-weight: bold;
padding: 2px;
}
/* Styles for documentation */
.class {
border-bottom: solid 2px gray;
}
.constants {
}
.description {
margin-top: 0.5em;
}
.discussion {
}
.enumeration {
border-bottom: solid 2px gray;
}
.function {
border-bottom: solid 2px gray;
margin-bottom: 0;
}
.members {
}
.method {
}
.parameters {
}
.returnvalue {
}
.struct {
border-bottom: solid 2px gray;
}
.typedef {
border-bottom: solid 2px gray;
}
.union {
border-bottom: solid 2px gray;
}
.variable {
}
code, p.code, pre, ul.code li {
font-family: monaco, courier, monospace;
font-size: 90%;
}
a:link, a:visited {
text-decoration: none;
}
span.info {
background: black;
border: solid thin black;
color: white;
font-size: 80%;
font-style: italic;
font-weight: bold;
white-space: nowrap;
}
h3 span.info, h4 span.info {
float: right;
font-size: 100%;
}
ul.code, ul.contents, ul.subcontents {
list-style-type: none;
margin: 0;
padding-left: 0;
}
ul.code li {
margin: 0;
}
ul.contents > li {
margin-top: 1em;
}
ul.contents li ul.code, ul.contents li ul.subcontents {
padding-left: 2em;
}
div.body dl {
margin-top: 0;
}
div.body dt {
font-style: italic;
margin-top: 0;
}
div.body dd {
margin-bottom: 0.5em;
}
h1.title {
}
h2.title {
border-bottom: solid 2px black;
}
h3.title {
border-bottom: solid 2px black;
}

@ -1,2 +0,0 @@
DirectoryIndex off
Loading…
Cancel
Save