Location: PHPKode > projects > QuickTicket > quickticket/quickticket/qti_topic_prt.php
<?php

/*
 * PHP versions 4 and 5
 *
 * LICENSE: This source file is subject to version 3.0 of the PHP license
 * that is available through the world-wide-web at the following URI:
 * http://www.php.net/license. If you did not receive a copy of
 * the PHP License and are unable to obtain it through the web, please
 * send a note to hide@address.com so we can mail you a copy immediately.
 *
 * @category   Troubleticket
 * @package    QuickTicket
 * @author     Philippe Vandenberghe <hide@address.com>
 * @copyright  2008-2012 The PHP Group
 * @license    http://www.php.net/license  PHP License 3.0
 * @version    1.9.0.3 build:20081001
 * @link       http://www.qt-cute.org/doc/package/qti
 * @since      File available since Release 1.0.0
 * @deprecated File deprecated in Release 2.0.0
 *
 */

session_start();
require_once('bin/qti_init.php');
if ( !$oVIP->CanAccess('MUV',3,true) ) $oVIP->EndMessage('!',$L['R_member'],$_SESSION[QT]['skin_dir'],0);

// INITIALISE

if (!isset($_GET['s'])) die('Missing section id...');
$s = intval($_GET['s']);
if (!isset($_GET['t'])) die('Missing topic id...');
$t = intval($_GET['t']);

include('bin/qti_fn_limitsql.php');

$oSEC = new cSection(intval($_GET['s']));
$oTopic = new cTopic(intval($_GET['t']),$oVIP->id);

  if ( $oSEC->type==1 && ($oVIP->role=='V' || $oVIP->role=='U') )
  {
  // exit
  $oVIP->selfname = $L['Section'];
  $oVIP->exitname = ObjectName('index','i',$_SESSION[QT]['index_name']);
  $oVIP->EndMessage(NULL,$L['R_moderator'],$_SESSION[QT]['skin_dir'],0);
  }
  if ( $oSEC->type==2 && $oVIP->role=='V' )
  {
  // exit
  $oVIP->selfname = $L['Section'];
  $oVIP->exitname = ObjectName('index','i',$_SESSION[QT]['index_name']);
  $oVIP->EndMessage(NULL,$L['R_member'],$_SESSION[QT]['skin_dir'],0);
  }

  if ( $oSEC->type==2 && $oVIP->role=='U' && $oTopic->firstpostuser != $oVIP->id )
  {
  // exit
  $oVIP->selfname = $L['Section'];
  $oVIP->exitname = ObjectName('index','i',$_SESSION[QT]['index_name']);
  $oVIP->EndMessage(NULL,$L['E_topic_private']."<br/>".$L['R_member'],$_SESSION[QT]['skin_dir'],0);
  }

$strCommand= '';
$byuser = '';
$limit = 0;
$PAGEcurr = 1;
if (isset($_GET['page'])) { $limit = ($_GET['page']-1)*$_SESSION[QT]['replies_per_page']; $PAGEcurr=$_GET['page']; }
if (isset($_GET['view'])) { $_SESSION[QT]['viewmode'] = $_GET['view']; }

$oVIP->selfurl = 'qti_topic.php';
$oVIP->exiturl = 'qti_topics.php?s='.$_GET['s'];
$oVIP->selfname = $L['Messages'];

// MAP MODULE

$bMap = UseModule('map');
if ( $bMap ) { if ( empty($_SESSION[QT]['m_map_gkey']) ) $bMap=false; }
if ( $bMap ) { require_once('qtim_map_lib.php'); if ( !QTgcanmap($s) ) $bMap=false; }
if ( $bMap ) include(Translate('qtim_map.inc'));

// --------
// HTML START
// --------

if ( $bMap ) {
if ( !empty($oTopic->x) && !empty($oTopic->y) ) {
  $strHeaderAddScript = QTgmapheader();
  $strBodyAddOnunload='GUnload()';
}}

