assignInclude( "header", "$skindir/header.tpl" );
$tpl->assignInclude( "footer", "$skindir/footer.tpl" );
include(_BASEDIR."includes/pagesetup.php");
if(file_exists(_BASEDIR."languages/".$language."_admin.php")) include_once(_BASEDIR."languages/".$language."_admin.php");
else include_once(_BASEDIR."languages/en_admin.php");
if(file_exists(_BASEDIR."languages/".$language.".php")) include_once(_BASEDIR."languages/".$language.".php");
else include_once(_BASEDIR."languages/en.php");
if(!isADMIN) accessDenied( );
$confirm = isset($_GET['confirm']) ? $_GET['confirm'] : false;
include("version.php");
list($currentVersion) = dbrow(dbquery("SELECT version FROM ".TABLEPREFIX."fanfiction_modules WHERE name = '$moduleName' LIMIT 1"));
$installed = dbnumrows(dbquery("SELECT COUNT(code_module) FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_module = 'betareader'"));
if(empty($currentVersion) || $currentVersion < "1.4" || !$installed) {
if($confirm == "yes") {
dbquery("UPDATE ".TABLEPREFIX."fanfiction_modules SET version = '1.4' WHERE name = '$moduleName' LIMIT 1");
if($currentVersion < "1.2") dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks` (`code_text`, `code_type`, `code_module`) VALUES ( 'include(_BASEDIR.\"modules/betareader/stats.php\");', 'sitestats', 'betareader');");
$output = write_message(_ACTIONSUCCESSFUL);
}
else if($confirm == "no") {
$output = write_message(_ACTIONCANCELLED);
}
else {
$output = write_message(_CONFIRMUPDATE."
"._YES." "._OR." "._NO."");
}
}
else $output .= write_message(_ALREADYUPDATED);
$tpl->assign("output", $output);
$tpl->printToScreen( );
?>