Location: PHPKode > projects > QuickTalk Forum > quicktalk/bin/qtf_fn_html.php
<?php

// QuickTalk 2.5 build:20100924

function Gotolist($intSelected=-1,$intReject=-1)
{
  global $oVIP;
  $str = '';

  if ( QTF_SHOW_GOTOLIST ) {
  if ( $_SESSION[QT]['sys_sections'] ) {
  if ( count($_SESSION[QT]['sys_sections'])>0 ) {
  
    $arr = $_SESSION[QT]['sys_sections'];
    if ( $intReject>=0 ) { if ( isset($arr[$intReject]) ) unset($arr[$intReject]); }
    $str = QTasTag($arr,($intSelected<0 ? '' : $intSelected));
  
    // in case of several domains
    if ( count($arr)>3 ) 
    {
      $arrDomains = GetDomains($oVIP->role);
      if ( count($arrDomains>1) )
      {
        $str = '';
        foreach ($arrDomains as $intDom=>$strDom)
        {
        $str .= '<optgroup label="'.$strDom.'">';// $arr[-$intDom] = $strDom;
        $arrSections = QTarrget(GetSections($oVIP->role,$intDom,(isset($intReject) ? $intReject : -1)),'title');
        foreach($arrSections as $intSection=>$strSection) $str .= '<option value="'.$intSection.'"'.($intSection==$intSelected ? QSEL : '').'>'.$strSection.'</option>';
        $str .= '</optgroup>';
        }
      }
    }

  }}}
  
  return $str;
}

// --------

function HtmlCsvLink($strUrl,$intCount=20,$intPage=1)
{
  if ( empty($strUrl) ) return '';
  global $L;
  if ( $intCount<=$_SESSION[QT]['topics_per_page'] )
  {
  return '<a href="'.$strUrl.'&amp;size=all&amp;n='.$intCount.'" class="a_csv" title="'.$L['H_Csv'].'">'.$L['Csv'].'</a>';
  }
  else
  {
  $strCsv = '<a href="'.$strUrl.'&amp;size=p'.$intPage.'&amp;n='.$intCount.'" class="csv" title="'.$L['H_Csv'].'">'.$L['Csv'].' <span class="small">('.strtolower($L['Page']).')</span></a>';
  if ( $intCount<=1000 )                   $strCsv .= ' &middot; <a href="'.$strUrl.'&amp;size=all&amp;n='.$intCount.'" class="csv" title="'.$L['H_Csv'].'">'.$L['Csv'].' <span class="small">('.strtolower($L['All']).')</span></a>';
  if ( $intCount>1000 && $intCount<=2000 ) $strCsv .= ' &middot; <a href="'.$strUrl.'&amp;size=m1&amp;n='.$intCount.'" class="csv" title="'.$L['H_Csv'].'">'.$L['Csv'].' <span class="small">(1-1000)</span></a> &middot; <a href="'.$strUrl.'&amp;size=m2&amp;n='.$intCount.'" class="csv" title="'.$L['H_Csv'].'">'.$L['Csv'].' <span class="small">(1000-'.$intCount.')</span></a>';
  if ( $intCount>2000 && $intCount<=5000 ) $strCsv .= ' &middot; <a href="'.$strUrl.'&amp;size=m5&amp;n='.$intCount.'" class="csv" title="'.$L['H_Csv'].'">'.$L['Csv'].' <span class="small">(1-5000)</span></a>';
  if ( $intCount>5000 )                    $strCsv .= ' &middot; <a href="'.$strUrl.'&amp;size=m5&amp;n='.$intCount.'" class="csv" title="'.$L['H_Csv'].'">'.$L['Csv'].' <span class="small">(1-5000)</span></a> &middot; <a href="'.$strUrl.'&amp;size=m10&amp;n='.$intCount.'" class="csv" title="'.$L['H_Csv'].'">'.$L['Csv'].' <span class="small">(5000-10000)</span></a>'; 
  }
  return $strCsv;
}

// --------

