<?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 ( $_SESSION[QT]['visitor_right']<2 && $oVIP->role=='V' )
{
include('qti_p_header.php');
HtmlMsg(0);
echo $L['R_login_register'];
HtmlMsg(1);
include('qti_p_footer.php');
exit;
}
if ( !$oVIP->CanAccess('MUV',2,true) ) $oVIP->EndMessage('!',$L['R_member'],$_SESSION[QT]['skin_dir'],0);
$s = -1;
if ( isset($_GET['s']) ) $s = intval(strip_tags($_GET['s']));
if ( isset($_POST['s']) ) $s = intval(strip_tags($_POST['s']));
if ( $s<0 ) die('Missing section id...');
// ---------
// INITIALISE
// ---------
include('bin/qti_fn_limitsql.php');
$oSEC = new cSection($s);
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);
}
$oVIP->selfurl = 'qti_topics.php';
$oVIP->selfname = $L['Section'].': '.$oSEC->name;
$strCommand = '';
$numid = '';
$strOrder = 'lastpostdate';
$strDirec = 'DESC';
$intPage = 1;
$intLimit = 0;
if (isset($_GET['page'])) { $intLimit = (intval($_GET['page'])-1)*$_SESSION[QT]['topics_per_page']; $intPage = intval($_GET['page']); }
if (isset($_GET['order'])) $strOrder = $_GET['order'];
if (isset($_GET['dir'])) $strDirec = $_GET['dir'];
if ($oVIP->numpost>0)
{
$oDB2 = new cDB($qti_dbsystem,$qti_host,$qti_database,$qti_user,$qti_pwd,$qti_port,$qti_dsn);
}
// 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
// --------
$bToPrint=true;
if ( $bMap )
{
$arrMapPoints = array();
$strHeaderAddScript = QTgmapheader('http://gmaps-utility-library.googlecode.com/svn/trunk/markermanager/release/src/markermanager.js');
$strBodyAddOnunload='GUnload()';
}
include('qti_p_header.php');
echo '
<h2>',$oSEC->name,'</h2>
';
// SECTION OPTIONS
$byuser = '';
if ( $oSEC->type==2 && $oVIP->role!='M' && $oVIP->role!='A' ) $byuser = ' AND t.firstpostuser='.$oVIP->id;
if ( !$_SESSION[QT]['show_closed'] ) $byuser .= ' AND t.status<>"Z"';
// BUTTON LINE AND PAGER
$oDB->Query('SELECT count(t.id) as countid FROM '.TABTOPIC.' t WHERE t.forum='.$oSEC->id.$byuser);
$row = $oDB->Getrow();
$intCount = $row['countid'];
$strPager = MakePager("$oVIP->selfurl?s=$oSEC->id",$intCount,$_SESSION[QT]['topics_per_page'],$intPage);
if ($strPager!='') $strPager = $L['Page'].$strPager;
if ($_SESSION[QT]['section_desc']=='1')
{
if (!empty($oSEC->descr)) echo '<!-- Section description -->',N,'<p id="topic_sectiondescr">',$oSEC->descr,'</p>',N,'<!-- Section description -->',N,N;
}
echo '
<!-- Button and pager -->
<table class="ta_button ta_button_top" cellspacing="0">
<tr class="tr_button">',S,'<td id="zone_pager_top">',$strPager,'</td>
</tr>
</table>
<!-- End button and pager -->
';
// DISPLAY
if ( $intCount==0 )
{
echo '<br/>',$L['None'],'... ',$L['E_topic_private'],'<br/><br/>',N;
include('qti_p_footer.php');
exit;
}
// LIST TOPICS
$strExtra = $oSEC->infofield; // can be "N" (moderator requests no-field)
if ( !empty($_SESSION[QT]['lastcolumn']) ) $strExtra = $_SESSION[QT]['lastcolumn'];
echo '<table class="ta ta_t" cellspacing="0">',N;
echo '<tr class="tr_t tr_t0">',N;
/* ======== */
$arrFields = array(); // SORT LABEL CLASS STYLE
$arrFields['ico_status'] = array(TRUE, '-', 'th_t th_t_ico th_t_first', 'width:25px');
if ( $oSEC->numfield!='N' )
{
$arrFields['numid'] = array(TRUE, $L['Ref'], 'th_t th_t_ref', 'width:50px');
}
if ( !empty($oSEC->prefix) )
{
$arrFields['smile'] = array(FALSE,S, 'th_t th_t_smi', 'width:20px');
}
$arrFields['title'] = array(TRUE, $L['Topics'], 'th_t th_t_tit', '');
$arrFields['you'] = array(FALSE,S, 'th_t th_t_inf', 'width:10px');
$arrFields['firstpostname'] = array(TRUE, $L['Topic_starter'],'th_t th_t_inf', 'width:120px');
if ( $strExtra=='N' || $strExtra=='no' )
{
$arrFields['lastpostdate'] = array(TRUE, $L['Last_message'], 'th_t th_t_inf th_t_last', 'width:140px');
}
else
{
$arrFields['lastpostdate'] = array(TRUE, $L['Last_message'], 'th_t th_t_inf', 'width:150px');
$arrFields[$strExtra] = array(TRUE, $L['Last_column_label'][$strExtra], 'th_t th_t_inf th_t_last', 'width:75px;text-align:center');
}
/* ======== */
TableHeader($arrFields,$intCount,"$oVIP->selfurl?s=$oSEC->id&page=1",$strOrder,$strDirec);
/* ======== */
echo '</tr>',N;
/* ------ */
// check that the INNER JOIN WORKS without parentheses in all rdbms
$strState = 't.*,p.title,p.icon,p.textmsg FROM '.TABTOPIC.' t INNER JOIN '.TABPOST.' p ON t.firstpostid=p.id WHERE t.forum = '.$oSEC->id.$byuser;
if ( $strOrder=='title' ) { $strOrder='p.title'; } else { $strOrder='t.'.$strOrder; }
if ( $_SESSION[QT]['news_on_top']==1 ) $strOrder = 't.type ASC, '.$strOrder;
$query = LimitSQL($strState,$strOrder.' '.$strDirec,$intLimit,$_SESSION[QT]['topics_per_page'],$intCount);
$oDB->Query($query);
/* ------ */
$bAddPrefix = !empty($oSEC->prefix);
$bAddSection = false;
if ( $oSEC->numfield=='N' ) { $bAddRef = false; } else { $bAddRef = true; }
include('qti_topics_inc.php');
/* ------ */
echo '<tr class="tr_t tr_t9">',N;
echo '<td class="tf_t tf_t_first"></td>',N;
For ($i=0;$i<(count($arrFields)-2);$i++)
{
echo '<td class="tf_t"></td>',N;
}
echo '<td class="tf_t tf_t_last"></td>',N;
echo '</tr>
</table>
';
if ( $bMap ) {
echo '
<div class="div_gmap" style="margin-bottom:5px;width:550px;">
',( count($arrMapPoints)==0 ? '<p class="p_gmap">'.$L['map']['E_noposition'].'</p>' : '<div id="map_canvas" style="width:100%; height:350px;"></div>'),'</td>
</div>
';
}
// BUTTON LINE AND PAGER
if ( $intCount>2 )
{
echo '
<!-- Button and pager -->
<table class="ta_button ta_button_bot" cellspacing="0">
<tr class="tr_button">',S,'<td id="zone_pager_bot">',$strPager,'</td>
</tr>
</table>
<!-- End button and pager -->
';
}
// ---------
// HTML END
// ---------
if ( $bMap ) {
if ( count($arrMapPoints)>0 ) {
$x = floatval(QTgetx($_SESSION[QT]['m_map_gcenter']));
$y = floatval(QTgety($_SESSION[QT]['m_map_gcenter']));
// center on the first ticket
foreach ($arrMapPoints as $intKey => $oMapPoint)
{
if ( !empty($oMapPoint->y) && !empty($oMapPoint->x) )
{
$y = $oMapPoint->y;
$x = $oMapPoint->x;
break;
}
}
$strFooterAddScript = QTgmappoints($L['map'],$y,$x,'',$arrMapPoints).N.'mapload();';
}}
include('qti_p_footer.php');
?>