[ Index ]
 

Code source de PHP NUKE 7.9

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Journal/ -> search.php (source)

   1  <?php
   2  
   3  /************************************************************************/

   4  /* Journal &#167 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 &#167 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  /* Additional security checking code 2003 by chatserv                   */

  31  /* http://www.nukefixes.com -- http://www.nukeresources.com             */

  32  /************************************************************************/

  33      /* Journal 2.0 Enhanced and Debugged 2004                               */

  34      /* by sixonetonoffun -- http://www.netflake.com --                      */

  35      /* Images Created by GanjaUK -- http://www.GanjaUK.com                  */

  36      /************************************************************************/

  37  if ( !defined('MODULE_FILE') )
  38  {
  39      die("You can't access this file directly...");
  40  }
  41      require_once ("mainfile.php");
  42      $module_name = basename(dirname(__FILE__));
  43      get_lang($module_name);
  44      $pagetitle = "- "._USERSJOURNAL."";
  45      include ("header.php");
  46      include("modules/$module_name/functions.php");
  47      if (is_user($user)) {
  48          cookiedecode($user);
  49          $username = $cookie[1];
  50      }
  51      if (!isset($bywhat)):
  52          $bywhat = "naddaanythang";
  53      else :
  54      $bywhat = filter($bywhat, "nohtml");
  55      $bywhat = filter($bywhat, "nohtml");
  56      endif;
  57      if (!isset($forwhat)):
  58          $forwhat = "naddaanythang";
  59      else :
  60      $forwhat = filter($forwhat, "nohtml");
  61      $forwhat = filter($forwhat, "nohtml");
  62      endif;
  63      startjournal($sitename, $user);
  64      function displaySearch($sitename, $username, $bgcolor2, $bgcolor3, $bgcolor1) {
  65          global $module_name;
  66          echo "<br>";
  67          OpenTable();
  68          echo ("<div align=center class=title>");
  69          echo ("<strong>"._JOURNALSEARCH."</strong></div><br><br>");
  70          echo ("<div align=center>");
  71          echo ("<form action='modules.php?name=$module_name&file=search' method='post'>");
  72          echo ("<input type='hidden' name='disp' value='search'>");
  73          echo ("<input type='text' name='forwhat' size='30' maxlength='150'> "._IN." <select name='bywhat'>");
  74          echo ("<option value=\"aid\" SELECTED>"._MEMBER."</option>");
  75          echo ("<option value=\"title\">"._TITLE."</option>");
  76          echo ("<option value=\"bodytext\">"._BODYTEXT."</option>");
  77          echo ("<option value=\"comment\">"._UCOMMENTS."</option>");
  78          echo ("</select>&nbsp;&nbsp;<input type='submit' name='submit' value='"._SEARCH."'>");
  79          echo ("</form>");
  80          echo ("</div>");
  81          CloseTable();
  82      }
  83      function search($username, $bywhat, $forwhat, $sitename, $bgcolor2, $bgcolor3, $user) {
  84          global $prefix, $user_prefix, $db, $module_name, $exact, $bgcolor1;
  85          echo "<br>";
  86          OpenTable();
  87          echo ("<div align=center>");
  88          $exact = intval($exact);
  89          if ($exact == '1') {
  90              echo ("<strong>"._JOURNALFOR.": \"$forwhat\"</strong><br><br>");
  91          } else {
  92              echo ("<strong>"._SEARCHRESULTS.": \"$forwhat\"</strong><br><br>");
  93          }
  94          if ($forwhat == "naddaanythang") :
  95          displaySearch($sitename, $username, $bgcolor2, $bgcolor3, $bgcolor1);
  96          else :
  97          echo ("<table align=center width=\"90%\" border=2>");
  98          echo ("<tr>");
  99          echo ("<td align=center width=100><strong><div align=\"center\">"._PROFILE."</div></strong></td>");
 100          echo ("<td align=center><strong>"._TITLE."</strong> "._CLICKTOVIEW."</td>");
 101          echo ("<td align=center width=\"5%\"><strong>"._VIEW."</strong></td>");
 102           /* Commented out because this was broken sixonetonoffun

 103          $editdel = intval($editdel);

 104          if ($exact == '1') {

 105              if ($forwhat == $username) {

 106                  $editdel = 1;

 107              }

 108          } else {

 109              if (eregi($forwhat, $username)) {

 110                  $editdel = 2;

 111              }

 112          }

 113         

 114          if ($editdel == '1') {

 115              echo ("<td align=center width=\"5%\"><strong>"._EDIT."</strong></td>");

 116              echo ("<td align=center width=\"5%\"><strong>"._DELETE."</strong></td>");

 117          } elseif ($editdel == '2') {

 118              echo ("<td align=center width=\"5%\"><strong>"._EDIT."/<br>"._PROFILE."</strong></td>");

 119              echo ("<td align=center width=\"5%\"><strong>"._DELETE."/<br>&nbsp;</strong></td>");

 120          } else {

 121              */
 122              echo ("<td align=center width=\"5%\"><strong>"._PROFILE."</strong></td>");
 123    //    } Commented out because this was broken sixonetonoffun

 124          echo ("</tr>");
 125          if ($bywhat == 'aid'):
 126              if ($exact == '1') {
 127              $sql = "SELECT j.jid, j.aid, j.title, j.pdate, j.ptime, j.status, j.mdate, j.mtime, u.user_id, u.username FROM ".$prefix."_journal j, ".$user_prefix."_users u WHERE u.username=j.aid and j.aid='$forwhat' order by j.jid DESC";
 128          } else {
 129              $sql = "SELECT j.jid, j.aid, j.title, j.pdate, j.ptime, j.status, j.mdate, j.mtime, u.user_id, u.username FROM ".$prefix."_journal j, ".$user_prefix."_users u WHERE u.username=j.aid and j.aid like '%$forwhat%' order by j.jid DESC";
 130          } elseif ($bywhat == 'title'):
 131          $sql = "SELECT j.jid, j.aid, j.title, j.pdate, j.ptime, j.status, j.mdate, j.mtime, u.user_id, u.username FROM ".$prefix."_journal j, ".$user_prefix."_users u WHERE u.username=j.aid and j.title like '%$forwhat%' order by j.jid DESC";
 132          elseif ($bywhat == 'bodytext'):
 133          $sql = "SELECT j.jid, j.aid, j.title, j.pdate, j.ptime, j.status, j.mdate, j.mtime, u.user_id, u.username FROM ".$prefix."_journal j, ".$user_prefix."_users u WHERE u.username=j.aid and j.bodytext LIKE '%$forwhat%' order by j.jid DESC";
 134          elseif ($bywhat == 'comment'):
 135          $sql = "SELECT j.jid, j.aid, j.title, j.pdate, j.ptime, j.status, j.mdate, j.mtime, u.user_id, u.username FROM ".$prefix."_journal j, ".$user_prefix."_users u, ".$user_prefix."_journal_comments c WHERE u.username=j.aid and c.rid=j.jid and c.comment LIKE '%$forwhat%' order by j.jid DESC";
 136          endif;
 137          $result = $db->sql_query($sql);
 138          while ($row = $db->sql_fetchrow($result)) {
 139              $row['jid'] = intval($row['jid']);
 140              $row['aid'] = filter($row['aid'], "nohtml");
 141              $row['title'] = filter($row['title'], "nohtml");
 142              $row['pdate'] = filter($row['pdate'], "nohtml");
 143              $row['ptime'] = filter($row['ptime'], "nohtml");
 144              $row['status'] = filter($row['status'], "nohtml");
 145              $row['mdate'] = filter($row['mdate'], "nohtml");
 146              $row['mtime'] = filter($row['mtime'], "nohtml");
 147              $row['user_id'] = filter($row['user_id'], "nohtml");
 148              $row['username'] = filter($row['username'], "nohtml");
 149              $dcount = 0;
 150              if ($row['status'] == "no") :
 151              $dcount = $dcount + 0;
 152              else :
 153              $dcount = $dcount + 1;
 154              print ("<tr>");
 155              //The follwing line made reference to non-existing field uname.//

 156              printf ("<td align=center bgcolor=$bgcolor2><a href=\"modules.php?name=Your_Account&op=userinfo&username=".$row['username']."\">%s</a></td>", $row['aid'], $row['aid']);
 157              printf ("<td align=left bgcolor=$bgcolor2>&nbsp;<a href=\"modules.php?name=$module_name&file=display&jid=%s\">%s</a> <span class=tiny>(%s @ %s)</span>", $row['jid'], $row['title'], $row['pdate'], $row['ptime']);
 158          $sqlscnd = "SELECT cid from ".$prefix."_journal_comments where rid=".$row['jid'];
 159              $rstscnd = $db->sql_query($sqlscnd);
 160              $scndcount = 0;
 161              while ($rowscnd = $db->sql_fetchrow($rstscnd)) {
 162                  $scndcount = $scndcount + 1;
 163              }
 164              if ($scndcount > 0):
 165                  printf (" &#151;&#151; $scndcount comments</td>");
 166              endif;
 167              printf ("<td align=center bgcolor=$bgcolor2><a href=\"modules.php?name=$module_name&file=display&jid=%s\"><img src=\"modules/$module_name/images/read.gif\" border=0 alt=\""._READ."\" title=\""._READ."\"></a></td>", $row['jid'], $row['title']);
 168          /* Commented out because this was broken sixonetonoffun

 169              if ($row['aid'] == $username) :

 170              printf ("<td align=center bgcolor=$bgcolor2><a href=\"modules.php?name=$module_name&file=modify&jid=%s\"><img src='modules/$module_name/images/edit.gif' border='0' alt=\""._EDIT."\" title=\""._EDIT."\"></a></td>", $row['jid'], $row['title']);

 171              printf ("<td align=center bgcolor=$bgcolor2><a href=\"modules.php?name=$module_name&file=delete&jid=%s&forwhat=$forwhat\"><img src='modules/$module_name/images/trash.gif' border='0' alt=\""._DELETE."\" title=\""._DELETE."\"></a></td>", $row['jid'], $row['title']);

 172              else :

 173              */
 174              //printf ("<td align=center bgcolor=$bgcolor2><a href=\"modules.php?name=$module_name&file=display&jid=%s\"><img src=\"modules/$module_name/images/read.gif\" border=0 alt=\""._READ."\" title=\""._READ."\"></a></td>", $row['jid'], $row['title']);

 175              //The follwing line made reference to non-existing field uname.//

 176              printf ("<td align=center bgcolor=$bgcolor2><a href=\"modules.php?name=Your_Account&op=userinfo&username=".$row['username']."\"><img src=\"modules/$module_name/images/nuke.gif\" border=\"0\" alt=\""._USERPROFILE2."\" title=\""._USERPROFILE2."\"></a></td>");
 177              /*

 178              if (empty($username)) {

 179              print ("<td align=center bgcolor=$bgcolor2><a href=\"modules.php?name=Your_Account\"><img src=\"modules/$module_name/images/folder.gif\" border=0 alt=\""._CREATEACCOUNT."\" title=\""._CREATEACCOUNT."\"></a></td>");

 180              } elseif (!empty($username) AND is_active("Private_Messages")) {

 181              printf ("<td align=center bgcolor=$bgcolor2><a href=\"modules.php?name=Private_Messages&mode=post&u=".$row['user_id']."\"><img src='modules/$module_name/images/chat.gif' border='0' alt='"._PRIVMSGJ2."'></a></td>", $row['aid'], $row['aid']);

 182              }

 183              */
 184              endif;
 185        //    endif; // Commented out because this was broken sixonetonoffun

 186          }
 187          echo ("</table>");
 188          if (empty($dcount)) {
 189              $dcount = 0;
 190          }
 191          echo ("<br><div align=center>$dcount "._PUBLICFOR." \"$forwhat\"</div>");
 192          endif;
 193          echo ("</div>");
 194          CloseTable();
 195      }
 196      if (isset($disp)) { $disp = filter($disp, "nohtml"); }
 197      else { $disp = ""; }
 198      switch($disp) {
 199          case "showsearch":
 200          displaySearch($sitename, $username, $bgcolor2, $bgcolor3, $bgcolor1, $forwhat, $user);
 201          break;
 202          case "search":
 203          search($username, $bywhat, $forwhat, $sitename, $bgcolor2, $bgcolor3, $user);
 204          break;
 205          default:
 206          search($username, $bywhat, $forwhat, $sitename, $bgcolor2, $bgcolor3, $user);
 207          break;
 208      }
 209      journalfoot();
 210  
 211  ?>


Généré le : Sun Apr 1 11:11:59 2007 par Balluche grâce à PHPXref 0.7