From 668a16604d697c339c52b670df78c276a89ef0fc Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Mon, 17 May 2004 21:00:42 +0000 Subject: [PATCH] Fix db schema for strtext (missing comma) Cleanup STR page. Add LOGIN_LEVEL global to auth stuff. --- www/data/mxml.sql | 6 +- www/phplib/auth.php | 22 ++++--- www/str.php | 137 ++++++++++++++++++++++++-------------------- 3 files changed, 92 insertions(+), 73 deletions(-) diff --git a/www/data/mxml.sql b/www/data/mxml.sql index 3423598..d7f0c91 100644 --- a/www/data/mxml.sql +++ b/www/data/mxml.sql @@ -1,5 +1,5 @@ -- --- "$Id: mxml.sql,v 1.2 2004/05/17 20:28:52 mike Exp $" +-- "$Id: mxml.sql,v 1.3 2004/05/17 21:00:42 mike Exp $" -- -- Database schema for the Mini-XML web pages. -- @@ -123,7 +123,7 @@ CREATE TABLE strtext ( id INTEGER PRIMARY KEY, -- Text ID str_id INTEGER, -- STR number is_published INTEGER, -- 0 = private, 1 = public - contents TEXT -- Text message + contents TEXT, -- Text message create_date INTEGER, -- Time/date of creation create_user VARCHAR(255) -- User that posted the text ); @@ -155,5 +155,5 @@ INSERT INTO users VALUES(NULL, 1, 'mike', 'Michael Sweet ', 1084823565, 'mike', 1084823565, 'mike'); -- --- End of "$Id: mxml.sql,v 1.2 2004/05/17 20:28:52 mike Exp $". +-- End of "$Id: mxml.sql,v 1.3 2004/05/17 21:00:42 mike Exp $". -- diff --git a/www/phplib/auth.php b/www/phplib/auth.php index af4c0bd..21006db 100644 --- a/www/phplib/auth.php +++ b/www/phplib/auth.php @@ -1,6 +1,6 @@ diff --git a/www/str.php b/www/str.php index 38e5fa5..a1a1589 100644 --- a/www/str.php +++ b/www/str.php @@ -146,9 +146,9 @@ notify_creator($id, // I - STR # else $fix_version = "Unassigned"; - if ($row['create_email'] != $row['modify_email'] && - $row['create_email'] != $manager) - mail($row['create_email'], "$STR_PROJECT STR #$id $what", + if ($row['create_user'] != $row['modify_user'] && + $row['create_user'] != $manager) + mail($row['create_user'], "$STR_PROJECT 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" @@ -200,7 +200,7 @@ notify_creator($id, // I - STR # else $manager = "$STR_EMAIL"; - if ($row['modify_email'] != $manager) + if ($row['modify_user'] != $manager) mail($manager, "$STR_PROJECT STR #$id $what", "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" @@ -380,7 +380,7 @@ switch ($op) { $time = time(); $manager_email = db_escape($_POST["MANAGER_EMAIL"]); - $modify_email = db_escape($managers[$LOGIN_USER]); + $modify_user = db_escape($_COOKIE["FROM"]); $message = $_POST["MESSAGE"]; if ($message != "") @@ -394,7 +394,7 @@ switch ($op) $mailmsg = ""; } - $query = "modify_date = $time, modify_email = '$modify_email'"; + $query = "modify_date = $time, modify_user = '$modify_user'"; if ($_POST["STATUS"] != "") $query .= ", status = $_POST[STATUS]"; @@ -416,7 +416,7 @@ switch ($op) if ($contents != "") { db_query("INSERT INTO strtext VALUES(NULL,$id,1,'$contents'," - ."$time,'$modify_email')"); + ."$time,'$modify_user')"); notify_creator($id, "updated", $mailmsg); } @@ -444,7 +444,7 @@ switch ($op) $row = db_next($result); html_start_links(1); - html_link("Return to STR List", "$PHP_SELF?L$options"); + html_link("Return to Support", "$PHP_SELF?L$options"); if ($row['status'] >= $STR_STATUS_ACTIVE) { @@ -457,7 +457,9 @@ switch ($op) html_end_links(); - $create_email = sanitize_email($row['create_email']); + print("

STR #$id

\n"); + + $create_user = sanitize_email($row['create_user']); $manager_email = sanitize_email($row['manager_email']); $subsystem = $row['subsystem']; $summary = htmlspecialchars($row['summary'], ENT_QUOTES); @@ -494,13 +496,11 @@ switch ($op) print("Subsystem:$subsystem\n"); print("Summary:$summary\n"); print("Version:$str_version\n"); - print("Created By:$create_email\n"); + print("Created By:$create_user\n"); print("Assigned To:$manager_email\n"); print("Fix Version:$fix_version\n"); - if ($LOGIN_USER) - $email = htmlspecialchars($managers[$LOGIN_USER]); - else if (array_key_exists("FROM", $_COOKIE)) + if (array_key_exists("FROM", $_COOKIE)) $email = htmlspecialchars($_COOKIE["FROM"]); else $email = ""; @@ -536,9 +536,9 @@ switch ($op) while ($row = db_next($result)) { - $date = date("M d, Y", $row['date']); - $time = date("H:m", $row['date']); - $email = sanitize_email($row['email']); + $date = date("M d, Y", $row['create_date']); + $time = date("H:m", $row['create_date']); + $email = sanitize_email($row['create_user']); $filename = htmlspecialchars($row['filename']); html_start_row(); @@ -572,9 +572,9 @@ switch ($op) while ($row = db_next($result)) { - $date = date("M d, Y", $row['date']); - $time = date("H:m", $row['date']); - $email = sanitize_email($row['email']); + $date = date("M d, Y", $row['create_date']); + $time = date("H:m", $row['create_date']); + $email = sanitize_email($row['create_user']); $contents = quote_text($row['contents']); html_start_row(); @@ -590,12 +590,14 @@ switch ($op) } else { - html_header("STR List"); + html_header("Support"); html_start_links(1); html_link("Post New Software Trouble Report", "$PHP_SELF?N$options'"); html_end_links(); + print("

Support

\n"); + print("

" ."Search Words:  " ."

\n"); @@ -641,7 +643,7 @@ switch ($op) } print("\n"); - if ($LOGIN_USER || array_key_exists("FROM", $_COOKIE)) + if (array_key_exists("FROM", $_COOKIE)) { print("Show: \n"); + ."value='$create_user' size='40'>\n"); print("Assigned To:" ."