Location: PHPKode > projects > QuickTalk Forum > quicktalk/bin/qtf_init.php
<?php

// QuickTalk 2.5.1 build:20101027

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

// -----------------
// System constants (CANNOT be changed by webmasters)
// -----------------
if ( !defined('PHP_VERSION_ID') ) { $version=explode('.',PHP_VERSION); define('PHP_VERSION_ID',($version[0]*10000+$version[1]*100+$version[2])); }
define('TABDOMAIN',$qtf_prefix.'qtadomain');
define('TABSECTION',$qtf_prefix.'qtaforum');
define('TABUSER',$qtf_prefix.'qtauser');
define('TABTOPIC',$qtf_prefix.'qtatopic');
define('TABPOST',$qtf_prefix.'qtapost');
define('TABSETTING',$qtf_prefix.'qtasetting');
define('TABLANG',$qtf_prefix.'qtalang');
define('QTFVERSION','2.5.1 build:20101027');
define('QSEL',' selected="selected"');
define('QCHE',' checked="checked"');
define('QDIS',' disabled="disabled"');
define('N',"\n");
define('S','&nbsp;');

// -----------------
// Interface constants (can be changed by webmasters)
// -----------------
define('QTF_CHANGE_USERNAME', false);// allow users to change their username (login). False = only administrators can change the username.
define('QTF_SHOW_CONTRAST', true);  // allow user to change contrast/normal mode
define('QTF_SHOW_FAQMENU',  false); // show faq in then menu on top
define('QTF_HOTTOPICS',     10);    // Number of replies to become hottopic. Use FALSE to disable hottopic icon
define('QTF_BACKBUTTON', '&nbsp;&laquo;&nbsp;'); // use FALSE to hide backbutton
define('QTF_DFLT_VIEWMODE', 'N');   // default view mode: N=normal view, C=compact view
define('QTF_SHOW_VIEWMODE', true);  // allow user to change view mode
define('QTF_SHOW_TIME',     true);  // show time in the bottom bar
define('QTF_SHOW_MODERATOR',true);  // show moderator in the bottom bar
define('QTF_SHOW_GOTOLIST', true);  // show gotolist in the bottom bar
define('QTF_CRUMBTRAIL', ' &middot; '); // crumbtrail separator (dont forget spaces)
define('QTF_MENUSEPARATOR', ' &middot; '); // bottom menu separator (dont forget spaces)
define('QTF_CONVERT_AMP',   false); // save &amp; instead of &. Use TRUE to make &#0000; symbols NOT working.
define('QTF_DIR_DOC', 'upload/');   // where to store uploaded files, if allowed, (with final '/')
define('QTF_DIR_PIC', 'avatar/');   // where to store avatar images, if allowed, (with final '/')
define('QTF_LIST_ME',       true);  // execute the 'i-replied' search in section list. Set False to improve speed.
define('QTF_LIST_TAG',      true);  // display a quick search link for the tags in section list.
define('QTF_JAVA_MAIL',     false); // Protect e-mail by a javascript
define('QTF_WEEKSTART', 1);         // Start of the week (use code 1=monday,...,7=sunday)
define('QTF_STAFFEDITSTAFF',true);  // Staff member can edit profile of other staff member
define('QTF_STAFFEDITADMIN',true);  // Staff member can edit profile of an administrator

define('QTF_URLREWRITE',false);
// URL rewriting (for expert only):
// Rewriting url requires that your server is configured with following rule for the application folder: RewriteRule ^(.+)\.html(.*) qtf_$1.php$2 [L]
// This can NOT be activated if you application folder contains html pages (they will not be accessible anymore when urlrewriting is acticated) 

// -----------------
// Class and function definition
// -----------------
require_once('bin/qt_lib_txt.php');
require_once('bin/qt_lib_db.php');
require_once('bin/qtf_class_vip.php');
require_once('bin/qtf_class_sec.php');
require_once('bin/qtf_class_topic.php');
require_once('bin/qtf_class_post.php');
require_once('bin/qtf_fn_base.php');
require_once('bin/qtf_fn_html.php');

