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

/*
 * PHP versions 4 and 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.
 *
 * @category   Troubleticket
 * @package    QuickTicket
 * @author     Philippe Vandenberghe <hide@address.com>
 * @copyright  2008-2012 The PHP Group
 * @license    http://www.php.net/license  PHP License 3.0
 * @version    1.9.0.3 build:20081001
 * @link       http://www.qt-cute.org/doc/package/qti
 * @since      File available since Release 1.0.0
 * @deprecated File deprecated in Release 2.0.0
 *
 */

session_start();
require_once('bin/qti_init.php');
include(Translate('qti_lang_adm.inc'));

if ( $oVIP->role!='A' ) die($L['E_admin']);

// INITIALISE

$oVIP->selfurl = 'qti_adm_index.php';
$oVIP->selfname = $L['Adm_status'];

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

if ( isset($_POST['ok']) )
{
  // check admin email and forum url
  if ( !QTismail($_SESSION[QT]['admin_email'],false) ) $qti_error='Error';
  if ( strlen($_SESSION[QT]['site_url'])<8 ) $qti_error='Error';
  if ( !empty($qti_error) )
  {
    $strFile=$_SESSION[QT]['language'].'/sys_online_error.php';
    if ( file_exists($strFile) ) { $strMsg = include($strFile); } else { $strMsg = '<p>Missing admin e-mail or forum url...</p>'.N; }
    $oVIP->exiturl = 'qti_adm_site.php';
    $oVIP->exitname = $L['Adm_general'];
    $oVIP->EndMessage(NULL,$strMsg,'admin',0);
  }

  $str = '-1';
  if ( isset($_POST['offline']) ) $str = strip_tags($_POST['offline']);
  if ( $str=='1' || $str=='0' )
  {
  $oDB->Query('UPDATE '.TABSETTING.' SET setting="'.$_POST['offline'].'" WHERE param="board_offline"');
  $_SESSION[QT]['board_offline'] = $_POST['offline'];
  }

  $strInfo = $L['S_save'];
}

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

$arrJava = array('com'=>false);

include('qti_adm_p_header.php');
include('qti_adm_p_title.php');

// BOARD OFFLINE

echo '<h2>',$oVIP->selfname,'</h2>
<table class="ta" cellspacing="0">
<tr class="tr tr_o">
<th class="th_o th_o_first" style="width:200px;"><span class="txt_head">',$L['Adm_status'],'</span></th>
';
if ( $_SESSION[QT]['board_offline']=='0' )
{
  echo '<td class="td_o">&nbsp;</td>';
  echo '<td class="td_o" style="text-align:center; background-color:#AAFFAA"><b>',$L['On_line'],'</b></td>';
}
else
{
  echo '<td class="td_o">&nbsp;</td>';
  echo '<td class="td_o" style="text-align:center; background-color:#FFAAAA"><b>',$L['Off_line'],'</b></td>';
}
echo '<td class="td_o" style="text-align:right">
<form method="post" action="',$oVIP->selfurl,'">',$L['Change'],S,'<select id="offline" name="offline">
<option value="0"',($_SESSION[QT]['board_offline']=='0' ? QSEL : ''),'>',$L['On_line'],'</option>
<option value="1"',($_SESSION[QT]['board_offline']=='1' ? QSEL : ''),'>',$L['Off_line'],'</option>
</select>&nbsp;<input type="submit" name="ok" value="',$L['Save'],'"/></form>
</td>
</tr>
</table>',N,N;

// STATS

echo '<h2>',$L['Info'],'</h2>',N;

$oDB->Query('SELECT count(id) as countid FROM '.TABDOMAIN);
$row = $oDB->Getrow();
$intDomain = $row['countid'];

$oDB->Query('SELECT count(id) as countid FROM '.TABSECTION);
$row = $oDB->Getrow();
$intSection = $row['countid'];

$oDB->Query('SELECT count(id) as countid FROM '.TABSECTION.' WHERE type="1"');
$row = $oDB->Getrow();
$intHidden = $row['countid'];

$oDB->Query('SELECT count(id) as countid FROM '.TABPOST);
$row = $oDB->Getrow();
$intPost = $row['countid'];

