//
// ------------------------------------------------------------------------- //
// Original Author: James Knickelbein
// Author Website : http://www.journeymilwaukee.com
// License Type : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //
include_once("../../mainfile.php");
include_once(XOOPS_ROOT_PATH.'/class/xoopstree.php');
include_once(XOOPS_ROOT_PATH."/class/upload.class.php");
include_once(XOOPS_ROOT_PATH."/class/module.errorhandler.php");
include_once(XOOPS_ROOT_PATH."/class/xoopsform/formdhtmltextarea.php");
include_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php");
include_once(XOOPS_ROOT_PATH.'/modules/arcade/classes/dbclass.category.php');
include_once(XOOPS_ROOT_PATH.'/modules/arcade/classes/dbclass.game.php');
include_once(XOOPS_ROOT_PATH.'/modules/arcade/classes/dbclass.score.php');
$eh = new ErrorHandler();
if ( !empty($_POST['submit']) ) {
$game = new Game();
$game->gtitle = $myts->makeTboxData4Save($_POST['gtitle']);
$game->bgcolor = $myts->makeTboxData4Save($_POST['bgcolor']);
$game->gwords = $myts->makeTboxData4Save($_POST['gwords']);
$game->object = $myts->makeTboxData4Save($_POST['object']);
$game->gkeys = $myts->makeTboxData4Save($_POST['gkeys']);
$game->gwidth = intval($_POST['gwidth']);
$game->gheight = intval($_POST['gheight']);
$game->cat_id = intval($_POST['cat_id']);
$game->active=1;
$game->date_added = time();
$game->active = 0;
// Upload the files
$upload = new Upload();
$upload->setUploadPath(XOOPS_ROOT_PATH.'/modules/arcade/cache');
$upload->setAllowedMimeTypes('.swf');
$upload->setDestinationFileName('gamefile');
$result = $upload->doUpload();
if ($result == true) {
$game->gname = $upload->FileName;
} else {
$errors = $upload->getUploadErrors();
$errorstring = "";
$errorstring .= "::Errors occured::
\n";
while(list($filename,$values) = each($errors)) {
$errorstring .= "File: " . $filename . "
";
$count = count($values);
for($i=0; $i<$count; $i++) { $errorstring .= "==>" . $values[$i] . "
"; }
}
redirect_header("index.php", 3, $errorstring);
exit();
}
$upload = new Upload();
$upload->setUploadPath(XOOPS_ROOT_PATH.'/modules/arcade/cache/images');
$upload->setAllowedMimeTypes(".gif");
$upload->setDestinationFileName('imgfile1');
$result = $upload->doUpload();
if ($result == false) {
$errors = $upload->getUploadErrors();
$errorstring = "";
$errorstring .= "::Errors occured::
\n";
while(list($filename,$values) = each($errors)) {
$errorstring .= "File: " . $filename . "
";
$count = count($values);
for($i=0; $i<$count; $i++) { $errorstring .= "==>" . $values[$i] . "
"; }
}
redirect_header("index.php", 3, $errorstring);
exit();
}
$upload = new Upload();
$upload->setUploadPath(XOOPS_ROOT_PATH.'/modules/arcade/cache/images');
$upload->setAllowedMimeTypes(".gif");
$upload->setDestinationFileName('imgfile2');
$result = $upload->doUpload();
if ($result == false ) {
$errors = $upload->getUploadErrors();
$errorstring = "";
$errorstring .= "::Errors occured::
\n";
while(list($filename,$values) = each($errors)) {
$errorstring .= "File: " . $filename . "
";
$count = count($values);
for($i=0; $i<$count; $i++) { $errorstring .= "==>" . $values[$i] . "
"; }
}
redirect_header("index.php", 3, $errorstring);
exit();
}
// Store the info into the DB
if($game->store())
{
redirect_header('submit.php',2, _MDA_GAME_ADDED);
}
else
{
redirect_header('submit.php',2, _MDA_GAME_ADD_FAILED);
}
exit();
} else {
include_once(XOOPS_ROOT_PATH."/header.php");
OpenTable();
if (!$xoopsUser) {
$uid = 0;
} else {
$uid = $xoopsUser->uid();
}
OpenTable();
?>
';
echo '
|