home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / modules / journal / modify.php < prev    next >
Encoding:
PHP Script  |  2002-09-16  |  6.1 KB  |  145 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. /* Required: PHPNuke 5.5 ( http://www.phpnuke.org/ ) and phpbb2         */
  15. /* ( http://bbtonuke.sourceforge.net/ ) forums port.                    */
  16. /*                                                                      */
  17. /* Member's Journal did not work on a PHPNuke 5.5 portal which had      */
  18. /* phpbb2 port integrated.  Thus was Journal § ZX created with the  */
  19. /* Member's Journal author's blessings.                                 */
  20. /*                                                                      */
  21. /* To install, backup everything first and then FTP the Journal package */
  22. /* files into your site's module directory.  Also run the tables.sql    */
  23. /* script so the proper tables and fields can be created and used.  The */
  24. /* default table prefix is "nuke" which is hard-coded throughout the    */
  25. /* entire system as a left-over from Member's Journal.  If a demand     */
  26. /* exists, that can be changed for a future release.                    */
  27. /*                                                                      */
  28. /* This program is free software. You can redistribute it and/or modify */
  29. /* it under the terms of the GNU General Public License as published by */
  30. /* the Free Software Foundation; either version 2 of the License.       */
  31. /************************************************************************/
  32.  
  33. if (!eregi("modules.php", $PHP_SELF)) {
  34.     die ("You can't access this file directly...");
  35. }
  36.  
  37. require_once("mainfile.php");
  38. $module_name = basename(dirname(__FILE__));
  39. get_lang($module_name);
  40.  
  41. $pagetitle = "- "._USERSJOURNAL."";
  42.  
  43. include("header.php");
  44. include("modules/$module_name/functions.php");
  45.  
  46. cookiedecode($user);
  47. $username = $cookie[1];
  48.  
  49. if ($debug == "true") :
  50.     echo ("UserName:$username<br>SiteName: $sitename<br>JID: $jid");
  51. endif;
  52.  
  53. startjournal($sitename,$user);
  54.  
  55. echo "<br>";
  56. OpenTable();
  57. echo ("<div align=center class=title>"._EDITJOURNAL."</div><br>");
  58. echo ("<div align=center> [ <a href=\"modules.php?name=$module_name&file=add\">"._ADDENTRY."</a> | <a href=\"modules.php?name=$module_name&file=edit&op=last\">"._YOURLAST20."</a> | <a href=\"modules.php?name=$module_name&file=edit&op=all\">"._LISTALLENTRIES."</a> ]</div>");
  59. CloseTable();
  60. echo "<br>";
  61.  
  62. OpenTable();
  63. $sql = "SELECT * FROM ".$prefix."_journal WHERE jid = '$jid'";
  64. $result = sql_query($sql, $dbi);
  65. while ($row = sql_fetch_array($result, $dbi)) {
  66.     if ($username != $row[aid]):
  67.     echo ("<br>");
  68.     openTable();
  69.     echo ("<div align=center>"._NOTYOURS2."</div>");
  70.     closeTable();
  71.     journalfoot();
  72.     die();
  73.     endif;
  74.     print  ("<form action='modules.php?name=$module_name&file=edit' method='post'>");
  75.     print  ("<input type='hidden' name='edit' value='1'>");
  76.     print  ("<input type='hidden' name='jid' value='$jid'>");
  77.     print  ("<table align=center border=0>");
  78.     print  ("<tr>");
  79.     print  ("<td align=right valign=top><strong>"._TITLE.": </strong></td>");
  80.     printf ("<td valign=top><input type='text' value='%s' size=50 maxlength=80 name='title'></td>", $row[title]);
  81.     print  ("</tr>");
  82.     print  ("<tr>");
  83.     print  ("<td align=right valign=top><strong>"._BODY.": </strong></td>");
  84.     printf ("<td valign=top><textarea name='bodytext' wrap=virtual cols=75 rows=10>%s</textarea><br>"._WRAP."</td>", $row[bodytext]);
  85.     print  ("</tr>");
  86.     print  ("<tr>");
  87.     print  ("<td align=right valign=top><strong>"._LITTLEGRAPH.": </strong><br>"._OPTIONAL."</td>");
  88.     echo "<td valign=top><table cellpadding=3><tr>";
  89.     $tempcount = 0;
  90.     $direktori = "modules/$module_name/images/moods";
  91.     $handle=opendir($direktori);
  92.     while ($file = readdir($handle)) {
  93.     $filelist[] = $file;
  94.     }
  95.     asort($filelist);
  96.     while (list ($key, $file) = each ($filelist)) {
  97.     ereg(".gif|.jpg",$file);
  98.     if ($file == "." || $file == "..") {
  99.         $a=1;
  100.     } else {
  101.         if ($file == $row[mood]) {
  102.         $checked = "checked";
  103.         } else {
  104.         $checked = "";
  105.         }
  106.         if ($tempcount == 6):
  107.         echo "</tr><tr>";
  108.         echo "<td><input type='radio' name='mood' value='$file' $checked></td><td><img src=\"modules/$module_name/images/moods/$file\" alt=\"$file\" title=\"$file\"></td>";
  109.         $tempcount = 0;
  110.         else :
  111.             echo "<td><input type='radio' name='mood' value='$file' $checked></td><td><img src=\"modules/$module_name/images/moods/$file\" alt=\"$file\" title=\"$file\"></td>";
  112.         endif;
  113.         $tempcount = $tempcount + 1;
  114.     }
  115.     }
  116.     echo "</tr></table>";
  117.     print  ("</td>");
  118.     print  ("</tr>");
  119.     print  ("<tr>");
  120.     print  ("<td align=right valign=top><strong>"._PUBLIC.": </strong></td>");
  121.     print  ("<td align=left valign=top>");
  122.     print  ("<select name='status'>");
  123.     if ($row[status] == 'yes'):
  124.     print  ("<option value=\"yes\" SELECTED>"._YES."</option>");
  125.     else :
  126.     print  ("<option value=\"yes\">"._YES."</option>");
  127.     endif;
  128.     if ($row[status] == 'no'):
  129.     print  ("<option value=\"no\" SELECTED>"._NO."</option>");
  130.     else :
  131.     print  ("<option value=\"no\">"._NO."</option>");
  132.     endif;
  133.     print  ("</select>");
  134.     print  ("</td>");
  135.     print  ("</tr>");
  136.     print  ("<td colspan=2 align=center><input type='submit' name='submit' value='"._MODIFYENTRY."'><br><br>"._TYPOS."</td>");
  137.     print  ("</tr>");
  138.     print  ("</table>");
  139.     print  ("</form>");
  140. }
  141.  
  142. CloseTable();
  143. journalfoot();
  144.  
  145. ?>