Location: PHPKode > projects > QuickTalk Forum > quicktalk/qtf_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   Forum
* @package    QuickTalk
* @author     Philippe Vandenberghe <hide@address.com>
* @copyright  2008-2012 The PHP Group
* @version    2.5 build:20100924
* @since      File available since Release 1.0.0
* @deprecated File deprecated in Release 3.0.0
*/

session_start();
require_once('bin/qtf_init.php');
include(Translate('qtf_adm.php'));

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

// INITIALISE

$oVIP->selfurl = 'qtf_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'],false) ) $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>'; }
    $oVIP->exiturl = 'qtf_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('qtf_adm_p_header.php');

// BOARD OFFLINE

echo '<h2>',$L['Adm_status'],'</h2>
<table class="data_o" cellspacing="0" summary="index">
<tr class="data_o">
<td class="colhd colhdfirst" style="width:200px;">',$L['Adm_status'],'</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'],S,'
<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();
$intForum = $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'];

if ( $intPost>0 )
{
$oDB->Query('SELECT min(firstpostdate) as firsttopic FROM '.TABTOPIC);
$row = $oDB->Getrow();
$strStartdate = QTdatestr($row['firsttopic'],'$','');
}
else
{
$strStartdate = S;
}

echo '<table class="data_o" cellspacing="0">',N;
echo '<tr class="data_o">';
echo '<td class="colhd colhdfirst" style="width:200px;">',$L['Domains'],'/',$L['Sections'],'</td>';
echo '<td class="colct">',LangS('Domain',$intDomain),', ',LangS('Section',$intForum),' <span class="small">(',$intHidden,S,$L['Hidden'],')</span>, <a href="qtf_stats.php">',$L['Statistics'],'</a></td>';
echo '</tr>',N;
echo '<tr class="data_o">';
echo '<td class="colhd colhdfirst" style="width:200px;">',$L['Section_start_date'],'</td>';
echo '<td class="colct">',$strStartdate,'</td>';
echo '</tr>',N;
echo '<tr class="data_o">';
echo '<td class="colhd colhdfirst">',$L['Members'],'</td>';

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

echo '<td class="colct">',LangS('Member',$intUser),' <span class="small">(',LangS('Userrole,A',$intAdmin),', ',LangS('Userrole,M',$intMod),', ',LangS('User',($intUser-$intAdmin-$intMod)),')</span></td>';
echo '</tr>',N;

// messages
$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">',$L['Messages'],'</td>
<td class="colct">',LangS('Message',$intPost),' <span class="small">(',LangS('Topic',$intTopic),', ',LangS('Reply',$intReply),')</span></td>
</tr>',N;

// db size
if ( $oDB->type=='mysql' )
{
  echo '<tr class="data_o">';
  echo '<td class="colhd colhdfirst">',$L['Db_disk_space'],'</td>';
  $oDB->Query('show table status from '.$oDB->db);
  $intSize = 0;
  $tables = array(TABSETTING,TABDOMAIN,TABSECTION,TABTOPIC,TABPOST,TABUSER);
  while($row = $oDB->Getrow())
  {
    if ( in_array($row['Name'],$tables) )
    {
    $intSize += $row['Data_length'];
    }
  }
  $strSize = round(($intSize/1024), 0).' Kb';
  echo '<td class="colct">',$strSize,'</td></tr>',N;
}

// db version
echo '<tr class="data_o">
<td class="colhd colhdfirst">',$L['Version'],'</td>
<td class="colct">',QTFVERSION,', <span class="small">database ',$_SESSION[QT]['version'],', sid ',QT,'</span></td>
</tr>',N;

echo '</table>',N;

// PUBLIC ACCESS LEVEL

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

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

// VERSIONS

$str='';
if ( file_exists('bin/phpinfo.php') ) $str .= ' &middot; <a href="bin/phpinfo.php">php info</a>';
if ( file_exists('qtf_adm_const.php') ) $str .= ' &middot; <a href="qtf_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;">QuickTalk</td>
<td class="colct" colspan="3">',QTFVERSION,', <span class="small">database ',$_SESSION[QT]['version'],', sid ',QT,'</span></td>
</tr>
';
echo '<tr class="data_o">
<td class="colhd colhdfirst">PHP</td>
<td class="colct">'.PHP_VERSION_ID.$str.'</td>
</tr>
</table>
';

// HTML END

include('qtf_adm_p_footer.php');

?>
Return current item: QuickTalk Forum