Location: PHPKode > projects > QuickTicket > quickticket/qti_user_sign.php
<?php

/**
* PHP versions 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    QuickTicket
* @author     Philippe Vandenberghe <hide@address.com>
* @copyright  2008-2012 The PHP Group
* @version    2.5 build:20101222
*/

session_start();
require_once('bin/qti_init.php');
if ( !$oVIP->CanView('U',true) ) die(Error(11));

// INITIALISE

include(GetLang().'qti_reg.php');

$id = -1; QThttpvar('id','int'); if ( $id<0 ) die('Missing parameters');

if ( $oVIP->id!=$id && !$oVIP->IsStaff() ) die(Error(11));

$oVIP->selfurl = 'qti_user_sign.php';
$oVIP->selfname = $L['Change_signature'];
$oVIP->exiturl = 'qti_user.php?id='.$id;
$oVIP->exitname = $L['Profile'];

// --------
// SUBMITTED
// --------

if ( isset($_POST['ok']) )
{
  // check values
  $str = trim($_POST['text']); if ( get_magic_quotes_gpc() ) $str = stripslashes($str);
  $str = substr( QTconv($str,'3',QTI_CONVERT_AMP),0,255 );

  // update domain
  if ( empty($error) )
  {
    $oDB->Query('UPDATE '.TABUSER.' SET signature="'.addslashes($str).'" WHERE id='.$id);
    // exit
    $oVIP->exiturl = 'qti_user.php?id='.$id;
    $oVIP->EndMessage(NULL,$L['S_update'],$_SESSION[QT]['skin_dir'],2);
  }
}

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

if ( $_SESSION[QT]['bbc']=='1' )
{
  $oHtml->scripts[] = '<script type="text/javascript" src="bin/qti_bbc.js"></script>';
  $oHtml->links[] = '<link rel="stylesheet" type="text/css" href="bin/css/qti_bbc.css" />';
}
else
{
  $oHtml->scripts = array();
}

include('qti_p_header.php');

$oDB->Query( 'SELECT signature,name,photo,role FROM '.TABUSER.' WHERE id='.$id );
$row = $oDB->Getrow();

  // staff cannot edit other staff
  if ( $row['role']=='M' && $oVIP->role=='M' && $oVIP->id!=$id ) die(Error(13));

if ( !is_string($row['signature']) ) $row['signature']='';

$strSign = QTbbc($row['signature']);
if ( empty($strSign) ) $strSign=S;

echo '
<table class="hidden" cellspacing="0">
<colgroup span="2"><col width="175"></col><col></col></colgroup>
<tr class="hidden">
<td class="hidden"><br />',AsImgBox(AsImg( AsAvatarScr($row['photo']),'',$row['name'],'member'),'picbox','',$row['name']),'</td>
<td class="hidden">
';

// SIGNATURE

echo '
<h2>',$L['Signature'],'</h2>
<table class="data_o" cellspacing="0">
<tr class="data_o">
<td class="colct">',$strSign,'</td>
</tr>
</table>
<p>',$L['H_no_signature'],'</p>
';

// NEW SIGNATURE

echo '
<h2>',$oVIP->selfname,'</h2>
<form method="post" action="',Href(),'">
<table class="data_o" cellspacing="0">
<tr class="data_o">
<td class="colct">
';
    echo '<table class="hidden" cellspacing="0">',N;
    if ( $_SESSION[QT]['bbc']=='1' )
    {
    echo '<tr class="hidden">',N;
    echo '<td style="height:22px"><ul class="bbc">',N;
    $intBbc=3; include('qti_form_button.php');
    echo '</ul></td>',N;
    echo '</tr>',N;
    }
    echo '<tr class="hidden">',N;
    echo '<td class="hidden">',N;
    echo '<a href="textarea"></a><textarea id="text" name="text" rows="5" cols="75">',$row['signature'],'</textarea>',N;
    echo '</td>',N;
    echo '</tr>',N;
    echo '</table>',N;

echo '</td>
</tr>
<tr class="data_o">
<td class="colct">
<input type="hidden" name="id" value="',$id,'" />
<input type="submit" name="ok" value="',$L['Save'],'" />',( !empty($error) ? ' <span class="error">'.$error.'</span>' : ''),'</td>
</tr>
</table>
</form>
<p><a href="',Href($oVIP->exiturl),'">&laquo; ',$L['Profile'],'</a></p>
';

echo '
</td>
</tr>
</table>
';

// HTML END

include('qti_p_footer.php');

?>
Return current item: QuickTicket