Fix links in docos.

Cleanup for comments, articles, strs, and documentation.

Fix comments in SQL schema.
pull/193/head
Michael R Sweet 21 years ago
parent 98d786165f
commit f367d28d41
  1. 26
      www/account.php
  2. 26
      www/comment.php
  3. 28
      www/docfiles/FindingandIteratingNodes.html
  4. 4
      www/docfiles/LegalStuff.html
  5. 32
      www/docfiles/LoadingandSavingXMLFiles.html
  6. 18
      www/docfiles/Nodes.html
  7. 39
      www/docfiles/OrganizationofThisDocument.html
  8. 8
      www/documentation.php
  9. 34
      www/phplib/auth.php
  10. 29
      www/phplib/common.php
  11. 80
      www/str.php

@ -1,6 +1,6 @@
<?php
//
// "$Id: account.php,v 1.8 2004/05/19 14:02:38 mike Exp $"
// "$Id: account.php,v 1.9 2004/05/20 02:04:44 mike Exp $"
//
// Account management page...
//
@ -194,11 +194,13 @@ switch ($op)
html_footer();
}
else if ($data == "disable")
else if ($data == "batch")
{
// Disable accounts...
if ($REQUEST_METHOD == "POST")
// Disable/enable/expire/etc. accounts...
if ($REQUEST_METHOD == "POST" && array_key_exists("OP", $_POST))
{
$op = $_POST["OP"];
db_query("BEGIN TRANSACTION");
reset($_POST);
@ -207,7 +209,10 @@ switch ($op)
{
$id = (int)substr($key, 3);
db_query("UPDATE users SET is_published = 0 WHERE id = $id");
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");
@ -367,7 +372,7 @@ switch ($op)
$result = db_query("SELECT * FROM users ORDER BY name");
print("<form method='POST' action='$PHP_SELF?Adisable'>\n");
print("<form method='POST' action='$PHP_SELF?Abatch'>\n");
html_start_table(array("Username", "EMail", "Level"));
@ -392,8 +397,11 @@ switch ($op)
}
html_start_row("header");
print("<td align='center' colspan='3'>&nbsp;<br /><input type='submit' "
."value='Disable Checked Accounts'/></td>");
print("<td align='center' colspan='3'>&nbsp;<br /><select name='OP'>"
."<option value='disable'>Disable</option>"
."<option value='enable'>Enable</option>"
."</select>"
."<input type='submit' value='Checked Accounts'/></td>");
html_end_row();
html_end_table();
@ -604,6 +612,6 @@ switch ($op)
//
// End of "$Id: account.php,v 1.8 2004/05/19 14:02:38 mike Exp $".
// End of "$Id: account.php,v 1.9 2004/05/20 02:04:44 mike Exp $".
//
?>

@ -1,6 +1,6 @@
<?php
//
// "$Id: comment.php,v 1.6 2004/05/19 16:34:54 mike Exp $"
// "$Id: comment.php,v 1.7 2004/05/20 02:04:44 mike Exp $"
//
// Comment and moderation interface for PHP pages...
//
@ -51,7 +51,7 @@ for ($i = 0; $i < $argc; $i ++)
break;
case 'p' : // Set path
$path = substr($argv[$i], 1);
$path = urldecode(substr($argv[$i], 1));
break;
}
}
@ -86,7 +86,9 @@ else
if ($REQUEST_METHOD == "POST")
{
if (array_key_exists("AUTHOR", $_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 = "";
@ -106,10 +108,10 @@ else
else
$contents = "";
if (strpos($contents, "http:") === false &&
strpos($contents, "https:") === false &&
strpos($contents, "ftp:") === false &&
strpos($contents, "mailto:") === false &&
if (strpos($contents, "http:") === FALSE &&
strpos($contents, "https:") === FALSE &&
strpos($contents, "ftp:") === FALSE &&
strpos($contents, "mailto:") === FALSE &&
$contents != "" && $create_user != "" && $file != "")
$havedata = 1;
@ -130,7 +132,9 @@ else
}
else
{
if (array_key_exists("FROM", $_COOKIE))
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>";
@ -143,7 +147,9 @@ else
}
else
{
if (array_key_exists("FROM", $_COOKIE))
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>";
@ -367,6 +373,6 @@ else
}
//
// End of "$Id: comment.php,v 1.6 2004/05/19 16:34:54 mike Exp $".
// End of "$Id: comment.php,v 1.7 2004/05/20 02:04:44 mike Exp $".
//
?>

@ -28,46 +28,46 @@ PRE { font-family: monospace }
<A HREF="3MoreMiniXMLProgrammingTechniques.html">Next</A>
<HR NOSHADE>
<H3><A NAME="3_3_1">Finding and Iterating Nodes</A></H3>
<P>The <A href="reference.html#mxmlWalkPrev"><TT>mxmlWalkPrev()</TT></A>
and <A href="reference.html#mxmlWalkNext"><TT>mxmlWalkNext()</TT></A>
<P>The <A href="mxmlWalkPrev.html#mxmlWalkPrev"><TT>mxmlWalkPrev()</TT></A>
and <A href="mxmlWalkNext.html#mxmlWalkNext"><TT>mxmlWalkNext()</TT></A>
functions can be used to iterate through the XML node tree:</P>
<PRE>
<A href="reference.html#mxml_node_t">mxml_node_t</A> *node = <A href="reference.html#mxmlWalkPrev">mxmlWalkPrev</A>(current, tree, MXML_DESCEND);
<A href="mxmlnodet.html#mxml_node_t">mxml_node_t</A> *node = <A href="mxmlWalkPrev.html#mxmlWalkPrev">mxmlWalkPrev</A>(current, tree, MXML_DESCEND);
<A href="reference.html#mxml_node_t">mxml_node_t</A> *node = <A href="reference.html#mxmlWalkNext">mxmlWalkNext</A>(current, tree, MXML_DESCEND);
<A href="mxmlnodet.html#mxml_node_t">mxml_node_t</A> *node = <A href="mxmlWalkNext.html#mxmlWalkNext">mxmlWalkNext</A>(current, tree, MXML_DESCEND);
</PRE>
<P>In addition, you can find a named element/node using the <A href="reference.html#mxmlFindElement">
<P>In addition, you can find a named element/node using the <A href="mxmlFindElement.html#mxmlFindElement">
<TT>mxmlFindElement()</TT></A> function:</P>
<PRE>
<A href="reference.html#mxml_node_t">mxml_node_t</A> *node = <A href="reference.html#mxmlFindElement">mxmlFindElement</A>(tree, tree, &quot;name&quot;, &quot;attr&quot;,
<A href="mxmlnodet.html#mxml_node_t">mxml_node_t</A> *node = <A href="mxmlFindElement.html#mxmlFindElement">mxmlFindElement</A>(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>
<PRE>
/* Find the first &quot;a&quot; element */
node = <A href="reference.html#mxmlFindElement">mxmlFindElement</A>(tree, tree, &quot;a&quot;, NULL, NULL, MXML_DESCEND);
node = <A href="mxmlFindElement.html#mxmlFindElement">mxmlFindElement</A>(tree, tree, &quot;a&quot;, NULL, NULL, MXML_DESCEND);
/* Find the first &quot;a&quot; element with &quot;href&quot; attribute */
node = <A href="reference.html#mxmlFindElement">mxmlFindElement</A>(tree, tree, &quot;a&quot;, &quot;href&quot;, NULL, MXML_DESCEND);
node = <A href="mxmlFindElement.html#mxmlFindElement">mxmlFindElement</A>(tree, tree, &quot;a&quot;, &quot;href&quot;, NULL, MXML_DESCEND);
/* Find the first &quot;a&quot; element with &quot;href&quot; to a URL */
node = <A href="reference.html#mxmlFindElement">mxmlFindElement</A>(tree, tree, &quot;a&quot;, &quot;href&quot;,
node = <A href="mxmlFindElement.html#mxmlFindElement">mxmlFindElement</A>(tree, tree, &quot;a&quot;, &quot;href&quot;,
&quot;http://www.easysw.com/~mike/mxml/&quot;, MXML_DESCEND);
/* Find the first element with a &quot;src&quot; attribute*/
node = <A href="reference.html#mxmlFindElement">mxmlFindElement</A>(tree, tree, NULL, &quot;src&quot;, NULL, MXML_DESCEND);
node = <A href="mxmlFindElement.html#mxmlFindElement">mxmlFindElement</A>(tree, tree, NULL, &quot;src&quot;, NULL, MXML_DESCEND);
/* Find the first element with a &quot;src&quot; = &quot;foo.jpg&quot; */
node = <A href="reference.html#mxmlFindElement">mxmlFindElement</A>(tree, tree, NULL, &quot;src&quot;, &quot;foo.jpg&quot;, MXML_DESCEND);
node = <A href="mxmlFindElement.html#mxmlFindElement">mxmlFindElement</A>(tree, tree, NULL, &quot;src&quot;, &quot;foo.jpg&quot;, MXML_DESCEND);
</PRE>
<P>You can also iterate with the same function:</P>
<PRE>
<A href="reference.html#mxml_node_t">mxml_node_t</A> *node;
<A href="mxmlnodet.html#mxml_node_t">mxml_node_t</A> *node;
for (node = <A href="reference.html#mxmlFindElement">mxmlFindElement</A>(tree, tree, &quot;name&quot;, NULL, NULL, MXML_DESCEND);
for (node = <A href="mxmlFindElement.html#mxmlFindElement">mxmlFindElement</A>(tree, tree, &quot;name&quot;, NULL, NULL, MXML_DESCEND);
node != NULL;
node = <A href="reference.html#mxmlFindElement">mxmlFindElement</A>(node, tree, &quot;name&quot;, NULL, NULL, MXML_DESCEND))
node = <A href="mxmlFindElement.html#mxmlFindElement">mxmlFindElement</A>(node, tree, &quot;name&quot;, NULL, NULL, MXML_DESCEND))
{
... do something ...
}

@ -30,8 +30,8 @@ PRE { font-family: monospace }
<H2><A NAME="1_1">Legal Stuff</A></H2>
<P>The Mini-XML library is copyright 2003-2004 by Michael Sweet.</P>
<P>This library is free software; you can redistribute it and/or modify
it under the terms of the <A href="AGNULibraryGeneralPublicLicense.html#LICENSE">
GNU Library General Public License</A> as published by the Free Software
it under the terms of the <A href="license.html#LICENSE">GNU Library
General Public License</A> as published by the Free Software
Foundation; either version 2 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

@ -28,14 +28,14 @@ PRE { font-family: monospace }
<A HREF="FindingandIteratingNodes.html">Next</A>
<HR NOSHADE>
<H2><A NAME="3_3">Loading and Saving XML Files</A></H2>
<P>You load an XML file using the <A href="reference.html#mxmlLoadFile"><TT>
mxmlLoadFile()</TT></A> function:</P>
<P>You load an XML file using the <A href="mxmlLoadFile.html#mxmlLoadFile">
<TT>mxmlLoadFile()</TT></A> function:</P>
<PRE>
FILE *fp;
<A href="reference.html#mxml_node_t">mxml_node_t</A> *tree;
<A href="mxmlnodet.html#mxml_node_t">mxml_node_t</A> *tree;
fp = fopen(&quot;filename.xml&quot;, &quot;r&quot;);
tree = <A href="reference.html#mxmlLoadFile">mxmlLoadFile</A>(NULL, fp, MXML_NO_CALLBACK);
tree = <A href="mxmlLoadFile.html#mxmlLoadFile">mxmlLoadFile</A>(NULL, fp, MXML_NO_CALLBACK);
fclose(fp);
</PRE>
<P>The third argument specifies a callback function which returns the
@ -45,14 +45,14 @@ MXML_TEXT</TT>. This 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. The default value type is MXML_TEXT if no callback is used.</P>
<P>Similarly, you save an XML file using the <A href="reference.html#mxmlSaveFile">
<P>Similarly, you save an XML file using the <A href="mxmlSaveFile.html#mxmlSaveFile">
<TT>mxmlSaveFile()</TT></A> function:</P>
<PRE>
FILE *fp;
<A href="reference.html#mxml_node_t">mxml_node_t</A> *tree;
<A href="mxmlnodet.html#mxml_node_t">mxml_node_t</A> *tree;
fp = fopen(&quot;filename.xml&quot;, &quot;w&quot;);
<A href="reference.html#mxmlSaveFile">mxmlSaveFile</A>(tree, fp, MXML_NO_CALLBACK);
<A href="mxmlSaveFile.html#mxmlSaveFile">mxmlSaveFile</A>(tree, fp, MXML_NO_CALLBACK);
fclose(fp);
</PRE>
<P>Callback functions for saving are used to optionally insert
@ -63,24 +63,24 @@ 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 <A href="reference.html#mxmlLoadString"><TT>mxmlLoadString()</TT></A>
, <A href="reference.html#mxmlSaveAllocString"><TT>mxmlSaveAllocString()</TT>
</A>, and <A href="reference.html#mxmlSaveString"><TT>mxmlSaveString()</TT>
</A> functions load XML node trees from and save XML node trees to
strings:</P>
<P>The <A href="mxmlLoadString.html#mxmlLoadString"><TT>mxmlLoadString()</TT>
</A>, <A href="mxmlSaveAllocString.html#mxmlSaveAllocString"><TT>
mxmlSaveAllocString()</TT></A>, and <A href="mxmlSaveString.html#mxmlSaveString">
<TT>mxmlSaveString()</TT></A> functions load XML node trees from and
save XML node trees to strings:</P>
<PRE>
char buffer[8192];
char *ptr;
<A href="reference.html#mxml_node_t">mxml_node_t</A> *tree;
<A href="mxmlnodet.html#mxml_node_t">mxml_node_t</A> *tree;
...
tree = <A href="reference.html#mxmlLoadString">mxmlLoadString</A>(NULL, buffer, MXML_NO_CALLBACK);
tree = <A href="mxmlLoadString.html#mxmlLoadString">mxmlLoadString</A>(NULL, buffer, MXML_NO_CALLBACK);
...
<A href="reference.html#mxmlSaveString">mxmlSaveString</A>(tree, buffer, sizeof(buffer), MXML_NO_CALLBACK);
<A href="mxmlSaveString.html#mxmlSaveString">mxmlSaveString</A>(tree, buffer, sizeof(buffer), MXML_NO_CALLBACK);
...
ptr = <A href="reference.html#mxmlSaveAllocString">mxmlSaveAllocString</A>(tree, MXML_NO_CALLBACK);
ptr = <A href="mxmlSaveAllocString.html#mxmlSaveAllocString">mxmlSaveAllocString</A>(tree, MXML_NO_CALLBACK);
</PRE>
<HR NOSHADE>
<A HREF="toc.html">Contents</A>

@ -29,16 +29,16 @@ PRE { font-family: monospace }
<HR NOSHADE>
<H2><A NAME="3_2">Nodes</A></H2>
<P>Every piece of information in an XML file (elements, text, numbers)
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. The <A href="reference.html#mxml_type_t">
is stored in memory in &quot;nodes&quot;. Nodes are defined by the <A href="mxmlnodet.html#mxml_node_t">
<TT>mxml_node_t</TT></A> structure. The <A href="mxmltypet.html#mxml_type_t">
<TT>type</TT></A> member defines the node type (element, integer,
opaque, real, or text) which determines which value you want to look at
in the <A href="reference.html#mxml_value_t"><TT>value</TT></A> union.</P>
<P>New nodes can be created using the <A href="reference.html#mxmlNewElement">
<TT>mxmlNewElement()</TT></A>, <A href="reference.html#mxmlNewInteger"><TT>
mxmlNewInteger()</TT></A>, <A href="reference.html#mxmlNewOpaque"><TT>
mxmlNewOpaque()</TT></A>, <A href="reference.html#mxmlNewReal"><TT>
mxmlNewReal()</TT></A>, and <A href="reference.html#mxmlNewText"><TT>
in the <A href="mxmlvaluet.html#mxml_value_t"><TT>value</TT></A> union.</P>
<P>New nodes can be created using the <A href="mxmlNewElement.html#mxmlNewElement">
<TT>mxmlNewElement()</TT></A>, <A href="mxmlNewInteger.html#mxmlNewInteger">
<TT>mxmlNewInteger()</TT></A>, <A href="mxmlNewOpaque.html#mxmlNewOpaque">
<TT>mxmlNewOpaque()</TT></A>, <A href="mxmlNewReal.html#mxmlNewReal"><TT>
mxmlNewReal()</TT></A>, and <A href="mxmlNewText.html#mxmlNewText"><TT>
mxmlNewText()</TT></A> functions. Only elements can have child nodes,
and the top node must be an element, usually &quot;?xml&quot;.</P>
<P>Each node has pointers for the node above (<TT>parent</TT>), below (<TT>
@ -77,7 +77,7 @@ child</TT>), to the left (<TT>prev</TT>), and to the right (<TT>next</TT>
</PRE>
<P>where &quot;-&quot; is a pointer to the next node and &quot;|&quot; is a pointer to the
first child node.</P>
<P>Once you are done with the XML data, use the <A href="reference.html#mxmlDelete">
<P>Once you are done with the XML data, use the <A href="mxmlDelete.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>

@ -30,26 +30,25 @@ PRE { font-family: monospace }
<H2><A NAME="1_3">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="1BuildingInstallingandPackagingMiniXML.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="2GettingStartedwithMiniXML.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="3MoreMiniXMLProgrammingTechniques.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="4UsingthemxmldocUtility.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="AGNULibraryGeneralPublicLicense.html#LICENSE">
GNU Library General Public License</A>&quot;, provides the terms and
conditions for using and distributing Mini-XML.</LI>
<LI>Appendix B, &quot;<A href="BReleaseNotes.html#RELNOTES">Release Notes</A>
&quot;, lists the changes in each release of Mini-XML.</LI>
<LI>Appendix C, &quot;<A href="CLibraryReference.html#REFERENCE">Library
Reference</A>&quot;, contains a complete reference for Mini-XML, generated
by <TT>mxmldoc</TT>.</LI>
<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">GNU Library General
Public 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="refapp.html#REFERENCE">Library Reference</A>&quot;,
contains a complete reference for Mini-XML, generated by <TT>mxmldoc</TT>
.</LI>
</UL>
<!-- NEED 4in -->

@ -1,6 +1,6 @@
<?php
//
// "$Id: documentation.php,v 1.2 2004/05/19 16:34:54 mike Exp $"
// "$Id: documentation.php,v 1.3 2004/05/20 02:04:44 mike Exp $"
//
// Mini-XML documentation page...
//
@ -108,10 +108,10 @@ if (array_key_exists("PATH_INFO", $_SERVER) &&
print("<hr noshade/>\n"
."<h2><a name='_USER_COMMENTS'>User Comments</a> [&nbsp;"
."<a href='comment.php?r0+p$path'>Add&nbsp;Comment</a>"
."<a href='../comment.php?r0+pdocumentation.php$path'>Add&nbsp;Comment</a>"
."&nbsp;]</h2>\n");
$num_comments = show_comments("documentation.php$path");
$num_comments = show_comments("documentation.php$path", "../");
if ($num_comments == 0)
print("<p>No comments for this page.</p>\n");
@ -195,6 +195,6 @@ formats on-line:</p>
}
//
// End of "$Id: documentation.php,v 1.2 2004/05/19 16:34:54 mike Exp $".
// End of "$Id: documentation.php,v 1.3 2004/05/20 02:04:44 mike Exp $".
//
?>

@ -1,14 +1,15 @@
<?
//
// "$Id: auth.php,v 1.7 2004/05/19 21:17:47 mike Exp $"
// "$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_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...
//
//
@ -154,6 +155,29 @@ auth_logout()
//
// End of "$Id: auth.php,v 1.7 2004/05/19 21:17:47 mike Exp $".
// '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,6 +1,6 @@
<?
//
// "$Id: common.php,v 1.9 2004/05/19 21:17:47 mike Exp $"
// "$Id: common.php,v 1.10 2004/05/20 02:04:45 mike Exp $"
//
// Common utility functions for PHP pages...
//
@ -16,6 +16,7 @@
// 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...
//
@ -577,7 +578,7 @@ show_comments($url, // I - URL for comment
$parent_id = 0, // I - Parent comment
$heading = 3) // I - Heading level
{
global $_COOKIE;
global $_COOKIE, $LOGIN_LEVEL;
$result = db_query("SELECT * FROM comment WHERE "
@ -621,6 +622,13 @@ show_comments($url, // I - URL for comment
."$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)
@ -648,6 +656,21 @@ show_comments($url, // I - URL for comment
//
// End of "$Id: common.php,v 1.9 2004/05/19 21:17:47 mike Exp $".
// '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.10 2004/05/20 02:04:45 mike Exp $".
//
?>

@ -1,12 +1,12 @@
<?php
//
// "$Id: str.php,v 1.10 2004/05/19 21:17:47 mike Exp $"
// "$Id: str.php,v 1.11 2004/05/20 02:04:44 mike Exp $"
//
// Software Trouble Report page...
//
// Contents:
//
// notify_creator() - Notify creator of a STR of changes...
// notify_users() - Notify users of STR changes...
//
//
@ -77,13 +77,13 @@ db_free($result);
//
// 'notify_creator()' - Notify creator of a STR of changes...
// 'notify_users()' - Notify users of STR changes...
//
function
notify_creator($id, // I - STR #
$what = "updated", // I - Reason for notification
$contents = "") // I - Notification message
notify_users($id, // I - STR #
$what = "updated", // I - Reason for notification
$contents = "") // I - Notification message
{
global $priority_long;
global $scope_long;
@ -110,9 +110,15 @@ notify_creator($id, // I - STR #
else
$fix_version = "Unassigned";
if (eregi("[a-z0-9_.]+", $row['create_user']))
$email = auth_user_email($row['create_user']);
else
$email = $row['create_user'];
if ($row['create_user'] != $row['modify_user'] &&
$row['create_user'] != $manager)
mail($row['create_user'], "$PROJECT_NAME STR #$id $what",
$row['create_user'] != $manager &&
$email != "")
mail($email, "$PROJECT_NAME STR #$id $what",
"Your software trouble report #$id has been $what. You can check\n"
."the status of the report and add additional comments and/or files\n"
."at the following URL:\n"
@ -131,12 +137,12 @@ notify_creator($id, // I - STR #
."Thank you for using the $PROJECT_NAME Software Trouble Report page!",
"From: noreply@easysw.com\r\n");
$ccresult = db_query("SELECT email FROM strcc WHERE str_id = $id");
$ccresult = db_query("SELECT email FROM carboncopy WHERE url = 'str.php_L$id'");
if ($ccresult)
{
while ($ccrow = db_next($ccresult))
{
mail($ccrow->email, "$PROJECT_NAME STR #$id $what",
mail($ccrow['email'], "$PROJECT_NAME STR #$id $what",
"Software trouble report #$id has been $what. You can check\n"
."the status of the report and add additional comments and/or files\n"
."at the following URL:\n"
@ -162,7 +168,7 @@ notify_creator($id, // I - STR #
if ($row['manager_email'] != "")
$manager = $row['manager_email'];
else
$manager = "$PROJECT_EMAIL";
$manager = $PROJECT_EMAIL;
if ($row['modify_user'] != $manager)
mail($manager, "$PROJECT_NAME STR #$id $what",
@ -383,7 +389,7 @@ switch ($op)
db_query("INSERT INTO strtext VALUES(NULL,$id,1,'$contents',"
."$time,'$modify_user')");
notify_creator($id, "updated", $mailmsg);
notify_users($id, "updated", $mailmsg);
}
}
@ -966,9 +972,9 @@ switch ($op)
$master_id = (int)$_POST["MASTER_ID"];
$summary = db_escape($_POST["SUMMARY"]);
$subsystem = db_escape($_POST["SUBSYSTEM"]);
$create_user = db_escape($_POST["CREATE_EMAIL"]);
$create_user = db_escape($_POST["CREATE_EMAIL"]);
$manager_email = db_escape($_POST["MANAGER_EMAIL"]);
$modify_user = db_escape($_COOKIE["FROM"]);
$modify_user = db_escape($_COOKIE["FROM"]);
$contents = db_escape(trim($_POST["CONTENTS"]));
$message = $_POST["MESSAGE"];
@ -1007,7 +1013,7 @@ switch ($op)
header("Location: $PHP_SELF?L$id$options");
notify_creator($id, "updated", $contents);
notify_users($id, "updated", $contents);
}
else if (array_key_exists("FILE_ID", $_POST))
{
@ -1051,7 +1057,7 @@ switch ($op)
$row = db_next($result);
$create_user = htmlspecialchars($row['create_user']);
$create_user = htmlspecialchars($row['create_user']);
$manager_email = htmlspecialchars($row['manager_email']);
$summary = htmlspecialchars($row['summary'], ENT_QUOTES);
@ -1292,10 +1298,13 @@ switch ($op)
{
$contents = $_POST["CONTENTS"];
if (array_key_exists("EMAIL", $_POST))
if ($LOGIN_USER != "" && $LOGIN_LEVEL < AUTH_DEVEL)
$email = $LOGIN_USER;
else if (array_key_exists("EMAIL", $_POST) &&
validate_email($_POST["EMAIL"]))
{
$email = $_POST["EMAIL"];
setcookie("FROM", "$email", time() + 57600, $PHP_SELF, $SERVER_NAME);
setcookie("FROM", "$email", time() + 90 * 86400, "/");
}
else if (array_key_exists("FROM", $_COOKIE))
$email = $_COOKIE["FROM"];
@ -1310,7 +1319,9 @@ switch ($op)
}
else
{
if (array_key_exists("FROM", $_COOKIE))
if ($LOGIN_USER != "")
$email = $LOGIN_USER;
else if (array_key_exists("FROM", $_COOKIE))
$email = $_COOKIE["FROM"];
else
$email = "";
@ -1338,7 +1349,7 @@ switch ($op)
header("Location: $PHP_SELF?L$id$options");
notify_creator($id, "updated", "$contents\n\n");
notify_users($id, "updated", "$contents\n\n");
}
else
{
@ -1400,10 +1411,13 @@ switch ($op)
case 'F' : // Post file for STR #
if ($REQUEST_METHOD == "POST")
{
if (array_key_exists("EMAIL", $_POST))
if ($LOGIN_USER != "" && $LOGIN_LEVEL < AUTH_DEVEL)
$email = $LOGIN_USER;
else if (array_key_exists("EMAIL", $_POST) &&
validate_email($_POST["EMAIL"]))
{
$email = $_POST["EMAIL"];
setcookie("FROM", "$email", time() + 57600, $PHP_SELF, $SERVER_NAME);
setcookie("FROM", "$email", time() + 90 * 86400, "/");
}
else if (array_key_exists("FROM", $_COOKIE))
$email = $_COOKIE["FROM"];
@ -1427,7 +1441,9 @@ switch ($op)
}
else
{
if (array_key_exists("FROM", $_COOKIE))
if ($LOGIN_USER != "")
$email = $LOGIN_USER;
else if (array_key_exists("FROM", $_COOKIE))
$email = $_COOKIE["FROM"];
else
$email = "";
@ -1484,7 +1500,7 @@ switch ($op)
header("Location: $PHP_SELF?L$id$options");
notify_creator($id, "updated", "Added file $name\n\n");
notify_users($id, "updated", "Added file $name\n\n");
}
else
{
@ -1558,7 +1574,8 @@ switch ($op)
if ($LOGIN_USER != "" && $LOGIN_LEVEL < AUTH_DEVEL)
$email = $LOGIN_USER;
else if (array_key_exists("EMAIL", $_POST))
else if (array_key_exists("EMAIL", $_POST) &&
validate_email($_POST["EMAIL"]))
{
$email = $_POST["EMAIL"];
setcookie("FROM", "$email", time() + 90 * 86400, "/");
@ -1656,7 +1673,7 @@ switch ($op)
}
header("Location: $PHP_SELF?L$id$options");
notify_creator($id, "created", "$contents\n\n");
notify_users($id, "created", "$contents\n\n");
}
else
{
@ -1814,20 +1831,21 @@ switch ($op)
$notification = $_POST["NOTIFICATION"];
$email = $_POST["EMAIL"];
if (($notification != "ON" && $notification != "OFF") || $email == "")
if (($notification != "ON" && $notification != "OFF") || $email == "" ||
!validate_email($email))
{
html_header("STR Error");
print("<p>Please press your browsers back button and enter an "
print("<p>Please press your browsers back button and enter a valid "
."EMail address and choose whether to receive notification "
."messages.</p>\n");
html_footer();
exit();
}
setcookie("FROM", "$email", time() + 57600, $PHP_SELF, $SERVER_NAME);
setcookie("FROM", "$email", time() + 90 * 86400, "/");
$result = db_query("SELECT * FROM carboncopy WHERE "
."url = 'str.php?L$id' AND email = '$email'");
."url = 'str.php_L$id' AND email = '$email'");
html_header("STR #$id Notifications");
@ -1872,6 +1890,6 @@ switch ($op)
}
//
// End of "$Id: str.php,v 1.10 2004/05/19 21:17:47 mike Exp $".
// End of "$Id: str.php,v 1.11 2004/05/20 02:04:44 mike Exp $".
//
?>

Loading…
Cancel
Save