<?php
require('includes/global.php');

if(isset($_POST['query'])) {
   if(!empty($_POST['send'])) {
      $ettvd->init();
      $ettvd->send($_POST['send']);
      $return  = (empty($_POST['return'])) ? '' : $_POST['return']."\n";
      $return .= '>> '.$_POST['send']."\n";
      $return .= implode("\n", $ettvd->buffer);
      $tpl->assign('return', $return);
   } else {
      send('console.php');
   }
}

$tpl->assign('javascripts', array('autosuggest'));
$tpl->assign('body', $tpl->fetch('console.tpl'));
$tpl->assign('area', 'Console');
require('finish.php');
?>