Location: PHPKode > projects > Quick Guestbook > quicktalk/bin/qtg_init.php
<?php

// QuickTalk 2.5 build:20100805

// -----------------
// Connexion config
// -----------------
require_once('bin/config.php');
if ( isset($qtg_install) ) { define('QT','qtg'.substr($qtg_install,-1)); } else { define('QT','qtg'); }

// -----------------
// Settings config
// -----------------
require_once('bin/config_display.php');
if ( isset($qtg_formatdate) ) { $_SESSION[QT]['formatdate']=$qtg_formatdate; } else { $_SESSION[QT]['formatdate']='j-M-Y'; }
if ( isset($qtg_formattime) ) { $_SESSION[QT]['formattime']=$qtg_formattime; } else { $_SESSION[QT]['formattime']='G:i'; }
if ( !isset($_SESSION[QT]['language']) ) $_SESSION[QT]['language']=$qtg_language;
if ( !isset($qtg_type) ) $qtg_type='1';

require_once('bin/config_stop.php');
require_once('bin/config_map.php');

if ( substr($qtg_skin,0,5)!='skin/' ) $qtg_skin = 'skin/'.$qtg_skin;

// -----------------
// System constants (this CANNOT be changed by webmasters)
// -----------------
define('TABMESSAGE', $qtg_prefix.'qtgmessage');
define('QTGVERSION', '2.5 build:20100805');
define('QSEL', ' selected="selected"');
define('QCHE', ' checked="checked"');
define('N', "\n");

// -----------------
// Function constants (this can be changed by webmasters)
// -----------------
define('QT_SHOW_CONTRAST',true); // Show contrast button in upper right corner
define('QT_MENUSEPARATOR', ' | '); // Menu separator is used in the footer (don't forget spaces).
define('QT_MAILSEPARATOR', '&nbsp;'); // In the message display, when email is allowed, use this separator between the name and the email icon. Use space (or <br/> to get the icon on the next line) 
define('QT_CONVERT_AMP', FALSE); // Convert & to &amp; before saving in the db. TRUE will make impossible to insert symbols or special characters (like &#nnnn;)
define('QT_NOTIFYAFTER', 50); // Monthly notification. One notification is send when the (n)th messages is recieved. No message will be send if less than n messages are inserted during the month.

define('QT_SMARTCUT', 4);
// Smartcut is a tolerance value (0-9) while truncating long messages.
// Value 0 will truncate at the exact specified length.
// Value N>0 will truncate with following advantages:
// * truncate can preverse up to N characters if the total length is within this tolerance.
// * truncate will take place after the characters ,;:.)]}!? when these characters are just on the truncate position.
// Ex: If you decide to tuncate message after 200 characters, with smartcut of 4;
//     the function will try to preserve the last word or the last punctuation character, and
//     the total length can be 204 characters maximum.  

define('QTG_URLREWRITE',false);
// URL rewriting (for expert only):
// Rewriting url requires that your server is configured with following rule for the application folder: RewriteRule ^(.+)\.html(.*) qtg_$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) 
   
// -----------------
// Classes and functions
// -----------------
require_once('bin/qt_lib_db.php');
require_once('bin/qt_lib_txt.php');
require_once('bin/qtg_class_post.php');
require_once('bin/qtg_fn_base.php');

// -----------------
//  Installation wizard (if file exists)
// -----------------
if ( !isset($qtg_install) ) $qtg_install='';
if ( empty($qtg_install) )
{
  if ( file_exists('install/index.php') )
  {
  echo '
  <p>QuickTalk ',QTGVERSION,' <a id="exiturl" href="install/index.php">starting installation or upgrade</a>...</p>
  <script type="text/javascript">
  <!--
  setTimeout(\'window.location=document.getElementById("exiturl").href\',0);
  -->
  </script>
  ';
  exit;
  }
}

// CHECK SETTING

foreach(array('qtg_dbsystem','qtg_host','qtg_database','qtg_prefix','qtg_port','qtg_dsn','qtg_user','qtg_pwd','qtg_user_2','qtg_pwd_2') as $Variable)
{
if ( !isset($$Variable) ) echo $Variable.' not defined check the file bin/config.php...';
}
if ( empty($qtg_dbsystem) ) die ('wrong qtg_dbsystem in file bin/config.php');
if ( !QTisbetween($qtg_page_size,1,100) )   { echo 'posts_per_page invalid (1-100)'; $qtg_page_size=10; }
if ( !isset($qtg_menulang) ) $qtg_menulang=false;

// LANGUAGE if required (by coockies or by the menu)

$str=GetIso($_SESSION[QT]['language']);
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($_SESSION[QT]['language']) && !empty($str) ) 
{
  require_once('bin/qtg_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, '/');
  }
  else
  {
    $error = 'Wrong iso code language';
  }
}

// ----------------
// INITIALIASE Classes and Variable
// ----------------

if ( $qtg_dbsystem=='file' )
{
  require_once('bin/qtg_class_dt.php');
  $oDB = new cDT($qtg_host);
}
else
{
  $oDB = new cDB($qtg_dbsystem,$qtg_host,$qtg_database,$qtg_user,$qtg_pwd,$qtg_port,$qtg_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>');

// if using class DT (data text)

$error = ''; // Required when server uses register_global_on
include(GetLang().'qtg_main.php');
$qtg_bbctags = array('B'=>$qtg_bbc_bold,'I'=>$qtg_bbc_italic,'U'=>$qtg_bbc_underline,'A'=>$qtg_bbc_url,'S'=>$qtg_bbc_smiley); // allowed tags
$qtg_back='<div class="backbutton"><span class="backbutton"><a id="exiturl" class="backbutton" href="'.Href().'">'.$L['Return'.$qtg_type].'</a></span></div>';

$arrExtData = array(); // Can be used by extensions
$arrCss = array();
$strLangMenu = '';
$bAdm = false;

?>
Return current item: Quick Guestbook