<?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
*
* About text coding in the database
* This script will convert the text before inserting into the dabase as follow:
*
* 1) stripslashes
* 2) htmlspecialchar($text,ENT_QUOTES) <>&"' are converted to html
* 3) bbcodes remain UNCHANGED (they are converted while displayed)
*
*/
session_start();
require_once('bin/qti_init.php');
if ( !$oVIP->CanAccess('MUV',6) ) die($L['R_member']);
// INITIALISE
include('bin/qti_fn_limitsql.php');
// initialise action (nt,re,ed,qu,ed allowed)
$a = -1;
if ( isset($_GET['a']) ) $a = $_GET['a'];
if ( isset($_POST['action']) ) $a = $_POST['action'];
if ( !in_array($a,array('nt','re','ed','qu')) ) die('Missing parameters A');
// initialise section (-1 not allowed)
$s = -1;
if ( isset($_GET['s']) ) $s = intval($_GET['s']);
if ( isset($_POST['section']) ) $s = intval($_POST['section']);
if ( $s<0 ) die('Missing parameters: section');
// initialise topic (-1 allowed when new topic)
$t = -1;
if ( isset($_GET['t']) ) $t = intval($_GET['t']);
if ( isset($_POST['topic']) ) $t = intval($_POST['topic']);
// initialise post (-1 allowed when new reply)
$p = -1;
if ( isset($_GET['p']) ) $p = intval($_GET['p']);
if ( isset($_POST['post']) ) $p = intval($_POST['post']);
$oSEC = new cSection($s);
$oTopic = new cTopic(($t>=0 ? $t : null));
$oPost = new cPost(($p>=0 ? $p : null));
// initialise others
$now = date('Ymd His');
$bUpload = false;
$intBehalf = -1;
$strBehalf = '';
$intNotified = -1;
$strNotified = '';
$oVIP->selfurl = 'qti_form_edit.php';
$oVIP->selfname = $L['Message'];
if ( $a=='nt' ) $oVIP->selfname = $L['Post_new_topic'];
if ( $a=='re' ) $oVIP->selfname = $L['Post_reply'];
if ( $a=='qu' ) $oVIP->selfname = $L['Post_reply'];
if ( $a=='ed' ) $oVIP->selfname = $L['Edit_message'];
$oVIP->exiturl = "qti_topic.php?s=$s&t=$t";
$oVIP->exitname = $L['Topics'];
// 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'));
// --------
// SUBMITTED
// --------
if ( isset($_POST['dosend']) || isset($_POST['dopreview']) )
{
// modifuser is the current editor/creator (can be the onbehalf)
// In case of New message (or Reply or Quote), this one becomes the creator (userid=modifuser)
// In case of Edit existing message, userid is not changed but the modifuser can be saved (if modifuser!=userid)
$oPost->modifuser = $oVIP->id;
$oPost->modifname = $oVIP->username;
// --------
// read submitted fields
// --------
if ( isset($_POST['icon']) ) { $oPost->icon = $_POST['icon']; }
if ( isset($_POST['title']) ) { $oPost->title = trim($_POST['title']); if ( get_magic_quotes_gpc() ) $oPost->title = stripslashes($oPost->title); }
if ( isset($_POST['text']) ) { $oPost->text = trim($_POST['text']); if ( get_magic_quotes_gpc() ) $oPost->text = stripslashes($oPost->text); }
if ( isset($_POST['wisheddate']) )
{
if ( !empty($_POST['wisheddate']) )
{
$str = QTdate(trim($_POST['wisheddate']),array('s','date','Ymd',null));
if ( !is_string($str) ) $qti_error = $L['Wisheddate'].S.$L['E_invalid'];
if ( substr($str,0,6)=='Cannot' ) $qti_error = $L['Wisheddate'].S.$L['E_invalid'];
if ( substr($str,0,4)=='1970' ) $qti_error = $L['Wisheddate'].S.$L['E_invalid'];
if ( empty($qti_error) ) $oTopic->wisheddate = $str;
}
}
if ( isset($_POST['oldattach']) ) { $oPost->attach = $_POST['oldattach']; }
if ( isset($_POST['behalf']) ) { $strBehalf = trim($_POST['behalf']); if ( get_magic_quotes_gpc() ) $strBehalf = stripslashes($strBehalf); }
if ( isset($_POST['notifiedname']) ) { $strNotified = trim($_POST['notifiedname']); if ( get_magic_quotes_gpc() ) $strNotified = stripslashes($strNotified); }
// complete if missing behalf name
if ( $strBehalf!='' )
{
$strBehalf = htmlspecialchars($strBehalf,ENT_QUOTES);
$arrNames = GetUsers('name',$strBehalf);
if ( !empty($arrNames) ) { foreach ( $arrNames as $intKey => $strValue ) { $intBehalf = $intKey; } }
if ( $intBehalf<0 ) $qti_error = $L['Send_on_behalf'].S.$L['E_invalid'];
$oPost->modifuser = $intBehalf;
$oPost->modifname = $strBehalf;
}
// identify user
if ( $a!='ed' )
{
$oPost->userid = $oPost->modifuser;
$oPost->username = $oPost->modifname;
}
// complete if missing notified name
if ( $strNotified!='' )
{
$strNotified = htmlspecialchars($strNotified,ENT_QUOTES);
$arrNames = GetUsers('name',$strNotified);
if ( !empty($arrNames) ) { foreach ( $arrNames as $intKey => $strValue ) { $intNotified = $intKey; } }
}
if ( $intNotified<0 && $strNotified!='' ) $qti_error = $L['Notify_also'].S.$L['E_invalid'];
// --------
// mandatory submitted fields
// --------
if ( $oSEC->notifycc=='2' && $intNotified<0 && $a=='nt' ) $qti_error = $L['Notify_also'].': '.$L['E_mandatory'];
if ( $oSEC->wisheddate=='2' && empty($_POST['wisheddate']) && $a=='nt' ) $qti_error = $L['Wishddate'].': '.$L['E_mandatory'];
$oPost->title = QTbbc($oPost->title,'deepdrop',' ',50,null,null,' ');
if ( $a=='nt' && $oPost->title=='' && $oSEC->titlefield==2 ) $qti_error = $L['E_no_title'];
if ( strlen($oPost->text)>$_SESSION[QT]['chars_per_post'] ) $qti_error = $L['E_too_long'].S.sprintf($L['E_char_max'], $_SESSION[QT]['chars_per_post']);
if ( substr_count($oPost->text,"\n")>$_SESSION[QT]['lines_per_post'] ) $qti_error = $L['E_too_long'].S.sprintf($L['E_line_max'], $_SESSION[QT]['lines_per_post']);
$oPost->text = substr( $oPost->text, 0, $_SESSION[QT]['chars_per_post'] );
$oTopic->preview = QTbbc($oPost->text,'deepdrop',' ',250,null,null,'');
if ($oPost->text=='') $qti_error = $L['Message'].S.$L['E_invalid'];
// --------
// check submitted rules (when sending the message)
// --------
if ( isset($_POST['dosend']) && empty($qti_error) )
{
// check maximum post per user/minutes
if ( !LastPostDelayAcceptable() ) $qti_error=$L['E_wait'];
// check maximum post per day (not for moderators)
if ( empty($qti_error) )
{
if ( $oVIP->role=='U' || $oVIP->role=='V' ) {
if ( !PostsTodayAcceptable(intval($_SESSION[QT]['posts_per_day'])) ) {
$qti_error=$L['E_too_much'];
// exit
$oVIP->exiturl = 'qti_topics.php?s='.$s;
$oVIP->EndMessage(NULL,$qti_error,$_SESSION[QT]['skin_dir'],0);
}}
}
// check message
if ( empty($qti_error) )
{
// ----------
// module antispam
if ( UseModule('antispam') ) include('qtim_antispam.php');
// ----------
}
// check upload
if ( empty($qti_error) ) {
if ( $_SESSION[QT]['upload']!='0' ) {
if ( !empty($_FILES['attach']['name']) ) {
include('qti_form_edit_attach.php');
}}}
}
}
// --------
// SUBMITTED Process a SEND
// --------
if ( isset($_POST['dosend']) && empty($qti_error) )
{
// ----------
// SEND a new topic
// ----------
if ( $a=='nt' )
{
$oTopic->id = Nextid(TABTOPIC);
$oTopic->numid = Nextid(TABTOPIC,'numid','WHERE forum='.$s);
$oPost->id = Nextid(TABPOST);
$oPost->topic = $oTopic->id;
$oPost->section = $s;
$oTopic->section = $s;
// if moderator post
if ( isset($_POST['topictype']) ) $oTopic->type = $_POST['topictype'];
if ( isset($_POST['topicstatus']) ) $oTopic->status = $_POST['topicstatus'];
$oTopic->firstpostid = $oPost->id;
$oTopic->lastpostid = $oPost->id;
$oTopic->firstpostuser = $oPost->userid;
$oTopic->firstpostname = $oPost->username;
$oTopic->lastpostuser = $oPost->userid;
$oTopic->lastpostname = $oPost->username;
$oTopic->firstpostdate = $now;
$oTopic->lastpostdate = $now;
if ( $intNotified>=0 )
{
$oTopic->notifiedid = $intNotified;
$oTopic->notifiedname = $strNotified;
}
// replace empty title
if ( empty($oPost->title) )
{
$oPost->title = QTbbc($oPost->text,'deepdrop',' ',50,null,null,' ');
}
$oPost->type = 'P';
$oPost->issuedate = $now;
if ( $bUpload )
{
if ( !empty($_POST['oldattach']) ) if ( file_exists(QTI_DOC_FOLDER.$oPost->id.'_'.$_POST['oldattach']) ) unlink(QTI_DOC_FOLDER.$oPost->id.'_'.$_POST['oldattach']);
copy($_FILES['attach']['tmp_name'],QTI_DOC_FOLDER.$oPost->id.'_'.$strUpload);
unlink($_FILES['attach']['tmp_name']);
$oPost->attach = $strUpload;
}
$oPost->InsertPost(false);
$oTopic->InsertTopic(true,true,$oPost,$oSEC);
$oVIP->numpost++;
// location update
if ( $bMap ) {
if ( isset($_POST['m_map_gcenter']) ) {
if ( !empty($_POST['m_map_gcenter']) ) {
QTgpoint(TABTOPIC,$oTopic->id,QTgety($_POST['m_map_gcenter']),QTgetx($_POST['m_map_gcenter']));
}}}
// ----------
// module rss
if ( UseModule('rss') ) { if ( $_SESSION[QT]['m_rss']=='1' ) include('qtim_rss_inc.php'); }
// ----------
}
// ----------
// SEND a reply
// ----------
if ( $a=='re' || $a=='qu' )
{
$oPost->id = Nextid(TABPOST);
$oPost->topic = $t;
$oPost->section = $s;
$oPost->type = 'R';
$oPost->issuedate = $now;
if ( $bUpload )
{
if ( !empty($_POST['oldattach']) ) if ( file_exists(QTI_DOC_FOLDER.$oPost->id.'_'.$_POST['oldattach']) ) unlink(QTI_DOC_FOLDER.$oPost->id.'_'.$_POST['oldattach']);
copy($_FILES['attach']['tmp_name'],QTI_DOC_FOLDER.$oPost->id.'_'.$strUpload);
unlink($_FILES['attach']['tmp_name']);
$oPost->attach = $strUpload;
}
$oPost->InsertPost(true);
$oVIP->numpost++;
// update topic stats and close topic if full (and lastpost topic info)
$oTopic->UpdateTopicStats($t,$_SESSION[QT]['posts_per_topic'],$oPost);
// topic status/type (from staff)
if ( isset($_POST['topictype']) )
{
if ( $_POST['topictype']!=$_POST['oldtype'] ) $oTopic->SetType($t,$_POST['topictype']);
}
if ( isset($_POST['topicstatus']) )
{
if ( $_POST['topicstatus']!=$_POST['oldstatus'] ) $oTopic->SetStatus($_POST['topicstatus'],true,$oPost);
}
// topic status (from user)
if ( isset($_POST['topicstatususer']) ) { if ( $_POST['topicstatususer'][0]=='Z' ) $oTopic->SetStatus('Z',true,$oPost); }
}
// ----------
// SEND a edition
// ----------
if ( $a=='ed' )
{
if ( $oSEC->titlefield==0 && $oPost->type=='P' )
{
$oPost->title = QTbbc($oPost->text,'deepdrop',' ',50,null,null,' ');
}
if ( empty($oPost->title) && $oPost->type=='P' )
{
$oPost->title = QTbbc($oPost->text,'deepdrop',' ',50,null,null,' ');
}
if ( isset($_POST['m_map_gcenter']) )
{
if ( empty($_POST['m_map_gcenter']) )
{
QTgpointdelete(TABTOPIC,$oTopic->id);
}
else
{
QTgpoint(TABTOPIC,$oTopic->id,QTgety($_POST['m_map_gcenter']),QTgetx($_POST['m_map_gcenter']));
}
}
$strModif = '';
// modifdate+modifuser if editor is not the creator
if ( $oPost->modifuser!=$oPost->userid ) $strModif=', modifdate="'.date('Ymd His').'", modifuser='.$oPost->modifuser.', modifname="'.$oPost->modifname.'"';
// modifdate+modifuser if not the last message
if ( $oTopic->lastpostid!=$oPost->id ) $strModif=', modifdate="'.date('Ymd His').'", modifuser='.$oPost->modifuser.', modifname="'.$oPost->modifname.'"';
if ( $bUpload )
{
if ( !empty($_POST['oldattach']) ) if ( file_exists(QTI_DOC_FOLDER.$oPost->id.'_'.$_POST['oldattach']) ) unlink(QTI_DOC_FOLDER.$oPost->id.'_'.$_POST['oldattach']);
copy($_FILES['attach']['tmp_name'],QTI_DOC_FOLDER.$oPost->id.'_'.$strUpload);
unlink($_FILES['attach']['tmp_name']);
$oPost->attach = $strUpload;
}
// if drop attachement
if ( isset($_POST['drop']) ) { if ( $_POST['drop'][0]=='1' ) $oPost->Dropattach(); }
if ( $oDB->type=='db2' || $oDB->type=='ifx')
{
$oDB->Query( 'UPDATE '.TABPOST.' SET title="'.addslashes($oPost->title).'", icon="'.$oPost->icon.'",textmsg="'.addslashes($oPost->text).'",",textmsg2="'.substr(addslashes($oPost->text),0,255).'",attach="'.$oPost->attach.'" '.$strModif.' WHERE id='.$oPost->id );
}
else
{
$oDB->Query( 'UPDATE '.TABPOST.' SET title="'.addslashes($oPost->title).'", icon="'.$oPost->icon.'",textmsg="'.addslashes($oPost->text).'",attach="'.$oPost->attach.'" '.$strModif.' WHERE id='.$oPost->id );
}
if ( !empty($oTopic->wisheddate) ) $oDB->Query('UPDATE '.TABTOPIC.' SET wisheddate="'.$oTopic->wisheddate.'" WHERE id='.$t);
// topic status/type (from moderator)
if ( isset($_POST['topictype']) )
{
if ( $_POST['topictype']!=$_POST['oldtype'] ) $oTopic->SetType($oTopic->id,$_POST['topictype']);
}
if ( isset($_POST['topicstatus']) )
{
if ( $_POST['topicstatus']!=$_POST['oldstatus'] ) $oTopic->SetStatus($_POST['topicstatus']);
}
// topic status (from user)
if ( isset($_POST['topicstatususer']) ) { if ( $_POST['topicstatususer'][0]=='Z' ) $oTopic->SetStatus('Z'); }
}
// update forum stats
UpdateSectionStats($s); // since v1.6, section will not be closed on a maximum content
// location update
if ( $bMap ) {
if ( isset($_POST['m_map_gcenter']) ) {
QTgpoint(TABTOPIC,$oTopic->id,QTgety($_POST['m_map_gcenter']),QTgetx($_POST['m_map_gcenter']));
}}
// exit
$oVIP->exiturl = "qti_topic.php?s=$s&t=$oPost->topic#$oPost->id";
$str = ''; if ( $oSEC->numfield!='N' ) $str='<b>'.sprintf($oSEC->numfield,$oTopic->numid).'</b><br/>';
$oVIP->EndMessage(NULL,$str.$L['S_message_saved'],$_SESSION[QT]['skin_dir'],2);
}
// --------
// HTML START
// --------
if ( $a=='nt' )
{
$oPost->icon = '00';
$oPost->type = 'P';
}
if ( $a=='qu' )
{
if ( $t<0 ) die('Missing parameters: topicid');
if ( $p<0 ) die('Missing parameters: postid');
$oPost->icon = '00';
$oPost->title = '';
$oPost->text = "[quote=$oPost->username]$oPost->text[/quote]";
// rest must be as reply
$a = 're';
}
if ( $a=='re' )
{
if ( $t<0 ) die('Missing parameters: topicid');
$oPost->icon = '00';
$oPost->type = 'R';
}
if ( $a=='ed' )
{
if ( $t<0 ) die('Missing parameters: topicid');
if ( $p<0 ) die('Missing parameters: postid');
}
$bAjax=false;
if ( $oVIP->role=='A' || $oVIP->role=='M' ) $bAjax=true;
if ( $oSEC->notify==1 && $oPost->type=='P' && $oSEC->notifycc!=0 ) $bAjax=true;
// --------
// CONTENT
// --------
$arrCss = array('qti_calendar.css'); if ( $oSEC->wisheddate!=0 ) $arrCss[] = 'qt_jquery_date.css';
$arrJava = array('bbc'=>true,'img'=>true);
$strHeaderAddScript = '
<script type="text/javascript">
<!--
function ValidateForm(theButton)
{
theForm = theButton.form;
if (theForm.text.value.length==0) { alert(html_entity_decode("'.$L['E_mandatory'].': '.$L['Message'].'")); return false; }
if (theForm.text.value.length>'.$_SESSION[QT]['chars_per_post'].') { alert(html_entity_decode("'.$L['E_too_long'].': '.$L['Maximum'].' '.$_SESSION[QT]['chars_per_post'].'")); return false; }
if ( theButton.name=="dosend" )
{
theForm.action="'.$oVIP->selfurl.'";
theForm.target="";
}
else
{
if ( theForm.attach )
{
if ( theForm.attach.value.length>1 )
{
theForm.action="qti_form_preview.php";
theForm.target="_blank";
}
}
}
return true;
}
-->
</script>
';
$bJavaBbc2 = true;
if ( CanPerform('upload',$oVIP->role) ) $bJavaBbc3 = true;
if ( $bAjax )
{
$arrCss[] = 'qt_jquery.css';
$strHeaderAddScript .= '
<script type="text/javascript" src="bin/qt_jquery.js"></script>
<script type="text/javascript" src="bin/qt_jquery_auto.js"></script>'.( $oSEC->wisheddate!=0 ? '<script type="text/javascript" src="bin/qt_jquery_date.js"></script>' : '').'
<script type="text/javascript">
<!--
$(document).ready(function() {
$("#behalf").autocomplete("qti_j_name.php", {
selectFirst: false
});
$("#notifiedname").autocomplete("qti_j_name.php", {
selectFirst: false
});
$("#wisheddate").datepicker({
dateFormat: "yy-mm-dd",
monthNames: ["'.implode('","',$L['dateMMM']).'"],
dayNames: ["'.implode('","',$L['dateDDD']).'"],
dayNamesMin: ["'.implode('","',$L['dateD']).'"]
});
});
-->
</script>
';
}
if ( $bMap )
{
$arrMapPoints = array();
if ( !empty($oTopic->y) && !empty($oTopic->x) )
{
$arrMapPoints[$oTopic->id] = array(
'y'=>floatval($oTopic->y),
'x'=>floatval($oTopic->x),
'title'=>substr($oTopic->title,0,25),
'icon'=>$_SESSION[QT]['m_map'][$s]['icon'],
'shadow'=>$_SESSION[QT]['m_map'][$s]['shadow'],
'printicon'=>$_SESSION[QT]['m_map'][$s]['printicon'],
'printshadow'=>$_SESSION[QT]['m_map'][$s]['printshadow']
);
}
$strHeaderAddScript .= QTgmapheader('http://gmaps-utility-library.googlecode.com/svn/trunk/markermanager/release/src/markermanager.js');
$strBodyAddOnunload='GUnload()';
}
include('qti_p_header.php');
// PREVIEW
if ( isset($_POST['dopreview']) && empty($qti_error) )
{
echo '<h2>',$L['Preview'],'</h2>',N;
// get user info
$oDB->Query('SELECT signature,avatar,location,role FROM '.TABUSER.' WHERE id='.$oPost->userid);
$row = $oDB->Getrow();
$oPost->userloca = $row['location'];
$oPost->useravat = $row['avatar'];
$oPost->usersign = $row['signature'];
$oPost->userrole = $row['role'];
$oPost->issuedate = $now;
$oPost->Show($oSEC,$oTopic,true,'','',$_SESSION[QT]['skin_dir'],'1');
}
// FORM START
echo '<h2>',$oVIP->selfname,'</h2>',N;
if ( !empty($qti_error) ) echo '<p><span class="error">',$qti_error,'</span></p>';
echo '
<form id="form_edit" method="post" action="',$oVIP->selfurl,'" enctype="multipart/form-data">
<input type="hidden" name="section" value="',$s,'"/>
<input type="hidden" name="topic" value="',$t,'"/>
<input type="hidden" name="action" value="',$a,'"/>
<input type="hidden" name="post" value="',$p,'"/>
<input type="hidden" name="oldtype" value="',$oTopic->type,'"/>
<input type="hidden" name="oldstatus" value="',$oTopic->status,'"/>
';
// Rules for status and types
// 1) author himself can NOT change de status
// 2) Moderator can change status
// 3) Admin can change status and type
if ( $oVIP->role=='A' || $oVIP->role=='M' )
{
echo '<div class="div_modboard"><span class="span_modboard">',N;
echo $L['Type'],' <select class="small" name="topictype" size="1">',N;
echo QTastags($_SESSION['qtiTtypes'],null,$oTopic->type,null,$oTopic->type,'bold');
echo '</select>',N;
echo S,$L['Status'],' <select class="small" name="topicstatus" size="1">',N;
echo QTastags($_SESSION['qtiTstatus'],null,$oTopic->status,null,$oTopic->status,'bold');
echo '</select>',N;
echo S,$L['Send_on_behalf'],S,'<input class="small" type="text" name="behalf" id="behalf" size="12" maxlength="24" value="'.(isset($strBehalf) ? $strBehalf : '').'"/></span>',N;
echo '</div>',N;
}
// End of rule for status and types
echo '<table cellspacing="0" class="ta">',N;
// WISHDATE
if ( $oSEC->wisheddate!=0 ) {
if ( $oPost->type=='P' ) {
$strValue = '';
if ( $oSEC->wisheddate=='3' ) $strValue = date('Y-m-d');
if ( isset($_POST['wisheddate']) ) $strValue = $_POST['wisheddate'];
if ( !empty($oTopic->wisheddate) ) $strValue = substr($oTopic->wisheddate,0,4).'-'.substr($oTopic->wisheddate,4,2).'-'.substr($oTopic->wisheddate,-2,2);
echo '<tr>',N;
echo '<th class="th_o th_o_first"><label for="wisheddate">',$L['Wisheddate'],'</label></th>',N;
echo '<td class="td_o"><input type="text" id="wisheddate" name="wisheddate" size="20" maxlength="10" value="',$strValue,'" tabindex="1"/> ',N;
/*
echo '<script language="JavaScript" id="jscal1x">
<!--
var MONTH_NAMES=new Array(\'',$L['dateMMM'][1],'\',\'',$L['dateMMM'][2],'\',\'',$L['dateMMM'][3],'\',\'',$L['dateMMM'][4],'\',\'',$L['dateMMM'][5],'\',\'',$L['dateMMM'][6],'\',\'',$L['dateMMM'][7],'\',\'',$L['dateMMM'][8],'\',\'',$L['dateMMM'][9],'\',\'',$L['dateMMM'][10],'\',\'',$L['dateMMM'][11],'\',\'',$L['dateMMM'][12],'\',\'',$L['dateMM'][1],'\',\'',$L['dateMM'][2],'\',\'',$L['dateMM'][3],'\',\'',$L['dateMM'][4],'\',\'',$L['dateMM'][5],'\',\'',$L['dateMM'][6],'\',\'',$L['dateMM'][7],'\',\'',$L['dateMM'][8],'\',\'',$L['dateMM'][9],'\',\'',$L['dateMM'][10],'\',\'',$L['dateMM'][11],'\',\'',$L['dateMM'][12],'\');
var MONTH_ABREVIATIONS=new Array(\'',$L['dateMM'][1],'\',\'',$L['dateMM'][2],'\',\'',$L['dateMM'][3],'\',\'',$L['dateMM'][4],'\',\'',$L['dateMM'][5],'\',\'',$L['dateMM'][6],'\',\'',$L['dateMM'][7],'\',\'',$L['dateMM'][8],'\',\'',$L['dateMM'][9],'\',\'',$L['dateMM'][10],'\',\'',$L['dateMM'][11],'\',\'',$L['dateMM'][12],'\');
var DAY_LETTERNAMES=new Array(\'',$L['dateD'][1],'\',\'',$L['dateD'][2],'\',\'',$L['dateD'][3],'\',\'',$L['dateD'][4],'\',\'',$L['dateD'][5],'\',\'',$L['dateD'][6],'\',\'',$L['dateD'][7],'\');
var DAY_NAMES=new Array(\'',$L['dateDDD'][1],'\',\'',$L['dateDDD'][2],'\',\'',$L['dateDDD'][3],'\',\'',$L['dateDDD'][4],'\',\'',$L['dateDDD'][5],'\',\'',$L['dateDDD'][6],'\',\'',$L['dateDDD'][7],'\');
var DAY_TODAY=\'',$L['dateSQL']['Today'],'\';
var cal1x = new CalendarPopup(\'div_calendar\');
-->
</script>';
echo '<a href="#" onclick="cal1x.select(document.getElementById(\'form_edit\').wisheddate,\'anchor1x\',\'',QTI_JAVADATE,'\'); return false;" name="anchor1x" id="anchor1x"><img class="ico ico_bbc" src="',$_SESSION[QT]['skin_dir'],'/ico_date.gif" title="',$L['Wisheddate'],'"/></a><div id="div_calendar" style="position:absolute;visibility:hidden;background-color:white;layer-background-color:white;z-index:1;"></div>';
*/
echo ' <span class="small">',$L['H_Wisheddate'],'</span></td>',N;
echo '</tr>',N;
}}
// PREFIX ICON
if ( !empty($oSEC->prefix) )
{
echo '<tr>',N;
echo '<th class="th_o th_o_first" style="width:100px">',$L['Smiley'],'</th>',N;
echo '<td class="td_o">',N;
for ($i=0;$i<10;$i++)
{
if ( file_exists($_SESSION[QT]['skin_dir'].'/ico_prefix_'.$oSEC->prefix.'_0'.$i.'.gif') )
{
echo '<input type="radio" name="icon" id="0',$i,'" value="0',$i,'"',($oPost->icon=='0$i' ? QCHE : ''),'/><label for="0',$i,'"><img class="ico_prefi" src="',$_SESSION[QT]['skin_dir'],'/ico_prefix_',$oSEC->prefix,'_0',$i,'.gif" label="smile" title="',$L['Ico_prefix'][$oPost->prefix.'_0'.$i],'"/></label> ',N;
}
}
echo '<input type="radio" name="icon" id="00" value="00"',($oPost->icon=='00' ? QCHE : ''),'/><label for="00">',$L['None'],'</label></td>',N;
echo '</tr>',N;
}
// TITLE
if ( $oSEC->titlefield!=0 )
{
echo '<tr>',N;
echo '<th class="th_o th_o_first"><label for="title">',$L['Title'],'</label></th>',N;
echo '<td class="td_o"><input type="text" id="title" name="title" size="80" maxlength="64" value="',QTconv($oPost->title,'3',QTI_CONVERT_AMP),'" tabindex="1"/></td>',N;
echo '</tr>',N;
}
// MESSAGE
echo '<tr>',N;
echo '<th class="th_o th_o_first"><label for="text">',$L['Message'],'</label></th>',N;
echo '<td class="td_o">',N;
include('qti_form_button.php');
echo '<a href="textarea"></a><br/>';
echo '<textarea id="text" name="text" rows="15" wrap="virtual" cols="80" tabindex="2">',QTconv($oPost->text,'3',QTI_CONVERT_AMP),'</textarea></td>',N;
echo '</tr>',N;
// ATTACHMENT
if ( CanPerform('upload',$oVIP->role) )
{
$intMax = intval($_SESSION[QT]['upload_size'])*1024;
echo '<tr>',N;
echo '<th class="th_o th_o_first"><label for="attach">',$L['Attachment'],'</label></th>',N;
echo '<td class="td_o">';
if ( !empty($oPost->attach) )
{
echo AsImg($_SESSION[QT]['skin_dir'].'/ico_attachment.gif','A',$L['Attachment'],'ico ico_user'),S,$oPost->attach,' <input type="hidden" id="oldattach" name="oldattach" value="',$oPost->attach,'"/>';
echo ' · <input type="checkbox" id="drop" name="drop[]" value="1"/><label for="drop"> ',$L['Drop_attachment'],'</label>';
}
else
{
echo '<input type="hidden" name="MAX_FILE_SIZE" value="',$intMax,'"/>';
echo '<input type="file" id="attach" name="attach" size="42" tabindex="3"/>';
}
echo '</td>',N,'</tr>',N;
}
// NOTIFIED
if ( $oSEC->notify==1 ) {
if ( $oPost->type=='P' ) {
if ( $oSEC->notifycc!=0 ) {
// default value
$intValue = -1;
$strValue = '';
if ( $oSEC->notifycc==3 ) { $intValue = $oVIP->id; $strValue = $oVIP->username; }
if ( $intNotified>=0 ) { $intValue = $intNotified; $strValue = $strNotified; }
if ( $oTopic->notifiedid>=0 ) { $intValue = $oTopic->notifiedid; $strValue = $oTopic->notifiedname; }
//
echo '<tr>',N;
echo '<th class="th_o th_o_first"><label for="notifiedname">',$L['Notify_also'],'</label></th>',N;
echo '<td class="td_o"><input type="hidden" id="notifiedid" name="notifiedid" value="',$intValue,'"/><input type="text" id="notifiedname" name="notifiedname" size="20" maxlength="24" value="',$strValue,'"</div></td>',N;
echo '</tr>',N;
}}}
// MAP
if ( $oPost->type=='P' ) {
if ( $bMap ) {
$strPosition = '<p class="small" style="margin:2px 0 4px 2px;text-align:right">'.$L['map']['cancreate'];
$strPosition .= ' | <a class="small" href="javascript:void(0)" onclick="createMarker(); return false;" title="'.$L['map']['H_pntadd'].'"/>'.$L['map']['pntadd'].'</a>';
if ( !empty($oTopic->x) || !empty($oTopic->y) )
{
$strPosition = '<p class="small" style="margin:2px 0 4px 2px;text-align:right">'.$L['map']['canmove'];
$strPosition .= ' | <a class="small" href="javascript:void(0)" onclick="deleteMarker(); return false;"/>'.$L['map']['pntdelete'].'</a>';
}
$strPosition .= ' | <a class="small" href="javascript:void(0)" onclick="undoChanges(); return false;"/>'.$L['map']['undo'].'</a></p>';
$strPosition .= '
<div id="map_canvas" style="width:100%; height:350px;"></div>
<input type="hidden" id="m_map_gcenter" name="m_map_gcenter" value=""/>
';
$strPosition .= '<p class="small" style="margin:4px 0 2px 2px;text-align:right">'.$L['map']['addrlatlng'].' <input type="text" size="24" id="find" name="find" class="small" value="'.$_SESSION[QT]['m_map_gfind'].'" onKeyUp="handle_keypress(event,\'findit\')" title="'.$L['map']['H_addrlatlng'].'"/> <input type="submit" id="findit" class="small" onclick="showLocation(document.getElementById(\'find\').value); return false;" value="'.$L['Search'].'"/></p>';
echo '<tr><th class="th_o th_o_first">',$L['map']['position'],'</th><td class="td_o">',$strPosition,'</td></tr>';
}}
// SUBMIT
echo '<tr>',N;
echo '<th class="th_o th_o_first"> </th>',N;
echo '<td class="td_o">',N;
if ( $oTopic->status!='Z' && $oTopic->firstpostuser==$oVIP->id )
{
// topic status (from user)
$bChecked = false;
if ( isset($_POST['topicstatususer']) ) { if ( $_POST['topicstatususer'][0]=='Z' ) $bChecked=true; }
echo '<input type="checkbox" id="topicstatususer" name="topicstatususer[]" value="Z"',($bChecked ? QCHE : ''),'/><label for="topicstatususer"> ',$L['Close_my_topic'],' </label>';
}
echo ' <input type="submit" id="dopreview" name="dopreview" value="',$L['Preview'],'" onclick="return ValidateForm(this);"/>';
echo ' <input type="submit" id="dosend" name="dosend" value="',$L['Send'],'" tabindex="3" onclick="return ValidateForm(this);"/> ',N;
echo '</td>',N;
echo '</tr>',N;
// FORM END
echo '</table></form>',N;
// PREVIOUS POSTS
if ( $a=='re' || $a=='qu' )
{
echo '<h2>',$L['Previous_replies'],'</h2>',N;
// --------
$strState = 'p.*, u.role, u.location, u.avatar, u.signature FROM '.TABPOST.' p, '.TABUSER.' u WHERE p.userid = u.id AND p.topic='.$t.' ';
$strQ = LimitSQL($strState,'p.id DESC',0,5);
$oDB->Query($strQ);
// --------
$iMsgNum = $oTopic->replies + 2;
$iMsgAdd = -1;
$intPosts= 0;
$intWhile= 0;
$strAlt= '1';
$strSep= '';
$bButton = false;
$bAvatar = false;
// --------
include('qti_topic_inc.php');
// --------
}
// --------
// HTML END
// --------
if ( $bMap )
{
// center
if ( !empty($oTopic->x) && !empty($oTopic->y) )
{
$y = floatval($oTopic->y);
$x = floatval($oTopic->x);
$oMapPoint = new cMapPoint( $y,$x,substr($oTopic->title,0,25) );
if ( isset($_SESSION[QT]['m_map'][$s]['icon']) ) $oMapPoint->icon = $_SESSION[QT]['m_map'][$s]['icon'];
if ( isset($_SESSION[QT]['m_map'][$s]['shadow']) ) $oMapPoint->shadow = $_SESSION[QT]['m_map'][$s]['shadow'];
if ( isset($_SESSION[QT]['m_map'][$s]['printicon']) ) $oMapPoint->printicon = $_SESSION[QT]['m_map'][$s]['printicon'];
if ( isset($_SESSION[QT]['m_map'][$s]['printshadow']) ) $oMapPoint->printshadow = $_SESSION[QT]['m_map'][$s]['printshadow'];
$arrMapPoints = array( $oMapPoint );
}
else
{
$y = floatval(QTgety($_SESSION[QT]['m_map_gcenter']));
$x = floatval(QTgetx($_SESSION[QT]['m_map_gcenter']));
$arrMapPoints = array();
}
$strFooterAddScript = QTgmappoints($L['map'],$y,$x,'drag',$arrMapPoints,true).N.'mapload();';
}
include('qti_p_footer.php');
?>