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

// QuickTicket 1.9.0.3 build:20081001

// -----------------
// Connection config
// -----------------
require_once('bin/config.php');
if ( isset($qti_install) ) { define('QT','qti'.substr($qti_install,-1)); } else { define('QT','qti'); }

// -----------------
// System constants (this CANNOT be changed by webmasters)
// -----------------
define('TABDOMAIN', $qti_prefix.'qtidomain');
define('TABSECTION', $qti_prefix.'qtiforum');
define('TABUSER', $qti_prefix.'qtiuser');
define('TABTOPIC', $qti_prefix.'qtitopic');
define('TABPOST', $qti_prefix.'qtipost');
define('TABSTATUS', $qti_prefix.'qtistatus');
define('TABSETTING', $qti_prefix.'qtisetting');
define('TABLANG', $qti_prefix.'qtilang');
define('QTIVERSION', '1.9.0.3 build:20081001');
define('QSEL', ' selected="selected"');
define('QCHE', ' checked="checked"');
define('QDIS', ' disabled="disabled"');
define('N', "\n");
define('S', '&nbsp;');

// -----------------
// Interface constants (this can be changed by webmasters)
// -----------------
define('QTI_BACKBUTTON', '&nbsp;&laquo;&nbsp;');  // use FALSE to hide backbutton
define('QTI_DFLT_VIEWMODE',   'N');   // default view mode: N=normal view, C=compact view
define('QTI_SHOW_VIEWMODE',   true);  // allow user to change view mode
define('QTI_SHOW_FAQMENU',    false); // show faq in then menu on top
define('QTI_SHOW_PRINT',      true);  // allow user to get a print style
define('QTI_SHOW_TIME',       true);  // show time in the bottom bar
define('QTI_SHOW_MEMBERLIST', true);  // show memberlist in the menu
define('QTI_SHOW_MODERATOR',  true);  // show moderator in the bottom bar
define('QTI_SHOW_GOTOLIST',   true);  // show gotolist in the bottom bar
define('QTI_SHOW_DOMAIN',     false); // show domain + section name in the crumb trail bar
define('QTI_USE_COPPA',       false); // apply coppa registration rule (child protection act)
define('QTI_CRUMBTRAIL',' &middot; ');// crumbtrail separator (dont forget spaces)
define('QTI_MENUSEPARATOR', ' &middot; '); // bottom menu separator (dont forget spaces)
define('QTI_JAVADATE','yyyy-MM-dd');  // date format of the java calendarpopup (! database MySQL support only YYYY-MM-DD)
define('QTI_NOTIFY_NEWACTOR', true);  // notify new actor when topic actor changes (this option is applicable only in sections having notification activated!)
define('QTI_NOTIFY_OLDACTOR', true);  // notify old actor when topic actor changes (this option is applicable only in sections having notification activated!)
define('QTI_CONVERT_AMP',     false); // save &amp; instead of &. Use TRUE to make &#0000; symbols NOT working.
define('QTI_CHILDREN',        13);    // end children age
define('QTI_SIMPLESEARCH',    true);  // simple search by default (use false to directly search as advanced)
define('QTI_DOC_FOLDER', 'upload/');  // where to store uploaded files, if allowed, (with final '/')

// -----------------
// Class and function definition
// -----------------
require_once('bin/qt_lib_db.php');
require_once('bin/qt_lib_txt.php');
require_once('bin/qt_lib_url.php');
require_once('bin/qti_class_vip.php');
require_once('bin/qti_class_section.php');
require_once('bin/qti_class_topic.php');
require_once('bin/qti_class_post.php');
require_once('bin/qti_class_status.php');
require_once('bin/qti_class_lang.php');
require_once('bin/qti_fn_common.php');
require_once('bin/qti_fn_html.php');

// -----------------
//  Installation wizard (if file exists)
// -----------------
if ( !isset($qti_install) )
{
  if ( file_exists('install/index.php') )
  {
  echo 'QuickTicket ',QTIVERSION,' <a href="install/index.php">starting installation</a>...';
  echo '<meta http-equiv="REFRESH" content="1;url=install/index.php">';
  exit;
  }
}
if ( empty($qti_install) )
{
  if ( file_exists('install/index.php') )
  {
  echo 'QuickTicket ',QTIVERSION,' <a href="install/index.php">starting installation</a>...';
  echo '<meta http-equiv="REFRESH" content="1;url=install/index.php">';
  exit;
  }
}

// ----------------
// Initialise Classes
// ----------------
$oDB = new cDB($qti_dbsystem,$qti_host,$qti_database,$qti_user,$qti_pwd,$qti_port,$qti_dsn); if ($oDB===FALSE) Exit;
if ( !empty($oDB->error) ) die ('<p><font color="red">Connection with database failed.<br/>Please contact the webmaster for further information.</font></p><p>The webmaster must check that server is up and running, and that the settings in the config file are correct for the database.</p>');
$oVIP = new cVIP();

