home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / modules / journal / index.php < prev    next >
Encoding:
PHP Script  |  2002-09-17  |  8.1 KB  |  151 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.  
  40. include("header.php");
  41. include("modules/$module_name/functions.php");
  42.  
  43. cookiedecode($user);
  44. $username = $cookie[1];
  45.  
  46. startjournal($sitename,$user);
  47.  
  48. function last20($bgcolor1, $bgcolor2, $bgcolor3, $username) {
  49.     global $prefix, $user_prefix, $dbi, $module_name;
  50.     OpenTable();
  51.     echo ("<div align=\"center\" class=title>"._20ACTIVE."</div><br>");
  52.     echo ("<table align=center border=1 cellpadding=0 cellspacing=0>");
  53.     echo ("<tr>");
  54.     echo ("<td bgcolor=$bgcolor1 width=150> <strong>"._MEMBER."</strong> "._CLICKTOVIEW."</td>");
  55.     echo ("<td bgcolor=$bgcolor1 width=70 align=center><strong>"._VIEWJOURNAL."</strong></td>");
  56.     echo ("<td bgcolor=$bgcolor1 width=70 align=center><strong>"._MEMBERPROFILE."</strong></td>");
  57.     if ($username == "") {
  58.     echo "<td bgcolor=$bgcolor1 width=70 align=center><strong>"._CREATEACCOUNT2."</strong></td>";
  59.     } else {
  60.     if (is_active("Private_Messages")) {
  61.         echo "<td bgcolor=$bgcolor1 width=70 align=center><strong>"._PRIVMSGJ."</strong></td>";
  62.     }
  63.     }
  64.     echo "</tr>";
  65.     $sql = "SELECT j.id, j.joid, j.nop, j.ldp, j.ltp, j.micro, u.uid, u.uname FROM ".$prefix."_journal_stats j, ".$user_prefix."_users u where u.uname=j.joid ORDER BY 'ldp' DESC";
  66.     $result = sql_query($sql, $dbi);
  67.     while ($row = sql_fetch_array($result, $dbi)) {
  68.     if ($dcount >= 21) {
  69.         echo "</table>";
  70.         CloseTable();
  71.         journalfoot();
  72.         die();
  73.     } else {
  74.         $dcount = $dcount + 1;
  75.         print  ("<tr>");
  76.         printf ("<td bgcolor=$bgcolor2>  <a href=\"modules.php?name=$module_name&file=search&bywhat=aid&exact=1&forwhat=%s\">%s</a></td>", $row[joid], $row[joid]);
  77.         printf ("<td bgcolor=$bgcolor2 align=center><div class=title><a href=\"modules.php?name=$module_name&file=search&bywhat=aid&exact=1&forwhat=%s\"><img src=\"modules/$module_name/images/binocs.gif\" border=0 alt=\""._VIEWJOURNAL2."\" title=\""._VIEWJOURNAL2."\"></a></td>", $row[joid], $row[joid]);
  78.         printf ("<td bgcolor=$bgcolor2 align=center><a href=\"modules.php?name=Your_Account&op=userinfo&uname=%s\"><img src=\"modules/$module_name/images/nuke.gif\" alt=\""._USERPROFILE2."\" title=\""._USERPROFILE2."\" border=0></a></td>", $row[joid], $row[joid], $row[joid]);
  79.         if ($username == "") {
  80.         print ("<td align=center bgcolor=$bgcolor2><a href=\"modules.php?name=Your_Account&op=new_user\"><img src=\"modules/$module_name/images/folder.gif\" border=0 alt=\""._CREATEACCOUNT."\" title=\""._CREATEACCOUNT."\"></a></td>");
  81.         } else {
  82.         if (is_active("Private_Messages")) {
  83.             printf ("<td align=center bgcolor=$bgcolor2><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='"._PRIVMSGJ2."'></a></td>", $row[joid], $row[joid]);
  84.         }
  85.         }
  86.         echo "</tr>";
  87.     }
  88.     }
  89.     echo "</table>";
  90.     CloseTable();
  91. }
  92.  
  93.  
  94. function all($bgcolor1,$bgcolor2,$bgcolor3,$sitename, $username) {
  95.     global $prefix, $user_prefix, $dbi, $module_name;
  96.     OpenTable();
  97.     echo ("<div align=\"center\" class=title>"._ALPHABETICAL."</div><br>");
  98.     echo ("<table align=center border=1 cellpadding=0 cellspacing=0>");
  99.     echo ("<tr>");
  100.     echo ("<td bgcolor=$bgcolor1 width=150> <strong>"._MEMBER."</strong> "._CLICKTOVIEW."</td>");
  101.     echo ("<td bgcolor=$bgcolor1 width=70 align=center><strong>"._VIEWJOURNAL."</strong></td>");
  102.     echo ("<td bgcolor=$bgcolor1 width=70 align=center><strong>"._MEMBERPROFILE."</strong></td>");
  103.     if ($username == "") {
  104.     echo ("<td bgcolor=$bgcolor1 width=70 align=center><strong>"._CREATEACCOUNT2."</strong></td>");
  105.     } else {
  106.     echo ("<td bgcolor=$bgcolor1 width=70 align=center><strong>"._PRIVMSGJ."</strong></td>");
  107.     }
  108.     echo ("</tr>");
  109.     $sql = "SELECT j.id, j.joid, j.nop, j.ldp, j.ltp, j.micro, u.uid FROM ".$prefix."_journal_stats j, ".$user_prefix."_users u where u.uname=j.joid ORDER BY 'joid'";
  110.     $result = sql_query($sql, $dbi);
  111.     while ($row = sql_fetch_array($result, $dbi)) {
  112.     print  ("<tr>");
  113.     printf ("<td bgcolor=$bgcolor2>  <a href=\"modules.php?name=$module_name&file=search&bywhat=aid&forwhat=%s\">%s</a></td>", $row[joid], $row[joid]);
  114.     printf ("<td bgcolor=$bgcolor2 align=center><div class=title><a href=\"modules.php?name=$module_name&file=search&bywhat=aid&forwhat=%s\"><img src=\"modules/$module_name/images/binocs.gif\" border=0 alt=\""._VIEWJOURNAL2."\" title=\""._VIEWJOURNAL2."\"></a></td>", $row[joid], $row[joid]);
  115.     printf ("<td bgcolor=$bgcolor2 align=center><a href=\"modules.php?name=Your_Account&op=userinfo&uname=%s\"><img src=\"modules/$module_name/images/nuke.gif\" alt=\""._USERPROFILE2."\" title=\""._USERPROFILE2."\" border=0></a></td>", $row[joid], $row[joid], $row[joid]);
  116.     if ($username == "") {
  117.         print ("<td align=center bgcolor=$bgcolor2><a href=\"modules.php?name=Your_Account&op=new_user\"><img src=\"modules/$module_name/images/folder.gif\" border=0 alt=\""._CREATEACCOUNT."\" title=\""._CREATEACCOUNT."\"></a></td>");
  118.     } elseif ($username != "" AND is_active("Private_Messages")) {
  119.         printf ("<td align=center bgcolor=$bgcolor2><a href=\"modules.php?name=Private_Messages&file=reply&send=1&uname=$row[joid]\"><img src='modules/$module_name/images/chat.gif' border='0' alt='"._PRIVMSGJ2."'></a></td>", $row[aid], $row[aid]);
  120.     }
  121.     echo "</tr>";
  122.     }
  123.     echo "</table>";
  124.     CloseTable();
  125. }
  126.  
  127. echo "<br>";
  128. OpenTable();
  129. echo ("<div align=center> [ <a href=\"modules.php?name=$module_name&op=last\">"._20AUTHORS."</a> | <a href=\"modules.php?name=$module_name&op=all\">"._LISTALLJOURNALS."</a> | <a href=\"modules.php?name=$module_name&file=search&disp=showsearch\">"._SEARCHMEMBER."</a> ]</div>");
  130. CloseTable();
  131. echo "<br>";
  132.  
  133. switch($op) {
  134.     case "last":
  135.     last20($bgcolor1,$bgcolor2,$bgcolor3, $username);
  136.     break;
  137.  
  138.  
  139.     case "all":
  140.     all($bgcolor1,$bgcolor2,$bgcolor3,$sitename, $username);
  141.     break;
  142.  
  143.  
  144.     default:
  145.     last20($bgcolor1,$bgcolor2,$bgcolor3, $username);
  146.     break;
  147. }
  148.  
  149. journalfoot();
  150.  
  151. ?>