[ Index ]
 

Code source de e107 0.7.8

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

title

Body

[fermer]

/e107_plugins/newforumposts_main/ -> newforumposts_main.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |     e107 website system
   5  |
   6  |     ©Steve Dunstan 2001-2002
   7  |     http://e107.org
   8  |     jalist@e107.org
   9  |
  10  |     Released under the terms and conditions of the
  11  |     GNU General Public License (http://gnu.org).
  12  |
  13  |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newforumposts_main/newforumposts_main.php,v $
  14  |     $Revision: 1.25 $
  15  |     $Date: 2006/11/07 03:26:54 $
  16  |     $Author: e107coders $
  17  +----------------------------------------------------------------------------+
  18  */
  19  if (!defined('e107_INIT')) { exit; }
  20  
  21  require_once(e_HANDLER."userclass_class.php");
  22  $query = ($pref['nfp_posts'] ? "thread_lastpost" : "thread_datestamp");
  23  $lan_file = e_PLUGIN."newforumposts_main/languages/".e_LANGUAGE.".php";
  24  $path = e_PLUGIN."forum/";
  25  include_once((file_exists($lan_file) ? $lan_file : e_PLUGIN."newforumposts_main/languages/English.php"));
  26  global $sql, $ns;
  27  // get template ...
  28  
  29  if (file_exists(THEME."newforumpost.php")) {
  30      require_once(THEME."newforumpost.php");
  31  }
  32  else if(!isset($NEWFORUMPOSTSTYLE_HEADER)) {
  33      // no template found - use default ...
  34      $NEWFORUMPOSTSTYLE_HEADER = "
  35          <!-- newforumposts -->
  36          <div style='text-align:center'>\n<table style='width:auto' class='fborder'>
  37          <tr>
  38          <td style='width:5%' class='forumheader'>&nbsp;</td>
  39          <td style='width:45%' class='forumheader'>".NFPM_LAN_1."</td>
  40          <td style='width:15%; text-align:center' class='forumheader'>".NFPM_LAN_2."</td>
  41          <td style='width:5%; text-align:center' class='forumheader'>".NFPM_LAN_3."</td>
  42          <td style='width:5%; text-align:center' class='forumheader'>".NFPM_LAN_4."</td>
  43          <td style='width:25%; text-align:center' class='forumheader'>".NFPM_LAN_5."</td>
  44          </tr>\n";
  45  
  46      $NEWFORUMPOSTSTYLE_MAIN = "
  47          <tr>
  48          <td style='width:5%; text-align:center' class='forumheader3'>{ICON}</td>
  49          <td style='width:45%' class='forumheader3'><b>{THREAD}</b> <span class='smalltext'>({FORUM})</span></td>
  50          <td style='width:15%; text-align:center' class='forumheader3'>{POSTER}</td>
  51          <td style='width:5%; text-align:center' class='forumheader3'>{VIEWS}</td>
  52          <td style='width:5%; text-align:center' class='forumheader3'>{REPLIES}</td>
  53          <td style='width:25%; text-align:center' class='forumheader3'>{LASTPOST}<br /><span class='smalltext'>{LASTPOSTDATE}&nbsp;</span></td>
  54          </tr>\n";
  55  
  56      $NEWFORUMPOSTSTYLE_FOOTER = "<tr>\n<td colspan='6' style='text-align:center' class='forumheader2'>
  57          <span class='smalltext'>".NFPM_LAN_6.": <b>{TOTAL_TOPICS}</b> | ".NFPM_LAN_4.": <b>{TOTAL_REPLIES}</b> | ".NFPM_LAN_3.": <b>{TOTAL_VIEWS}</b></span>\n</td>\n</tr>\n</table>\n</div>";
  58  
  59  }
  60  
  61  $results = $sql->db_Select_gen("
  62  SELECT t.thread_id, t.thread_name, t.thread_datestamp, t.thread_user, t.thread_views, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies, f.forum_id, f.forum_name, f.forum_class, u.user_name, fp.forum_class, lp.user_name AS lp_name
  63  FROM #forum_t AS t
  64  LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
  65  LEFT JOIN #user AS lp ON SUBSTRING_INDEX(t.thread_lastuser,'.',1) = lp.user_id
  66  LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
  67  LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id
  68  WHERE f.forum_id = t.thread_forum_id AND t.thread_parent=0 AND f.forum_class IN (".USERCLASS_LIST.")
  69  AND fp.forum_class IN (".USERCLASS_LIST.")
  70  ORDER BY t.$query DESC LIMIT 0, ".$pref['nfp_amount']);
  71  
  72  $forumArray = $sql->db_getList();
  73  
  74  if (!isset($gen) || !is_object($gen)) {
  75      $gen = new convert;
  76  }
  77  
  78  $ICON = "<img src='".e_PLUGIN."forum/images/".IMODE."/new_small.png' alt='' />";
  79  $TOTAL_TOPICS = $sql->db_Count("forum_t", "(*)", " WHERE thread_parent='0' ");
  80  $TOTAL_REPLIES = $sql->db_Count("forum_t", "(*)", " WHERE thread_parent!='0' ");
  81  $sql->db_Select_gen("SELECT sum(thread_views) FROM ".MPREFIX."forum_t");
  82  $tmp = $sql->db_Fetch();
  83  $TOTAL_VIEWS = $tmp[0];
  84  $text = preg_replace("/\{(.*?)\}/e", '$\1', $NEWFORUMPOSTSTYLE_HEADER);
  85  
  86  foreach($forumArray as $forumInfo)
  87  {
  88      extract($forumInfo);
  89  
  90      $r_datestamp = $gen->convert_date($thread_lastpost, "forum");
  91      if($thread_total_replies)
  92      {
  93          $tmp = explode(".", $thread_lastuser, 2);
  94          if($lp_name)
  95          {
  96              $LASTPOST = "<a href='".e_BASE."user.php?id.{$tmp[0]}'>$lp_name</a>";
  97          }
  98          else
  99          {
 100              if($tmp[1])
 101              {
 102                  $LASTPOST = $tmp[1];
 103              }
 104              else
 105              {
 106                  $LASTPOST = NFPM_L16;
 107              }
 108          }
 109          $LASTPOSTDATE = "<span class='smalltext'>$r_datestamp</span>";
 110      }
 111      else
 112      {
 113          $LASTPOST = " - ";
 114          $LASTPOSTDATE = "";
 115      }
 116  
 117      $x = explode(chr(1), $thread_user);
 118      $tmp = explode(".", $x[0], 2);
 119      if($user_name)
 120      {
 121          $POSTER = "<a href='".e_BASE."user.php?id.{$tmp[0]}'>$user_name</a>";
 122      }
 123      else
 124      {
 125          if($tmp[1])
 126          {
 127              $POSTER = $tmp[1];
 128          }
 129          else
 130          {
 131              $POSTER = NFPM_L16;
 132          }
 133      }
 134  
 135      $THREAD = "<a href='".$path."forum_viewtopic.php?{$thread_id}.last'>$thread_name</a>";
 136      $FORUM = "<a href='".$path."forum_viewforum.php?{$forum_id}'>$forum_name</a>";
 137  
 138      $VIEWS = $thread_views;
 139      $REPLIES = $thread_total_replies;
 140      $text .= preg_replace("/\{(.*?)\}/e", '$\1', $NEWFORUMPOSTSTYLE_MAIN);
 141  
 142  }
 143  $text .= preg_replace("/\{(.*?)\}/e", '$\1', $NEWFORUMPOSTSTYLE_FOOTER);
 144  
 145  $text = ($pref['nfp_layer'] ? "<div style='border : 0; padding : 4px; width : auto; height : ".$pref['nfp_layer_height']."px; overflow : auto; '>".$text."</div>" : $text);
 146  
 147  if ($results)
 148  {
 149      $ns->tablerender($pref['nfp_caption'], $text, "nfp");
 150  }
 151  
 152  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7