[ PHPXref.com ] [ Generated: Sun Jul 20 20:57:59 2008 ] [ vtiger Forums 1.1 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> postings_popup.php (source)

   1  <?php 

   2  

   3  define('IN_PHPBB', true); 

   4  $phpbb_root_path = './'; 

   5  include ($phpbb_root_path . 'extension.inc'); 

   6  include($phpbb_root_path . 'common.'.$phpEx); 

   7  

   8  // Start initial var setup


   9  

  10  $topic_id = intval($HTTP_GET_VARS[POST_TOPIC_URL]);

  11  

  12  // Start session management 


  13  

  14  $userdata = session_pagestart($user_ip, PAGE_FAQ); 

  15  init_userprefs($userdata); 

  16   

  17  // End session management 


  18  

  19  // Load templates


  20  

  21  $gen_simple_header = TRUE;

  22  $page_title = $lang['Postings_popup_title'];

  23  $topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id");

  24  

  25  include($phpbb_root_path . 'includes/page_header.'.$phpEx); 

  26  

  27  $template->set_filenames(array( 

  28     'body' => 'postings_popup.tpl') 

  29  ); 

  30  

  31  // Process the data


  32  // Find who started the topic


  33  

  34  $sql = "SELECT t.topic_poster, t.topic_title

  35      FROM " . TOPICS_TABLE . " t

  36      WHERE t.topic_id = $topic_id";

  37  if ( !($result = $db->sql_query($sql)) )

  38  {

  39      message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);

  40  }

  41  $row = $db->sql_fetchrow($result);

  42  $starter = $row['topic_poster'];

  43  $topic_title = $row['topic_title'];

  44  $title_break = '&nbsp;';

  45  if (strlen($topic_title) > 17)

  46  {

  47      $title_break = '<br>';

  48  }

  49  

  50  // Send vars to template


  51  

  52  $template->assign_vars(array( 

  53      'PAGE_TITLE' => $page_title,

  54      'TOPIC_URL' => $topic_url,

  55      'TOPIC_TITLE' => $topic_title,

  56      'TITLE_BREAK' => $title_break,

  57      'L_CLOSE_WINDOW' => "<a href='javascript:window.close();'>".$lang['Close_window']."</a>",

  58      'L_TOTAL_POSTS' => $lang['Total_posts'],

  59      'L_USER' => $lang['Poster'],

  60      'L_POSTS' => $lang['Posts'],

  61      'L_TOPIC' => $lang['Topic'],

  62      'L_AUTHOR' => $lang['Postings_popup_starter'],

  63      'L_VIEW_TOPIC' => $lang['View_topic'],

  64      'L_PROFILE_MESSAGE' => $lang['Profile_message'],

  65      'L_POSTS_MESSAGE' => $lang['Posts_message']

  66      ) 

  67  ); 

  68  

  69  // Find poster_id and their postcount and order by postcount then poster_id 


  70  $sql = "SELECT DISTINCT p.poster_id, COUNT(p.topic_id) as postcount 

  71    FROM " . POSTS_TABLE . " p 

  72    WHERE p.topic_id = $topic_id 

  73    GROUP BY p.poster_id 

  74    ORDER BY postcount DESC, p.poster_id"; 

  75  

  76  if ( !($result = $db->sql_query($sql)) )

  77  {

  78      message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);

  79  }

  80  

  81  $total_topics = 0;

  82  $total_rows = 0;

  83  while( $row = $db->sql_fetchrow($result) )

  84  {

  85      $topic_rowset[] = $row;

  86      $total_topics += $row['postcount']; 

  87      $total_rows++; 

  88  }

  89  

  90  // Find the number of posts for each user


  91  for($i = 0; $i < $total_rows; $i++)

  92  {

  93      $poster_id = $topic_rowset[$i]['poster_id'];

  94      $flag = '&nbsp;&nbsp;&nbsp;';

  95  

  96      if($poster_id == $starter)

  97      {

  98          $flag = '*&nbsp;';

  99      }

 100      $sql = "SELECT u.username 

 101          FROM " . USERS_TABLE . " u

 102          WHERE user_id = $poster_id"; 

 103      if ( !($result = $db->sql_query($sql)) )

 104      {

 105          message_die(GENERAL_ERROR, 'Could not obtain poster information', '', __LINE__, __FILE__, $sql);

 106      }

 107  

 108      $posts = $topic_rowset[$i]['postcount'];

 109      $row = $db->sql_fetchrow($result);

 110      $poster = $row['username'];

 111      $posts_url = append_sid("search.$phpEx?search_author=" . $poster . "&amp;search_topic=" . $topic_id . "&amp;showresults=posts");

 112      $poster_url = append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$poster_id");

 113  

 114      if ($poster_id == -1)

 115      {

 116          $poster = $lang['Guest'];

 117      }

 118  

 119      $template->assign_block_vars('topicrow', array(

 120          'POSTER' => $poster,

 121          'FLAG' => $flag,

 122          'POSTS' => $posts,

 123          'POSTER_URL' => $poster_url,

 124          'POSTS_URL' => $posts_url)

 125      );

 126  

 127      $template->assign_vars(array( 

 128          'TOTAL_TOPICS' => $total_topics)

 129      );

 130  }

 131  

 132  $template->pparse('body'); 

 133  

 134  include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

 135  

 136  ?> 


[ Powered by PHPXref - Served by Debian GNU/Linux ]