2022-04-04 10:55:53 +00:00
|
|
|
<body>
|
|
|
|
<html>
|
|
|
|
<?php
|
2022-04-05 08:19:17 +00:00
|
|
|
|
|
|
|
public function removeBrackets($input)
|
|
|
|
{
|
|
|
|
$output = str_replace('"', "'", $input)
|
|
|
|
return $output
|
|
|
|
}
|
|
|
|
|
2022-04-04 14:38:47 +00:00
|
|
|
if (preg_match('/^[\/\w\-. ]+$/', $_POST['rolename'].'.php')){
|
2022-04-04 10:55:53 +00:00
|
|
|
echo 'VALID FILENAME';
|
|
|
|
|
|
|
|
$language = $_POST['language'];
|
2022-04-04 14:38:47 +00:00
|
|
|
$rolefile = fopen("roles/".$language."/".$_POST['rolename'].".php", "w");
|
2022-04-04 10:55:53 +00:00
|
|
|
|
2022-04-04 14:38:47 +00:00
|
|
|
|
|
|
|
#Initialisation
|
|
|
|
fwrite($rolefile, '<?php'.PHP_EOL);
|
2022-04-04 10:55:53 +00:00
|
|
|
#
|
|
|
|
# COLORS
|
|
|
|
#
|
|
|
|
|
|
|
|
# This is the color defined by https://materializecss.com/color.html
|
2022-04-05 08:19:17 +00:00
|
|
|
$f_color = removeBrackets($_POST['rolecolor']." ".$_POST['rolestrength']."-".$_POST['rolemod']);
|
2022-04-04 14:38:47 +00:00
|
|
|
fwrite($rolefile, '$color = "'.$f_color.'"'.PHP_EOL);
|
2022-04-04 10:55:53 +00:00
|
|
|
|
2022-04-04 14:38:47 +00:00
|
|
|
# Text Color
|
2022-04-05 08:19:17 +00:00
|
|
|
$f_tcolor = removeBrackets($_POST['tcolor']);
|
2022-04-04 14:38:47 +00:00
|
|
|
fwrite($rolefile, '$tcolor = '.$f_tcolor.PHP_EOL);
|
2022-04-04 10:55:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# BASEINFO
|
|
|
|
#
|
|
|
|
|
|
|
|
#The Name of the Role
|
2022-04-05 08:19:17 +00:00
|
|
|
$f_name = removeBrackets($_POST['rolename']);
|
|
|
|
fwrite($rolefile, '$name = "'.$f_name.PHP_EOL);
|
2022-04-04 14:38:47 +00:00
|
|
|
|
2022-04-04 10:55:53 +00:00
|
|
|
#The Description of the Role, HTML conform :)
|
2022-04-05 08:19:17 +00:00
|
|
|
$f_description = removeBrackets($_POST['roledesc']);
|
|
|
|
fwrite($rolefile,'$description = "'. $f_description.PHP_EOL);
|
2022-04-04 10:55:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# TABS
|
|
|
|
#
|
|
|
|
|
|
|
|
#How To play
|
2022-04-05 08:19:17 +00:00
|
|
|
$f_howtoplay = removeBrackets($_POST['howtoplay']);
|
|
|
|
fwrite($rolefile, '$howtoplay = "'.$f_howtoplay.PHP_EOL);
|
2022-04-04 10:55:53 +00:00
|
|
|
|
|
|
|
#With what roles does this role play best?
|
2022-04-04 14:38:47 +00:00
|
|
|
fwrite($rolefile, '$playsbestwith = "<ul>'.PHP_EOL);
|
|
|
|
|
2022-04-05 08:19:17 +00:00
|
|
|
foreach($_POST['goodRoles'] as removeBrackets($selectedOption)) {
|
2022-04-04 14:38:47 +00:00
|
|
|
fwrite($rolefile, '<li>'.$selectedOption.'</li>'.PHP_EOL);
|
2022-04-04 10:55:53 +00:00
|
|
|
};
|
2022-04-04 14:38:47 +00:00
|
|
|
fwrite($rolefile, '</ul>;"'.PHP_EOL);
|
2022-04-04 10:55:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
#Convars
|
|
|
|
$f_convars = '$convars = "Normal Role Convars (also found in ULX):
|
2022-04-05 08:19:17 +00:00
|
|
|
<code>'.removeBrackets($_POST['gconvars'].'</code>
|
2022-04-04 10:55:53 +00:00
|
|
|
|
|
|
|
Rolespecific Convars:
|
2022-04-05 08:19:17 +00:00
|
|
|
<code>'.removeBrackets($_POST['cconvars']).'</code>"';
|
2022-04-04 10:55:53 +00:00
|
|
|
|
2022-04-04 14:38:47 +00:00
|
|
|
fwrite($rolefile, $f_convars.PHP_EOL);
|
2022-04-04 10:55:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Credits
|
|
|
|
#
|
|
|
|
|
|
|
|
#The Steam URL to your addon
|
2022-04-05 08:19:17 +00:00
|
|
|
$f_steam = removeBrackets($_POST['steam']);
|
|
|
|
fwrite($rolefile, '$steam = "'.$f_steam.'"'.PHP_EOL);
|
2022-04-04 10:55:53 +00:00
|
|
|
#The Source URL to your addon
|
2022-04-05 08:19:17 +00:00
|
|
|
$f_source = removeBrackets($_POST['source']);
|
|
|
|
fwrite($rolefile, '$source = "'.$f_source.'"'.PHP_EOL);
|
2022-04-04 10:55:53 +00:00
|
|
|
|
|
|
|
#Creator of the Addon
|
2022-04-05 08:19:17 +00:00
|
|
|
$f_author = removeBrackets($_POST['creator']);
|
|
|
|
fwrite($rolefile, '$author = "'.$f_author.'"'.PHP_EOL);
|
2022-04-04 10:55:53 +00:00
|
|
|
#Creatorlink
|
2022-04-05 08:19:17 +00:00
|
|
|
$f_authorurl = removeBrackets($_POST['creatorurl']);
|
|
|
|
fwrite($rolefile, '$authorurl = "'.$f_authorurl.'"'.PHP_EOL);
|
2022-04-04 10:55:53 +00:00
|
|
|
# Credittext (can use the above variables)
|
2022-04-05 08:19:17 +00:00
|
|
|
$f_ctext = removeBrackets($_POST['credits']);
|
|
|
|
fwrite($rolefile, '$ctext = "'.$f_ctext.'"'.PHP_EOL);
|
2022-04-04 10:55:53 +00:00
|
|
|
|
2022-04-05 08:19:17 +00:00
|
|
|
fwrite($rolefile, '?>');
|
2022-04-04 10:55:53 +00:00
|
|
|
fclose($rolefile);
|
|
|
|
} else {
|
|
|
|
echo 'INVALID ROLENAME';
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|