<?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',5,true) ) $oVIP->EndMessage('!',$L['R_member'],$_SESSION[QT]['skin_dir'],0);
if ( !isset($_GET['ref']) ) die('Missing parameter ref');
// INITIALISE
$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',$oVIP->role) ) $bMap=false; }
if ( $bMap ) include(Translate('qtim_map.inc'));
$id = 0;
$s = -1;
$strOrder = 'lastpostdate';
$strDirec = 'DESC';
$intLimit = 0;
$intPage = 1;
// security check 1
if ( isset($_GET['s']) ) $s = intval(strip_tags($_GET['s']));
if ( isset($_GET['ref']) ) $id = strip_tags($_GET['ref']);
if ( isset($_GET['order']) ) $strOrder = strip_tags($_GET['order']);
if ( isset($_GET['dir']) ) $strDirec = strip_tags($_GET['dir']);
if ( isset($_GET['page']) ) $intPage = intval(strip_tags($_GET['page']));
if ( isset($_GET['view']) ) $_SESSION[QT]['viewmode'] = strip_tags($_GET['view']);
// check keywords
if ( empty($id) ) $qti_error = $L['Ref'].S.$L['E_invalid'];
if ( strstr($id,'.') ) $qti_error = $L['Ref'].S.$L['E_invalid'];
if ( strstr($id,',') ) $qti_error = $L['Ref'].S.$L['E_invalid'];
if ( !is_numeric($id) ) $qti_error = $L['Ref'].S.$L['E_invalid'];
$id = intval($id);
if ( !empty($qti_error) )
{
echo '<p class="error">',$qti_error,'</p>';
echo '<a href="qti_search.php',( !empty($id) ? '?ref='.$id : ''),'">',$L['Search'],'</a>';
exit;
}
// security check 2 (no long argument)
if ( strlen($strOrder)>12 ) die('Invalid argument #order');
if ( strlen($strDirec)>4 ) die('Invalid argument #dir');
$intLimit = ($intPage-1)*$_SESSION[QT]['topics_per_page'];
if ($oVIP->numpost>0)
{
$oDB2 = new cDB($qti_dbsystem,$qti_host,$qti_database,$qti_user,$qti_pwd,$qti_port,$qti_dsn);
}
$oVIP->selfurl = 'qti_search_id.php';
$oVIP->selfname = $L['Search_by_ref'];
$oVIP->exiturl = 'qti_search.php?'.QTargimplode(QTargexplode());
$oVIP->exitname = $L['Search'];
include('bin/qti_fn_limitsql.php');
// --------
// HTML START
// --------
// check section
$strSection = 't.forum = '.$s;
if ( $s<0 )
{
$strSection = 't.forum>=0 AND f.type<>"1"';
if ( $oVIP->role=='A' || $oVIP->role=='M' ) $strSection = 't.forum>=0';
}
if ( $bMap )
{
$arrMapPoints = array();
$strHeaderAddScript = QTgmapheader('http://gmaps-utility-library.googlecode.com/svn/trunk/markermanager/release/src/markermanager.js');
$strBodyAddOnunload='GUnload()';
}
$arrJava = array('com'=>false);
include('qti_p_header.php');
echo '<table class="ta_button" cellspacing="0">',N;
echo '<tr class="tr_button">',N;
echo '<td> </td>',N;
echo '<td style="width:25px" class="td_button">',AsImg($_SESSION[QT]['skin_dir'].'/ico_topic_t_0.gif','T',$L['Ico_topic_t_0'],'ico ico_t'),'</td>',N;
echo '<td style="width:120px" class="td_button"> <a href="qti_search_ov.php?a=last" class="a_button">',$L['Recent_messages'],'</a> </td>',N;
echo '<td style="width:10px"> </td>',N;
echo '<td style="width:25px" class="td_button">',AsImg($_SESSION[QT]['skin_dir'].'/ico_topic_a_0.gif','T',$L['Ico_topic_a_0'],'ico ico_t'),'</td>',N;
echo '<td style="width:120px" class="td_button"> <a href="qti_search_ov.php?a=news" class="a_button">',$L['All_news'],'</a> </td>',N;
if ($oVIP->role!='V')
{
echo '<td style="width:10px"> </td>',N;
echo '<td style="width:25px" class="td_button">',AsImg($_SESSION[QT]['skin_dir'].'/ico_user_p_1.gif','T',$L['Ico_user_p_1'],'ico ico_user'),'</td>',N;
echo '<td style="width:120px" class="td_button"> <a href="qti_search_ov.php?a=user&id=',$oVIP->id,'&n=',urlencode($oVIP->username),'" class="a_button">',$L['All_my_topics'],'</a> </td>',N;
}
echo '</tr>',N;
echo '</table>',N;
echo '<h2>',$oVIP->selfname,'</h2>',N;
// -----
// COUNT
// -----
$oDB->Query
(
'SELECT count(*) as countid
FROM '.TABTOPIC.' t INNER JOIN '.TABSECTION.' f ON t.forum = f.id INNER JOIN '.TABPOST.' p ON t.firstpostid = p.id
WHERE '.$strSection.' AND t.numid='.$id
);
$row = $oDB->Getrow();
$intCount = $row['countid'];
// FOUND
$strSubtitle = $id;
if ( $s>=0 ) $strSubtitle .= ' ('.$L['Section'].': '.(isset($_SESSION['qtiGoto'][$s]) ? $_SESSION['qtiGoto'][$s] : '').')';
$strSubtitle = '<p>'.$L['Ref'].': '.$strSubtitle.' · '.LangS('Result',$intCount).'</p>';
// NO RESULT
if ($intCount==0)
{
echo $strSubtitle;
echo '<p>',$L['None'],'</p>',N;
echo '<p>« <a href="',$oVIP->exiturl,'">',$oVIP->exitname,'</a></p>';
include('qti_p_footer.php');
exit;
}
// -----
// QUERY
// -----
// order
$strFullOrder = 't.'.$strOrder.' '.$strDirec;
if ( $strOrder=='title' ) $strFullOrder='p.title'.' '.$strDirec;
if ( $strOrder=='sectiontitle' ) $strFullOrder='f.title'.' '.$strDirec;
// second order
if ( $strOrder!='lastpostdate' ) $strFullOrder .= ',t.lastpostdate DESC';
$oDB->Query
(
'SELECT t.*, f.title as sectiontitle, p.icon, p.title, p.textmsg, f.numfield, f.prefix
FROM '.TABTOPIC.' t INNER JOIN '.TABSECTION.' f ON t.forum = f.id INNER JOIN '.TABPOST.' p ON t.firstpostid = p.id
WHERE '.$strSection.' AND t.numid='.$id.'
ORDER BY '.$strFullOrder
);
// --------
// Post content
// --------
echo $strSubtitle;
echo '<table class="ta ta_t" cellspacing="0">',N;
echo '<tr class="tr_t tr_t0">',N;
/* ======== */
$arrFields = array(); // SORT LABEL CLASS STYLE
$arrFields['status'] = array(TRUE, S, 'th_t th_t_ico th_t_first', 'width:25px');
$arrFields['numid'] = array(TRUE, $L['Ref'], 'th_t th_t_ref', 'width:50px');
$arrFields['smile'] = array(FALSE,S, 'th_t th_t_inf', '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['sectiontitle'] = array(TRUE, $L['Section'], 'th_t th_t_inf', '');
$arrFields['firstpostname'] = array(TRUE, $L['Topic_starter'], 'th_t th_t_inf', 'width:125px');
$arrFields['lastpostdate'] = array(TRUE, $L['Last_message'], 'th_t th_t_inf', 'width:125px');
$arrFields['replies'] = array(TRUE, $L['Last_column_label']['replies'], 'th_t th_t_inf th_t_last', 'width:70px;text-align:center');
/* ======== */
TableHeader($arrFields,$intCount,"qti_search_id.php?title=$id&s=$s&page=1",$strOrder,$strDirec);
/* ======== */
echo '</tr>',N;
/* ======== */
$bAddPrefix = true;
$bAddSection = true;
$bAddRef = true;
$strExtra='replies';
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>',N;
echo '</table>',N;
// -- no data --
if ( $intWhile==0 ) echo '<tr><td class="td_t td_t_tit1" colspan="6">',$L['None'],'...</td></tr>',N;
// MAP MODULE
if ( $bMap )
{
if ( count($arrMapPoints)==0 )
{
echo '<p class="p_gmap">'.$L['map']['E_noposition'].'</p>';
}
else
{
//select zoomto (maximum 15 items in the list)
if ( count($arrMapPoints)>1 )
{
$str = '<p class="p_gmap" style="margin:0 0 4px 0"><a class="a_gmap" href="javascript:void(0)" onclick="zoomToFullExtend(); return false;">'.$L['map']['zoomtoall'].'</a> | '.$L['Goto'].' <select class="gmap" id="zoomto" name="zoomto" size="1" onchange="map.setCenter(eval(this.value));">';
$str .= '<option class="gmap" value="new GLatLng('.QTgety($_SESSION[QT]['m_map_gcenter']).','.QTgetx($_SESSION[QT]['m_map_gcenter']).')"> </option>';
$i=0;
foreach ( $arrMapPoints as $intKey => $arrMapPoint )
{
$str .= '<option class="gmap" value="new GLatLng('.$arrMapPoint['y'].','.$arrMapPoint['x'].')">'.$arrMapPoint['title'].'</option>';
$i++; if ( $i>15 ) break;
}
$str .= '</select></p>';
}
echo '
<table class="ta_hidden" style="margin-top:5px;">
<tr class="tr_hidden">
<td class="div_gmap">
',( count($arrMapPoints)>1 ? $str :'' ),'
<div id="map_canvas" style="width:100%; height:350px;"></div>
<p class="p_gmap" style="margin:4px 0 0 0">',sprintf($L['map']['items'],strtolower( LangS('Topic',count($arrMapPoints))),strtolower(LangS('Topic',$intCount)) ),'</p>
</td>
</tr>
</table>
';
}
}
echo '<p>« <a href="',$oVIP->exiturl,'">',$oVIP->exitname,'</a></p>';
// --------
// HTML END
// --------
if ( $bMap ) {
if ( count($arrMapPoints)>0 ) {
$x = QTgetx($_SESSION[QT]['m_map_gcenter']);
$y = 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;
}
}
// override symbol
if ( $_SESSION[QT]['m_map']['S']['icon']!='S' ) $arrMapPoints = QTgoverridesymbol($arrMapPoints,$_SESSION[QT]['m_map']['S']['icon']);
$strFooterAddScript = QTgmappoints($L['map'],$y,$x,'click',$arrMapPoints).N.'mapload();';
}}
include('qti_p_footer.php');