$strStartdate = S;
if ( $intPost>0 )
{
  $oDB->Query('SELECT min(firstpostdate) as firsttopic FROM '.TABTOPIC.' WHERE firstpostdate<>"0"');
  if ( $row = $oDB->Getrow() )
  {
    if ( isset($row['firsttopic']) ) $strStartdate = QTdate($row['firsttopic'],$arrQTdate);
  }
}

echo '<table class="ta" cellspacing="0">
';
echo '<tr class="tr tr_o">
<th class="th_o th_o_first" style="width:200px;"><span class="txt_head">',$L['Domains'],'/',$L['Sections'],'</span></th>
<td class="td_o">',LangS('Domain',$intDomain),', ',LangS('Section',$intSection),' <span class="small">(',$intHidden,S,$L['Hidden'],')</span>, <a href="qti_stats.php">',$L['Adm_stats'],'</a></td>
</tr>
';
echo '<tr class="tr tr_o">
<th class="th_o th_o_first" style="width:200px;"><span class="txt_head">',$L['Board_start_date'],'</span></th>
<td class="td_o">',$strStartdate,'</td>
</tr>
';

$oDB->Query('SELECT count(id) as countid FROM '.TABUSER);
$row = $oDB->Getrow();
$intUser = $row['countid'];
$oDB->Query('SELECT count(id) as countid FROM '.TABUSER.' WHERE role="A"');
$row = $oDB->Getrow();
$intAdmin = $row['countid'];
$oDB->Query('SELECT count(id) as countid FROM '.TABUSER.' WHERE role="M"');
$row = $oDB->Getrow();
$intMod = $row['countid'];

echo '<tr class="tr tr_o">
<th class="th_o th_o_first"><span class="txt_head">',$L['Users'],'</span></th>
<td class="td_o">',LangS('User',$intUser),' <span class="small">(',LangS('Userrole,A',$intAdmin),', ',LangS('Userrole,M',$intMod),')</span></td>
</tr>
';

// ticket

$oDB->Query('SELECT count(id) as countid FROM '.TABTOPIC);
$row = $oDB->Getrow();
$intTopic = $row['countid'];
$oDB->Query('SELECT count(id) as countid FROM '.TABPOST.' WHERE type<>"P"');
$row = $oDB->Getrow();
$intReply = $row['countid'];

echo '<tr class="tr tr_o">
<th class="th_o th_o_first"><span class="txt_head">',$L['Topics'],'</span></th>
<td class="td_o">',LangS('Topic',$intTopic),' <span class="small">(',LangS('Reply',$intReply),')</span></td>
</tr>
';

if ( $oDB->type=='mysql' )
{
  $oDB->Query('show table status from '.$oDB->db);
  $intSize = 0;
  $tables = array(TABSETTING,TABDOMAIN,TABSECTION,TABTOPIC,TABPOST,TABUSER,TABLANG);
  while($row = $oDB->Getrow())
  {
    if ( in_array($row['Name'],$tables) )
    {
    $intSize += $row['Data_length'];
    }
  }
  echo '<tr class="tr tr_o">
  <th class="th_o th_o_first"><span class="txt_head">',$L['Db_disk_space'],'</span></th>
  <td class="td_o">',round(($intSize/1024), 0),' Kb</td></tr>';
}

// db version
echo '<tr class="tr tr_o">
<th class="th_o th_o_first"><span class="txt_head">',$L['Version'],'</span></th>
<td class="td_o">',QTIVERSION,', <span class="small">database ',$_SESSION[QT]['version'],', sid ',QT,'</span></td>
</tr>
';

echo '</table>
';

// PUBLIC ACCESS LEVEL

echo '
<h2>',$L['Public_access_level'],'</h2>
<table class="ta" cellspacing="0">
<tr class="tr tr_o">
<th class="th_o th_o_first" style="width:200px; text-align:right; height:25px"><span class="texthead">',$L['Visitors_can'],'</span></th>
<td class="td_o">',$L['Pal'][$_SESSION[QT]['visitor_right']],'</td>
<td class="td_o" style="text-align:right"><a href="qti_adm_secu.php">',$L['Change'],'</a></span></td>
</tr>
</table>
';

// HTML END

include('qti_adm_p_footer.php');

?>
Return current item: QuickTicket