function HtmlHead($strRoot='',$strSkin='',$arrCss='',$arrJava='',$strHeadScript='',$strTitlePrefix='')
{

if ( empty($strSkin) ) $strSkin = $_SESSION[QT]['skin_dir'];
if ( !is_array($arrCss) ) $arrCss = array();
if ( !is_array($arrJava) ) $arrJava = array();

echo QTF_HTML_DTD,'
<html xmlns="http://www.w3.org/1999/xhtml" dir="',QTF_HTML_DIR,'" xml:lang="',QTF_HTML_LANG,'">
<head>
<title>',(empty($strTitlePrefix) ? '' : $strTitlePrefix.' - '),$_SESSION[QT]['site_name'],'</title>
<meta http-equiv="content-type" content="text/html; charset=',QTF_HTML_CHAR,'"/>
<meta name="description" content="QT QuickTalk forum"/>
<meta name="keywords" content="quicktalk,forum,faq,knowledge,qt-cute,OpenSource"/>
<meta name="author" content="qt-cute.org" />
<meta name="language" content="en,fr,nl"/>
<link rel="shortcut icon" href="',$strRoot,$strSkin,'/qtf_icon.ico"/>
<link rel="stylesheet" type="text/css" href="',$strRoot,$strSkin,'/qtf_main.css" title="cssmain"/>
<link rel="stylesheet" type="text/css" href="bin/css/qtf_print.css" media="print"/>
';
foreach($arrCss as $str) {
switch($str) {
  case 'qtf_contrast.css': echo '<link rel="alternate stylesheet" type="text/css" href="',$strRoot,'bin/css/qtf_contrast.css" title="cssalternate"/><link rel="alternate stylesheet" type="text/css" href="bin/css/qtf_print.css" media="print" title="cssalternate"/>',N; break;
  case 'qtf_main2.css':    echo '<link rel="stylesheet" type="text/css" href="',$strRoot,$strSkin,'/',$str,'" title="cssmain"/>',N; break;
  default:                 echo '<link rel="stylesheet" type="text/css" href="',(substr($str,0,3)=='../' ? substr($str,3) : $strRoot.$strSkin.'/'.$str),'"/>',N; break;
}}

foreach($arrJava as $str)
{
echo '<script type="text/javascript" src="',$strRoot,$str,'"></script>
';
}

if ( !empty($strHeadScript) ) echo $strHeadScript;

echo '</head>
';

}

// --------

function HtmlLettres($strGroup,$str='All')
{
  global $oVIP;
  $strGroups = '<td class="lettres'.($strGroup=='all' ? ' active' : '').'" style="width:35px;">'.($strGroup=='all' ? $str : '<a class="lettres" href="'.Href($oVIP->selfurl).'?group=all">'.$str.'</a>' ).'</td>';
  for ($g='A';$g!='AA';$g++)
  {
  $strGroups .= '<td class="lettres'.($strGroup==$g ? ' active' : '').'" style="width:18px;">'.($strGroup==$g ? $g : '<a class="lettres" href="'.Href($oVIP->selfurl).'?group='.$g.'">'.$g.'</a>' ).'</td>';
  }
  $strGroups .= '<td class="lettres'.($strGroup=='0' ? ' active' : '').'" style="width:18px;">'.($strGroup=='0' ? '#' : '<a class="lettres" href="'.Href($oVIP->selfurl).'?group=0">#</a>' ).'</td>';
  return $strGroups.'<td class="hidden">&nbsp;</td>'.N;
}

// --------

function HtmlPageCtrl($intType=0,$strWidth='')
{

if ( empty($strWidth) ) $strWidth=$_SESSION[QT]['site_width'];
switch ($intType)
{
case 0: echo '
<!-- PAGE CONTROL -->
<div class="qtf">
<div class="page" style="width:',$strWidth,(substr($strWidth,-1)=='%' ? '' : 'px'),'">
<!-- PAGE CONTROL -->  
';
break;
case 1: echo '
<!-- END PAGE CONTROL -->
</div>
</div>
<!-- END PAGE CONTROL -->
';
break;
}

}

// --------

