Location: PHPKode > projects > QuickTicket > quickticket/qti_adm_domain.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->role!='A' ) die(Error(13));
require_once('bin/qti_class_dom.php');
include(Translate('qti_adm.php'));

// INITIALISE

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

$oDOM = new cDomain($d);

$oVIP->selfurl = 'qti_adm_domain.php';
$oVIP->selfname = '<span class="upper">'.$L['Adm_content'].'</span><br />'.$L['Domain_upd'];
$oVIP->exiturl = 'qti_adm_sections.php';
$oVIP->exitname = '&laquo; '.$L['Sections'];

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

if ( isset($_POST['ok']) )
{
  $str = trim($_POST['title']); if ( get_magic_quotes_gpc() ) $str = stripslashes($str);
  $str = QTconv($str,'3',QTI_CONVERT_AMP,false);
  if ( $str=='' ) $error = $L['Title'].' '.$L['E_invalid'];

  // Save

  if ( empty($error) )
  {
    $oDOM->Rename($str);

    $oVIP->LangDel('domain','d'.$d);    
    foreach($_POST as $strKey=>$strTranslation)
    {
      if ( substr($strKey,0,1)=='T' )
      {
        $strTranslation = trim($strTranslation);
        if ( !empty($strTranslation) )
        {
        if ( get_magic_quotes_gpc() ) $strTranslation = stripslashes($strTranslation);
        $oVIP->LangAdd('domain', substr($strKey,1), 'd'.$d, addslashes(QTconv($strTranslation,'5')));
        }
      }
    }
    Unset($_SESSION['L']['domain']);

    // Exit
    
    $oVIP->EndMessage('0');
  }
}

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

include('qti_adm_p_header.php');

echo '
<script type="text/javascript">
<!--
function ValidateForm(theForm)
{
  if (theForm.title.value.length<1) { alert(qtHtmldecode("',$L['Missing'],': ',$L['Title'],'")); return false; }
  return null;
}
-->
</script>
';

echo '
<form method="post" action="',$oVIP->selfurl,'" onsubmit="return ValidateForm(this);">
<table class="data_o" width="500" cellspacing="0">
';
$str = QTconv($oDOM->title,'I');
echo '<tr class="data_o">
<td class="colhd colhdfirst" style="width:100px;"><label for="title">',$L['Title'],'</label></td>
<td class="colct"><input type="text" id="title" name="title" size="32" maxlength="64" value="',$str,'" onchange="bEdited=true;" />',(strstr($str,'&amp;') ?  ' <span class="small">'.$oDOM->title.'</span>' : ''),'</td>
</tr>
';
echo '<tr class="data_o">
<td class="colhd colhdfirst">',$L['Translations'],'</td>
<td class="colct" colspan="2">
<p class="help">',sprintf($L['E_no_translation'],$oDOM->title),'</p>
<table class="hidden" cellspacing="0">';
$arrTrans = cVIP::LangGet('domain','*','d'.$d);
include('bin/qti_lang.php'); // this creates $arrLang
foreach($arrLang as $strIso=>$arr)
{
  $str = '';
  if ( isset($arrTrans[$strIso]) ) {
  if ( !empty($arrTrans[$strIso]) ) {
    $str = QTconv($arrTrans[$strIso],'I');
  }}
  echo '
  <tr class="hidden">
  <td class="hidden" style="width:30px"><span title="',$arr[1],'">',$arr[0],'</span></td>
  <td class="hidden"><input class="small" title="',$L['Domain'],' (',$strIso,')" type="text" id="T',$strIso,'" name="T',$strIso,'" size="32" maxlength="64" value="',$str,'" onchange="bEdited=true;" />',(strstr($str,'&amp;') ?  ' <span class="small">'.$arrTrans[$strIso].'</span>' : ''),'</td>
  </tr>
  ';
}
echo '</table>
</td>
</tr>
';
echo '<tr class="data_o">
<td class="colhd colhdfirst">&nbsp;</td>
<td class="colct"><input type="submit" id="ok" name="ok" value="',$L['Save'],'" /><input type="hidden" name="d" value="',$d,'" /></td>
</tr>
';
echo '</table>
</form>
<p><a href="',$oVIP->exiturl,'">',$oVIP->exitname,'</a></p>
';

// HTML END

include('qti_adm_p_footer.php');

?>
Return current item: QuickTicket