Account stuff.

Skeleton pages.

Updated database schema and STR pages.
pull/193/head
Michael R Sweet 21 years ago
parent a792df4faa
commit d5bbf222cd
  1. 91
      www/account.php
  2. 20
      www/articles.php
  3. 20
      www/comment.php
  4. 7
      www/data/mxml.sql
  5. 2
      www/docfiles/.htaccess
  6. 20
      www/documentation.php
  7. BIN
      www/images/bottom-left.gif
  8. BIN
      www/images/bottom-right.gif
  9. BIN
      www/images/top-left.gif
  10. BIN
      www/images/top-right.gif
  11. 48
      www/login.php
  12. 124
      www/phplib/auth.php
  13. 64
      www/phplib/common.php
  14. 64
      www/phplib/db.php
  15. 143
      www/phplib/html.php
  16. 20
      www/software.php
  17. 396
      www/str.php
  18. 8
      www/style.css

@ -0,0 +1,91 @@
<?php
//
// "$Id: account.php,v 1.1 2004/05/17 20:28:52 mike Exp $"
//
//
//
// Include necessary headers...
//
include_once "phplib/html.php";
if ($argc == 1 && $argv[0] == "X")
auth_logout();
if ($LOGIN_USER == "")
{
header("Location: login.php");
exit(0);
}
if ($argc == 1)
$op = "$argv[0]";
else
$op = "L";
switch ($op)
{
case 'L' :
// List
html_header("New/Pending");
html_start_links(1);
html_link("New/Pending", "$PHP_SELF?L");
html_link("Change Password", "$PHP_SELF?P");
html_link("Logout", "$PHP_SELF?X");
html_end_links();
print("<h1>New/Pending</h1>\n");
print("<h2>New/Pending Articles:</h2>\n");
print("<h2>New/Pending STRs:</h2>\n");
html_footer();
break;
case 'P' :
// Change password
html_header("Change Password");
html_start_links(1);
html_link("New/Pending", "$PHP_SELF?L");
html_link("Change Password", "$PHP_SELF?P");
html_link("Logout", "$PHP_SELF?X");
html_end_links();
print("<h1>Change Password</h1>\n");
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'>"
."<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></p></form>\n");
}
html_footer();
break;
}
//
// End of "$Id: account.php,v 1.1 2004/05/17 20:28:52 mike Exp $".
//
?>

@ -0,0 +1,20 @@
<?php
//
// "$Id: articles.php,v 1.1 2004/05/17 20:28:52 mike Exp $"
//
//
//
// Include necessary headers...
//
include_once "phplib/html.php";
html_header("Title");
html_footer();
//
// End of "$Id: articles.php,v 1.1 2004/05/17 20:28:52 mike Exp $".
//
?>

@ -0,0 +1,20 @@
<?php
//
// "$Id: comment.php,v 1.1 2004/05/17 20:28:52 mike Exp $"
//
//
//
// Include necessary headers...
//
include_once "phplib/html.php";
html_header("Title");
html_footer();
//
// End of "$Id: comment.php,v 1.1 2004/05/17 20:28:52 mike Exp $".
//
?>

@ -1,5 +1,5 @@
-- --
-- "$Id: mxml.sql,v 1.1 2004/05/17 19:05:00 mike Exp $" -- "$Id: mxml.sql,v 1.2 2004/05/17 20:28:52 mike Exp $"
-- --
-- Database schema for the Mini-XML web pages. -- Database schema for the Mini-XML web pages.
-- --
@ -150,7 +150,10 @@ CREATE TABLE users (
modify_user VARCHAR(255) -- User that made the last change modify_user VARCHAR(255) -- User that made the last change
); );
INSERT INTO users VALUES(NULL, 1, 'mike', 'Michael Sweet <mike@easysw.com>',
'195c416888c3151df53ae9f38c67afcc', 100,
1084823565, 'mike', 1084823565, 'mike');
-- --
-- End of "$Id: mxml.sql,v 1.1 2004/05/17 19:05:00 mike Exp $". -- End of "$Id: mxml.sql,v 1.2 2004/05/17 20:28:52 mike Exp $".
-- --

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

@ -0,0 +1,20 @@
<?php
//
// "$Id: documentation.php,v 1.1 2004/05/17 20:28:52 mike Exp $"
//
//
//
// Include necessary headers...
//
include_once "phplib/html.php";
html_header("Title");
html_footer();
//
// End of "$Id: documentation.php,v 1.1 2004/05/17 20:28:52 mike Exp $".
//
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

@ -0,0 +1,48 @@
<?php
//
// "$Id: login.php,v 1.1 2004/05/17 20:28:52 mike Exp $"
//
//
//
// Include necessary headers...
//
include_once "phplib/html.php";
if ($REQUEST_METHOD == "POST" &&
array_key_exists("USERNAME", $_POST) &&
array_key_exists("PASSWORD", $_POST))
auth_login($_POST["USERNAME"], $_POST["PASSWORD"]);
if ($LOGIN_USER != "")
header("Location: account.php");
else
{
html_header("Login");
print("<h1>Login</h1>\n"
."<form method='POST' action='$PHP_SELF'>"
."<p><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></p></form>\n");
html_footer();
}
//
// End of "$Id: login.php,v 1.1 2004/05/17 20:28:52 mike Exp $".
//
?>

@ -0,0 +1,124 @@
<?
//
// "$Id: auth.php,v 1.1 2004/05/17 20:28:52 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.
//
//
// Include necessary headers...
//
include_once "db.php";
//
// Store the current user in the global variable LOGIN_USER...
//
$LOGIN_USER = auth_current();
//
// 'auth_current()' - Return the currently logged in user...
//
function // O - Current username or ""
auth_current()
{
global $_COOKIE, $_SERVER;
// 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])."'");
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)
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_USER;
// Reset the user...
$LOGIN_USER = "";
// Lookup the username in the database...
$result = db_query("SELECT * FROM users WHERE name='".db_escape($name)."'");
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...
$LOGIN_USER = $name;
// 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_USER;
$LOGIN_USER = "";
setcookie("SID", "", time() + 90 * 86400, "/");
}
//
// End of "$Id: auth.php,v 1.1 2004/05/17 20:28:52 mike Exp $".
//
?>

@ -1,6 +1,6 @@
<? <?
// //
// "$Id: common.php,v 1.1 2004/05/17 03:23:06 mike Exp $" // "$Id: common.php,v 1.2 2004/05/17 20:28:52 mike Exp $"
// //
// Common utility functions for PHP pages... // Common utility functions for PHP pages...
// //
@ -12,6 +12,66 @@
// sanitize_text() - Sanitize text. // sanitize_text() - Sanitize text.
// //
//
// '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);
}
// //
// 'quote_text()' - Quote a string... // 'quote_text()' - Quote a string...
// //
@ -230,6 +290,6 @@ sanitize_text($text) // I - Original text
// //
// End of "$Id: common.php,v 1.1 2004/05/17 03:23:06 mike Exp $". // End of "$Id: common.php,v 1.2 2004/05/17 20:28:52 mike Exp $".
// //
?> ?>