function HtmlRedirect($u='qtf_index.php',$s='Continue')
{

if ( headers_sent() )
{
echo '<a href="'.$u.'">',$s,'</a><meta http-equiv="REFRESH" content="0;url='.$u.'">';
}
else
{
header('Location: '.str_replace('&amp;','&',$u));
}
exit;

}

// --------

function HtmlBanner($intType=0,$strSkin='',$strLogo='',$strLangMenu='')
{

if ( empty($strSkin) ) $strSkin=$_SESSION[QT]['skin_dir'];
if ( empty($strLogo) ) $strLogo='qtf_logo.gif';

switch ($intType)
{
case 0: echo '
<!-- banner -->
<div class="banner">
<div class="bannerleft"><img class="banner_logo" src="',$strSkin,'/',$strLogo,'" alt="',$_SESSION[QT]['site_name'],'" title="',$_SESSION[QT]['site_name'],'"/></div>
<div class="bannerright">',$strLangMenu,'</div>
</div>
';
break;
case 1: echo '
<!-- banner -->
<div class="nobanner">
<div class="nobannerleft">&nbsp;</div>
<div class="nobannerright">&nbsp;',$strLangMenu,'</div>
</div>
';
break;
case 2: echo '
<!-- banner -->
<div class="banner">
<div class="bannerleft"><img src="',$strSkin,'/',$strLogo,'" width="175" height="50" style="border-width:0" alt="QuickTalk" title="QuickTalk"/></div>
</div>
';
break;
}

}

// --------

function HtmlPage($e=0)
{

global $oVIP,$L;
include('qtf_p_header.php');

if ( $e==99 )
{
$strFile = Translate('sys_offline.txt'); if ( file_exists($strFile) ) { include($strFile); } else { echo Error(10); }
}
else
{
HtmlMsg(0); echo Error($e); HtmlMsg(1);
}

include('qtf_p_footer.php');
exit;

}

// --------

function HtmlMsg($intType=0,$strWidth='',$strTitleId='',$strTitle='!',$strBodyId='',$strBody='')
{

if ( empty($strWidth) ) $strWidth='350px';
switch ($intType)
{
case 0: echo '
<div class="msgbox" style="width:',$strWidth,'">
<div class="msgboxtitle"',(empty($strTitleId) ? '' : ' id="'.$strTitleId.'"'),'>',$strTitle,'</div>
<div class="msgboxbody"',(empty($strBodyId) ? '' : ' id="'.$strBodyId.'"'),'>',(empty($strBody) ? '' : $strBody),'
';
break;
case 1: echo '
</div>
</div>
';
break;
}

}

// --------