// ----------------
// Load system parameters (attention some parameters can be reserved, thus not loaded)
// ----------------
if ( !isset($_SESSION[QT]) ) GetParam(true);

  // check major parameters
  if ( !isset($_SESSION[QT]['skin_dir']) ) $_SESSION[QT]['skin_dir']='skin/default';
  if ( !isset($_SESSION[QT]['language']) ) $_SESSION[QT]['language']='language/english';
  if ( !isset($_SESSION[QT]['lang_iso']) ) $_SESSION[QT]['lang_iso']='en';
  if ( empty($_SESSION[QT]['skin_dir']) ) $_SESSION[QT]['skin_dir']='skin/default';
  if ( empty($_SESSION[QT]['language']) ) $_SESSION[QT]['language']='language/english';
  if ( empty($_SESSION[QT]['lang_iso']) ) $_SESSION[QT]['lang_iso']='en';
  if ( substr($_SESSION[QT]['skin_dir'],0,5)!='skin/' ) $_SESSION[QT]['skin_dir'] = 'skin/'.$_SESSION[QT]['skin_dir'];
  if ( substr($_SESSION[QT]['language'],0,9)!='language/' ) $_SESSION[QT]['language'] = 'language/'.$_SESSION[QT]['language'];

if ( isset($_GET['lx']) )
{
  // check that value is valid (to avoid injection)
  require_once('bin/qti_lang.php');
  if ( array_key_exists($_GET['lx'],$arrLang) )
  {
    $_SESSION[QT]['lx'] = $arrLang[$_GET['lx']][2];
    $_SESSION[QT]['lang_iso'] = $_GET['lx'];
    if ( isset($_SESSION['L']) ) $_SESSION['L'] = array();
    if ( isset($_SESSION['qtiDomains']) ) unset($_SESSION['qtiDomains']);
    if ( isset($_SESSION['qtiGoto']) ) unset($_SESSION['qtiGoto']);
    if ( isset($_SESSION['qtiTstatus']) ) unset($_SESSION['qtiTstatus']);
  }
  else
  {
    $qti_error = 'Wrong iso code language';
  }
}
if ( isset($_SESSION[QT]['lx']) ) $_SESSION[QT]['language'] = 'language/'.$_SESSION[QT]['lx'];

if ( !isset($_SESSION['qtiDomains']) ) $_SESSION['qtiDomains'] = GetDomains();
if ( !isset($_SESSION['qtiGoto']) ) $_SESSION['qtiGoto'] = GetSectionTitles($oVIP->role,-1,-1,'',QTI_SHOW_DOMAIN);

// ----------------
// Initialise variable
// ----------------

$qti_error = ''; // Required when server uses register_global_on
$qti_warning = ''; // Required when server uses register_global_on


if ( !isset($_SESSION[QT]['viewmode']) ) $_SESSION[QT]['viewmode']=QTI_DFLT_VIEWMODE;
if ( !isset($_SESSION[QT]['javamail']) ) $_SESSION[QT]['javamail']='0';
if ( !isset($_SESSION[QT]['userlang']) ) $_SESSION[QT]['userlang']='1';
if ( !isset($_SESSION[QT]['lastcolumn']) ) $_SESSION[QT]['lastcolumn']='';
if ( !isset($_SESSION[QT]['cal_shownews']) ) $_SESSION[QT]['cal_shownews']=FALSE;
if ( !isset($_SESSION[QT]['cal_showall']) ) $_SESSION[QT]['cal_showall']=FALSE;
if ( !isset($_SESSION[QT]['sys_topics']) ) SysStats('t');
if ( !isset($_SESSION[QT]['sys_messages']) ) SysStats('p');
if ( !isset($_SESSION[QT]['sys_members']) ) SysStats('u');
if ( !isset($_SESSION[QT]['sys_newuserid']) || !isset($_SESSION[QT]['sys_newusername']) ) SysStats('n');
if ( !isset($_SESSION[QT]['sys_notifysections']) ) SysStats('notifysections');

// ----------------
// Load dictionary
// ----------------

include_once($_SESSION[QT]['language'].'/qti_lang_main.inc');
include_once($_SESSION[QT]['language'].'/qti_lang_icon.inc');

$arrQTdate = array('n','todaytodaytime',$_SESSION[QT]['formatdate'],$_SESSION[QT]['formattime'],$L['dateSQL']);

if ( !isset($_SESSION['L']['index']) ) $_SESSION['L']['index'] = cLang::GetName('index',$_SESSION[QT]['lang_iso'],'*');
if ( !isset($_SESSION['L']['domain']) ) $_SESSION['L']['domain'] = cLang::GetName('domain',$_SESSION[QT]['lang_iso'],'*');
if ( !isset($_SESSION['L']['sec']) ) $_SESSION['L']['sec'] = cLang::GetName('sec',$_SESSION[QT]['lang_iso'],'*');
if ( !isset($_SESSION['L']['secdesc']) ) $_SESSION['L']['secdesc'] = cLang::GetName('secdesc',$_SESSION[QT]['lang_iso'],'*');

// ----------------
// Load status
// ----------------

if ( !isset($_SESSION['qtiTstatus']) ) $_SESSION['qtiTstatus'] = cStatus::GetStatus('*');
if ( !isset($_SESSION['qtiTtypes']) )
{
   $_SESSION['qtiTtypes'] = array();
   $_SESSION['qtiTtypes']['T'] = array('name'=>$L['Topic'],'color'=>'');
   $_SESSION['qtiTtypes']['A'] = array('name'=>$L['News'],'color'=>'');
}
?>
Return current item: QuickTicket