Location: PHPKode > scripts > ScreamingToDos > std-0.9/comments.php
<?PHP
require 'login.php';

if (!($id)) {
 Header ( "Location:index.php");
 exit;
}

$r = qDB("SELECT owner FROM $todotable WHERE id=$id");
$d = mysql_fetch_array($r);
if (strtolower($d[0]) != strtolower($currentuser)) {
 Header ( "Location:index.php");
 exit;
}

$currentPage = "STD->comments";
$confirmStr = "Are you sure you want to delete this comment?";
require 'header.php';
if (!($print)) { ?>
<center>
<form method="post" action="comments.php">
 <table border=0 cellpadding=0 cellspacing=0 width="1">
  <tr vlign=center>
   <td align=left>
    <font size="-1"><strong>Comment:</strong></font>
   </td>
  </tr>
  <tr valign=center>
   </td><td width="100%">
    <input type="text" size="60" name="comment">
   </td>
  </tr>
  <tr>
   <td colspan=5 align="right">
    <input type="hidden" name="owner" value="<?PHP echo $currentuser ?>">
    <input type="hidden" name="addcomment" value="1">
    <input type="hidden" name="id" value="<?PHP echo $id ?>">
    <input type="submit" value="+ add +">
   </td>
  </tr>
 </table>
</form>
</center>
<?PHP
 }

$r = qDB("SELECT id,priority,owner,task,DATE_FORMAT(due_date, '%m.%d.%y') AS due_date,closed,DATE_FORMAT(created_date, '%m.%d.%y') AS created_date FROM $todotable WHERE ID=$id");
$todoD = mysql_fetch_array($r);

if ($todoD["closed"]) {
 $foreCol = $doneForeCol;
 $backCol = $doneBackCol;
} else { 
 if (($todoD["priority"] >= 1) && ($todoD["priority"] <= 3)){ $foreCol = $highForeCol; $backCol = $highBackCol; }
 elseif (($todoD["priority"] > 3) && ($todoD["priority"] < 8)) { $foreCol = $medForeCol; $backCol = $medBackCol; }
 elseif (($todoD["priority"] >= 8) && ($todoD["priority"] <= 10)) { $foreCol = $lowForeCol; $backCol = $lowBackCol; }
}
?>

<center>
<hr size="1" width="90%" NOSHADE>
 ORIGINAL TODO
<hr size="1" width="90%" NOSHADE>

<table width="90%" border="0" align="center">
 <tr>
  <td align="center"><strong><font face="<?PHP echo $pageFont ?>" size="<?PHP echo $pageFontsize ?>">Date Added</a></font></strong></td>
  <td align="center"><strong><font face="<?PHP echo $pageFont ?>" size="<?PHP echo $pageFontsize ?>">Priority</a></font></strong></td>

<?PHP if ($multiuser) { ?>
  <td align="center"><strong><font face="<?PHP echo $pageFont ?>" size="<?PHP echo $pageFontsize ?>">Owner</font></strong></td>
<?PHP } ?>

 <td align="center" width="99%"><strong><font face="<?PHP echo $pageFont ?>" size="<?PHP echo $pageFontsize ?>">Task</a></font></strong></td></tr>

<tr><td bgcolor="<?PHP echo $backCol ?>" align="center"><font face="<?PHP echo $pageFont ?>" color="<?PHP echo $foreCol ?>" size="<?PHP echo $pageFontsize ?>"><nobr><?PHP echo substr($todoD["created_date"],0,10) ?></nobr></font></td>

<td bgcolor="<?PHP echo $backCol ?>" align="center"><font face="<?PHP echo $pageFont ?>" color="<?PHP echo $foreCol ?>" size="<?PHP echo $pageFontsize ?>"><?PHP echo $todoD["priority"] ?></font></td>

<?PHP if ($multiuser) { ?>
<td bgcolor="<?PHP echo $backCol ?>" align="center"><font face="<?PHP echo $pageFont ?>" color="<?PHP echo $foreCol ?>" size="<?PHP echo $pageFontsize ?>"><?PHP echo $todoD["owner"] ?></font></td>
<?PHP } ?>

<td bgcolor="<?PHP echo $backCol ?>" align="center"><font face="<?PHP echo $pageFont ?>" color="<?PHP echo $foreCol ?>" size="<?PHP echo $pageFontsize ?>"><?PHP echo $todoD["task"] ?></font></td>