function HtmlTabs($arrTabs=array(0=>'Empty'),$strUrl='', $strCurrent='',$intMax=6,$bFirst=true,$bLast=true,$strWarning='Data not yet saved. Quit without saving?')
{

// tabx means the last tab (can be special due to popup)
// if defined, the class/style tab_on replaces the class/style tab (but you can cumulate the classes in the definition)
// if defined, the class/style tabx_on replaces the class/style tabx (but you can cumulate the styles in the definition)
// When strCurrent is defined, this tab will not be clickable
// $arrTabs can be an array of: strings, arrays, cTab

$iCurrent=1;
foreach(array_keys($arrTabs) as $strKey)
{
  if ($strKey==$strCurrent) break;
  $iCurrent++;
}

// check

if ( !is_array($arrTabs) ) die('HtmlTabs: Argument #1 must be an array');
if ( !empty($strUrl) ) { if ( !strstr($strUrl,'?') ) $strUrl .= '?'; }

// display

echo'
<!-- tab header begin -->
<table cellspacing="0" class="tab" summary="tabs">
';

$strOuts=''; $strOut=''; $intRow=0; $intCol=0;
foreach($arrTabs as $strKey=>$oTab)
{
  if ( $intCol==0 )
  {
    $strOut = '<tr class="tab">'."\n";
    if ( $bFirst ) $strOut .= '<td class="tab '.($intRow==0 ? 'tab_begin' : 'tab_hidden').'">&nbsp;</td>'."\n";
    $intCol++;
  }
  if ( $intCol>0 )
  {
    $strTab = '';
    $strTabDesc = '';
    // extract name and description from the object in arrTabs: can be a string, an array or a cTab
    if ( is_string($oTab) )
    {
      $strTab = $oTab;
    }
    elseif ( is_array($oTab) )
    {
      if ( isset($oTab['tabdesc']) )
      {
        if ( !empty($oTab['tabdesc']) ) $strTabDesc = $oTab['tabdesc'];
      }
      if ( isset($oTab['tabname']) )
      {
        if ( !empty($oTab['tabname']) ) { $strTab=$oTab['tabname']; } else { $strTab=ObjTrans('tab',$strKey); }
      }
      else
      {
        $strTab=ObjTrans('tab',$strKey);
      }
    }
    elseif ( strtolower(get_class($oTab))=='ctab' )
    {
      $strTabDesc = $oTab->tabdesc;
      $strTab = $oTab->tabname; if ( empty($strTab) ) $strTab = $oTab->tabid;
    }
    else
    {
      die('HtmlTabs: Arg #1 must be an array of strings, arrays or cTab');
    }
    $strOut .= '<td class="tab tab_'.($strCurrent==$strKey ? 'on' : 'off').'_l">&nbsp;</td>';
    $strOut .= '<td class="tab tab_'.($strCurrent==$strKey ? 'on' : 'off').'_c">';
    if ( empty($strUrl) || $strCurrent==$strKey )
    {
    $strOut .=  $strTab;
    }
    else
    {
    $strOut .=  '<a class="tab" href="'.$strUrl.'&amp;tt='.$strKey.'"'.(empty($strTabDesc) ? '' : ' title="'.$strTabDesc.'"').' onclick="return warningedited(bEdited,\''.$strWarning.'\');">'.$strTab.'</a>';
    }
    $strOut .= '</td>';
    $strOut .= '<td class="tab tab_'.($strCurrent==$strKey ? 'on' : 'off').'_r">&nbsp;</td>'."\n";
    $intCol++; 
  }
  if ( $intCol>$intMax || $intCol>count($arrTabs) )
  {
    if ( $bLast ) $strOut .= '<td class="'.($intRow==0 ? 'tab tab_end' : 'hidden').'">&nbsp;</td>'."\n";
    $strOut .= '</tr>'."\n";
    $intCol=0;
    $strOuts = $strOut.$strOuts;
    $intRow++;
  }
}
if ( $intCol>0 )
{
  while($intCol<=$intMax) { $strOut .= '<td class="tab tab_a">&nbsp;</td>'; $intCol++; }
  if ( $bLast ) $strOut .= '<td class="tab'.($intRow==0 ? ' tab_end' : ' tab_hidden').'">&nbsp;</td>'."\n";
  $strOut .= '</tr>';
  $strOuts = $strOut.$strOuts;
}
echo $strOuts;

echo '
</table>
<!-- tab header end -->
';

}

// --------

function TableEmpty($strMsg='...')
{
  $arrFLD = array( new cFLD('0','&nbsp;','colhd colhdfirst','width:10px','colct colfirst'), new cFLD('1','&nbsp;','colhd','','colct'), new cFLD('2','&nbsp;','colhd colhdlast','width:10px','colct collast'));
  echo '<table class="data_t" cellspacing="0" summary="empty table"><tr class="data_t">',N;
  TableHeader($arrFLD,0);
  echo '</tr>',N;
  echo '<tr class="data_t">',N;
  echo '<td class="colct r1">&nbsp;</td>',N;
  echo '<td class="colct r1"><p>',$strMsg,'</p></td>',N;
  echo '<td class="colct r1">&nbsp;</td>',N;
  echo '</tr>';
  echo '<tr class="data_t">',N;
  echo '<td class="colft colftfirst"></td>',N;
  for($i=1;$i<count($arrFLD)-1;$i++) echo '<td class="colft"></td>',N;
  echo '<td class="colft colftlast"></td>',N;
  echo '</tr></table>',N;
  echo '<br/>';
}

// --------

