Location: PHPKode > projects > Quick Guestbook > quicktalk/qtg_msg_view.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.
*
* @package    QuickTalk Guestbook
* @author     Philippe Vandenberghe <hide@address.com>
* @copyright  2009-2012 The PHP Group
* @version    2.5 build:20100731
*/

session_start();
require_once('bin/qtg_init.php');

$id = '-1'; // in case of file system, id is a string (hashed)
$page = 1;
QThttpvar('id page', 'str int',true,true,false); //only Http Get
if ( $id<0 ) die('ID '.$L['E_invalid']);

$pg_url='qtg_msg_view.php';

// MAP

if ( !empty($qtg_gkey) )
{ 
  include('qtg_map_lib.php');
  include(GetLang().'qtg_map.php');
  $strBodyAddOnunload='GUnload()';
}

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

include('qtg_p_header.php');

echo '<h1>',$L['Message'],'</h1>
';

$oPost = new cPost($id);
$intMessages=1;

$qtg_show_size=null;

if ( !empty($qtg_gkey) ) { 
if ( $oPost->x!=0 && $oPost->y!=0 ) {

  $strPname = substr(QTconv($oPost->name,'1'),0,25);
  $strPlink = '<a href="http://maps.google.com?q='.$oPost->y.','.$oPost->x.'+('.$strPname.')" class="small" title="'.$L['map']['In_google'].'" target="_blank">[G]</a>';
  $strPtxt = QTconv(QTcompact(QTunbbc($oPost->message),150,' '),'3').($qtg_use_from && !empty($oPost->postfrom) ? '<br/>'.QTconv($oPost->postfrom,'1') : '');
  $strPtxt = str_replace("\r\n"," ",$strPtxt);
  $strPtxt = str_replace("\n"," ",$strPtxt);
  $oMapPoint = new cMapPoint(floatval($oPost->y),floatval($oPost->x),QTconv($oPost->name,'-3'),'<div class="ginfo"><b>'.$strPname.'</b><br/>'.$strPtxt.'<br/>'.QTdatestr($oPost->issuedate,'$','$',true).' '.$strPlink.'</div>',false);
  if ( isset($qtg_gsymbol) ) $oMapPoint->icon = $qtg_gsymbol;
  if ( isset($qtg_gshadow) ) $oMapPoint->shadow = $qtg_gshadow;
  if ( isset($qtg_gprinticon) ) $oMapPoint->printicon = $qtg_gprinticon;
  if ( isset($qtg_gprintshadow) ) $oMapPoint->printshadow = $qtg_gprintshadow;
  $arrExtData[$id] = $oMapPoint;

}}

// ------------
include('qtg_msg_inc.php'); 
// ------------  

if ( !empty($qtg_gkey) )
{ 
  if ( count($arrExtData)==0 )
  {
    echo '<div class="gmap_disabled">'.$L['map']['E_noposition'].'</div>';
  }
  else
  {
    //select zoomto (maximum 20 items in the list)
    if ( count($arrExtData)>1 )
    {
      $str = '<p class="gmap" style="margin:0 0 4px 0"><a class="gmap" href="javascript:void(0)" onclick="zoomToFullExtend(); return false;">'.$L['map']['zoomtoall'].'</a> | '.$L['map']['jumpto'].' <select class="gmap" id="zoomto" name="zoomto" size="1" onchange="map.setCenter(eval(this.value));">';
      $str .= '<option class="small_gmap" value="new GLatLng('.QTgety($qtg_gcenter).','.QTgetx($qtg_gcenter).')"> </option>';
      $i=0;
      foreach($arrExtData as $oMapPoint)
      {
      $str .= '<option class="small_gmap" value="new GLatLng('.$oMapPoint->y.','.$oMapPoint->x.')">'.$oMapPoint->title.'</option>';
      $i++; if ( $i>20 ) break;       
      }
      $str .= '</select></p>';
    }

    echo '
    <div class="gmap">
    ',( count($arrExtData)>1 ? $str :'' ),'
    <div id="map_canvas" style="width:100%; height:350px;"></div>
    <p class="gmap" style="margin:4px 0 0 0">',sprintf($L['map']['items'],strtolower( LangS('Message',count($arrExtData))),strtolower(LangS('Message',$intMessages)) ),'</p>
    </div>
    ';
  }
}

echo '<div class="backbutton"><span class="backbutton"><a id="exiturl" class="backbutton" href="'.Href().'?page='.$page.'">'.$L['Return'.$qtg_type].'</a></span></div>';

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

if ( !empty($qtg_gkey) ) 
{ 
  if ( count($arrExtData)>0 )
  {
    $y = floatval(QTgety($qtg_gcenter));
    $x = floatval(QTgetx($qtg_gcenter));

    // center on the first item
    foreach($arrExtData as $oMapPoint)
    {
      if ( !empty($oMapPoint->y) && !empty($oMapPoint->x) )
      {
      $y=$oMapPoint->y;
      $x=$oMapPoint->x;
      break;
      }
    }

$strFooterAddScript = QTgmapscript($qtg_gkey).'
<script type="text/javascript">
<!--
'.QTgmappoints(false,$y,$x,'click',$arrExtData).'
mapload();
-->
</script>
';

  }
  else
  {

$strFooterAddScript = '
<script type="text/javascript">
<!--
function GUnload() { return true; }
-->
</script>
';

  }
}

include('qtg_p_footer.php');

?>
Return current item: Quick Guestbook