[ Index ]
 

Code source de e107 0.7.8

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

title

Body

[fermer]

/ -> userposts.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/userposts.php,v $
  14  |     $Revision: 1.25 $
  15  |     $Date: 2007/02/11 15:33:15 $
  16  |     $Author: e107steved $
  17  +----------------------------------------------------------------------------+
  18  */
  19  require_once ("class2.php");
  20  require_once(e_HANDLER."comment_class.php");
  21  $cobj = new comment;
  22  require_once(HEADERF);
  23  
  24  if (!check_class(varset($pref['memberlist_access'], 253)))
  25  {
  26      header("location:".e_BASE."index.php");
  27      exit;
  28  }
  29  
  30  $_POST['f_query'] = trim($_POST['f_query']);
  31  
  32  if (e_QUERY)
  33  {
  34      list($from, $action, $id) = explode(".", e_QUERY);
  35      $id = intval($id);
  36      $from = intval($from);
  37  }
  38  else
  39  {
  40      header("location:".e_BASE."index.php");
  41      exit;
  42  }
  43  
  44  if(!defined("BULLET"))
  45  {
  46      define("BULLET", "bullet2.gif");
  47  }
  48  
  49  if ($action == "comments")
  50  {
  51      if(is_numeric($id))
  52      {
  53          $sql->db_Select("user", "user_name", "user_id=".$id);
  54          $row = $sql->db_Fetch();
  55          extract($row);
  56          $user_id = $id.".".$user_name."";
  57      }
  58      else
  59      {
  60          $user_name = UP_LAN_16.$id;
  61      }
  62  
  63      if (!$USERPOSTS_COMMENTS_TABLE)
  64      {
  65          if (file_exists(THEME."userposts_template.php"))
  66          {
  67              require_once(THEME."userposts_template.php");
  68          }
  69          else
  70          {
  71              require_once(e_BASE.$THEMES_DIRECTORY."templates/userposts_template.php");
  72          }
  73      }
  74  
  75  
  76      $sql2 = new db;
  77      if(is_numeric($id))
  78      {
  79          $ccaption = UP_LAN_1.$user_name;
  80          $sql->db_Select("user", "user_comments", "user_id=".$id."");
  81          list($user_comments) = $sql->db_Fetch();
  82          $ctotal = $user_comments;
  83          $data = $cobj->getCommentData($amount='10', $from, "comment_author = '".$user_id."'");
  84      }
  85      else
  86      {
  87          require_once(e_HANDLER."encrypt_handler.php");
  88          $dip = decode_ip($id);
  89          $ccaption = UP_LAN_1.$dip;
  90          $data = $cobj->getCommentData($amount='10', $from, "comment_ip = '".$id."'");
  91      }
  92  
  93      if(empty($data) || !is_array($data)){
  94          $ctext = "<span class='mediumtext'>".UP_LAN_7."</span>";
  95      }
  96  
  97      global $row;
  98      foreach($data as $row){
  99          $userposts_comments_table_string .= parse_userposts_comments_table($row);
 100      }
 101  
 102      $userposts_comments_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_COMMENTS_TABLE_START);
 103      $userposts_comments_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_COMMENTS_TABLE_END);
 104  
 105      $ctext .= $userposts_comments_table_start."".$userposts_comments_table_string."".$userposts_comments_table_end;
 106  
 107      $ns->tablerender($ccaption, $ctext);
 108  
 109      $parms = $ctotal.",10,".$from.",".e_SELF."?[FROM].comments.".$id;
 110      $USERPOSTS_NEXTPREV = $tp->parseTemplate("{NEXTPREV={$parms}}");
 111      echo preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_NP_TABLE);
 112  }
 113  
 114  
 115  
 116  if ($action == "forums" || isset($_POST['fsearch']))
 117  {
 118  
 119      if(is_numeric($id))
 120      {
 121          $user_id = intval($id);
 122          $sql->db_Select("user", "user_name", "user_id=".$id."");
 123          $row = $sql->db_Fetch();
 124          $fcaption = UP_LAN_0." ".$row['user_name'];
 125      }
 126      else
 127      {
 128          $user_name = 0;
 129      }
 130  
 131      if (!$USERPOSTS_FORUM_TABLE)
 132      {
 133          if (file_exists(THEME."userposts_template.php"))
 134          {
 135              require_once(THEME."userposts_template.php");
 136          }
 137          else
 138          {
 139              require_once(e_BASE.$THEMES_DIRECTORY."templates/userposts_template.php");
 140          }
 141      }
 142  
 143      $s_info = "";
 144      if (isset($_POST['f_query']) && $_POST['f_query'] != "")
 145      {
 146          $f_query = $tp -> toDB($_POST['f_query']);
 147          $s_info = "AND (ft.thread_name REGEXP('".$f_query."') OR ft.thread_thread REGEXP('".$f_query."'))";
 148          $fcaption = UP_LAN_12." ".$row['user_name'];
 149      }
 150      $qry = "
 151      SELECT f.*, ft.* FROM #forum_t AS ft
 152      LEFT JOIN #forum AS f ON ft.thread_forum_id = f.forum_id
 153      LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id
 154      WHERE ft.thread_user LIKE '{$user_id}.%'
 155      AND f.forum_class IN (".USERCLASS_LIST.")
 156      AND fp.forum_class IN (".USERCLASS_LIST.")
 157      {$s_info}
 158      ORDER BY ft.thread_datestamp DESC LIMIT {$from}, 10
 159      ";
 160  
 161      $total_qry = "
 162      SELECT COUNT(*) AS count FROM #forum_t AS ft
 163      LEFT JOIN #forum AS f ON ft.thread_forum_id = f.forum_id
 164      LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id
 165      WHERE ft.thread_user LIKE '{$user_id}.%'
 166      AND f.forum_class IN (".USERCLASS_LIST.")
 167      AND fp.forum_class IN (".USERCLASS_LIST.")
 168      {$s_info}
 169      ";
 170  
 171      $ftotal = 0;
 172      if($sql->db_Select_gen($total_qry))
 173      {
 174          $row = $sql->db_Fetch();
 175          $ftotal = $row['count'];
 176      }
 177  
 178      if (!$sql->db_Select_gen($qry))
 179      {
 180          $ftext .= "<span class='mediumtext'>".UP_LAN_8."</span>";
 181      }
 182      else
 183      {
 184          if (!is_object($gen))
 185          {
 186              $gen = new convert;
 187          }
 188          $render = $sql -> db_getList();
 189          foreach ($render as $row)
 190          {
 191              $userposts_forum_table_string .= parse_userposts_forum_table($row);
 192          }
 193          $userposts_forum_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_FORUM_TABLE_START);
 194          $USERPOSTS_FORUM_SEARCH = "<input class='tbox' type='text' name='f_query' size='20' value='' maxlength='50' /> <input class='button' type='submit' name='fsearch' value='".UP_LAN_12."' />";
 195          $userposts_forum_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_FORUM_TABLE_END);
 196          $ftext .= $userposts_forum_table_start."".$userposts_forum_table_string."".$userposts_forum_table_end;
 197      }
 198      $ns->tablerender($fcaption, $ftext);
 199  
 200      $parms = $ftotal.",10,".$from.",".e_SELF."?[FROM].forums.".$id;
 201      $USERPOSTS_NEXTPREV = $tp->parseTemplate("{NEXTPREV={$parms}}");
 202      echo preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_NP_TABLE);
 203  }
 204  
 205  require_once(FOOTERF);
 206  
 207  
 208  
 209  
 210  function parse_userposts_comments_table($row)
 211  {
 212      global $USERPOSTS_COMMENTS_TABLE, $pref, $gen, $tp, $menu_pref, $id, $sql2, $comment_files;
 213  
 214      $gen = new convert;
 215      $datestamp = $gen->convert_date($row['comment_datestamp'], "short");
 216      $USERPOSTS_COMMENTS_ICON        = "<img src='".THEME."images/".BULLET."' alt='' />";
 217      $USERPOSTS_COMMENTS_DATESTAMP    = UP_LAN_11." ".$datestamp;
 218      $USERPOSTS_COMMENTS_HEADING        = $row['comment_title'];
 219      $USERPOSTS_COMMENTS_COMMENT        = $row['comment_comment'];
 220      $USERPOSTS_COMMENTS_HREF_PRE    = "<a href='".$row['comment_url']."'>";
 221      $USERPOSTS_COMMENTS_TYPE        = $row['comment_type'];
 222  
 223      return(preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_COMMENTS_TABLE));
 224  }
 225  
 226  
 227  function parse_userposts_forum_table($row)
 228  {
 229      global $USERPOSTS_FORUM_TABLE, $gen, $tp, $id;
 230      extract($row);
 231  
 232      $gen = new convert;
 233      $sql2 = new db;
 234  
 235      $poster = substr($thread_user, (strpos($thread_user, ".")+1));
 236      $datestamp = $gen->convert_date($thread_datestamp, "short");
 237      $DATESTAMP = $datestamp;
 238  
 239      if ($thread_parent)
 240      {
 241          if ($cachevar[$thread_parent])
 242          {
 243              $thread_name = $cachevar[$thread_parent];
 244          }
 245          else
 246          {
 247              $tmp = $thread_parent;
 248              $sql2->db_Select("forum_t", "thread_name", "thread_id = '".intval($thread_parent)."' ");
 249              list($thread_name) = $sql2->db_Fetch();
 250              $cachevar[$thread_parent] = $thread_name;
 251          }
 252          $USERPOSTS_FORUM_TOPIC_PRE = UP_LAN_15.": ";
 253      }
 254      else
 255      {
 256          $tmp = $thread_id;
 257          $USERPOSTS_FORUM_TOPIC_PRE = UP_LAN_2.": ";
 258      }
 259  
 260      $thread_thread = $tp->toHTML($thread_thread, TRUE, "", $id);
 261  
 262      $USERPOSTS_FORUM_ICON = "<img src='".e_PLUGIN."forum/images/".IMODE."/new_small.png' alt='' />";
 263      $USERPOSTS_FORUM_TOPIC_HREF_PRE = "<a href='".e_PLUGIN."forum/forum_viewtopic.php?".$tmp."'>";
 264      $USERPOSTS_FORUM_TOPIC = $thread_name;
 265      $USERPOSTS_FORUM_NAME_HREF_PRE = "<a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>";
 266      $USERPOSTS_FORUM_NAME = $forum_name;
 267      $USERPOSTS_FORUM_THREAD = $thread_thread;
 268      $USERPOSTS_FORUM_DATESTAMP = UP_LAN_11." ".$datestamp;
 269  
 270      return(preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_FORUM_TABLE));
 271  }
 272  
 273  ?>


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