function TableHeader($arrFLD,$intCount=0,$strUrl='',$strOrder='lastpostdate',$strDir='DESC')
{
  $img['ASC'] = ' <img class="ico i_sort" src="'.$_SESSION[QT]['skin_dir'].'/sort_asc.gif" alt="+"/>';
  $img['DESC']= ' <img class="ico i_sort" src="'.$_SESSION[QT]['skin_dir'].'/sort_desc.gif" alt="-"/>';
  
  foreach($arrFLD as $strKey=>$oFLD)
  {
    // change the text to hyperlink+image when necessary
    if ( $oFLD->sort && $intCount>2 && !empty($strUrl) )
    {
      if ( $strKey==$strOrder )
      {
      $str = '<a href="'.Href($strUrl).'&amp;order='.$oFLD->uid.'&amp;dir='.($strDir=='ASC' ? 'DESC' : '').($strDir=='DESC' ? 'ASC' : '').'">'.$oFLD->name.'</a>'.$img[$strDir];
      }
      else
      {
      $str = '<a href="'.Href($strUrl).'&amp;order='.$oFLD->uid.'&amp;dir='.$oFLD->sort.'">'.$oFLD->name.'</a>';
      }
    }
    else
    {
    $str = $oFLD->name;
    }
    echo '<td',(isset($oFLD->class_th) ? ' class="'.$oFLD->class_th.'"' : ''),(!empty($oFLD->style_th) ? ' style="'.$oFLD->style_th.'"' : ''),'>',$str,'</td>',N;
  }
}

// --------

function TableRowShow($arrFLD,$arr,$strRowClass='table_o r1',$arrSrc=array())
{
  global $oVIP;
  echo '<tr class="',$strRowClass,'">',N;
  foreach($arrFLD as $strKey=>$oFLD)
  {
    $strFullClass = $oFLD->class_td.($oFLD->class_dynamic ? $oFLD->AddClassDynamic($arrSrc) : ''); // in case of dynamic class
    $strFullStyle = $oFLD->style_td.($oFLD->style_dynamic ? $oFLD->AddStyleDynamic($arrSrc) : ''); // in case of dynamic style
    $strClass = ''; if ( !empty($strFullClass) ) $strClass = ' class="'.$strFullClass.'"';
    $strStyle = ''; if ( !empty($strFullStyle) ) $strStyle = ' style="'.$strFullStyle.'"';
    // show column (empty value is replaced by &nbsp;)
    if ( !isset($arr[$strKey]) ) $arr[$strKey]='&nbsp;';
    if ( $arr[$strKey]==='' ) $arr[$strKey]='&nbsp;';
    echo '<td',$strClass,$strStyle,'>',$arr[$strKey],'</td>'.N;
  }
  echo '</tr>',N;
}

// --------