</tr>
</table>
<br><p></p>
<center>
<hr size="1" width="90%" NOSHADE>      
COMMENTS
<hr size="1" width="90%" NOSHADE>
<form name="commentForm" method="post">
<table width="90%" border="0" align="center">
 <tr>
  <td align="center"><strong><font face="<?PHP echo $pageFont ?>" size="<?PHP echo $pageFontsize ?>"><?PHP if (!($print)) { ?><a href="comments.php?updatecomsort=created_date&id=<?PHP echo $id ?>"><?PHP } ?>Date Added</a></font></strong></td>
<?PHP
if ($multiuser) { ?>
 <td align="center"><strong><font face="<?PHP echo $pageFont ?>" size="<?PHP echo $pageFontsize ?>"><?PHP if (!($print)) { ?><a href="comments.php?updatecomsort=owner&id=<?PHP echo $id ?>"><?PHP } ?>Owner</a></font></strong></td>
<?PHP } ?>
 <td align="center" width="99%"><strong><font face="<?PHP echo $pageFont ?>" size="<?PHP echo $pageFontsize ?>"><?PHP if (!($print)) { ?><a href="comments.php?updatecomsort=comment&id=<?PHP echo $id ?>"><?PHP } ?>Comment</a></font></strong></td>

<?PHP if (!($print)) { ?>
<td align="center" width="99%"><strong><font face="<?PHP echo $pageFont ?>" size="<?PHP echo $pageFontsize ?>">Modify</a></font></strong></td>
 <td align="center" width="99%"><strong><font face="<?PHP echo $pageFont ?>" size="<?PHP echo $pageFontsize ?>">Delete</a></font></strong></td>
<?PHP } ?>
</tr>

<?PHP
$r = qDB("SELECT id,owner,comment,todoid,DATE_FORMAT(created_date, '%m.%d.%y') AS created_date FROM $commentstable WHERE todoid=$id ORDER BY $comments_sortby");
while ($commentD = mysql_fetch_array($r)) {

if ($editcomment == $commentD["id"]) {
 $modifyURL = "<input type=\"hidden\" name=\"updatecomment\" value=\"".$commentD["id"]."\"><input type=\"submit\" value=\"Update\">";
 $commentURL =  "<input type=\"text\" name=\"comment\" size=\"60\" value=\"".$commentD["comment"]."\">";
} else {
 $modifyURL = "<a href=\"comments.php?id=".$commentD["todoid"]."&editcomment=".$commentD["id"]."\">Modify</a>";
 $commentURL = makeAnchor($commentD["comment"]);
}
?>

<tr>
  <td bgcolor="<?PHP echo $commentsBackCol ?>" align="center"><font face="<?PHP echo $pageFont ?>" color="<?PHP echo $commentsForeCol ?>" size="<?PHP echo $pageFontsize ?>"><nobr><?PHP echo substr($commentD["created_date"],0,10) ?></nobr></font></td>

<?PHP if ($multiuser) { ?>
<td bgcolor="<?PHP echo $commentsBackCol ?>" align="center"><font face="<?PHP echo $pageFont ?>" color="<?PHP echo $commentsForeCol ?>" size="<?PHP echo $pageFontsize ?>"><?PHP echo $commentD["owner"] ?></font></td>
<?PHP } ?>

  <td bgcolor="<?PHP echo $commentsBackCol ?>" align="center"><font face="<?PHP echo $pageFont ?>" color="<?PHP echo $commentsForeCol ?>" size="<?PHP echo $pageFontsize ?>"><?PHP echo $commentURL ?></font></td>

<?PHP if (!($print)) { ?>
<td bgcolor="<?PHP echo $commentsBackCol ?>" align="center"><font face="<?PHP echo $pageFont ?>" color="<?PHP echo $commentsForeCol ?>" size="<?PHP echo $pageFontsize ?>"><?PHP echo $modifyURL ?></font></td>

  <td bgcolor="<?PHP echo $commentsBackCol ?>" align="center"><font face="<?PHP echo $pageFont ?>" color="<?PHP echo $commentsForeCol ?>" size="<?PHP echo $pageFontsize ?>"><a href="javascript:if(doublecheck()){ document.location.href='comments.php?deletecomment=<?PHP echo $commentD["id"] ?>&id=<?PHP echo $commentD["todoid"] ?>';}">Delete</a></font></td>
<?PHP } ?>
</tr>
<?PHP
}
?>

</table>
</form>
</center>
</center>
<?PHP
 $footerURL = "index.php";
 require 'footer.php';
?>
Return current item: ScreamingToDos