$bToPrint = true;
include('qti_p_header.php');

echo '<p>',$oSEC->name,'</p>
<h2>',( $oSEC->numfield=='N' ? '' : sprintf($oSEC->numfield,$oTopic->numid) ),' &middot; ',$_SESSION['qtiTstatus'][$oTopic->status]['statusname'],'</h2>';

// map module
if ( $bMap )
{
  if ( !empty($oTopic->y) && !empty($oTopic->x) )
  {
  if ( $_SESSION[QT]['viewmode']=='C' )
  {
  echo '
  <div class="div_gmap" style="margin-bottom:5px;width:375px;">
  <div id="map_canvas" style="width:100%; height:200px;"></div>
  </div>
  ';
  }
  else
  {
  echo '
  <div class="div_gmap" style="margin-bottom:5px;width:500px;">
  <div id="map_canvas" style="width:100%; height:350px;"></div>
  </div>
  ';
  }
  }
  else
  {
  echo '<p class="p_gmap">'.$L['map']['E_noposition'].'</p>';
  }
}

// CHECK IF FORUM BY USER

if ( $oSEC->type==2 && $oVIP->role!='M' && $oVIP->role!='A' ) $byuser = 'AND p.userid='.$oVIP->id;

// COUNT RECORDS

$oDB->Query('SELECT count(p.id) as countid FROM '.TABPOST.' p WHERE p.forum='.$oSEC->id.' AND p.topic='.$oTopic->id.' '.$byuser);
$row = $oDB->Getrow();
$intPosts = $row['countid'];

// CONTENT

// -- stop if no post (or user not creator) --

if ( $intPosts==0 )
{
  echo '<br/>',$L['None'],'... ',$L['E_topic_private'],'<br/><br/>',N;
  include('qti_p_footer.php');
  exit;
}

  /*****/
  $strState = 'p.*, u.role, u.location, u.avatar, u.signature FROM '.TABPOST.' p, '.TABUSER.' u WHERE p.userid = u.id AND p.topic='.$oTopic->id.' '.$byuser;
  $query = LimitSQL($strState,'p.id ASC',$limit,$_SESSION[QT]['replies_per_page'],$intPosts);
  $oDB->Query($query);
  /*****/
  $iMsgNum = $limit;
  $iMsgAdd = 1;
  $intWhile= 0;
  $strAlt = '1';
  $strSep = '';
  $bButton = false;
  $bAvatar = true;
  /*****/
  include('qti_topic_inc.php');
  /*****/

// --------
// HTML END
// --------

if ( $bMap ) {
if ( !empty($oTopic->y) && !empty($oTopic->x) ) {

  $y = floatval($oTopic->y);
  $x = floatval($oTopic->x);
  $str = ( $oSEC->numfield=='N' ? '' : sprintf($oSEC->numfield,$oTopic->numid) );

  $oMapPoint = new cMapPoint($y,$x,$str);
  if ( isset($_SESSION[QT]['m_map'][$s]['icon']) )        $oMapPoint->icon        = $_SESSION[QT]['m_map'][$s]['icon'];
  if ( isset($_SESSION[QT]['m_map'][$s]['shadow']) )      $oMapPoint->shadow      = $_SESSION[QT]['m_map'][$s]['shadow'];
  if ( isset($_SESSION[QT]['m_map'][$s]['printicon']) )   $oMapPoint->printicon   = $_SESSION[QT]['m_map'][$s]['printicon'];
  if ( isset($_SESSION[QT]['m_map'][$s]['printshadow']) ) $oMapPoint->printshadow = $_SESSION[QT]['m_map'][$s]['printshadow'];
  $arrMapPoints = array( $oMapPoint );

  $strFooterAddScript = QTgmappoints($L['map'],$y,$x,'',$arrMapPoints,false,$_SESSION[QT]['viewmode']=='C').N.'mapload();';

}}

include('qti_p_footer.php');

?>
Return current item: QuickTicket