home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / modules / journal / display.php < prev    next >
Encoding:
PHP Script  |  2002-09-16  |  7.4 KB  |  143 lines

  1. <?php
  2.  
  3. /************************************************************************/
  4. /* Journal § ZX                                                     */
  5. /* ================                                                     */
  6. /*                                                                      */
  7. /* Original work done by Joseph Howard known as Member's Journal, which */
  8. /* was based on Trevor Scott's vision of Atomic Journal.                */
  9. /*                                                                      */
  10. /* Modified on 25 May 2002 by Paul Laudanski (paul@computercops.biz)    */
  11. /* Copyright (c) 2002 Modifications by Computer Cops.                   */
  12. /* http://computercops.biz                                              */
  13. /*                                                                      */
  14. /* Member's Journal did not work on a PHPNuke 5.5 portal which had      */
  15. /* phpbb2 port integrated.  Thus was Journal § ZX created with the  */
  16. /* Member's Journal author's blessings.                                 */
  17. /*                                                                      */
  18. /* To install, backup everything first and then FTP the Journal package */
  19. /* files into your site's module directory.  Also run the tables.sql    */
  20. /* script so the proper tables and fields can be created and used.  The */
  21. /* default table prefix is "nuke" which is hard-coded throughout the    */
  22. /* entire system as a left-over from Member's Journal.  If a demand     */
  23. /* exists, that can be changed for a future release.                    */
  24. /*                                                                      */
  25. /* This program is free software. You can redistribute it and/or modify */
  26. /* it under the terms of the GNU General Public License as published by */
  27. /* the Free Software Foundation; either version 2 of the License.       */
  28. /************************************************************************/
  29.  
  30. if (!eregi("modules.php", $PHP_SELF)) {
  31.     die ("You can't access this file directly...");
  32. }
  33.  
  34. require_once("mainfile.php");
  35. $module_name = basename(dirname(__FILE__));
  36. get_lang($module_name);
  37.  
  38. $pagetitle = "- "._USERSJOURNAL."";
  39. include("header.php");
  40. include("modules/$module_name/functions.php");
  41.  
  42. cookiedecode($user);
  43. $username = $cookie[1];
  44.  
  45. if ($debug == "true") :
  46.     echo ("UserName:$username<br>SiteName: $sitename");
  47. endif;
  48.  
  49. startjournal($sitename,$user);
  50.  
  51. if ($jid == "") :
  52.     opentable();
  53.     echo ("<div align=\"center\">"._ANERROR."</div>");
  54.     closetable();
  55.     echo ("<br><br>");
  56.     journalfoot();
  57. endif;
  58.  
  59. $sql = "SELECT j.jid, j.aid, j.title, j.pdate, j.ptime, j.mdate, j.mtime, j.bodytext, j.status, j.mood, u.uid, u.uname FROM ".$prefix."_journal j, ".$user_prefix."_users u WHERE u.uname=j.aid and j.jid = '$jid'";
  60. $result = sql_query($sql, $dbi);
  61.  
  62. while ($row = sql_fetch_array($result, $dbi)) {
  63.     $owner = $row[aid];
  64.     if (($row[status] == 'no') && ($row[aid] != $username)):
  65.     OpenTable();
  66.     echo "<center><br>"._ISPRIVATE."<br></center>";
  67.     CloseTable();
  68.     journalfoot();
  69.     endif;
  70.     echo "<br>";
  71.     OpenTable();
  72.     printf ("<div class=title align=center>%s</div>", $row[title]);
  73.     printf ("<div align=center>"._BY.": <a href=\"modules.php?name=Your_Account&op=userinfo&uname=$row[uname]\">%s</a></div>", $row[aid], $row[aid]);
  74.     printf ("<div align=center class=tiny>"._POSTEDON.": %s @ %s</div>", $row[pdate], $row[ptime]);
  75.     CloseTable();
  76.     echo "<br>";
  77.     openTable();
  78.     $row[bodytext]=check_html($row[bodytext], $strip);
  79.     printf ("%s", $row[bodytext]);
  80.     if ($row[mood] != ""):
  81.         printf ("<br><div align=center><img src=\"modules/$module_name/images/moods/%s\" alt=\"%s\" title=\"%s\"></div>", $row[mood], $row[mood], $row[mood]);
  82.     endif;
  83.     printf ("<br><br><div class=tiny align=center>"._LASTUPDATED." %s @ %s</div><br>", $row[mdate], $row[mtime]);
  84.     printf ("<div class=tiny align=center>[ <a href=\"modules.php?name=$module_name&file=friend&jid=%s\">"._SENDJFRIEND."</a> ]</div>", $row[jid]);
  85.     closeTable();
  86.     print  ("<br>");
  87.     openTable();
  88.     print  ("<table width=\"100%\" align=\"center\"><tr>");
  89.     if ($row[aid] == $username):
  90.     echo "<td align=\"center\" width=\"15%\"><a href=\"modules.php?name=$module_name&file=modify&jid=$jid\"><img src=\"modules/$module_name/images/edit.gif\" border=0 alt=\""._EDIT."\" title=\""._EDIT."\"><br>"._EDIT."</a></td>";
  91.     echo "<td align=\"center\" width=\"15%\"><a href=\"modules.php?name=$module_name&file=delete&jid=$jid&forwhat=$jid\"><img src=\"modules/$module_name/images/trash.gif\" border=0 alt=\""._DELETE."\" title=\""._DELETE."\"><br>"._DELETE."</a></td>";
  92.     endif;
  93.     if ($username != ""):
  94.     echo "<td align=\"center\" width=\"15%\"><a href=\"modules.php?name=$module_name&file=comment&onwhat=$jid\"><img src=\"modules/$module_name/images/write.gif\" border=0 alt=\""._WRITECOMMENT."\" title=\""._WRITECOMMENT."\"><br>"._WRITECOMMENT."</a></td>";
  95.     endif;
  96.     echo "<td align=\"center\" width=\"15%\"><a href=\"modules.php?name=$module_name&file=search&bywhat=aid&forwhat=$row[aid]\"><img src=\"modules/$module_name/images/binocs.gif\" border=0 alt=\""._VIEWMORE."\" title=\""._VIEWMORE."\"><br>"._VIEWMORE."</a></td>";
  97.     echo "<td align=\"center\" width=\"15%\"><a href=\"modules.php?name=Your_Account&op=userinfo&uname=$row[uname]\"><img src=\"modules/$module_name/images/nuke.gif\" border=0 alt=\""._USERPROFILE."\" title=\""._USERPROFILE."\"><br>"._USERPROFILE."</a></td>";
  98.     if ($username != "" AND is_active("Private_Messages")):
  99.     echo "<td align=\"center\" width=\"15%\"><a href=\"modules.php?name=Private_Messages&file=reply&send=1&uname=$row[uname]\"><img src=\"modules/$module_name/images/chat.gif\" border=0 alt=\""._SENDMESSAGE."\" title=\""._SENDMESSAGE."\"><br>"._SENDMESSAGE."</a></td>";
  100.     endif;
  101.     if ($username == ""):
  102.     echo "<td align=\"center\" width=\"15%\"><a href=\"modules.php?name=Your_Account\"><img src=\"modules/$module_name/images/folder.gif\" border=0 alt=\"Create an account\" title=\"Create an account\"><br>"._CREATEACCOUNT."</a></td>";
  103.     endif;
  104.     print  ("</tr></table>");
  105.     closeTable();
  106. }
  107.  
  108. $commentheader = "no";
  109.  
  110. $sql = "SELECT j.cid, j.rid, j.aid, j.comment, j.pdate, j.ptime, u.uid FROM ".$prefix."_journal_comments j, ".$user_prefix."_users u WHERE j.aid=u.uname and j.rid = '$jid'";
  111. $result = sql_query($sql, $dbi);
  112.  
  113. while ($row = sql_fetch_array($result, $dbi)) {
  114.     if ($row == 0):
  115.         $commentheader = "yes";
  116.     else:
  117.     if ($commentheader == "no"):
  118.         echo "<br>";
  119.         if ($username == "" OR $username == $anonymous) {
  120.         $ann_co = "<br><div align=center class=tiny>"._REGUSERSCOMM."</div>";
  121.         } else {
  122.         $ann_co = "";
  123.         }
  124.         title("Posted Comments$ann_co");
  125.         $commentheader = "yes";
  126.     elseif ($commentheader = "yes"):
  127.         // Do not print comment header.
  128.     endif;
  129.     endif;
  130.     openTable();
  131.     printf (""._COMMENTBY.": <a href=\"modules.php?name=Your_Account&op=userinfo&uname=$row[uname]\">%s</a> <div class=tiny>("._POSTEDON." $row[pdate] @ $row[ptime])</div><br>", $row[aid], $row[aid], $row[pdate], $row[ptime]);
  132.     $row[comment]=check_html($row[comment], $strip);        
  133.     printf ("<strong>Comment:</strong> %s", $row[comment]);
  134.     if ($username == $owner):
  135.     printf ("<br><div align=center>[ <a href=\"modules.php?name=$module_name&file=commentkill&onwhat=%s&ref=$jid\">"._DELCOMMENT."</a> ]</div>", $row[cid], $row[jid]);
  136.     endif;
  137.     closeTable();
  138.     print  ("<br><br>");
  139. }
  140.  
  141. journalfoot();
  142.  
  143. ?>