function TableRowFormat($arrFLD,$row,$bTopic=false,$oSEC,$bMap=false,$bCsv=false)
{
  $arr = array();
  global $oVIP,$L,$arrExtData;
  if ( $bTopic ) $oTopic = new cTopic($row);

  // PRE-PROCESS
    
  if ( isset($arrFLD['numid']) ) { $strSectionNumfield='N'; if ( isset($oSEC) ) $strSectionNumfield=$oSEC->numfield; if ( isset($row['numfield']) ) $strSectionNumfield=$row['numfield']; }
  if ( isset($arrFLD['smile']) ) { $strSectionPrefix=''; if ( isset($oSEC) ) $strSectionPrefix=$oSEC->prefix; if ( isset($row['prefix']) ) $strSectionPrefix=$row['prefix']; }
  if ( isset($arrFLD['you']) && $oTopic->replies>0 )
  {
    global $arrMe;
    if ( !empty($arrMe) ) {
    if ( array_key_exists($oTopic->id,$arrMe) ) {
    $oTopic->youreply = '<span title="'.$L['You_reply'].(empty($arrMe[$oTopic->id]) ? '' : ', '.QTdatestr($arrMe[$oTopic->id],'d M','H:i',true,true)).'"><b>&reg;</b></span>';
    }}
  }
  if ( isset($arrFLD['sectiontitle']) ) { if ( isset($_SESSION[QT]['sys_sections'][$oTopic->section]) ) { $strSectiontitle = $_SESSION[QT]['sys_sections'][$oTopic->section]; } else { $strSectiontitle='[section '.$oTopic->section.']'; } }
  if ( isset($arrFLD['tags']) )
  {
    $strTags = '';
    $strAbbr = '';
    if ( empty($oTopic->tags) ) { $arrTags=array(); } else { $arrTags=explode(';',$oTopic->tags); }
    if ( count($arrTags)>1 )
    {
      for ($i=0;$i<count($arrTags);$i++)
      {
        if ( $i<3 ) $strTags .= $arrTags[$i].';';
        if ( $i>=3 ) $strAbbr .= $arrTags[$i].';';
        if ( $i>13 ) break;
      }
    }
    else
    {
      $strTags = $oTopic->tags;
    }
    $strTags = str_replace(';',' ',$strTags.(empty($strAbbr) ? '' : '<abbr title="'.$strAbbr.'">...</abbr>'));
  }
  
  // when searching in posts without title, use this to report empty title
  if ( isset($arrFLD['title']) )
  {
    if ( trim($oTopic->title)=='' ) $oTopic->title='('.strtolower($L['Reply']).')';
    if ( empty($oTopic->title) && $oTopic->title!='0' ) $oTopic->title='('.strtolower($L['Reply']).')';
  }
  
  // icon
  if ( isset($arrFLD['icon']) )
  {
    if ( strtolower($oTopic->type)=='a' )
    {
    $strTicon = $_SESSION[QT]['skin_dir'].'/ico_topic_a_0'.$oTopic->hottopic.'.gif';
    $strTname = $L['Ico_topic_a_0'.$oTopic->hottopic];
    }
    else 
    {
    $strTicon = $_SESSION[QT]['skin_dir'].'/ico_topic_t_'.$oTopic->status.$oTopic->hottopic.'.gif';
    $strTname = $L['Ico_topic_t_'.$oTopic->status.$oTopic->hottopic];
    }
  }
  // mail
  if ( isset($arrFLD['mail']) || isset($arrFLD['location']) )
  {
    $strMail = '<img class="ico i_user" src="'.$_SESSION[QT]['skin_dir'].'/ico_user_e_0.gif" alt="mail" title="no e-mail"/>';
    if ( !empty($row['mail']) )
    {
    if ( $row['privacy']=='2' ) $strMail = AsEmails($row['mail'],$row['id'],'0','img'.(QTF_JAVA_MAIL ? 'java' : ''),false,$_SESSION[QT]['skin_dir'],'Java protected email','&nbsp;');
    if ( $row['privacy']=='1' && $oVIP->role!='V' ) $strMail = AsEmails($row['mail'],$row['id'],'0','img'.(QTF_JAVA_MAIL ? 'java' : ''),false,$_SESSION[QT]['skin_dir'],'Java protected email','&nbsp;');
    if ( $oVIP->id==$row['id'] || $oVIP->IsStaff() ) $strMail = AsEmails($row['mail'],$row['id'],'0','img'.(QTF_JAVA_MAIL ? 'java' : ''),false,$_SESSION[QT]['skin_dir'],'Java protected email','&nbsp;');
    }
  }
  // www
  if ( isset($arrFLD['www']) || isset($arrFLD['location']) )
  {
    if ($row['www']=='')
    {
    $strWww = '<img class="ico i_user" src="'.$_SESSION[QT]['skin_dir'].'/ico_user_w_0.gif" alt="email" title="no web site"/>';
    }
    else
    {
    $strWww = '<a href="'.$row['www'].'"><img class="ico i_user" src="'.$_SESSION[QT]['skin_dir'].'/ico_user_w_1.gif" alt="www" title="web site"/></a>';
    }
  }
  // coord
  $strCoord='';
  $strLatLon='';
  if ( $bMap && isset($row['y']) && isset($row['x']) )
  {
    $y = floatval($row['y']);
    $x = floatval($row['x']);
    if ( !empty($y) && !empty($x) )
    {
      $strCoord = '<a href="javascript:void(0)"'.($_SESSION[QT]['m_map_hidelist'] ? '' : ' onclick="map.setCenter(new GLatLng('.$y.','.$x.')); return false;"').' title="'.$L['Coord'].': '.round($y,8).','.round($x,8).'"><img class="ico" src="'.$_SESSION[QT]['skin_dir'].'/ico_user_m_1.gif" alt="G" title="'.$L['Coord_latlon'].' '.QTdd2dms($y).','.QTdd2dms($x).'"/></a>';
      $strLatLon = QTdd2dms($y).'<br/>'.QTdd2dms($x);
    }
  }
  if ( $bMap && empty($strCoord) ) $strCoord = '<img class="ico i_user" src="'.$_SESSION[QT]['skin_dir'].'/ico_user_m_0.gif" alt="G" title="No coordinates"/>';
  
  $strPriv = '';
  if ( isset($row['privacy']) && isset($row['id']) )
  {
  if ( $row['privacy']!=2 && ($oVIP->IsStaff() || $oVIP->id==$row['id']) ) $strPriv=' <img class="ico" src="admin/private'.$row['privacy'].'.gif" title="'.$L['Privacy_visible'][$row['privacy']].'"/>';
  }

  // FORMAT
    
  // ::::::::::
  foreach($arrFLD as $strKey=>$oFLD) {
  // ::::::::::
  
  if ( $bCsv ) 
  {

    $str='';
    switch($strKey)
    {
    case 'csvdate': $str = substr($oTopic->firstpostdate,0,8); break;
    case 'csvtime': $str = (strlen($oTopic->firstpostdate)>9 ? substr($oTopic->firstpostdate,9,2).':'.substr($oTopic->firstpostdate,11,2).':'.substr($oTopic->firstpostdate,13,2) : ''); break;
    case 'numid':   $str = sprintf($strSectionNumfield,$oTopic->numid); break;
    case 'status':  $arrStatuses = $oVIP->GetStatuses(); $str = $arrStatuses[$oTopic->status]['statusname']; break;
    case 'smile':   $str = ($oTopic->smile=='00' ? '' : $L['Ico_prefix'][$strSectionPrefix.'_'.$oTopic->smile]); break;
    case 'title':   $str = ($oTopic->type=='A' ? $L['News_stamp'] : '').$oTopic->title; break;
    case 'text':    $str = $oTopic->preview; break;
    case 'sectiontitle': $str = ObjTrans('sec','s'.$oTopic->section,$strSectiontitle); break;
    case 'firstpostname':$str = $oTopic->firstpostname.', '.QTdatestr($oTopic->firstpostdate); break;
    case 'lastpostdate': $str = QTdatestr($oTopic->lastpostdate).' '.strtolower($L['By']).' '.$oTopic->lastpostname; break;
    case 'replies': $str = $oTopic->replies; if ( $oTopic->type=='I' && !empty($oTopic->param) ) $str .= ' '.ValueName($oTopic->z,$oTopic->ParamGet('Ilevel'),30); break;
    case 'uid': $str = $oTopic->id; break;
    case 'modifdate': $str = QTdatestr($oTopic->modifdate,'$',''); break;
    case 'coord': $str = str_replace('&#176;','°',$strLatLon); break;
    default: if ( isset($oTopic->$strKey) ) $str = $oTopic->$strKey; break;
    }
    $arr[$strKey] = ToCsv($str);

  }
  else
  {

    switch ($strKey)
    {
    case 'icon': $arr[$strKey] = AsImg($strTicon,'T',$strTname,'ico i_topic','',Href('qtf_topic.php').'?t='.$oTopic->id); break;
    case 'numid': $arr[$strKey] = ( $strSectionNumfield=='N' ? '&nbsp;' : '<span class="span_ref">'.sprintf($strSectionNumfield,$oTopic->numid).'</span>' ); break;
    case 'smile': $arr[$strKey] = ( $oTopic->smile=='00' ? '&nbsp;' : AsImg($_SESSION[QT]['skin_dir'].'/ico_prefix_'.$strSectionPrefix.'_'.$oTopic->smile.'.gif','[o]',$L['Ico_prefix'][$strSectionPrefix.'_'.$oTopic->smile],'ico ico_prefix') ); break;
    case 'title': $arr[$strKey] = ( $oTopic->type=='A' ? '<span class="small">'.$L['News_stamp'].'</span>' : '' ).'<a class="topic" href="'.Href('qtf_topic.php').'?t='.$oTopic->id.'"'.(!empty($oTopic->preview) ? ' title="'.$oTopic->preview.'"' : '').'>'.$oTopic->title.'</a>'.( empty($strCoord) ? '' : ' '.$strCoord ); break;
    case 'you': $arr[$strKey] = $oTopic->youreply; break;
    case 'replies': $arr[$strKey] = $oTopic->replies; break;
    case 'sectiontitle': $arr[$strKey] = ObjTrans('sec','s'.$oTopic->section,$strSectiontitle); break;
    case 'firstpostname': $arr[$strKey] = '<a href="qtf_user.php?id='.$oTopic->firstpostuser.'" title="'.$L['Ico_user_p'].'" class="small">'.$oTopic->firstpostname.'</a><br/>'.QTdatestr($oTopic->firstpostdate,'$','$',true,true,true); break;
    case 'lastpostdate': $arr[$strKey] = QTdatestr($oTopic->lastpostdate,'$','$',true,true,true).' <a href="'.Href('qtf_topic.php').'?t='.$oTopic->id.'#p'.$oTopic->lastpostid.'" title="'.$L['H_Goto_message'].'">'.$L['Goto_message'].'</a><br/>'.strtolower($L['By']).' <a href="qtf_user.php?id='.$oTopic->lastpostuser.'" title="'.$L['Ico_user_p'].'" class="small">'.$oTopic->lastpostname.'</a>'; break;
    case 'status': $arrStatuses = $oVIP->GetStatuses(); $arr[$strKey] = '<span title="'.(empty($oTopic->statusdate) ? '' : QTdatestr($oTopic->statusdate,'d M','H:i',true,true)).'">'.$arrStatuses[$oTopic->status].'</span>'; break;
    case 'tags': $arr[$strKey] = '<span class="tag">'.$strTags.'</span>'; break;
    case 'picture': $arr[$strKey] = ( empty($row['picture']) ? S : AsImg(QTF_DIR_PIC.$row['picture'],'',$row['name'],'imagelist','','qtf_user.php?id='.$row['id']) ); break;
    case 'name': $arr[$strKey] = '<a href="qtf_user.php?id='.$row['id'].'">'.$row['name'].'</a>'; break;
    case 'role': $arr[$strKey] = $L['Userrole'][$row['role']]; break;
    case 'contact': $arr[$strKey] = ( empty($strMail) ? '<img class="ico" src="'.$_SESSION[QT]['skin_dir'].'/ico_user_e_0.gif" alt="mail" title="no e-mail"/>' : $strMail ).' '.( empty($strWww) ? '<img class="ico" src="'.$_SESSION[QT]['skin_dir'].'/ico_user_w_0.gif" alt="email" title="no web site"/>' : $strWww ).( empty($strCoord) ? '' : ' '.$strCoord ).( empty($strPriv) ? '' : $strPriv); break;
    case 'location': $arr[$strKey] = $row['location']; break;
    case 'firstdate': $arr[$strKey] = QTdatestr($row['firstdate'],'$','',true,false,true); break;
    case 'modifdate': $arr[$strKey] = ( !empty($oTopic->modifdate) ? QTdatestr($oTopic->modifdate,'$','',true,false,true) : $L['None']); break;
    case 'coord': $arr[$strKey] = $strLatLon; break;
    default:
      if ( $bTopic )
      {
        if ( isset($oTopic->$strKey) ) $arr[$strKey] = $oTopic->$strKey;
      }
      elseif ( isset($row[$strKey]) )
      {
        $arr[$strKey] = $row[$strKey];
      }
      else
      {
        $arr[$strKey] = '';
      }
      if ( $arr[$strKey]!=='' ) $arr[$strKey] = '<span class="small">'.$arr[$strKey].'</span>';
      break;
    }
  
  }
  
  // ::::::::::
  }
  // ::::::::::

  return $arr;
}

?>
Return current item: QuickTalk Forum