mirror of
https://github.com/michaelrsweet/mxml.git
synced 2024-11-08 13:39:58 +00:00
Private symbol for hidden articles/STRs.
Batch support for articles. HTML tag support for article contents. Colorize PRE text. Move project name, email, and max items/page to globals.php.
This commit is contained in:
parent
659c7425b4
commit
fcb37ae372
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
//
|
||||
// "$Id: account.php,v 1.4 2004/05/18 21:26:52 mike Exp $"
|
||||
// "$Id: account.php,v 1.5 2004/05/19 00:57:33 mike Exp $"
|
||||
//
|
||||
// Account management page...
|
||||
//
|
||||
@ -64,6 +64,10 @@ switch ($op)
|
||||
$abstract = htmlspecialchars($row['abstract'], ENT_QUOTES);
|
||||
$date = date("M d, Y", $row['modify_date']);
|
||||
|
||||
if ($row['is_published'] == 0)
|
||||
$title .= " <img src='images/private.gif' width='16' height='16' "
|
||||
."border='0' align='middle' alt='Private'/>";
|
||||
|
||||
html_start_row();
|
||||
|
||||
print("<td align='center' nowrap><a "
|
||||
@ -112,6 +116,10 @@ switch ($op)
|
||||
$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>"
|
||||
@ -184,6 +192,6 @@ switch ($op)
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: account.php,v 1.4 2004/05/18 21:26:52 mike Exp $".
|
||||
// End of "$Id: account.php,v 1.5 2004/05/19 00:57:33 mike Exp $".
|
||||
//
|
||||
?>
|
||||
|
295
www/articles.php
295
www/articles.php
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
//
|
||||
// "$Id: articles.php,v 1.4 2004/05/18 21:26:52 mike Exp $"
|
||||
// "$Id: articles.php,v 1.5 2004/05/19 00:57:33 mike Exp $"
|
||||
//
|
||||
// Web form for the article table...
|
||||
//
|
||||
@ -18,7 +18,7 @@ include_once "phplib/common.php";
|
||||
// Maximum number of articles per page...
|
||||
//
|
||||
|
||||
$ARTICLE_PAGE_MAX = 10;
|
||||
$PAGE_MAX = 10;
|
||||
|
||||
|
||||
// Get command-line options...
|
||||
@ -27,6 +27,7 @@ $ARTICLE_PAGE_MAX = 10;
|
||||
//
|
||||
// Operations:
|
||||
//
|
||||
// B - Batch update selected articles
|
||||
// D# - Delete article
|
||||
// L = List all
|
||||
// L# = List article #
|
||||
@ -46,7 +47,7 @@ if ($argc)
|
||||
$op = $argv[0][0];
|
||||
$id = (int)substr($argv[0], 1);
|
||||
|
||||
if ($op != 'D' && $op != 'L' && $op != 'M' && $op != 'N')
|
||||
if ($op != 'D' && $op != 'L' && $op != 'M' && $op != 'N' && $op != 'B')
|
||||
{
|
||||
html_header("Article Error");
|
||||
print("<p>Bad command '$op'!\n");
|
||||
@ -62,7 +63,7 @@ if ($argc)
|
||||
exit();
|
||||
}
|
||||
|
||||
if (($op == 'D' || $op == 'M') && $LOGIN_USER == "")
|
||||
if (($op == 'D' || $op == 'M' && $op != 'B') && $LOGIN_USER == "")
|
||||
{
|
||||
html_header("Article Error");
|
||||
print("<p>Command '$op' requires a login!\n");
|
||||
@ -123,6 +124,40 @@ $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")
|
||||
{
|
||||
@ -294,7 +329,12 @@ switch ($op)
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= "$prefix$logic (title LIKE \"%$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;
|
||||
@ -318,23 +358,26 @@ switch ($op)
|
||||
}
|
||||
|
||||
if ($index >= $count)
|
||||
$index = $count - ($count % $ARTICLE_PAGE_MAX);
|
||||
$index = $count - ($count % $PAGE_MAX);
|
||||
if ($index < 0)
|
||||
$index = 0;
|
||||
|
||||
$start = $index + 1;
|
||||
$end = $index + $ARTICLE_PAGE_MAX;
|
||||
$end = $index + $PAGE_MAX;
|
||||
if ($end > $count)
|
||||
$end = $count;
|
||||
|
||||
$prev = $index - $ARTICLE_PAGE_MAX;
|
||||
$prev = $index - $PAGE_MAX;
|
||||
if ($prev < 0)
|
||||
$prev = 0;
|
||||
$next = $index + $ARTICLE_PAGE_MAX;
|
||||
$next = $index + $PAGE_MAX;
|
||||
|
||||
print("<p>$count article(s) found, showing $start to $end:</p>\n");
|
||||
|
||||
if ($count > $ARTICLE_PAGE_MAX)
|
||||
if ($LOGIN_USER)
|
||||
print("<form method='POST' action='$PHP_SELF?B$options'>\n");
|
||||
|
||||
if ($count > $PAGE_MAX)
|
||||
{
|
||||
print("<p><table border='0' cellspacing='0' cellpadding='0' "
|
||||
."width='100%'>\n");
|
||||
@ -342,11 +385,11 @@ switch ($op)
|
||||
print("<tr><td>");
|
||||
if ($index > 0)
|
||||
print("[ <a href='$PHP_SELF?L+I$prev+Q" . urlencode($search)
|
||||
."'>Previous $ARTICLE_PAGE_MAX</a> ]");
|
||||
."'>Previous $PAGE_MAX</a> ]");
|
||||
print("</td><td align='right'>");
|
||||
if ($end < $count)
|
||||
{
|
||||
$next_count = min($ARTICLE_PAGE_MAX, $count - $end);
|
||||
$next_count = min($PAGE_MAX, $count - $end);
|
||||
print("[ <a href='$PHP_SELF?L+I$next+Q" . urlencode($search)
|
||||
."'>Next $next_count</a> ]");
|
||||
}
|
||||
@ -357,30 +400,30 @@ switch ($op)
|
||||
html_start_table(array("ID","Title","Last Modified", "Comment(s)"));
|
||||
|
||||
db_seek($result, $index);
|
||||
for ($i = 0; $i < $ARTICLE_PAGE_MAX && $row = db_next($result); $i ++)
|
||||
for ($i = 0; $i < $PAGE_MAX && $row = db_next($result); $i ++)
|
||||
{
|
||||
html_start_row();
|
||||
|
||||
$id = $row['id'];
|
||||
$id = $row['id'];
|
||||
$link = "<a href='$PHP_SELF?L$id$options' alt='Article #$id'>";
|
||||
|
||||
print("<td align='center'><a href='$PHP_SELF?L$id$options' "
|
||||
."alt='Article #$id'>"
|
||||
."$id</a></td>");
|
||||
print("<td align='center' nowrap>");
|
||||
if ($LOGIN_USER)
|
||||
print("<input type='checkbox' name='ID_$row[id]'>");
|
||||
print("$link$id</a></td>");
|
||||
|
||||
$temp = htmlspecialchars($row['title']);
|
||||
print("<td align='center' width='67%'><a href='$PHP_SELF?L$id$options' "
|
||||
."alt='Article #$id'>"
|
||||
."$temp</a></td>");
|
||||
if ($row['is_published'] == 0)
|
||||
$temp .= " <img src='images/private.gif' width='16' height='16' "
|
||||
."border='0' align='middle' alt='Private'/>";
|
||||
|
||||
print("<td align='center' width='67%'>$link$temp</a></td>");
|
||||
|
||||
$temp = date("M d, Y", $row['modify_date']);
|
||||
print("<td align='center'><a href='$PHP_SELF?L$id$options' "
|
||||
."alt='Article #$id'>"
|
||||
."$temp</a></td>");
|
||||
print("<td align='center'>$link$temp</a></td>");
|
||||
|
||||
$count = count_comments("articles.php_L$id");
|
||||
print("<td align='center'><a href='$PHP_SELF?L$id$options' "
|
||||
."alt='Article #$id'>"
|
||||
."$count</a></td>");
|
||||
print("<td align='center'>$link$count</a></td>");
|
||||
|
||||
html_end_row();
|
||||
|
||||
@ -390,9 +433,20 @@ switch ($op)
|
||||
html_end_row();
|
||||
}
|
||||
|
||||
if ($LOGIN_USER)
|
||||
{
|
||||
html_start_row("header");
|
||||
|
||||
print("<th colspan='4'>Published: ");
|
||||
select_is_published();
|
||||
print("<input type='submit' value='Modify Selected Articles'/></th>\n");
|
||||
|
||||
html_end_row();
|
||||
}
|
||||
|
||||
html_end_table();
|
||||
|
||||
if ($count > $ARTICLE_PAGE_MAX)
|
||||
if ($count > $PAGE_MAX)
|
||||
{
|
||||
print("<p><table border='0' cellspacing='0' cellpadding='0' "
|
||||
."width='100%'>\n");
|
||||
@ -400,11 +454,11 @@ switch ($op)
|
||||
print("<tr><td>");
|
||||
if ($index > 0)
|
||||
print("[ <a href='$PHP_SELF?L+I$prev+Q" . urlencode($search)
|
||||
."'>Previous $ARTICLE_PAGE_MAX</a> ]");
|
||||
."'>Previous $PAGE_MAX</a> ]");
|
||||
print("</td><td align='right'>");
|
||||
if ($end < $count)
|
||||
{
|
||||
$next_count = min($ARTICLE_PAGE_MAX, $count - $end);
|
||||
$next_count = min($PAGE_MAX, $count - $end);
|
||||
print("[ <a href='$PHP_SELF?L+I$next+Q" . urlencode($search)
|
||||
."'>Next $next_count</a> ]");
|
||||
}
|
||||
@ -419,18 +473,67 @@ switch ($op)
|
||||
case 'M' : // Modify Article
|
||||
if ($REQUEST_METHOD == "POST")
|
||||
{
|
||||
$date = time();
|
||||
$is_published = db_escape($_POST["IS_PUBLISHED"]);
|
||||
$title = db_escape($_POST["TITLE"]);
|
||||
$abstract = db_escape($_POST["ABSTRACT"]);
|
||||
$contents = db_escape($_POST["CONTENTS"]);
|
||||
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_USER) && $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 = $date, "
|
||||
."modify_date = $modify_date, "
|
||||
."modify_user = '$LOGIN_USER' "
|
||||
."WHERE id = $id");
|
||||
|
||||
@ -446,35 +549,26 @@ switch ($op)
|
||||
html_end_links();
|
||||
|
||||
print("<h1>Modify Article #$id</h1>\n");
|
||||
$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);
|
||||
|
||||
print("<form method='post' action='$PHP_SELF?M$id$options'>"
|
||||
."<p><table width='100%' cellpadding='5' cellspacing='0' border='0'>\n");
|
||||
|
||||
print("<tr><th align='right'>Published:</th><td>");
|
||||
select_is_published($row['is_published']);
|
||||
select_is_published($is_published);
|
||||
print("</td></tr>\n");
|
||||
|
||||
$temp = htmlspecialchars($row['title'], ENT_QUOTES);
|
||||
$temp = htmlspecialchars($title, ENT_QUOTES);
|
||||
print("<tr><th align='right'>Title:</th>"
|
||||
."<td><input type='text' name='TITLE' "
|
||||
."value='$temp' size='40'></td></tr>\n");
|
||||
|
||||
$temp = htmlspecialchars($row['abstract'], ENT_QUOTES);
|
||||
$temp = htmlspecialchars($abstract, ENT_QUOTES);
|
||||
print("<tr><th align='right'>Abstract:</th>"
|
||||
."<td><input type='text' name='ABSTRACT' "
|
||||
."value='$temp' size='40'></td></tr>\n");
|
||||
|
||||
$temp = htmlspecialchars($row['contents'], ENT_QUOTES);
|
||||
print("<tr><th align='right'>Contents:</th>"
|
||||
$temp = htmlspecialchars($contents, ENT_QUOTES);
|
||||
print("<tr><th align='right' valign='top'>Contents:</th>"
|
||||
."<td><textarea name='CONTENTS' "
|
||||
."cols='80' rows='10' wrap='virtual'>"
|
||||
."$temp</textarea></td></tr>\n");
|
||||
@ -490,18 +584,63 @@ switch ($op)
|
||||
case 'N' : // Post new Article
|
||||
if ($REQUEST_METHOD == "POST")
|
||||
{
|
||||
$date = time();
|
||||
$is_published = db_escape($_POST["IS_PUBLISHED"]);
|
||||
$title = db_escape($_POST["TITLE"]);
|
||||
$abstract = db_escape($_POST["ABSTRACT"]);
|
||||
$contents = db_escape($_POST["CONTENTS"]);
|
||||
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 (array_key_exists("CREATE_USER", $_POST))
|
||||
$create_user = $_POST["CREATE_USER"];
|
||||
else
|
||||
$create_user = "";
|
||||
|
||||
if (($is_published == 0 || $LOGIN_USER) && $title != "" &&
|
||||
$abstract != "" && $contents != "")
|
||||
$havedata = 1;
|
||||
else
|
||||
$havedata = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$is_published = 0;
|
||||
$title = "";
|
||||
$abstract = "";
|
||||
$contents = "";
|
||||
|
||||
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',"
|
||||
."$date,'$LOGIN_USER',$date,'$LOGIN_USER')");
|
||||
."$is_published,'$title','$abstract','$contents',"
|
||||
."$create_date,'$create_user',$create_date,'$create_user')");
|
||||
|
||||
$id = db_insert_id();
|
||||
|
||||
@ -516,30 +655,56 @@ switch ($op)
|
||||
html_end_links();
|
||||
|
||||
print("<h1>Post New Article</h1>\n");
|
||||
|
||||
print("<p>Please use this form to post announcements, how-to's, "
|
||||
."examples, and case studies showing how you use $PROJECT. "
|
||||
."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!</p>\n"
|
||||
."<hr noshade/>\n");
|
||||
|
||||
print("<form method='post' action='$PHP_SELF?N$options'>"
|
||||
."<p><table width='100%' cellpadding='5' cellspacing='0' border='0'>\n");
|
||||
|
||||
if ($LOGIN_USER != "")
|
||||
{
|
||||
print("<tr><th align='right'>Published:</th><td>");
|
||||
select_is_published();
|
||||
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);
|
||||
|
||||
print("<tr><th align='right'>Title:</th>"
|
||||
."<td><input type='text' name='TITLE' "
|
||||
."size='40'></td></tr>\n");
|
||||
."size='40' value='$title'></td></tr>\n");
|
||||
|
||||
$abstract = htmlspecialchars($abstract, ENT_QUOTES);
|
||||
|
||||
print("<tr><th align='right'>Abstract:</th>"
|
||||
."<td><input type='text' name='ABSTRACT' "
|
||||
."size='40'></td></tr>\n");
|
||||
."size='40' value='$abstract'></td></tr>\n");
|
||||
|
||||
print("<tr><th align='right'>Contents:</th>"
|
||||
$author = htmlspecialchars($author, ENT_QUOTES);
|
||||
|
||||
print("<tr><th align='right'>Author:</th>"
|
||||
."<td><input type='text' name='CREATE_USER' "
|
||||
."size='40' value='$author'></td></tr>\n");
|
||||
|
||||
$contents = htmlspecialchars($contents, ENT_QUOTES);
|
||||
|
||||
print("<tr><th align='right' valign='top'>Contents:</th>"
|
||||
."<td><textarea name='CONTENTS' "
|
||||
."cols='80' rows='10' wrap='virtual'>"
|
||||
."</textarea></td></tr>\n");
|
||||
."$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='Create Article'></th></tr>\n");
|
||||
@ -551,6 +716,6 @@ switch ($op)
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: articles.php,v 1.4 2004/05/18 21:26:52 mike Exp $".
|
||||
// End of "$Id: articles.php,v 1.5 2004/05/19 00:57:33 mike Exp $".
|
||||
//
|
||||
?>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
//
|
||||
// "$Id: comment.php,v 1.2 2004/05/18 21:26:52 mike Exp $"
|
||||
// "$Id: comment.php,v 1.3 2004/05/19 00:57:33 mike Exp $"
|
||||
//
|
||||
// Comment and moderation interface for PHP pages...
|
||||
//
|
||||
@ -232,7 +232,7 @@ else
|
||||
print("<tr><th align='right'>File Path:</th>"
|
||||
."<td><input type='text' name='FILE' value='$path' "
|
||||
."size='40'/></td></tr>\n");
|
||||
print("<tr><th align='right'>Status:</th>"
|
||||
print("<tr><th align='right'>Score:</th>"
|
||||
."<td><select name='STATUS'>");
|
||||
for ($i = 0; $i <= 5; $i ++)
|
||||
if ($i == $status)
|
||||
@ -361,6 +361,6 @@ else
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: comment.php,v 1.2 2004/05/18 21:26:52 mike Exp $".
|
||||
// End of "$Id: comment.php,v 1.3 2004/05/19 00:57:33 mike Exp $".
|
||||
//
|
||||
?>
|
||||
|
BIN
www/images/private.gif
Normal file
BIN
www/images/private.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 84 B |
@ -1,6 +1,6 @@
|
||||
<?
|
||||
//
|
||||
// "$Id: common.php,v 1.5 2004/05/18 21:26:52 mike Exp $"
|
||||
// "$Id: common.php,v 1.6 2004/05/19 00:57:33 mike Exp $"
|
||||
//
|
||||
// Common utility functions for PHP pages...
|
||||
//
|
||||
@ -122,7 +122,57 @@ format_text($text) // I - Original string
|
||||
{
|
||||
case '<' :
|
||||
$col ++;
|
||||
$ftext .= "<";
|
||||
if (tolower(substr($text, $i, 8)) == "<a href=" ||
|
||||
tolower(substr($text, $i, 8)) == "<a name=" ||
|
||||
tolower(substr($text, $i, 4)) == "</a>" ||
|
||||
tolower(substr($text, $i, 3)) == "<b>" ||
|
||||
tolower(substr($text, $i, 4)) == "</b>" ||
|
||||
tolower(substr($text, $i, 12)) == "<blockquote>" ||
|
||||
tolower(substr($text, $i, 13)) == "</blockquote>" ||
|
||||
tolower(substr($text, $i, 6)) == "<code>" ||
|
||||
tolower(substr($text, $i, 7)) == "</code>" ||
|
||||
tolower(substr($text, $i, 4)) == "<em>" ||
|
||||
tolower(substr($text, $i, 5)) == "</em>" ||
|
||||
tolower(substr($text, $i, 4)) == "<h1>" ||
|
||||
tolower(substr($text, $i, 5)) == "</h1>" ||
|
||||
tolower(substr($text, $i, 4)) == "<h2>" ||
|
||||
tolower(substr($text, $i, 5)) == "</h2>" ||
|
||||
tolower(substr($text, $i, 4)) == "<h3>" ||
|
||||
tolower(substr($text, $i, 5)) == "</h3>" ||
|
||||
tolower(substr($text, $i, 4)) == "<h4>" ||
|
||||
tolower(substr($text, $i, 5)) == "</h4>" ||
|
||||
tolower(substr($text, $i, 4)) == "<h5>" ||
|
||||
tolower(substr($text, $i, 5)) == "</h5>" ||
|
||||
tolower(substr($text, $i, 4)) == "<h6>" ||
|
||||
tolower(substr($text, $i, 5)) == "</h6>" ||
|
||||
tolower(substr($text, $i, 3)) == "<i>" ||
|
||||
tolower(substr($text, $i, 4)) == "</i>" ||
|
||||
tolower(substr($text, $i, 5)) == "<img " ||
|
||||
tolower(substr($text, $i, 4)) == "<li>" ||
|
||||
tolower(substr($text, $i, 5)) == "</li>" ||
|
||||
tolower(substr($text, $i, 4)) == "<ol>" ||
|
||||
tolower(substr($text, $i, 5)) == "</ol>" ||
|
||||
tolower(substr($text, $i, 3)) == "<p>" ||
|
||||
tolower(substr($text, $i, 4)) == "</p>" ||
|
||||
tolower(substr($text, $i, 5)) == "<pre>" ||
|
||||
tolower(substr($text, $i, 6)) == "</pre>" ||
|
||||
tolower(substr($text, $i, 4)) == "<tt>" ||
|
||||
tolower(substr($text, $i, 5)) == "</tt>" ||
|
||||
tolower(substr($text, $i, 3)) == "<u>" ||
|
||||
tolower(substr($text, $i, 4)) == "</u>" ||
|
||||
tolower(substr($text, $i, 4)) == "<ul>" ||
|
||||
tolower(substr($text, $i, 5)) == "</ul>")
|
||||
{
|
||||
while ($i < $len && $text[$i] != '>')
|
||||
{
|
||||
$ftext .= $text[$i];
|
||||
$i ++;
|
||||
}
|
||||
|
||||
$ftext .= ">";
|
||||
}
|
||||
else
|
||||
$ftext .= "<";
|
||||
break;
|
||||
|
||||
case '>' :
|
||||
@ -183,13 +233,13 @@ format_text($text) // I - Original string
|
||||
break;
|
||||
|
||||
case " " :
|
||||
if ($col == 0 && !pre)
|
||||
if ($col == 0 && !$pre)
|
||||
{
|
||||
for ($j = $i + 1; $j < $len; $j ++)
|
||||
if ($text[$j] != " " && $text[$j] != "\t")
|
||||
break;
|
||||
|
||||
if ($j < $len && $text[$j] == "%")
|
||||
if ($j < $len && $text[$j] == '%')
|
||||
{
|
||||
$ftext .= "\n<pre>";
|
||||
$pre = 1;
|
||||
@ -585,6 +635,6 @@ show_comments($url, // I - URL for comment
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: common.php,v 1.5 2004/05/18 21:26:52 mike Exp $".
|
||||
// End of "$Id: common.php,v 1.6 2004/05/19 00:57:33 mike Exp $".
|
||||
//
|
||||
?>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
//
|
||||
// "$Id: db.php,v 1.3 2004/05/17 20:28:52 mike Exp $"
|
||||
// "$Id: db.php,v 1.4 2004/05/19 00:57:33 mike Exp $"
|
||||
//
|
||||
// Common database include file for PHP web pages. This file can be used
|
||||
// to abstract the specific database in use...
|
||||
@ -122,7 +122,7 @@ function // O - Row object or NULL at end
|
||||
db_next($result) // I - Result of query
|
||||
{
|
||||
if ($result)
|
||||
return (sqlite_fetch_array($result, SQLITE_ASSOC));
|
||||
return (sqlite_fetch_array($result, SQLITE_ASSOC, TRUE));
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
@ -159,6 +159,6 @@ db_seek($result, // I - Result of query
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: db.php,v 1.3 2004/05/17 20:28:52 mike Exp $".
|
||||
// End of "$Id: db.php,v 1.4 2004/05/19 00:57:33 mike Exp $".
|
||||
//
|
||||
?>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
//
|
||||
// "$Id: globals.php,v 1.1 2004/05/17 23:02:35 mike Exp $"
|
||||
// "$Id: globals.php,v 1.2 2004/05/19 00:57:33 mike Exp $"
|
||||
//
|
||||
// Global PHP variables...
|
||||
//
|
||||
@ -11,6 +11,10 @@
|
||||
// Global vars...
|
||||
//
|
||||
|
||||
$PROJECT = "Mini-XML"; // Title of project
|
||||
$EMAIL = "mxml@easysw.com"; // Default notification address
|
||||
$PAGE_MAX = 10; // Max STRs per page
|
||||
|
||||
global $_COOKIE, $_FILES, $_POST, $_SERVER;
|
||||
|
||||
$argc = $_SERVER["argc"];
|
||||
@ -19,7 +23,8 @@ $PHP_SELF = $_SERVER["PHP_SELF"];
|
||||
$REQUEST_METHOD = $_SERVER["REQUEST_METHOD"];
|
||||
$SERVER_NAME = $_SERVER["SERVER_NAME"];
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: globals.php,v 1.1 2004/05/17 23:02:35 mike Exp $".
|
||||
// End of "$Id: globals.php,v 1.2 2004/05/19 00:57:33 mike Exp $".
|
||||
//
|
||||
?>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
//
|
||||
// "$Id: str.php,v 1.1 2004/05/18 01:39:00 mike Exp $"
|
||||
// "$Id: str.php,v 1.2 2004/05/19 00:57:33 mike Exp $"
|
||||
//
|
||||
// Common STR definitions...
|
||||
//
|
||||
@ -11,10 +11,6 @@
|
||||
// STR constants...
|
||||
//
|
||||
|
||||
$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_UNRESOLVED = 2;
|
||||
$STR_STATUS_ACTIVE = 3;
|
||||
@ -81,6 +77,6 @@ $scope_long = array(
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: str.php,v 1.1 2004/05/18 01:39:00 mike Exp $".
|
||||
// End of "$Id: str.php,v 1.2 2004/05/19 00:57:33 mike Exp $".
|
||||
//
|
||||
?>
|
||||
|
48
www/str.php
48
www/str.php
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
//
|
||||
// "$Id: str.php,v 1.6 2004/05/18 19:58:34 mike Exp $"
|
||||
// "$Id: str.php,v 1.7 2004/05/19 00:57:33 mike Exp $"
|
||||
//
|
||||
// Software Trouble Report page...
|
||||
//
|
||||
@ -76,7 +76,7 @@ notify_creator($id, // I - STR #
|
||||
global $priority_long;
|
||||
global $scope_long;
|
||||
global $status_long;
|
||||
global $PHP_SELF, $STR_EMAIL, $STR_PROJECT;
|
||||
global $PHP_SELF, $EMAIL, $PROJECT;
|
||||
|
||||
|
||||
$result = db_query("SELECT * FROM str WHERE id = $id");
|
||||
@ -100,7 +100,7 @@ notify_creator($id, // I - STR #
|
||||
|
||||
if ($row['create_user'] != $row['modify_user'] &&
|
||||
$row['create_user'] != $manager)
|
||||
mail($row['create_user'], "$STR_PROJECT STR #$id $what",
|
||||
mail($row['create_user'], "$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"
|
||||
@ -116,7 +116,7 @@ notify_creator($id, // I - STR #
|
||||
."Fix Version: $fix_version\n"
|
||||
."\n$contents"
|
||||
."________________________________________________________________\n"
|
||||
."Thank you for using the $STR_PROJECT Software Trouble Report page!",
|
||||
."Thank you for using the $PROJECT Software Trouble Report page!",
|
||||
"From: noreply@easysw.com\r\n");
|
||||
|
||||
$ccresult = db_query("SELECT email FROM strcc WHERE str_id = $id");
|
||||
@ -124,7 +124,7 @@ notify_creator($id, // I - STR #
|
||||
{
|
||||
while ($ccrow = db_next($ccresult))
|
||||
{
|
||||
mail($ccrow->email, "$STR_PROJECT STR #$id $what",
|
||||
mail($ccrow->email, "$PROJECT 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"
|
||||
@ -140,7 +140,7 @@ notify_creator($id, // I - STR #
|
||||
."Fix Version: $fix_version\n"
|
||||
."\n$contents"
|
||||
."________________________________________________________________\n"
|
||||
."Thank you for using the $STR_PROJECT Software Trouble Report page!",
|
||||
."Thank you for using the $PROJECT Software Trouble Report page!",
|
||||
"From: noreply@easysw.com\r\n");
|
||||
}
|
||||
|
||||
@ -150,10 +150,10 @@ notify_creator($id, // I - STR #
|
||||
if ($row['manager_email'] != "")
|
||||
$manager = $row['manager_email'];
|
||||
else
|
||||
$manager = "$STR_EMAIL";
|
||||
$manager = "$EMAIL";
|
||||
|
||||
if ($row['modify_user'] != $manager)
|
||||
mail($manager, "$STR_PROJECT STR #$id $what",
|
||||
mail($manager, "$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"
|
||||
."at the following URL:\n"
|
||||
@ -748,26 +748,26 @@ switch ($op)
|
||||
}
|
||||
|
||||
if ($index >= $count)
|
||||
$index = $count - ($count % $STR_PAGE_MAX);
|
||||
$index = $count - ($count % $PAGE_MAX);
|
||||
if ($index < 0)
|
||||
$index = 0;
|
||||
|
||||
$start = $index + 1;
|
||||
$end = $index + $STR_PAGE_MAX;
|
||||
$end = $index + $PAGE_MAX;
|
||||
if ($end > $count)
|
||||
$end = $count;
|
||||
|
||||
$prev = $index - $STR_PAGE_MAX;
|
||||
$prev = $index - $PAGE_MAX;
|
||||
if ($prev < 0)
|
||||
$prev = 0;
|
||||
$next = $index + $STR_PAGE_MAX;
|
||||
$next = $index + $PAGE_MAX;
|
||||
|
||||
print("<p>$count STR(s) found, showing $start to $end:</p>\n");
|
||||
|
||||
if ($LOGIN_USER)
|
||||
print("<form method='POST' action='$PHP_SELF?B$options'>\n");
|
||||
|
||||
if ($count > $STR_PAGE_MAX)
|
||||
if ($count > $PAGE_MAX)
|
||||
{
|
||||
print("<p><table border='0' cellspacing='0' cellpadding='0' "
|
||||
."width='100%'>\n");
|
||||
@ -777,11 +777,11 @@ switch ($op)
|
||||
print("[ <a href='$PHP_SELF?L+P$priority+S$status+C$scope+I$prev+"
|
||||
."E$femail+Q"
|
||||
. urlencode($search)
|
||||
."'>Previous $STR_PAGE_MAX</a> ]");
|
||||
."'>Previous $PAGE_MAX</a> ]");
|
||||
print("</td><td align='right'>");
|
||||
if ($end < $count)
|
||||
{
|
||||
$next_count = min($STR_PAGE_MAX, $count - $end);
|
||||
$next_count = min($PAGE_MAX, $count - $end);
|
||||
print("[ <a href='$PHP_SELF?L+P$priority+S$status+C$scope+I$next+"
|
||||
."E$femail+Q"
|
||||
. urlencode($search)
|
||||
@ -796,7 +796,7 @@ switch ($op)
|
||||
"Assigned To"));
|
||||
|
||||
db_seek($result, $index);
|
||||
for ($i = 0; $i < $STR_PAGE_MAX && $row = db_next($result); $i ++)
|
||||
for ($i = 0; $i < $PAGE_MAX && $row = db_next($result); $i ++)
|
||||
{
|
||||
$date = date("M d, Y", $row['modify_date']);
|
||||
$summary = htmlspecialchars($row['summary'], ENT_QUOTES);
|
||||
@ -809,6 +809,10 @@ switch ($op)
|
||||
|
||||
html_start_row();
|
||||
|
||||
if ($row['is_published'] == 0)
|
||||
$summabbr .= " <img src='images/private.gif' width='16' height='16' "
|
||||
."border='0' align='middle' alt='Private'/>";
|
||||
|
||||
print("<td nowrap>");
|
||||
if ($LOGIN_USER)
|
||||
print("<input type='checkbox' name='ID_$row[id]'>");
|
||||
@ -901,7 +905,7 @@ switch ($op)
|
||||
|
||||
html_end_table();
|
||||
|
||||
if ($count > $STR_PAGE_MAX)
|
||||
if ($count > $PAGE_MAX)
|
||||
{
|
||||
print("<p><table border='0' cellspacing='0' cellpadding='0' "
|
||||
."width='100%'>\n");
|
||||
@ -911,11 +915,11 @@ switch ($op)
|
||||
print("[ <a href='$PHP_SELF?L+P$priority+S$status+C$scope+I$prev+"
|
||||
."E$femail+Q"
|
||||
. urlencode($search)
|
||||
."'>Previous $STR_PAGE_MAX</a> ]");
|
||||
."'>Previous $PAGE_MAX</a> ]");
|
||||
print("</td><td align='right'>");
|
||||
if ($end < $count)
|
||||
{
|
||||
$next_count = min($STR_PAGE_MAX, $count - $end);
|
||||
$next_count = min($PAGE_MAX, $count - $end);
|
||||
print("[ <a href='$PHP_SELF?L+P$priority+S$status+C$scope+I$next+"
|
||||
."E$femail+Q"
|
||||
. urlencode($search)
|
||||
@ -1656,11 +1660,11 @@ switch ($op)
|
||||
else
|
||||
{
|
||||
print("<p>Please use this form to report all bugs and request "
|
||||
."features in the $STR_PROJECT software. Be sure to include "
|
||||
."features in the $PROJECT software. Be sure to include "
|
||||
."the operating system, compiler, sample programs and/or "
|
||||
."files, and any other information you can about your "
|
||||
."problem. <i>Thank you</i> for helping us to improve "
|
||||
."$STR_PROJECT!</p><hr noshade/>\n");
|
||||
."$PROJECT!</p><hr noshade/>\n");
|
||||
|
||||
$hstart = "";
|
||||
$hend = "";
|
||||
@ -1848,6 +1852,6 @@ switch ($op)
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: str.php,v 1.6 2004/05/18 19:58:34 mike Exp $".
|
||||
// End of "$Id: str.php,v 1.7 2004/05/19 00:57:33 mike Exp $".
|
||||
//
|
||||
?>
|
||||
|
@ -26,15 +26,10 @@ KBD {
|
||||
}
|
||||
|
||||
PRE {
|
||||
color: #000000;
|
||||
color: #7f0000;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
PRE.command {
|
||||
margin-left: 2em;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
SUB, SUP {
|
||||
font-size: smaller;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user