Location: PHPKode > projects > QuickTicket > quickticket/qti_adm_index.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');
include(Translate('qti_adm.php'));

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

// INITIALISE

$oVIP->selfurl = 'qti_adm_index.php';
$oVIP->selfname = '<span class="upper">'.$L['Adm_info'].'</span><br />'.$L['Adm_status'];

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

if ( isset($_POST['ok']) )
{
  // check admin email and forum url
  if ( !QTismail($_SESSION[QT]['admin_email']) ) $error='Error';
  if ( strlen($_SESSION[QT]['site_url'])<8 ) $error='Error';
  if ( !empty($error) )
  {
    $strFile=GetLang().'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);
  }

  if ( isset($_POST['offline']) ) {
  if ( $_POST['offline']=='1' || $_POST['offline']=='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
// --------

include('qti_adm_p_header.php');

// BOARD OFFLINE

echo '<h2>',$L['Adm_status'],'</h2>
<table class="data_o" cellspacing="0">
<tr class="data_o">
<td class="colhd colhdfirst" style="width:200px;"><span class="txt_head">',$L['Adm_status'],'</span></td>
';
if ( $_SESSION[QT]['board_offline']=='0' )
{
  echo '<td class="colct center" style="background-color:#AAFFAA"><b>',$L['On_line'],'</b></td>';
}
else
{
  echo '<td class="colct center" style="background-color:#FFAAAA"><b>',$L['Off_line'],'</b></td>';
}
echo '<td class="colct" style="text-align:right">
<form method="post" action="',$oVIP->selfurl,'">',$L['Change'],'&nbsp;<select id="offline" name="offline" onchange="bEdited=true;">
<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>
';

// 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 = QTdatestr($row['firsttopic']);
  }
}

echo '<table class="data_o" cellspacing="0">
';
echo '<tr class="data_o">
<td class="colhd colhdfirst" style="width:200px;"><span class="txt_head">',$L['Domains'],'/',$L['Sections'],'</span></td>
<td class="colct">',LangS('Domain',$intDomain),', ',LangS('Section',$intSection),' <span class="small">(',$intHidden,' ',$L['Hidden'],')</span>, <a href="qti_stats.php">',$L['Adm_stats'],'</a></td>
</tr>
';
echo '<tr class="data_o">
<td class="colhd colhdfirst" style="width:200px;"><span class="txt_head">',$L['Board_start_date'],'</span></td>
<td class="colct">',$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="data_o">
<td class="colhd colhdfirst"><span class="txt_head">',$L['Users'],'</span></td>
<td class="colct">',$intUser,' <span class="small">(',LangS('Userrole,A',$intAdmin),', ',LangS('Userrole,M',$intMod),', ',LangS('Member',($intUser-$intMod-$intAdmin)),')</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="data_o">
<td class="colhd colhdfirst"><span class="txt_head">',$L['Topics'],'</span></td>
<td class="colct">',LangS('Topic',$intTopic),' <span class="small">(',LangS('Reply',$intReply),')</span></td>
</tr>
</table>
';

// PUBLIC ACCESS LEVEL

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

// VERSIONS

$str='';
if ( file_exists('bin/phpinfo.php') ) $str .= ' &middot; <a href="bin/phpinfo.php">php info</a>';
if ( file_exists('qti_adm_const.php') ) $str .= ' &middot; <a href="qti_adm_const.php">php constants</a>';

echo '
<h2>',$L['Version'],'</h2>
<table class="data_o" cellspacing="0">
<tr class="data_o">
<td class="colhd colhdfirst" style="width:200px;"><span class="txt_head">QuickTicket</span></td>
<td class="colct" colspan="3">',QTIVERSION,', <span class="small">database ',$_SESSION[QT]['version'],', sid ',QT,'</span></td>
</tr>
';
echo '<tr class="data_o">
<td class="colhd colhdfirst"><span class="txt_head">PHP</span></td>
<td class="colct">'.PHP_VERSION_ID.$str.'</td>
</tr>
</table>
';

// HTML END

include('qti_adm_p_footer.php');

?>
Return current item: QuickTicket