<?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');
$oVIP->selfurl = 'qti_index.php';
// --------
// SECURITY
// --------
if ( $_SESSION[QT]['board_offline']=='1' )
{
include('qti_p_header.php');
$strFile = $_SESSION[QT]['language'].'/sys_offline.txt';
if ( file_exists($strFile) ) { include($strFile); } else { echo '<h1>Board off-line</h1><p>The administrator has turned this board off-line.<br/>Please wait...</p>',N; }
echo '<br/>',N;
include('qti_p_footer.php');
exit;
}
if ( $_SESSION[QT]['visitor_right']<1 && $oVIP->role=='V' )
{
include('qti_p_header.php');
HtmlMsg(0);
echo $L['R_login_register'];
HtmlMsg(1);
include('qti_p_footer.php');
exit;
}
// --------
// HTML START
// --------
$arrJava = array('com'=>false);
include('qti_p_header.php');
// END IF NO DOMAIN
if ( count($_SESSION['qtiDomains'])==0 )
{
echo '<br/>',$L['E_no_public_section'],'<br/><br/>';
include('qti_p_footer.php');
exit;
}
// --------
// MY BOARD
// --------
if ( $oVIP->role!='V' )
{
$intMytopics=0;
$intMyAssigned=0;
// COUNT MY TOPICS
$oDB->Query('SELECT count(id) as countid FROM '.TABTOPIC.' WHERE firstpostuser='.$oVIP->id.' AND type="T" AND status<>"Z"');
$row = $oDB->Getrow();
$intMytopics = $row['countid'];
if ( $oVIP->role=='A' || $oVIP->role=='M' )
{
$oDB->Query('SELECT count(id) as countid FROM '.TABTOPIC.' WHERE actorid='.$oVIP->id.' AND type="T" AND status<>"Z"');
$row = $oDB->Getrow();
$intMyAssigned = $row['countid'];
}
if ( $intMytopics>=0 || $intMyAssigned>0 )
{
// SHOW MY BUTTONS
echo '
<!-- My board -->
<div class="div_myboard">
<table class="ta_button" cellspacing="0">
<tr class="tr_button">
<td><span class="p_myboardtitle">',$L['My_last_topic'],'</span></td>';
if ( $intMytopics>0 )
{
echo '<td style="width:140px" class="td_button td_button_myboard"> <a href="qti_search_ov.php?a=user&id=',$oVIP->id,'&n=',urlencode($oVIP->username),'" class="a_button">',$L['All_my_topics'],' (',$intMytopics,')</a> </td>';
}
else
{
echo '<td>',$L['None'],'</td>';
}
if ( $oVIP->role=='A' || $oVIP->role=='M' ) {
if ( $intMyAssigned>0 ) {
echo '<td style="width:5px"> </td>';
echo '<td style="width:140px" class="td_button td_button_myboard"> <a href="qti_search_ov.php?a=actor&id=',$oVIP->id,'&n=',urlencode($oVIP->username),'" class="a_button">',$L['All_my_assigned'],' (',$intMyAssigned,')</a> </td>';
}}
echo '</tr>';
echo '</table>',N;
// MY LAST TICKET
if ( $intMytopics>0 )
{
include('bin/qti_fn_limitsql.php');
// User's query: ticket issued by user
$strState = 't.*,p.icon,p.title,p.textmsg,f.numfield FROM (('.TABTOPIC.' t INNER JOIN '.TABPOST.' p ON t.firstpostid = p.id) INNER JOIN '.TABSECTION.' f on t.forum=f.id) WHERE t.firstpostuser='.$oVIP->id.' AND t.type="T" AND t.status<>"Z"';
// Staff member query: ticket assigned to staff member
if ( $intMyAssigned>0 ) {
if ( $oVIP->role=='A' || $oVIP->role=='M' ) {
$strState = 't.*,p.icon,p.title,p.textmsg,f.numfield FROM (('.TABTOPIC.' t INNER JOIN '.TABPOST.' p ON t.firstpostid = p.id) INNER JOIN '.TABSECTION.' f on t.forum=f.id) WHERE t.lastpostuser='.$oVIP->id.' AND t.type="T" AND t.status<>"Z"';
}}
$strOrder = 't.lastpostdate DESC';
$strQ = LimitSQL($strState,$strOrder,0,1,1);
$oDB->Query($strQ);
$row = $oDB->Getrow();
if ( is_array($row) )
{
$oTopic = new cTopic($row);
if ( isset($_SESSION['qtiGoto'][$oTopic->section]) ) { $str = $_SESSION['qtiGoto'][$oTopic->section]; } else { $str='untitled'; }
$strSection = ObjectName('sec','s'.$oTopic->section,$str);
// reduce long title
if ( strlen($oTopic->title)>30 ) $oTopic->title = substr($oTopic->title,0,25).'...';
if ( strlen($strSection)>30 ) $strSection = substr($strSection,0,25).'...';
$strText = '<p style="text-align:right; margin:0" class="small"><i>'.QTdate($oTopic->firstpostdate,$arrQTdate).', '.$L['I_wrote'].'</i></p><p class="small">'.$oTopic->preview.'</p>';
$strLasttext = '';
if ( $oTopic->firstpostid!=$oTopic->lastpostid )
{
$oPost = new cPost($oTopic->lastpostid);
$strLasttext = '<p class="p_myboard_line small" style="text-align:right"><i>'.QTdate($oPost->issuedate,$arrQTdate).', '.strtolower($L['Last_message'].' '.$L['By']).' '.$oPost->username.'</i></p><p class="small">'.QTbbc($oPost->text,'deepdrop',' ',250,null,null,'').'</p>';
}
echo '<table class="ta_hidden" cellspacing="0">',N;
echo '<tr valign="top">',N;
if ( strtolower($oTopic->type)=='a' )
{
$strTicon = $_SESSION[QT]['skin_dir'].'/ico_topic_a_0.gif';
$strTname = $L['Ico_topic_a_0'];
}
else
{
if ( isset($_SESSION['qtiTstatus'][$oTopic->status]['statusname']) )
{
$strTicon = $_SESSION[QT]['skin_dir'].'/'.$_SESSION['qtiTstatus'][$oTopic->status]['icon'];
$strTname = $_SESSION['qtiTstatus'][$oTopic->status]['statusname'];
}
else
{
$strTicon = 'admin/ico_status.gif';
$strTname = 'unknown status';
}
}
echo '<td class="td_tyboard">',AsImg($strTicon,'T',$strTname,'ico ico_t',null,'qti_topic.php?s='.$oTopic->section.'&t='.$oTopic->id),( $row['numfield']=='N' ? '' : ' · '.sprintf($row['numfield'],$oTopic->numid) ),' · <a class="a_topic" href="qti_topic.php?s=',$oTopic->section,'&t=',$oTopic->id,'">',$oTopic->title,'</a> · <span class="small">',$L['Section'],': ',$strSection,'</span></td>',N;
echo '</tr>',N;
echo '<tr valign="top">',N;
echo '<td class="td_tyboard">'.$strText.($strLasttext!='' ? $strLasttext : '').'</td>',N;
echo '</tr>',N;
echo '</table>',N;
}
}
echo '</div>',N,'<!-- End My board -->',N,N;
}
}
// --------
// DOMAIN / SECTIONS
// --------
$intDom = 0;
foreach ($_SESSION['qtiDomains'] as $intDomid => $strDomtitle)
{
$intDom++;
$arrSections = GetSections($oVIP->role,$intDomid);
if ( count($arrSections)>0 )
{
echo '<!-- domain ',$intDomid,': ',$strDomtitle,' -->',N;
echo '<table class="ta ta_s" cellspacing="0">',N;
echo '<colgroup span="5"><col width="35"></col><col></col><col width="150"></col><col width="60"></col><col width="60"></col></colgroup>',N;
echo '<tr class="tr_s tr_s0">',N;
echo '<th class="th_s th_s_ico th_s_first"> </th>',N;
echo '<th class="th_s th_s_tit">',$strDomtitle,'</th>',N;
echo '<th class="th_s th_s_inf">',$L['Last_message'],'</th>',N;
echo '<th class="th_s th_s_sta">',$L['Topics'],'</th>',N;
echo '<th class="th_s th_s_sta th_s_last">',$L['Replys'],'</th>',N;
echo '</tr>',N;
// SHOW SECTIONS
$i=0;
$strAlt='1';
foreach ($arrSections as $intSection => $arrSection)
{
$i++;
$oSEC = new cSection($arrSection,true);
echo '<tr class="tr_s tr_s',$strAlt,'">',N;
echo '<td class="td_s td_s_ico',$strAlt,' td_s_first" >',AsImg($_SESSION[QT]['skin_dir'].'/ico_section_'.$oSEC->type.'_'.$oSEC->status.'.gif','F',$L['Ico_section_'.$oSEC->type.'_'.$oSEC->status],'ico ico_s',null,'qti_topics.php?s='.$oSEC->id),'</td>',N;
echo '<td class="td_s td_s_tit',$strAlt,'"><a class="a_section" href="qti_topics.php?s=',$oSEC->id,'" >',$oSEC->name,'</a><br/><span class="p_sectiondescr">',$oSEC->descr,'</span></td>',N;
echo '<td class="td_s td_s_inf',$strAlt,'">';
if ( $oSEC->topics<1 )
{
echo S;
}
else
{
if ( isset($oSEC->lastpostid) )
{
echo QTdate($oSEC->lastpostdate,$arrQTdate);
echo ' <a href="qti_topic.php?s=',$oSEC->id,'&t=',$oSEC->lastposttopic,'#p',$oSEC->lastpostid,'" title="',$L['H_Goto_message'],'">',$L['Goto_message'],'</a><br/>',strtolower($L['By']).' <a href="qti_usr.php?id=',$oSEC->lastpostuser,'" title="',$L['Ico_user_p_1'],'" class="small">',$oSEC->lastpostname,'</a>';
}
else
{
echo S;
}
}
echo '</td>',N;
echo '<td class="td_s td_s_sta',$strAlt,'">',$oSEC->topics,'</td>',N;
echo '<td class="td_s td_s_sta',$strAlt,' td_s_last">',$oSEC->replies,'</td>',N;
echo '</tr>',N;
if ( $strAlt=='1' ) { $strAlt='2'; } else { $strAlt='1'; }
}
echo '<tr class="tr_s tr_s9">',N;
echo '<td class="tf_s tf_s_first"></td>',N;
echo '<td class="tf_s"></td>',N;
echo '<td class="tf_s"></td>',N;
echo '<td class="tf_s"></td>',N;
echo '<td class="tf_s tf_s_last"></td>',N;
echo '</tr>',N;
echo '</table>',N;
if ( $intDom<count($_SESSION['qtiDomains']) ) echo '<!-- domain separator -->',N,'<div class="div_dom_separator"></div>',N;
}
}
// --------
// HTML END
// --------
if ( isset($oSEC) ) unset($oSEC);
include('qti_p_footer.php');
?>