// -----------------
//  Installation wizard (if file exists)
// -----------------
if ( !isset($qtf_install) )
{
  if ( file_exists('install/index.php') )
  {
  echo 'QuickTalk ',QTFVERSION,' <a href="install/index.php">starting installation</a>...';
  echo '<meta http-equiv="REFRESH" content="1;url=install/index.php">';
  exit;
  }
}
if ( empty($qtf_install) )
{
  if ( file_exists('install/index.php') )
  {
  echo 'QuickTalk ',QTFVERSION,' <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($qtf_dbsystem,$qtf_host,$qtf_database,$qtf_user,$qtf_pwd,$qtf_port,$qtf_dsn);
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 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']='english';
if ( empty($_SESSION[QT]['skin_dir']) ) $_SESSION[QT]['skin_dir']='skin/default';
if ( empty($_SESSION[QT]['language']) ) $_SESSION[QT]['language']='english';
if ( substr($_SESSION[QT]['skin_dir'],0,5)!='skin/' ) $_SESSION[QT]['skin_dir'] = 'skin/'.$_SESSION[QT]['skin_dir'];

// change language if required (by coockies or by the menu)

$str=GetIso();
if ( isset($_COOKIE[QT.'_cooklang']) ) $str=substr($_COOKIE[QT.'_cooklang'],0,2);
if ( isset($_GET['lx']) ) $str=substr($_GET['lx'],0,2);
if ( $str!=GetIso() && !empty($str) ) 
{
  include('bin/qtf_lang.php');
  if ( array_key_exists($str,$arrLang) )
  {
    $_SESSION[QT]['language'] = $arrLang[$str][2];
    if ( isset($_COOKIE[QT.'_cooklang']) ) setcookie(QT.'_cooklang', $str, time()+60*60*24*100, '/');
    // unset dictionnaries
    $_SESSION['L'] = array();
  }
  else
  {
    die('Wrong iso code language');
  }
}

// ----------------
// Initialiase variable
// ----------------
$error = ''; // Required when server uses register_global_on
$warning = ''; // Required when server uses register_global_on
$arrExtData = array(); // Can be used by extensions

if ( !isset($_SESSION[QT]['viewmode']) ) $_SESSION[QT]['viewmode']=QTF_DFLT_VIEWMODE;
if ( !isset($_SESSION[QT]['userlang']) ) $_SESSION[QT]['userlang']='1';

// ----------------
// Load dictionary
// ----------------
 
if ( !isset($_SESSION['L']) ) $_SESSION['L'] = array();

CheckDico('index domain sec secdesc');

include_once(GetLang().'qtf_main.php');
include_once(GetLang().'qtf_icon.php');

// ----------------
// Load section list & sys_states
// ----------------

// must be at the end because uses language
if ( !isset($_SESSION[QT]['sys_sections']) ) $_SESSION[QT]['sys_sections'] = QTarrget(GetSections($oVIP->role));
if ( !isset($_SESSION[QT]['sys_states']) ) $_SESSION[QT]['sys_states'] = $oVIP->SysCount('states');

// ----------------
// Coockie confirm
// ----------------

if ( $oVIP->coockieconfirm )
{
$oVIP->exitname = $L['Continue'];
$oVIP->EndMessage(NULL,'<h2>'.$L['Welcome'].' '.$oVIP->username.'</h2><p><a href="qtf_login.php?a=out">'.sprintf($L['Welcome_not'],$oVIP->username).'</a></p><br/>',$_SESSION[QT]['skin_dir'],0,'350px','login_header','login');
}

// -----------------
//  Time setting (for PHP >=5.2)
// -----------------

if ( PHP_VERSION_ID>=50200 ) {
if ( isset($_SESSION[QT]['defaulttimezone']) ) {
if ( $_SESSION[QT]['defaulttimezone']!=='' ) {

date_default_timezone_set($_SESSION[QT]['defaulttimezone']);

}}}

?>
Return current item: QuickTalk Forum