@ -1,6 +1,6 @@
<?php <?php
// //
// "$Id: db.php,v 1.2 2004/05/17 03:23:06 mike Exp $" // "$Id: db.php,v 1.3 2004/05/17 20:28:52 mike Exp $"
// //
// Common database include file for PHP web pages. This file can be used // Common database include file for PHP web pages. This file can be used
// to abstract the specific database in use... // to abstract the specific database in use...
@ -23,6 +23,7 @@
// //
// Some static database access info. // Some static database access info.
$DB_ADMIN = "webmaster@easysw.com";
$DB_HOST = ""; $DB_HOST = "";
$DB_NAME = "mxml"; $DB_NAME = "mxml";
$DB_USER = ""; $DB_USER = "";
@ -37,63 +38,14 @@ if (!extension_loaded("sqlite"))
// Open the SQLite database defined above... // Open the SQLite database defined above...
if ($DB_CONN = sqlite_open("data/$DB_NAME.db", 0666, $sqlerr)) $DB_CONN = sqlite_open("data/$DB_NAME.db", 0666, $sqlerr);
{
if (0) { if (!$DB_CONN)
// Opened the database, create all tables...
sqlite_query($DB_CONN,
"CREATE TABLE str ("
."id INTEGER PRIMARY KEY,"
."master_id INTEGER,"
."is_published INTEGER,"
."status INTEGER,"
."priority INTEGER,"
."scope INTEGER,"
."summary text,"
."subsystem VARCHAR(128),"
."str_version VARCHAR(16),"
."fix_version VARCHAR(16),"
."manager_email VARCHAR(128),"
."create_date INTEGER,"
."create_email VARCHAR(128),"
."modify_date INTEGER,"
."modify_email VARCHAR(128)"
.")");
sqlite_query($DB_CONN,
"CREATE TABLE strcc ("
."id INTEGER PRIMARY KEY,"
."str_id INTEGER,"
."email VARCHAR(128)"
.")");
sqlite_query($DB_CONN,
"CREATE TABLE strfile ("
."id INTEGER PRIMARY KEY,"
."str_id INTEGER,"
."is_published INTEGER,"
."date INTEGER,"
."email VARCHAR(128),"
."filename VARCHAR(128)"
.")");
sqlite_query($DB_CONN,
"CREATE TABLE strtext ("
."id INTEGER PRIMARY KEY,"
."str_id INTEGER,"
."is_published INTEGER,"
."date INTEGER,"
."email VARCHAR(128),"
."contents TEXT"
.")");
}
}
else
{ {
// Unable to open, display an error message... // Unable to open, display an error message...
print("<p>Database error $sqlerr</p>\n"); print("<p>Database error $sqlerr</p>\n");
print("<p>Please report the problem to <a href='mailto:webmaster@easysw.com'>" print("<p>Please report the problem to <a href='mailto:$DB_ADMIN'>"
."webmaster@easysw.com</a>.</p>\n"); ."$DB_ADMIN</a>.</p>\n");
exit(1); exit(1);
} }
@ -207,6 +159,6 @@ db_seek($result, // I - Result of query
// //
// End of "$Id: db.php,v 1.2 2004/05/17 03:23:06 mike Exp $". // End of "$Id: db.php,v 1.3 2004/05/17 20:28:52 mike Exp $".
// //
?> ?>

@ -1,6 +1,6 @@
<?php <?php
// //
// "$Id: html.php,v 1.3 2004/05/17 03:39:24 mike Exp $" // "$Id: html.php,v 1.4 2004/05/17 20:28:52 mike Exp $"
// //
// PHP functions for standardized HTML output... // PHP functions for standardized HTML output...
// //
@ -22,10 +22,15 @@
// html_end_row() - End a table row. // html_end_row() - End a table row.
// //
// //
// Include necessary headers... // Include necessary headers...
// //
include_once "globals.php";
include_once "auth.php";
// //
// Search keywords... // Search keywords...
// //
@ -53,9 +58,16 @@ $html_keywords = array(
function // O - User information function // O - User information
html_header($title = "") // I - Additional document title html_header($title = "") // I - Additional document title
{ {
global $html_keywords, $HTTP_COOKIE_VARS; global $html_keywords, $argc, $argv, $PHP_SELF, $LOGIN_USER;
// Check for a logout on the command-line...
if ($argc == 1 && $argv[0] == "logout")
{
auth_logout();
$argc = 0;
}
// Common stuff... // Common stuff...
print("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN' " print("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN' "
."'http://www.w3.org/TR/REC-html40/loose.dtd'>\n"); ."'http://www.w3.org/TR/REC-html40/loose.dtd'>\n");
@ -89,20 +101,35 @@ html_header($title = "") // I - Additional document title
."<body>\n"); ."<body>\n");
// Standard navigation stuff... // Standard navigation stuff...
print("<p><table width='100%' height='100%' border='1' cellspacing='0' " print("<p><table width='100%' height='100%' border='0' cellspacing='0' "
."cellpadding='5'>\n" ."cellpadding='0'>\n"
."<tr class='header'>" ."<tr class='header' height='40'>"
."<td><img src='images/logo.gif' width='39' height='32' alt='Mini-XML' " ."<td valign='top'><img src='images/top-left.gif' width='15' height='15' "
."align='middle'/> " ."alt=''/></td>"
."[ <a href='index.php'>Home</a> | " ."<td width='100%'><img src='images/logo.gif' width='39' height='32' "
."alt='Mini-XML' align='middle'/> "
."[&nbsp;<a href='index.php'>Home</a> | "
."<a href='documentation.php'>Documentation</a> | " ."<a href='documentation.php'>Documentation</a> | "
."<a href='software.php'>Download</a> | " ."<a href='software.php'>Download</a> | "
."<a href='faq.php'>FAQ</a> | " ."<a href='faq.php'>FAQ</a> | "
."<a href='str.php'>Support</a> ]</td>" ."<a href='str.php'>Support</a>&nbsp;]</td>"
."<td align='right'>[&nbsp;");
if ($LOGIN_USER)
print("<a href='account.php'>$LOGIN_USER</a>");
else
print("<a href='login.php'>Login</a>");
print("&nbsp;]</td>"
."<td valign='top'><img src='images/top-right.gif' width='15' height='15' "
."alt=''/></td>"
."</tr>\n"); ."</tr>\n");
print("<tr height='100%'>" print("<tr class='page' height='100%'><td></td>"
."<td align='justify' valign='top'>\n"); ."<td colspan='2' valign='top'>"
."<table width='100%' height='100%' border='0' cellpadding='5' "
."cellspacing='0'><tr><td valign='top'>");
} }
@ -113,14 +140,19 @@ html_header($title = "") // I - Additional document title
function function
html_footer() html_footer()
{ {
print("</td></tr>\n"); print("</td></tr></table></td><td></td></tr>\n");
print("<tr class='header'>" print("<tr class='header'>"
."<td>Copyright 2003-2004 by Michael Sweet. This library is free " ."<td valign='bottom'><img src='images/bottom-left.gif' width='15' "
."height='15' alt=''/></td>"
."<td colspan='2'><small> <br />"
."Copyright 2003-2004 by Michael Sweet. This library is free "
."software; you can redistribute it and/or modify it " ."software; you can redistribute it and/or modify it "
."under the terms of the GNU Library General Public " ."under the terms of the GNU Library General Public "
."License as published by the Free Software Foundation; " ."License as published by the Free Software Foundation; "
."either version 2 of the License, or (at your option) " ."either version 2 of the License, or (at your option) "
."any later version.</td>" ."any later version.<br />&nbsp;</small></td>"
."<td valign='bottom'><img src='images/bottom-right.gif' width='15' "
."height='15' alt=''/></td>"
."</tr>\n"); ."</tr>\n");
print("</table></p>\n"); print("</table></p>\n");
print("</body>\n" print("</body>\n"
@ -140,7 +172,9 @@ html_start_links($center = 0) // I - 1 for centered, 0 for in-line
$html_firstlink = 1; $html_firstlink = 1;
if ($center) if ($center)
print("<p class='center' align='center'>"); print("<p class='center' align='center'>[&nbsp;");
else
print("<p>[&nbsp;");
} }
@ -149,10 +183,9 @@ html_start_links($center = 0) // I - 1 for centered, 0 for in-line
// //
function function
html_end_links($center = 0) // I - 1 for centered, 0 for in-line html_end_links()
{ {
if ($center) print("&nbsp;]</p>\n");
print("</p>\n");
} }
@ -182,48 +215,11 @@ html_link($text, // I - Text for hyperlink
// //
function function
html_links($links, // I - Associated array of hyperlinks html_links($links) // I - Associated array of hyperlinks
$path = "") // I - Relative path to add to root
{ {
reset($links); reset($links);
while (list($key, $val) = each($links)) while (list($key, $val) = each($links))
html_link($key, $path . $val); html_link($key, $val);
}
//
// 'html_start_box()' - Start a rounded, shaded box.
//
function
html_start_box($title = "", // I - Title for box
$path = "") // I - Relative path to root
{
print("<p><table width='100%' border='0' cellpadding='0' cellspacing='0'>"
."<tr class='box'><th align='left' valign='top'>"
."<img src='${path}images/inv-top-left.gif' width='16' height='16' "
."alt=''/></th>"
."<th>$title</th>"
."<th align='right' valign='top'><img src='${path}images/inv-top-right.gif' "
."width='16' height='16' alt=''/></th></tr>\n"
."<tr class='box'>"
."<th align='left' valign='bottom'>"
."<img src='${path}images/inv-bottom-left.gif' width='16' height='16' "
."alt=''/></th>"
."<td valign='top'>");
}
//
// 'html_end_box()' - End a rounded, shaded box.
//
function
html_end_box($path = "") // I - Relative path to root
{
print("</td><th align='right' valign='bottom'><img src='${path}images/inv-bottom-right.gif' "
."width='16' height='16' alt=''/></th></tr>\n"
."</table></p>\n");
} }
@ -232,17 +228,16 @@ html_end_box($path = "") // I - Relative path to root
// //
function function
html_start_table($headings, // I - Array of heading strings html_start_table($headings) // I - Array of heading strings
$path = "") // I - Relative path to root
{ {
global $html_row, $html_cols; global $html_row, $html_cols;
print("<p><table width='100%' border='0' cellpadding='0' cellspacing='0'>" print("<p><table width='100%' border='0' cellpadding='0' cellspacing='0'>"
."<tr class='header'><th align='left' valign='top'>" ."<tr class='header'><th align='left' valign='top'>"
."<img src='${path}images/hdr-top-left.gif' width='16' height='16' " ."<img src='images/top-left.gif' width='16' height='16' "
."alt=''/></th>"); ."alt=''/></th>");
$add_html_cols; // Add to html_cols after display if colspan is used. $add_html_cols = 0; // Add to html_cols after display if colspan is used.
$html_row = 0; $html_row = 0;
$html_cols = sizeof($headings); $html_cols = sizeof($headings);
@ -280,35 +275,38 @@ html_start_table($headings, // I - Array of heading strings
$align = $data[1]; $align = $data[1];
$s_align = "align=$align"; $s_align = "align=$align";
} }
if ($data[2] > 0) if ($data[2] > 0)
{ {
$colspan = $data[2]; $colspan = $data[2];
$s_colspan = "colspan=$colspan"; $s_colspan = "colspan=$colspan";
if ($colspan > 1) if ($colspan > 1)
$add_html_cols += ($colspan-1); $add_html_cols += ($colspan - 1);
} }
if ($data[3] > 0) if ($data[3] > 0)
{ {
$width = $data[3]; $width = $data[3];
$s_width = "width=$width%"; $s_width = "width=$width%";
} }
} }
else $s_header = $headings[$i]; else
$s_header = $headings[$i];
if (strlen($s_header)) if (strlen($s_header))
{ {
print("<th $s_align $s_colspan $s_width>" print("<th $s_align $s_colspan $s_width>$s_header</th>");
."<font color='white'>$s_header</font></th>");
} }
else else
{ {
print("<th $s_colspan $s_width>&nbsp;</th>"); print("<th $s_colspan $s_width>&nbsp;</th>");
} }
} }
$html_cols += $add_html_cols; $html_cols += $add_html_cols;
print("<th align='right' valign='top'>" print("<th align='right' valign='top'>"
."<img src='${path}images/hdr-top-right.gif' " ."<img src='images/top-right.gif' "
."width='16' height='16' alt=''/></th></tr>\n"); ."width='16' height='16' alt=''/></th></tr>\n");
} }
@ -318,15 +316,15 @@ html_start_table($headings, // I - Array of heading strings
// //
function function
html_end_table($path = "") // I - Relative path to root html_end_table()
{ {
global $html_cols; global $html_cols;
print("<tr class='header'><th align='left' valign='bottom'>" print("<tr class='header'><th align='left' valign='bottom'>"
."<img src='${path}images/hdr-bottom-left.gif' width='16' height='16' " ."<img src='images/bottom-left.gif' width='16' height='16' "
."alt=''/></th>" ."alt=''/></th>"
."<th colspan='$html_cols'>&nbsp;</th>" ."<th colspan='$html_cols'>&nbsp;</th>"
."<th align='right' valign='bottom'><img src='${path}images/hdr-bottom-right.gif' " ."<th align='right' valign='bottom'><img src='images/bottom-right.gif' "
."width='16' height='16' alt=''/></th></tr>\n" ."width='16' height='16' alt=''/></th></tr>\n"
."</table></p>\n"); ."</table></p>\n");
} }
@ -337,11 +335,14 @@ html_end_table($path = "") // I - Relative path to root
// //
function function
html_start_row() html_start_row($classname = "") // I - HTML class to use
{ {
global $html_row; global $html_row;
print("<tr class='data$html_row'><td>&nbsp;</td>"); if ($classname == "")
$classname = "data$html_row";
print("<tr class='$classname'><td>&nbsp;</td>");
} }

@ -0,0 +1,20 @@
<?php
//
// "$Id: software.php,v 1.1 2004/05/17 20:28:52 mike Exp $"
//
//
//
// Include necessary headers...
//
include_once "phplib/html.php";
html_header("Title");
html_footer();
//
// End of "$Id: software.php,v 1.1 2004/05/17 20:28:52 mike Exp $".
//
?>

@ -3,10 +3,11 @@
// Standard stuff... // Standard stuff...
include_once "phplib/html.php"; include_once "phplib/html.php";
include_once "phplib/common.php"; include_once "phplib/common.php";
include_once "phplib/db.php";
// STR constants... // STR constants...
$STR_PAGE_MAX = 10; // Max STRs per page $STR_PROJECT = "Mini-XML"; // Title of project
$STR_EMAIL = "mxml@easysw.com"; // Default notification address
$STR_PAGE_MAX = 10; // Max STRs per page
$STR_STATUS_RESOLVED = 1; $STR_STATUS_RESOLVED = 1;
$STR_STATUS_UNRESOLVED = 2; $STR_STATUS_UNRESOLVED = 2;
@ -99,7 +100,7 @@ $priority_long = array(
); );
$scope_text = array( $scope_text = array(
1 => "M/P", 1 => "M",
2 => "OS", 2 => "OS",
3 => "ALL" 3 => "ALL"
); );
@ -110,32 +111,21 @@ $scope_long = array(
3 => "3 - Applies to all machines and operating systems" 3 => "3 - Applies to all machines and operating systems"
); );
// Global web vars...
global $_COOKIE, $_FILES, $_POST, $_SERVER;
$argc = $_SERVER["argc"];
$argv = $_SERVER["argv"];
$PHP_SELF = $_SERVER["PHP_SELF"];
$REMOTE_USER = $_SERVER["PHP_AUTH_USER"];
$REQUEST_METHOD = $_SERVER["REQUEST_METHOD"];
$SERVER_NAME = $_SERVER["SERVER_NAME"];
// Function to abbreviate long strings...
function abbreviate($text, $maxlen = 32)
{
if (strlen($text) > $maxlen)
return (substr($text, 0, $maxlen) . "...");
else
return ($text);
}
//
// 'notify_creator()' - Notify creator of an STR of changes...
//
// Function to notify creator of an STR of changes... function
function notify_creator($id, $what = "updated", $contents = "") notify_creator($id, // I - STR #
$what = "updated", // I - Reason for notification
$contents = "") // I - Notification message
{ {
global $priority_long; global $priority_long;
global $scope_long; global $scope_long;
global $status_long; global $status_long;
global $PHP_SELF, $STR_EMAIL, $STR_PROJECT;
$result = db_query("SELECT * FROM str WHERE id = $id"); $result = db_query("SELECT * FROM str WHERE id = $id");
if ($result) if ($result)
@ -158,12 +148,12 @@ function notify_creator($id, $what = "updated", $contents = "")
if ($row['create_email'] != $row['modify_email'] && if ($row['create_email'] != $row['modify_email'] &&
$row['create_email'] != $manager) $row['create_email'] != $manager)
mail($row['create_email'], "Mini-XML STR #$id $what", mail($row['create_email'], "$STR_PROJECT STR #$id $what",
"Your software trouble report #$id has been $what. You can check\n" "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" ."the status of the report and add additional comments and/or files\n"
."at the following URL:\n" ."at the following URL:\n"
."\n" ."\n"
." http://www.easysw.com/str.php?L$id\n" ." $PHP_SELF?L$id\n"
."\n" ."\n"
." Summary: $row[summary]\n" ." Summary: $row[summary]\n"
." Version: $row[str_version]\n" ." Version: $row[str_version]\n"
@ -174,7 +164,7 @@ function notify_creator($id, $what = "updated", $contents = "")
."Fix Version: $fix_version\n" ."Fix Version: $fix_version\n"
."\n$contents" ."\n$contents"
."________________________________________________________________\n" ."________________________________________________________________\n"
."Thank you for using the Mini-XML Software Trouble Report page!", ."Thank you for using the $STR_PROJECT Software Trouble Report page!",
"From: noreply@easysw.com\r\n"); "From: noreply@easysw.com\r\n");
$ccresult = db_query("SELECT email FROM strcc WHERE str_id = $id"); $ccresult = db_query("SELECT email FROM strcc WHERE str_id = $id");
@ -182,12 +172,12 @@ function notify_creator($id, $what = "updated", $contents = "")
{ {
while ($ccrow = db_next($ccresult)) while ($ccrow = db_next($ccresult))
{ {
mail($ccrow->email, "Mini-XML STR #$id $what", mail($ccrow->email, "$STR_PROJECT STR #$id $what",
"Software trouble report #$id has been $what. You can check\n" "Software trouble report #$id has been $what. You can check\n"
."the status of the report and add additional comments and/or files\n" ."the status of the report and add additional comments and/or files\n"
."at the following URL:\n" ."at the following URL:\n"
."\n" ."\n"
." http://www.easysw.com/str.php?L$id\n" ." $PHP_SELF?L$id\n"
."\n" ."\n"
." Summary: $row[summary]\n" ." Summary: $row[summary]\n"
." Version: $row[str_version]\n" ." Version: $row[str_version]\n"
@ -198,7 +188,7 @@ function notify_creator($id, $what = "updated", $contents = "")
."Fix Version: $fix_version\n" ."Fix Version: $fix_version\n"
."\n$contents" ."\n$contents"
."________________________________________________________________\n" ."________________________________________________________________\n"
."Thank you for using the Mini-XML Software Trouble Report page!", ."Thank you for using the $STR_PROJECT Software Trouble Report page!",
"From: noreply@easysw.com\r\n"); "From: noreply@easysw.com\r\n");
} }
@ -208,15 +198,15 @@ function notify_creator($id, $what = "updated", $contents = "")
if ($row['manager_email'] != "") if ($row['manager_email'] != "")
$manager = $row['manager_email']; $manager = $row['manager_email'];
else else
$manager = "mxml"; $manager = "$STR_EMAIL";
if ($row['modify_email'] != $manager) if ($row['modify_email'] != $manager)
mail($manager, "Mini-XML STR #$id $what", mail($manager, "$STR_PROJECT STR #$id $what",
"The software trouble report #$id assigned to you has been $what.\n" "The software trouble report #$id assigned to you has been $what.\n"
."You can manage the report and add additional comments and/or files\n" ."You can manage the report and add additional comments and/or files\n"
."at the following URL:\n" ."at the following URL:\n"
."\n" ."\n"
." http://www.easysw.com/private/str.php?L$id\n" ." $PHP_SELF?L$id\n"
."\n" ."\n"
." Summary: $row[summary]\n" ." Summary: $row[summary]\n"
." Version: $row[str_version]\n" ." Version: $row[str_version]\n"
@ -277,7 +267,7 @@ if ($argc)
exit(); exit();
} }
if (($op == 'M' || $op == 'B') && !$REMOTE_USER) if (($op == 'M' || $op == 'B') && !$LOGIN_USER)
{ {
html_header("STR Error"); html_header("STR Error");
print("<p>The '$op' command is not available to you!</p>\n"); print("<p>The '$op' command is not available to you!</p>\n");
@ -390,7 +380,7 @@ switch ($op)
{ {
$time = time(); $time = time();
$manager_email = db_escape($_POST["MANAGER_EMAIL"]); $manager_email = db_escape($_POST["MANAGER_EMAIL"]);
$modify_email = db_escape($managers[$REMOTE_USER]); $modify_email = db_escape($managers[$LOGIN_USER]);
$message = $_POST["MESSAGE"]; $message = $_POST["MESSAGE"];
if ($message != "") if ($message != "")
@ -413,6 +403,8 @@ switch ($op)
if ($manager_email != "") if ($manager_email != "")
$query .= ", manager_email = '$manager_email'"; $query .= ", manager_email = '$manager_email'";
db_query("BEGIN TRANSACTION");
reset($_POST); reset($_POST);
while (list($key, $val) = each($_POST)) while (list($key, $val) = each($_POST))
if (substr($key, 0, 3) == "ID_") if (substr($key, 0, 3) == "ID_")
@ -423,12 +415,14 @@ switch ($op)
if ($contents != "") if ($contents != "")
{ {
db_query("INSERT INTO strtext VALUES(NULL,$id,1,$time," db_query("INSERT INTO strtext VALUES(NULL,$id,1,'$contents',"
."'$modify_email','$contents')"); ."$time,'$modify_email')");
notify_creator($id, "updated", $mailmsg); notify_creator($id, "updated", $mailmsg);
} }
} }
db_query("COMMIT TRANSACTION");
} }
header("Location: $PHP_SELF?L$options"); header("Location: $PHP_SELF?L$options");
@ -449,17 +443,19 @@ switch ($op)
$row = db_next($result); $row = db_next($result);
print("<p align='center'>" html_start_links(1);
."[&nbsp;<a href='$PHP_SELF?L$options'>Return&nbsp;to&nbsp;STR&nbsp;List</a>"); html_link("Return to STR List", "$PHP_SELF?L$options");
if ($row['status'] >= $STR_STATUS_ACTIVE) if ($row['status'] >= $STR_STATUS_ACTIVE)
print(" | <a href='$PHP_SELF?T$id$options'>Post&nbsp;Text</a>" {
." | <a href='$PHP_SELF?F$id$options'>Post&nbsp;File</a>"); html_link("Post Text", "$PHP_SELF?T$id$options");
html_link("Post File", "$PHP_SELF?F$id$options");
}
if ($REMOTE_USER) if ($LOGIN_USER)
print(" | <a href='$PHP_SELF?M$id$options'>Modify&nbsp;STR</a>"); html_link("Modify STR", "$PHP_SELF?M$id$options");
print("&nbsp;]</p><hr />\n"); html_end_links();
$create_email = sanitize_email($row['create_email']); $create_email = sanitize_email($row['create_email']);
$manager_email = sanitize_email($row['manager_email']); $manager_email = sanitize_email($row['manager_email']);
@ -502,8 +498,8 @@ switch ($op)
print("<tr><th align='right'>Assigned To:</th><td>$manager_email</td></tr>\n"); print("<tr><th align='right'>Assigned To:</th><td>$manager_email</td></tr>\n");
print("<tr><th align='right'>Fix Version:</th><td>$fix_version</td></tr>\n"); print("<tr><th align='right'>Fix Version:</th><td>$fix_version</td></tr>\n");
if ($REMOTE_USER) if ($LOGIN_USER)
$email = htmlspecialchars($managers[$REMOTE_USER]); $email = htmlspecialchars($managers[$LOGIN_USER]);
else if (array_key_exists("FROM", $_COOKIE)) else if (array_key_exists("FROM", $_COOKIE))
$email = htmlspecialchars($_COOKIE["FROM"]); $email = htmlspecialchars($_COOKIE["FROM"]);
else else
@ -521,10 +517,13 @@ switch ($op)
db_free($result); db_free($result);
print("<hr /><p><b>Trouble Report Files:</b>"); print("<hr noshade/><p><b>Trouble Report Files:</b></p>\n");
if ($row['status'] >= $STR_STATUS_ACTIVE) if ($row['status'] >= $STR_STATUS_ACTIVE)
print(" [&nbsp;<a href='$PHP_SELF?F$id$options'>Post&nbsp;File</a>&nbsp;]"); {
print("</p>\n"); html_start_links();
html_link("Post File", "$PHP_SELF?F$id$options");
html_end_links();
}
$result = db_query("SELECT * FROM strfile WHERE " $result = db_query("SELECT * FROM strfile WHERE "
."str_id = $id AND is_published = 1"); ."str_id = $id AND is_published = 1");
@ -533,12 +532,8 @@ switch ($op)
print("<p><i>No files</i></p>\n"); print("<p><i>No files</i></p>\n");
else else
{ {
print("<p><table width='100%' border='0' cellpadding='5' " html_start_table(array("Name/Time/Date", "Filename"));
."cellspacing='0'>\n"
."<tr class='header'><th>Name/Time/Date</th>"
."<th>Filename</th></tr>\n");
$line = 0;
while ($row = db_next($result)) while ($row = db_next($result))
{ {
$date = date("M d, Y", $row['date']); $date = date("M d, Y", $row['date']);
@ -546,23 +541,25 @@ switch ($op)
$email = sanitize_email($row['email']); $email = sanitize_email($row['email']);
$filename = htmlspecialchars($row['filename']); $filename = htmlspecialchars($row['filename']);
print("<tr class='data$line'>" html_start_row();
."<td align='center' valign='top'>$email<br />$time $date</td>" print("<td align='center' valign='top'>$email<br />$time $date</td>"
."<td align='center' valign='top'>" ."<td align='center' valign='top'>"
."<a href='strfiles/$id/$filename'>$filename</a></td>" ."<a href='strfiles/$id/$filename'>$filename</a></td>");
."</tr>\n"); html_end_row();
$line = 1 - $line;
} }
print("</table></p>\n");
html_end_table();
} }
db_free($result); db_free($result);
print("<hr /><p><b>Trouble Report Dialog:</b>"); print("<hr noshade/><p><b>Trouble Report Dialog:</b></p>\n");
if ($row['status'] >= $STR_STATUS_ACTIVE) if ($row['status'] >= $STR_STATUS_ACTIVE)
print(" [&nbsp;<a href='$PHP_SELF?T$id$options'>Post&nbsp;Text</a>&nbsp;]"); {
print("</p>\n"); html_start_links();
html_link("Post Text", "$PHP_SELF?T$id$options");
html_end_links();
}
$result = db_query("SELECT * FROM strtext WHERE " $result = db_query("SELECT * FROM strtext WHERE "
."str_id = $id AND is_published = 1"); ."str_id = $id AND is_published = 1");
@ -571,12 +568,7 @@ switch ($op)
print("<p><i>No text</i></p>\n"); print("<p><i>No text</i></p>\n");
else else
{ {
print("<p><Table width='100%' border='0' cellpadding='5' " html_start_table(array("Name/Time/Date", "Text"));
."cellspacing='0'>\n"
."<tr class='header'><th>Name/Time/Date</th>"
."<th>Text</th></tr>\n");
$line = 0;
while ($row = db_next($result)) while ($row = db_next($result))
{ {
@ -585,14 +577,13 @@ switch ($op)
$email = sanitize_email($row['email']); $email = sanitize_email($row['email']);
$contents = quote_text($row['contents']); $contents = quote_text($row['contents']);
print("<tr class='data$line'>" html_start_row();
."<td align='center' valign='top'>$email<br />$time $date</td>" print("<td align='center' valign='top'>$email<br />$time $date</td>"
."<td valign='top'><tt>$contents</tt></td>" ."<td valign='top'><tt>$contents</tt></td>");
."</tr>\n"); html_end_row();
$line = 1 - $line;
} }
print("</table></p>\n");
html_end_table();
} }
db_free($result); db_free($result);
@ -601,8 +592,9 @@ switch ($op)
{ {
html_header("STR List"); html_header("STR List");
print("<p align='center'>[ <a href='$PHP_SELF?N$options'>Post " html_start_links(1);
."New Software Trouble Report</a> ]</p>\n"); html_link("Post New Software Trouble Report", "$PHP_SELF?N$options'");
html_end_links();
print("<form method='POST' action='$PHP_SELF'><p align='center'>" print("<form method='POST' action='$PHP_SELF'><p align='center'>"
."Search&nbsp;Words: &nbsp;<input type='text' size='60' name='SEARCH' value='$search'>" ."Search&nbsp;Words: &nbsp;<input type='text' size='60' name='SEARCH' value='$search'>"
@ -649,7 +641,7 @@ switch ($op)
} }
print("</select>\n"); print("</select>\n");
if ($REMOTE_USER || array_key_exists("FROM", $_COOKIE)) if ($LOGIN_USER || array_key_exists("FROM", $_COOKIE))
{ {
print("Show:&nbsp;<select name='FEMAIL'>"); print("Show:&nbsp;<select name='FEMAIL'>");
print("<option value='0'"); print("<option value='0'");
@ -659,7 +651,7 @@ switch ($op)
print("<option value='1'"); print("<option value='1'");
if ($femail) if ($femail)
print(" selected"); print(" selected");
if ($REMOTE_USER) if ($LOGIN_USER)
print(">Mine + Unassigned</option>"); print(">Mine + Unassigned</option>");
else else
print(">Only Mine</option>"); print(">Only Mine</option>");
@ -667,7 +659,7 @@ switch ($op)
} }
print("</p></form>\n"); print("</p></form>\n");
print("<hr />\n"); print("<hr noshade/>\n");
$query = ""; $query = "";
$prefix = "WHERE "; $prefix = "WHERE ";
@ -700,7 +692,7 @@ switch ($op)
$prefix = " AND "; $prefix = " AND ";
} }
if (!$REMOTE_USER) if (!$LOGIN_USER)
{ {
$query .= "${prefix}is_published = 1"; $query .= "${prefix}is_published = 1";
$prefix = " AND "; $prefix = " AND ";
@ -708,10 +700,10 @@ switch ($op)
if ($femail) if ($femail)
{ {
if ($REMOTE_USER) if ($LOGIN_USER)
{ {
$query .= "${prefix}(manager_email = '' OR " $query .= "${prefix}(manager_email = '' OR "
." manager_email = '$managers[$REMOTE_USER]')"; ." manager_email = '$managers[$LOGIN_USER]')";
$prefix = " AND "; $prefix = " AND ";
} }
else if (array_key_exists("FROM", $_COOKIE)) else if (array_key_exists("FROM", $_COOKIE))
@ -815,38 +807,35 @@ switch ($op)
print("<p>$count STR(s) found, showing $start to $end:</p>\n"); print("<p>$count STR(s) found, showing $start to $end:</p>\n");
if ($REMOTE_USER) if ($LOGIN_USER)
print("<form method='POST' action='$PHP_SELF?B$options'>\n"); print("<form method='POST' action='$PHP_SELF?B$options'>\n");
print("<p><table border='0' cellspacing='0' cellpadding='5' "
."width='100%'>\n");
if ($count > $STR_PAGE_MAX) if ($count > $STR_PAGE_MAX)
{ {
print("<tr><td colspan='4'>"); print("<p><table border='0' cellspacing='0' cellpadding='0' "
."width='100%'>\n");
print("<tr><td>");
if ($index > 0) if ($index > 0)
print("[ <a href='$PHP_SELF?L+P$priority+S$status+C$scope+I$prev+" print("[&nbsp;<a href='$PHP_SELF?L+P$priority+S$status+C$scope+I$prev+"
."E$femail+Q" . urlencode($search) . "'>Previous $STR_PAGE_MAX</a> ]"); ."E$femail+Q"
if ($REMOTE_USER) . urlencode($search)
print("</td><td colspan='4' align='right'>"); ."'>Previous&nbsp;$STR_PAGE_MAX</a>&nbsp;]");
else print("</td><td align='right'>");
print("</td><td colspan='3' align='right'>");
if ($end < $count) if ($end < $count)
print("[ <a href='$PHP_SELF?L+P$priority+S$status+C$scope+I$next+" print("[&nbsp;<a href='$PHP_SELF?L+P$priority+S$status+C$scope+I$next+"
."E$femail+Q" . urlencode($search) . "'>Next $STR_PAGE_MAX</a> ]"); ."E$femail+Q"
. urlencode($search)
."'>Next&nbsp;$STR_PAGE_MAX</a>&nbsp;]");
print("</td></tr>\n"); print("</td></tr>\n");
print("</table></p>\n");
} }
print("<tr class='header'><th>Id</th><th>Priority</th>" html_start_table(array("Id", "Priority", "Status", "Scope",
."<th>Status</th><th>Scope</th><th>Summary</th>" "Summary", "Version", "Last Updated",
."<th>Version</th><th>Last Updated</th>"); "Assigned To"));
if ($REMOTE_USER)
print("<th>Assigned To</th>");
print("</tr>\n");
$line = 0; if ($LOGIN_USER)
if ($REMOTE_USER)
$sumlen = 80; $sumlen = 80;
else else
$sumlen = 40; $sumlen = 40;
@ -861,12 +850,10 @@ switch ($op)
$sttext = $status_text[$row['status']]; $sttext = $status_text[$row['status']];
$sctext = $scope_text[$row['scope']]; $sctext = $scope_text[$row['scope']];
if ($row['is_published']) html_start_row();
print("<tr class='data$line'>");
else
print("<tr class='priv$line'>");
print("<td nowrap>"); print("<td nowrap>");
if ($REMOTE_USER) if ($LOGIN_USER)
print("<input type='checkbox' name='ID_$row[id]'>"); print("<input type='checkbox' name='ID_$row[id]'>");
print("<a href='$PHP_SELF?L$row[id]$options' alt='STR #$row[id]: $summary'>" print("<a href='$PHP_SELF?L$row[id]$options' alt='STR #$row[id]: $summary'>"
."$row[id]</a></td>" ."$row[id]</a></td>"
@ -877,18 +864,17 @@ switch ($op)
."alt='STR #$row[id]: $summary'>$summabbr</a></td>" ."alt='STR #$row[id]: $summary'>$summabbr</a></td>"
."<td align='center'>$row[str_version]</td>" ."<td align='center'>$row[str_version]</td>"
."<td align='center'>$date</td>"); ."<td align='center'>$date</td>");
if ($REMOTE_USER)
{
if ($row['manager_email'] != "")
$email = sanitize_email($row['manager_email']);
else
$email = "<i>Unassigned</i>";
print("<td align='center'>$email</td>"); if ($row['manager_email'] != "")
} $email = sanitize_email($row['manager_email']);
print("</tr>\n"); else
$email = "<i>Unassigned</i>";
print("<td align='center'>$email</td>");
html_end_row();
if ($REMOTE_USER && $row['status'] >= $STR_STATUS_PENDING) if ($row['status'] >= $STR_STATUS_PENDING)
{ {
$textresult = db_query("SELECT * FROM strtext " $textresult = db_query("SELECT * FROM strtext "
."WHERE str_id = $row[id] " ."WHERE str_id = $row[id] "
@ -897,30 +883,28 @@ switch ($op)
{ {
$textrow = db_next($textresult); $textrow = db_next($textresult);
if ($row['is_published']) html_start_row();
print("<tr class='data$line'>");
else
print("<tr class='priv$line'>");
$email = sanitize_email($textrow->email); $email = sanitize_email($textrow['email']);
$contents = quote_text(abbreviate($textrow->contents, 128)); $contents = abbreviate(quote_text($textrow['contents']), 128);
print("<td align='center' valign='top' colspan='2'>$email</td>" print("<td align='center' valign='top' colspan='2'>$email</td>"
."<td valign='top' colspan='6' width='100%'><tt>$contents</tt></td>" ."<td valign='top' colspan='6' width='100%'>"
."</tr>\n"); ."<tt>$contents</tt></td>");
html_end_row();
db_free($textresult); db_free($textresult);
} }
} }
$line = 1 - $line;
} }
db_free($result); db_free($result);
if ($REMOTE_USER) if ($LOGIN_USER)
{ {
print("<tr class='header'><th colspan='8'>"); html_start_row("header");
print("<th colspan='8'>");
print("Status:&nbsp;<select name='STATUS'>" print("Status:&nbsp;<select name='STATUS'>"
."<option value=''>No Change</option>"); ."<option value=''>No Change</option>");
@ -956,31 +940,34 @@ switch ($op)
print("</select>\n"); print("</select>\n");
print("<input type='submit' value='Modify Selected STRs'>"); print("<input type='submit' value='Modify Selected STRs'>");
print("</th><tr>\n"); print("</th>\n");
html_end_row();
} }
else
print("<tr class='header'><th colspan='7'>" html_end_table();
."<spacer width='1' height='1'></th><tr>\n");
if ($count > $STR_PAGE_MAX) if ($count > $STR_PAGE_MAX)
{ {
print("<tr><td colspan='4'>"); print("<p><table border='0' cellspacing='0' cellpadding='0' "
."width='100%'>\n");
print("<tr><td>");
if ($index > 0) if ($index > 0)
print("[ <a href='$PHP_SELF?L+P$priority+S$status+C$scope+I$prev+" print("[&nbsp;<a href='$PHP_SELF?L+P$priority+S$status+C$scope+I$prev+"
."E$femail+Q" . urlencode($search) . "'>Previous $STR_PAGE_MAX</a> ]"); ."E$femail+Q"
if ($REMOTE_USER) . urlencode($search)
print("</td><TD COLSPAN='4' ALIGN='RIGHT'>"); ."'>Previous&nbsp;$STR_PAGE_MAX</a>&nbsp;]");
else print("</td><td align='right'>");
print("</td><TD COLSPAN='3' ALIGN='RIGHT'>");
if ($end < $count) if ($end < $count)
print("[ <a href='$PHP_SELF?L+P$priority+S$status+C$scope+I$next+" print("[&nbsp;<a href='$PHP_SELF?L+P$priority+S$status+C$scope+I$next+"
."E$femail+Q" . urlencode($search) . "'>Next $STR_PAGE_MAX</a> ]"); ."E$femail+Q"
. urlencode($search)
."'>Next&nbsp;$STR_PAGE_MAX</a>&nbsp;]");
print("</td></tr>\n"); print("</td></tr>\n");
print("</table></p>\n");
} }
print("</table>"); if ($LOGIN_USER)
if ($REMOTE_USER)
print("</form>"); print("</form>");
print("<p>" print("<p>"
@ -1003,7 +990,7 @@ switch ($op)
$subsystem = db_escape($_POST["SUBSYSTEM"]); $subsystem = db_escape($_POST["SUBSYSTEM"]);
$create_email = db_escape($_POST["CREATE_EMAIL"]); $create_email = db_escape($_POST["CREATE_EMAIL"]);
$manager_email = db_escape($_POST["MANAGER_EMAIL"]); $manager_email = db_escape($_POST["MANAGER_EMAIL"]);
$modify_email = db_escape($managers[$REMOTE_USER]); $modify_email = db_escape($managers[$LOGIN_USER]);
$contents = db_escape(trim($_POST["CONTENTS"])); $contents = db_escape(trim($_POST["CONTENTS"]));
$message = $_POST["MESSAGE"]; $message = $_POST["MESSAGE"];
@ -1025,8 +1012,8 @@ switch ($op)
if ($contents != "") if ($contents != "")
{ {
db_query("INSERT INTO strtext VALUES(NULL,$id,1,$time," db_query("INSERT INTO strtext VALUES(NULL,$id,1,'$contents',"
."'$modify_email','$contents')"); ."$time,'$modify_email')");
$contents = trim($_POST["CONTENTS"]) . "\n\n"; $contents = trim($_POST["CONTENTS"]) . "\n\n";
} }
@ -1034,8 +1021,8 @@ switch ($op)
{ {
$contents = db_escape($messages[$message]); $contents = db_escape($messages[$message]);
db_query("INSERT INTO strtext VALUES(NULL,$id,1,$time," db_query("INSERT INTO strtext VALUES(NULL,$id,1,'$contents',"
."'$modify_email','$contents')"); ."$time,'$modify_email')");
$contents = $messages[$message] . "\n\n"; $contents = $messages[$message] . "\n\n";
} }
@ -1067,12 +1054,12 @@ switch ($op)
{ {
html_header("STR #$id"); html_header("STR #$id");
print("<p align='center'>" html_start_links(1);
."[&nbsp;<a href='$PHP_SELF?L$options'>Return&nbsp;to&nbsp;STR&nbsp;List</a>" html_link("Return to STR List", "$PHP_SELF?L$options");
." | <a href='$PHP_SELF?L$id$options'>Return&nbsp;to&nbsp;STR&nbsp;#$id</a>" html_link("Return to STR #$id", "$PHP_SELF?L$id$options");
." | <a href='$PHP_SELF?T$id$options'>Post&nbsp;Text</a>" html_link("Post Text", "$PHP_SELF?T$id$options");
." | <a href='$PHP_SELF?F$id$options'>Post&nbsp;File</a>" html_link("Post File", "$PHP_SELF?F$id$options");
."&nbsp;]</p><hr />\n"); html_end_links();
$result = db_query("SELECT * FROM str WHERE id = $id"); $result = db_query("SELECT * FROM str WHERE id = $id");
if (db_count($result) != 1) if (db_count($result) != 1)
@ -1221,7 +1208,7 @@ switch ($op)
."<INPUT type='SUBMIT' value='Update Trouble Report'></th></tr>\n"); ."<INPUT type='SUBMIT' value='Update Trouble Report'></th></tr>\n");
print("</table></p></form>\n"); print("</table></p></form>\n");
print("<hr /><p><b>Trouble Report Files:</b> " print("<hr noshade/><p><b>Trouble Report Files:</b> "
."[ <a href='$PHP_SELF?F$id$options'>Post&nbsp;File</a> ]" ."[ <a href='$PHP_SELF?F$id$options'>Post&nbsp;File</a> ]"
."</p>\n"); ."</p>\n");
@ -1268,7 +1255,7 @@ switch ($op)
db_free($result); db_free($result);
print("<hr /><p><b>Trouble Report Dialog:</b> " print("<hr noshade/><p><b>Trouble Report Dialog:</b> "
."[ <a href='$PHP_SELF?T$id$options'>Post&nbsp;Text</a> ]" ."[ <a href='$PHP_SELF?T$id$options'>Post&nbsp;Text</a> ]"
."</p>\n"); ."</p>\n");
@ -1330,8 +1317,8 @@ switch ($op)
$email = $_POST["EMAIL"]; $email = $_POST["EMAIL"];
setcookie("FROM", "$email", time() + 57600, $PHP_SELF, $SERVER_NAME); setcookie("FROM", "$email", time() + 57600, $PHP_SELF, $SERVER_NAME);
} }
else if ($REMOTE_USER) else if ($LOGIN_USER)
$email = $managers[$REMOTE_USER]; $email = $managers[$LOGIN_USER];
else if (array_key_exists("FROM", $_COOKIE)) else if (array_key_exists("FROM", $_COOKIE))
$email = $_COOKIE["FROM"]; $email = $_COOKIE["FROM"];
else else
@ -1345,8 +1332,8 @@ switch ($op)
} }
else else
{ {
if ($REMOTE_USER) if ($LOGIN_USER)
$email = $managers[$REMOTE_USER]; $email = $managers[$LOGIN_USER];
else else
$email = $_COOKIE["FROM"]; $email = $_COOKIE["FROM"];
@ -1362,8 +1349,8 @@ switch ($op)
$temail = db_escape($email); $temail = db_escape($email);
$tcontents = db_escape($contents); $tcontents = db_escape($contents);
db_query("INSERT INTO strtext VALUES(NULL,$id,1,$time,'$temail'," db_query("INSERT INTO strtext VALUES(NULL,$id,1,'$tcontents',"
."'$tcontents')"); ."$time,'$temail')");
db_query("UPDATE str SET modify_date=$time, modify_email='$temail' " db_query("UPDATE str SET modify_date=$time, modify_email='$temail' "
."WHERE id = $id"); ."WHERE id = $id");
@ -1379,21 +1366,22 @@ switch ($op)
{ {
html_header("Post Text For STR #$id"); html_header("Post Text For STR #$id");
print("<p align='center'>[ <a href='$PHP_SELF?L$id$options'>Return to " html_start_links(1);
."STR #$id</a> ]</p>\n"); html_link("Return to STR #$id", "$PHP_SELF?L$id$options");
html_end_links();
if ($REQUEST_METHOD == "POST") if ($REQUEST_METHOD == "POST")
{ {
print("<p><b>Error:</b> Please fill in the fields marked in " print("<p><b>Error:</b> Please fill in the fields marked in "
."<b><font color='red'>bold red</font></b> below and resubmit " ."<b><font color='red'>bold red</font></b> below and resubmit "
."your trouble report.</p><hr />\n"); ."your trouble report.</p><hr noshade/>\n");
$hstart = "<font color='red'>"; $hstart = "<font color='red'>";
$hend = "</font>"; $hend = "</font>";
} }
else else
{ {
print("<hr />\n"); print("<hr noshade/>\n");
$hstart = ""; $hstart = "";
$hend = ""; $hend = "";
@ -1437,8 +1425,8 @@ switch ($op)
$email = $_POST["EMAIL"]; $email = $_POST["EMAIL"];
setcookie("FROM", "$email", time() + 57600, $PHP_SELF, $SERVER_NAME); setcookie("FROM", "$email", time() + 57600, $PHP_SELF, $SERVER_NAME);
} }
else if ($REMOTE_USER) else if ($LOGIN_USER)
$email = $managers[$REMOTE_USER]; $email = $managers[$LOGIN_USER];
else if (array_key_exists("FROM", $_COOKIE)) else if (array_key_exists("FROM", $_COOKIE))
$email = $_COOKIE["FROM"]; $email = $_COOKIE["FROM"];
else else
@ -1461,8 +1449,8 @@ switch ($op)
} }
else else
{ {
if ($REMOTE_USER) if ($LOGIN_USER)
$email = $managers[$REMOTE_USER]; $email = $managers[$LOGIN_USER];
else else
$email = $_COOKIE["FROM"]; $email = $_COOKIE["FROM"];
@ -1507,8 +1495,8 @@ switch ($op)
fclose($infile); fclose($infile);
fclose($outfile); fclose($outfile);
db_query("INSERT INTO strfile VALUES(NULL,$id,1,$time,'$temail'," db_query("INSERT INTO strfile VALUES(NULL,$id,1,'$tname',"
."'$tname')"); ."$time,'$temail')");
db_query("UPDATE str SET modify_date=$time, modify_email='$temail' " db_query("UPDATE str SET modify_date=$time, modify_email='$temail' "
."WHERE id = $id"); ."WHERE id = $id");
@ -1524,21 +1512,22 @@ switch ($op)
{ {
html_header("Post File For STR #$id"); html_header("Post File For STR #$id");
print("<p align='center'>[ <a href='$PHP_SELF?L$id$options'>Return to " html_start_links(1);
."STR #$id</a> ]</p>\n"); html_link("Return to STR #$id", "$PHP_SELF?L$id$options");
html_end_links();
if ($REQUEST_METHOD == "POST") if ($REQUEST_METHOD == "POST")
{ {
print("<p><b>Error:</b> Please fill in the fields marked in " print("<p><b>Error:</b> Please fill in the fields marked in "
."<b><font color='red'>bold red</font></b> below and resubmit " ."<b><font color='red'>bold red</font></b> below and resubmit "
."your trouble report.</p><hr />\n"); ."your trouble report.</p><hr noshade/>\n");
$hstart = "<font color='red'>"; $hstart = "<font color='red'>";
$hend = "</font>"; $hend = "</font>";
} }
else else
{ {
print("<hr />\n"); print("<hr noshade/>\n");
$hstart = ""; $hstart = "";
$hend = ""; $hend = "";
@ -1590,10 +1579,8 @@ switch ($op)
if (array_key_exists("EMAIL", $_POST)) if (array_key_exists("EMAIL", $_POST))
{ {
$email = $_POST["EMAIL"]; $email = $_POST["EMAIL"];
setcookie("FROM", "$email", time() + 57600, $PHP_SELF, $SERVER_NAME); setcookie("FROM", "$email", time() + 90 * 86400, "/");
} }
else if ($REMOTE_USER)
$email = $managers[$REMOTE_USER];
else if (array_key_exists("FROM", $_COOKIE)) else if (array_key_exists("FROM", $_COOKIE))
$email = $_COOKIE["FROM"]; $email = $_COOKIE["FROM"];
else else
@ -1614,10 +1601,10 @@ switch ($op)
} }
else else
{ {
if ($REMOTE_USER) if (array_key_exists("FROM", $_COOKIE))
$email = $managers[$REMOTE_USER]; $email = $_COOKIE["FROM"];
else else
$email = $_COOKIE["FROM"]; $email = "";
$npriority = 0; $npriority = 0;
$nscope = 0; $nscope = 0;
@ -1644,8 +1631,8 @@ switch ($op)
$id = db_insert_id(); $id = db_insert_id();
db_query("INSERT INTO strtext VALUES(NULL,$id,1,$time,'$temail'," db_query("INSERT INTO strtext VALUES(NULL,$id,1,'$tcontents',"
."'$tcontents')"); ."$time,'$temail')");
if ($filename != "") if ($filename != "")
{ {
@ -1680,8 +1667,8 @@ switch ($op)
fclose($infile); fclose($infile);
fclose($outfile); fclose($outfile);
db_query("INSERT INTO strfile VALUES(NULL,$id,1,$time,'$temail'," db_query("INSERT INTO strfile VALUES(NULL,$id,1,'$tname',"
."'$tname')"); ."$time,'$temail')");
} }
header("Location: $PHP_SELF?L$id$options"); header("Location: $PHP_SELF?L$id$options");
@ -1691,14 +1678,15 @@ switch ($op)
{ {
html_header("New STR"); html_header("New STR");
print("<p align='center'>[ <a href='$PHP_SELF?L$options'>Return to " html_start_links(1);
."STR List</a> ]</p>\n"); html_link("Return to STR List", "$PHP_SELF?L$options");
html_end_links();
if ($REQUEST_METHOD == "POST") if ($REQUEST_METHOD == "POST")
{ {
print("<p><b>Error:</b> Please fill in the fields marked in " print("<p><b>Error:</b> Please fill in the fields marked in "
."<b><font color='red'>bold red</font></b> below and resubmit " ."<b><font color='red'>bold red</font></b> below and resubmit "
."your trouble report.</p><hr />\n"); ."your trouble report.</p><hr noshade/>\n");
$hstart = "<font color='red'>"; $hstart = "<font color='red'>";
$hend = "</font>"; $hend = "</font>";
@ -1706,11 +1694,11 @@ switch ($op)
else else
{ {
print("<p>Please use this form to report all bugs and request " print("<p>Please use this form to report all bugs and request "
."features in the Mini-XML software. Be sure to include " ."features in the $STR_PROJECT software. Be sure to include "
."the operating system, compiler, sample programs and/or " ."the operating system, compiler, sample programs and/or "
."files, and any other information you can about your " ."files, and any other information you can about your "
."problem. <i>Thank you</i> for helping us to make Mini-XML " ."problem. <i>Thank you</i> for helping us to improve "
."a better library!</p><hr />\n"); ."$STR_PROJECT!</p><hr noshade/>\n");
$hstart = ""; $hstart = "";
$hend = ""; $hend = "";
@ -1852,7 +1840,8 @@ switch ($op)
setcookie("FROM", "$email", time() + 57600, $PHP_SELF, $SERVER_NAME); setcookie("FROM", "$email", time() + 57600, $PHP_SELF, $SERVER_NAME);
$result = db_query("SELECT * FROM strcc WHERE str_id = $id AND email = '$email'"); $result = db_query("SELECT * FROM carboncopy WHERE "
."url = 'str.php?L$id' AND email = '$email'");
html_header("STR #$id Notifications"); html_header("STR #$id Notifications");
@ -1863,7 +1852,7 @@ switch ($op)
."notification list for STR #$id!</p>\n"); ."notification list for STR #$id!</p>\n");
else else
{ {
db_query("INSERT INTO strcc VALUES(NULL,$id,'$email')"); db_query("INSERT INTO carboncopy VALUES(NULL,'str.php?L$id','$email')");
print("<p>Your email address has been added to the notification list " print("<p>Your email address has been added to the notification list "
."for STR #$id.</p>\n"); ."for STR #$id.</p>\n");
@ -1871,7 +1860,8 @@ switch ($op)
} }
else if ($result && db_count($result) > 0) else if ($result && db_count($result) > 0)
{ {
db_query("DELETE FROM strcc WHERE str_id = $id AND email = '$email'"); db_query("DELETE FROM carboncopy WHERE "
."url = 'str.php?L$id' AND email = '$email'");
print("<p>Your email address has been removed from the notification list " print("<p>Your email address has been removed from the notification list "
."for STR #$id.</p>\n"); ."for STR #$id.</p>\n");
@ -1885,7 +1875,9 @@ switch ($op)
if ($result) if ($result)
db_free($result); db_free($result);
print("<p>[ <a href='$PHP_SELF?L$id$options'>Return to STR #$id</a> ]</p>\n"); html_start_links();
html_link("Return to STR #$id", "$PHP_SELF?L$id$options");
html_end_links();
html_footer(); html_footer();
break; break;

@ -10,6 +10,10 @@ P, TD, TH {
font-family: serif; font-family: serif;
} }
P.center {
text-align: center;
}
H1, H2, H3, H4, H5, H6 { H1, H2, H3, H4, H5, H6 {
color: #000000; color: #000000;
font-family: sans-serif; font-family: sans-serif;
@ -39,6 +43,10 @@ TR.header, TR.header TH, TH.header {
background-color: #cccccc; background-color: #cccccc;
} }
TR.page {
background-color: #f8f8f8;
}
TR.data0, TD.data0 { TR.data0, TD.data0 {
background-color: #eeeeee; background-color: #eeeeee;
} }

Loading…
Cancel
Save