<?php if(!isset($_SESSION)){ob_start();session_start();}header("Access-Control-Allow-Origin: *");
$ID = "bot_message";

include("../lib/DataTables.php");
use
	DataTables\Editor,
	DataTables\Editor\Field,
	DataTables\Editor\Format,
	DataTables\Editor\Mjoin,
	DataTables\Editor\Upload,
	DataTables\Editor\Validate;

// The following statement can be removed after the first run (i.e. the database
// table has been created). It is a good idea to do this to help improve
// performance.

$db->sql( "ALTER DATABASE CHARACTER SET utf8 COLLATE utf8_unicode_ci; ");

$db->sql( "CREATE TABLE IF NOT EXISTS `files` (
	`id` int(50) NOT NULL auto_increment,
	`filename` varchar(255),
	`filesize` varchar(255),
	`web_path` varchar(255),
	`system_path` varchar(255),
	PRIMARY KEY( `id` )
);" );



$db->sql( "CREATE TABLE IF NOT EXISTS `bot_message` (
	`id` int(10) NOT NULL auto_increment,
	`title` varchar(255),
`content` text,
`rel` int(50),PRIMARY KEY( `id` ));");

$db->sql( "ALTER TABLE bot_message CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci; ");
$db->sql( "ALTER TABLE files CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci; ");
Editor::inst( $db, "bot_message" )
->fields(Field::inst( "bot_message.id" ),
Field::inst( "bot_message.rel" ),
Field::inst( "bot_message.title" )->validator( 'Validate::notEmpty' )
,Field::inst( "bot_message.content" )->validator( 'Validate::notEmpty')
)
->process( $_POST )
->json();?>