<?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',4,true) ) $oVIP->EndMessage('!',$L['R_member'],$_SESSION[QT]['skin_dir'],0);
// INITIALISE
function show_ban($strRole='V',$intBan=0)
{
if ( $intBan<1 ) return '';
if ( $strRole=='A' || $strRole=='M' )
{
global $L;
if ( $intBan>1 ) $intBan=($intBan-1)*10;
Return '<p class="small error">'.$L['Is_banned'].' '.strtolower(LangS('Day',$intBan)).' '.$L['Since'].' '.strtolower($L['Last_message']).'</p>';
}
}
include('bin/qt_lib_smtp.php');
include($_SESSION[QT]['language'].'/qti_lang_reg.inc');
$bMap = UseModule('map');
if ( $bMap ) { if ( empty($_SESSION[QT]['m_map_gkey']) ) $bMap=false; }
if ( $bMap ) { require_once('qtim_map_lib.php'); if ( !QTgcanmap('U') ) $bMap=false; }
if ( $bMap ) include(Translate('qtim_map.inc'));
$id = -1;
if (isset($_GET['id'])) $id = intval($_GET['id']);
if (isset($_POST['id'])) $id = intval($_POST['id']);
$bEdit = false;
if ( $oVIP->id==$id ) $bEdit=true;
if ( $oVIP->role=='A' || $oVIP->role=='M' ) $bEdit=true;
if ( $id==0 ) $bEdit=false;
$oVIP->selfurl = 'qti_usr.php';
$oVIP->selfname = $L['Profile'];
// --------
// SUBMITTED
// --------
if ( isset($_POST['ok']) )
{
// check form
$strLoca = trim($_POST['location']); if ( get_magic_quotes_gpc() ) $strLoca = stripslashes($strLoca);
$strLoca = QTconv($strLoca,'3',QTI_CONVERT_AMP);
if ( empty($qti_error) )
{
$strMail = trim($_POST['mail']);
$strMail = str_replace(';',' ; ',$strMail);
$strMail = str_replace(' ',' ',$strMail);
if ( !empty($strMail) && !QTismail($strMail) ) $qti_error=$L['Email'].S.$strMail.' '.$L['E_invalid'];
}
if ( empty($qti_error) )
{
$strPhone = QTconv($_POST['phone'],'2');
}
if ( empty($qti_error) )
{
$strChild='0';
$strParentmail = '';
if ( QTI_USE_COPPA )
{
$strChild=$_POST['child'];
if ( $id=='1' && $strChild!='0' ) $qti_error='user id[1] is admin and child status cannot be changed...';
if ( $id=='0' && $strChild!='0' ) $qti_error='user id[0] is visitor and child status cannot be changed...';
$strParentmail = trim($_POST['parentmail']);
if ( !empty($strParentmail) )
{
if ( !QTismail($strParentmail) ) $qti_error=$L['Parent_mail'].S.$L['E_invalid'];
}
}
}
if ( empty($qti_error) )
{
$strWww = QTconv($_POST['www'],'2');
if ( !empty($strWww) && substr($strWww,0,4)!='http' ) $qti_error=$L['Website'].S.$L['E_invalid'];
if ( $strWww=='http://' || $strWww=='https://' ) $strWww='';
}
// save
if ( empty($qti_error) )
{
$oDB->Query('UPDATE '.TABUSER.' SET location="'.addslashes($strLoca).'", mail="'.$strMail.'", phone="'.addslashes($strPhone).'", www="'.addslashes($strWww).'", privacy="'.$_POST['privacy'].'", children="'.$strChild.'", parentmail="'.$strParentmail.'" WHERE id='.$id);
if ( isset($_POST['m_map_gcenter']) )
{
if ( empty($_POST['m_map_gcenter']) )
{
QTgpointdelete(TABUSER,$id);
}
else
{
QTgpoint(TABUSER,$id,QTgety($_POST['m_map_gcenter']),QTgetx($_POST['m_map_gcenter']));
}
}
// parent warning if coppa
if ( QTI_USE_COPPA && $strChild!='0' )
{
$strSubject = $_SESSION[QT]['site_name'].' - Profile updated';
$strMessage = "Your children (login: %s) has modified his/her profile on the board {$_SESSION[QT]['site_name']}.";
$strFile = $_SESSION[QT]['language'].'/mail_profile_coppa.inc';
if ( file_exists($strFile) ) include($strFile);
$strMessage = sprintf($strMessage, $_POST['name']);
QTmail($_POST['parentmail'],QTconv($strSubject,'-4'),QTconv($strMessage,'-4'),QTI_HTML_CHAR);
}
// exit
unset($_SESSION['qtiGoto']);
$oVIP->exiturl = "qti_usr.php?id=$id";
$oVIP->exitname = $L['Profile'];
$oVIP->EndMessage(NULL,$L['S_save'],$_SESSION[QT]['skin_dir'],2);
}
}
// --------
// STATS AND USER
// --------
// -- COUNT TOPICS --
$oDB->Query('SELECT count(id) as countid FROM '.TABTOPIC.' WHERE firstpostuser='.$id);
$row = $oDB->Getrow();
$counttopics = $row['countid'];
// -- COUNT MESSAGES --
$oDB->Query('SELECT count(id) as countid FROM '.TABPOST.' WHERE userid='.$id);
$row = $oDB->Getrow();
$countmessages = $row['countid'];
// -- QUERY USER --
$oDB->Query('SELECT * FROM '.TABUSER.' WHERE id='.$id);
$row = $oDB->Getrow();
// --------
// HTML START
// --------
if ( $bMap )
{
$strHeaderAddScript = QTgmapheader();
$strBodyAddOnunload='GUnload()';
}
include('qti_p_header.php');
if ( $id<0 ) die('Wrong id');
// -- PARTICIPATION INFO --
$strParticip = '';
if ( $counttopics>0 )
{
$strParticip .= '<a href="qti_search_ov.php?a=user&id='.$id.'&n='.urlencode($row['name']).'">'.LangS('Topic',$counttopics).'</a>, ';
}
if ( $countmessages>0 )
{
$strParticip .= '<span class="small">'.LangS('Message',$countmessages).', '.strtolower($L['Last_message']).' '.QTdate($row['lastdate'],$arrQTdate);
$oDB->Query( 'SELECT p.id,p.topic,p.forum FROM '.TABPOST.' p WHERE p.userid='.$id.' ORDER BY p.issuedate DESC' );
$row2 = $oDB->Getrow();
$strParticip .= ' <a class="small" href="qti_topic.php?s='.$row2['forum'].'&t='.$row2['topic'].'&tt=messages#p'.$row2['id'].'" title="'.$L['H_Goto_message'].'">'.$L['Goto_message'].'</a></span>';
}
// -- STAFF MENU --
if ( $oVIP->role=='A' )
{
echo '<form method="get" action="qti_cmd.php" id="modaction">
<div class="div_modboard">
<span class="span_modboard">',$L['Userrole']['A'],'
<select name="a" class="small" onchange="',"if (this.value!='') { document.getElementById('modaction').submit(); }",'">
<option value="">',S,'</option>
<option value="pwdreset">',$L['Reset_pwd'],'...</option>',
($id>1 ? '<option value="userrole">'.$L['Change_role'].'...</option>
<option value="user_ban">'.$L['Ban_user'].'...</option>
<option value="user_del">'.$L['User_del'].'...</option>
' :''),'
<input type="submit" name="Mok" value="',$L['Ok'],'" class="small" id="action_ok"/>
<input type="hidden" name="s" value="',$id,'"/>
<script type="text/javascript">document.getElementById("action_ok").style.visibility="hidden";document.getElementById("action_ok").value="";</script>
</span>
</div>
</form>
';
}
// -- DISPLAY PROFILE --
$strMail = S;
if ( !empty($row['mail']) )
{
$strMail = AsEmails($row['mail'],$id,'0','txt'.($_SESSION[QT]['javamail']=='1' ? 'java' : ''),false,$_SESSION[QT]['skin_dir'],$L['E_javamail']);
if ( $row['privacy']=='0' && $oVIP->role!='A' ) $strMail = S;
if ( $row['privacy']=='1' && $oVIP->role=='V' ) $strMail = S;
if ( $strMail!=S && ($oVIP->id==$id || $oVIP->role=='A' || $oVIP->role=='M') ) $strMail .= ' <span class="disabled">('.$L['Privacy_visible'][$row['privacy']].')</span>';
}
$strPhone = S;
if ( !empty($row['phone']) )
{
$strPhone = $row['phone'];
if ( $row['privacy']=='0' && $oVIP->role!='A' ) $strPhone = S;
if ( $row['privacy']=='1' && $oVIP->role=='V' ) $strPhone = S;
if ( $strPhone!=S && ($oVIP->id==$id || $oVIP->role=='A' || $oVIP->role=='M') ) $strPhone .= ' <span class="disabled">('.$L['Privacy_visible'][$row['privacy']].')</span>';
}
echo '
<table class="ta_hidden" cellspacing="0">
<colgroup span="2"><col width="175"></col><col></col></colgroup>
<tr class="tr_hidden">
<td class="td_hidden"><h2>',$oVIP->selfname,'</h2><br/>',AsImgBox(AsImg( (!empty($row['avatar']) ? 'avatar/'.$id.'.'.$row['avatar'] : ''),null,$row['name']),'div_pic_box',null,$row['name']),show_ban($oVIP->role,$row['closed']),'</td>
<td class="td_hidden">
';
echo '
<table class="ta ta_o" cellspacing="0">
<colgroup span="2"><col width="150"></col><col></col></colgroup>
<tr><th class="th_o th_o_first">',$L['Username'],'</th><td class="td_o"><b>',$row['name'],'</b>',($row['role']!='U' ? ' ('.$L['Userrole'][$row['role']].')' : ''),'</td></tr>
<tr><th class="th_o th_o_first">',$L['Location'],'</th><td class="td_o">',$row['location'],' </td></tr>
<tr><th class="th_o th_o_first">',$L['Email'],'</th><td class="td_o">',$strMail,'</td></tr>
<tr><th class="th_o th_o_first">',$L['Phone'],'</th><td class="td_o">',$strPhone,'</td></tr>
<tr><th class="th_o th_o_first">',$L['Website'],'</th><td class="td_o">',(empty($row['www']) ? S : '<a href="'.$row['www'].'" target="_blank">'.$row['www'].'</a>'),'</td></tr>
<tr><th class="th_o th_o_first">',$L['Joined'],'</th><td class="td_o">',QTdate($row['firstdate'],$arrQTdate),' </td></tr>
<tr><th class="th_o th_o_first">',$L['Topics'],'</th><td class="td_o">',$strParticip,'</td></tr>
';
if ( !$bEdit ) {
if ( $bMap ) {
if ( !empty($row['x']) && !empty($row['y']) ) {
$strPosition = '<div id="map_canvas" style="width:100%; height:340px;"></div>';
if ( $row['privacy']=='0' && $oVIP->role!='A' ) $strPosition = S;
if ( $row['privacy']=='1' && $oVIP->role=='V' ) $strPosition = S;
echo '<tr><th class="th_o th_o_first">',$L['map']['position'],'</th><td class="td_o">',$strPosition,'</td></tr>';
}}}
echo '</table>
';
echo '
</td>
</tr>
</table>
';
// -- EDIT PROFILE --
if ( $bEdit ) {
// -- EDIT PROFILE --
echo '
<div class="div_hidden_sep"></div>
';
echo '
<table class="ta_hidden" cellspacing="0">
<colgroup span="2"><col width="175"></col><col></col></colgroup>
<tr class="tr_hidden">
<td>
';
echo '<h2>',$L['User_upd'],'</h2>',N;
if ( $_SESSION[QT]['avatar']!='0' )
{
echo '<p><a href="qti_usr_img.php?id=',$id,'">',$L['Change_avatar'],'</a></p>',N;
}
echo '<p><a href="qti_usr_sign.php?id=',$id,'">',$L['Change_signature'],'</a></p>',N;
echo '<p><a href="qti_usr_pwd_chg.php?id=',$id,'">',$L['Change_password'],'</a></p>',N;
echo '</td>',N;
echo '<td>',N;
echo '
<form method="post" action="qti_usr.php?id=',$id,'">
<table class="ta ta_o" cellspacing="0">
<colgroup span="2"><col width="150"></col><col></col></colgroup>
<tr><th class="th_o th_o_first">',$L['Location'],'</th><td class="td_o"><input type="text" name="location" size="35" maxlength="24" value="',(empty($row['location']) ? '' : QTconv($row['location'],'I')),'"/></td></tr>
<tr><th class="th_o th_o_first">',$L['Email'],'</th><td class="td_o"><input type="text" name="mail" size="35" maxlength="64" value="',$row['mail'],'"/></td></tr>
<tr><th class="th_o th_o_first">',$L['Phone'],'</th><td class="td_o"><input type="text" name="phone" size="35" maxlength="64" value="',(empty($row['phone']) ? '' : QTconv($row['phone'],'I')),'"/></td></tr>
<tr>
<th class="th_o th_o_first">',$L['Privacy'],'</th>
<td class="td_o">',$L['Email'],'/',$L['Phone'],($bMap ? '/'.$L['map']['position'] : ''),' <select size="1" name="privacy">
<option value="0"',($row['privacy']=='0' ? QSEL : ''),'>',$L['Privacy_visible'][0],'</option>
<option value="1"',($row['privacy']=='1' ? QSEL : ''),'>',$L['Privacy_visible'][1],'</option>
<option value="2"',($row['privacy']=='2' ? QSEL : ''),'>',$L['Privacy_visible'][2],'</option>
</select></td>
</tr>
<tr>
<th class="th_o">',$L['Website'],'</th><td class="td_o"><input type="text" name="www" size="35" maxlength="64" value="',(!empty($row['www']) ? $row['www'] : 'http://'),'" title="',$L['H_Website'],'"/></td>
</tr>
';
if ( $oVIP->role=='A' )
{
if ( QTI_USE_COPPA )
{
echo '<tr>';
echo '<th class="th_o th_o_first">',$L['Child'],'</th>';
echo '<td class="td_o">';
echo '<select size="1" name="child">';
echo '<option value="0"',($row['children']=='0' ? QSEL : ''),'>',$L['N'],'</option>';
echo '<option value="1"',($row['children']=='1' ? QSEL : ''),'>',$L['Y'],' ',$L['With_parent_agree'],'</option>';
echo '<option value="2"',($row['children']=='2' ? QSEL : ''),'>',$L['Y'],' ',$L['Without_parent_agree'],'</option>';
echo '</select>';
echo '</td>';
echo '</tr>',N;
echo '<tr>';
echo '<th class="th_o th_o_first">',$L['Parent_mail'],'</th>';
echo '<td class="td_o"><input type="text" name="parentmail" size="32" maxlength="64" value="',$row['parentmail'],'"/></td>';
echo '</tr>',N;
}
}
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($row['x']) || !empty($row['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:345px;"></div>
<input type="hidden" id="m_map_gcenter" name="m_map_gcenter" value="'.(!empty($row['y']) ? $row['y'].','.$row['x'] : '').'"/>
';
$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>';
if ( $row['privacy']=='0' && $oVIP->role!='A' ) $strPosition = S;
if ( $row['privacy']=='1' && $oVIP->role=='V' ) $strPosition = S;
echo '<tr><th class="th_o th_o_first">',$L['map']['position'],'</th><td class="td_o">',$strPosition,'</td></tr>';
}
echo '<tr>
<th class="th_o th_o_first"><input type="hidden" name="id" value="',$id,'"/><input type="hidden" name="name" value="',$row['name'],'"/></th>
<td class="td_o"><input type="submit" name="ok" value="',$L['Save'],'"/>',( !empty($qti_error) ? ' <span class="error">'.$qti_error.'</span>' : '' ),'</td>
</tr>
</table>
</form>
';
echo '</td>
</tr>
</table>
';
// -- END EDIT PROFILE --
}
// -- END EDIT PROFILE --
// HTML END
if ( $bMap ) {
// center
if ( !empty($row['x']) && !empty($row['y']) )
{
$x = floatval($row['x']);
$y = floatval($row['y']);
$strUsername = QTconv($row['name'],'-4');
$oMapPoint = new cMapPoint($y,$x,$strUsername);
if ( isset($_SESSION[QT]['m_map']['U']['icon']) ) $oMapPoint->icon = $_SESSION[QT]['m_map']['U']['icon'];
if ( isset($_SESSION[QT]['m_map']['U']['shadow']) ) $oMapPoint->shadow = $_SESSION[QT]['m_map']['U']['shadow'];
if ( isset($_SESSION[QT]['m_map']['U']['printicon']) ) $oMapPoint->printicon = $_SESSION[QT]['m_map']['U']['printicon'];
if ( isset($_SESSION[QT]['m_map']['U']['printshadow']) ) $oMapPoint->printshadow = $_SESSION[QT]['m_map']['U']['printshadow'];
$arrMapPoints = array( $oMapPoint );
}
else
{
$x = QTgetx($_SESSION[QT]['m_map_gcenter']);
$y = QTgety($_SESSION[QT]['m_map_gcenter']);
$arrMapPoints = array();
}
if ( $bEdit )
{
$strFooterAddScript = QTgmappoints($L['map'],$y,$x,'drag',$arrMapPoints,true,false).N.'mapload();';
}
else
{
$strFooterAddScript = QTgmappoints($L['map'],$y,$x,'',$arrMapPoints,false,false).N.'mapload();';
}
}
include('qti_p_footer.php');
?>