Compare commits

...

2 Commits

2 changed files with 39 additions and 25 deletions

View File

@ -1,25 +1,26 @@
<body>
<html>
<?php
if (preg_match('/^[\/\w\-. ]+$/', $_POST['rolename'])){
if (preg_match('/^[\/\w\-. ]+$/', $_POST['rolename'].'.php')){
echo 'VALID FILENAME';
$language = $_POST['language'];
$rolefile = "roles/".$language."/".$_POST['rolename'].".php";
$rolefile = fopen("roles/".$language."/".$_POST['rolename'].".php", "w");
fopen($rolefile, "w");
#Initialisation
fwrite($rolefile, '<?php'.PHP_EOL);
#
# COLORS
#
# Text Color
$f_tcolor = $_POST['textcol'];
fwrite($rolefile, $f_tcolor);
# This is the color defined by https://materializecss.com/color.html
$f_color = $_POST['rolecolor']." ".$_POST['rolestrength']."-".$_POST['rolemod'];
fwrite($rolefile, $f_color);
fwrite($rolefile, '$color = "'.$f_color.'"'.PHP_EOL);
# Text Color
$f_tcolor = $_POST['tcolor'];
fwrite($rolefile, '$tcolor = '.$f_tcolor.PHP_EOL);
#
@ -28,10 +29,11 @@ if (preg_match('/^[\/\w\-. ]+$/', $_POST['rolename'])){
#The Name of the Role
$f_name = $_POST['rolename'];
fwrite($rolefile, $f_name);
fwrite($rolefile, '$name = '.$f_name.PHP_EOL);
#The Description of the Role, HTML conform :)
$f_description = $_POST['roledesc'];
fwrite($rolefile, $f_description);
fwrite($rolefile,'$description = '. $f_description.PHP_EOL);
@ -42,14 +44,15 @@ if (preg_match('/^[\/\w\-. ]+$/', $_POST['rolename'])){
#How To play
$f_howtoplay = $_POST['howtoplay'];
fwrite($rolefile, $f_howtoplay);
fwrite($rolefile, '$howtoplay = '.$f_howtoplay.PHP_EOL);
#With what roles does this role play best?
fwrite($rolefile, '$playsbestwith = "<ul>');
foreach($_POST['goodRol es'] as $selectedOption) {
fwrite($rolefile, '<li>'.$selectedOption.'</li>');
fwrite($rolefile, '$playsbestwith = "<ul>'.PHP_EOL);
foreach($_POST['goodRoles'] as $selectedOption) {
fwrite($rolefile, '<li>'.$selectedOption.'</li>'.PHP_EOL);
};
fwrite($rolefile, '<</ul>"');
fwrite($rolefile, '</ul>;"'.PHP_EOL);
#Convars
@ -59,7 +62,7 @@ if (preg_match('/^[\/\w\-. ]+$/', $_POST['rolename'])){
Rolespecific Convars:
<code>'.$_POST['cconvars'].'</code>"';
fwrite($rolefile, $f_convars);
fwrite($rolefile, $f_convars.PHP_EOL);
#
@ -68,21 +71,22 @@ if (preg_match('/^[\/\w\-. ]+$/', $_POST['rolename'])){
#The Steam URL to your addon
$f_steam = $_POST['steam'];
fwrite($rolefile, $f_steam);
fwrite($rolefile, '$steam = '.$f_steam.PHP_EOL);
#The Source URL to your addon
$f_source = $_POST['source'];
fwrite($rolefile, $f_source);
fwrite($rolefile, '$source = '.$f_source.PHP_EOL);
#Creator of the Addon
$f_author = $_POST[''];
fwrite($rolefile, $f_author);
$f_author = $_POST['creator'];
fwrite($rolefile, '$author = '.$f_author.PHP_EOL);
#Creatorlink
$f_authorurl = $_POST[''];
fwrite($rolefile, $f_authorurl);
$f_authorurl = $_POST['creatorurl'];
fwrite($rolefile, '$authorurl = '.$f_authorurl.PHP_EOL);
# Credittext (can use the above variables)
$f_ctext = $_POST['credits'];
fwrite($rolefile, $f_ctext);
fwrite($rolefile, '$ctext = '.$f_ctext);
fwrite($rolefile, PHP_EOL.'?>');
fclose($rolefile);
} else {
echo 'INVALID ROLENAME';

View File

@ -88,7 +88,7 @@
<label>Select Strength</label>
</div>
<div class="input-field col s3">
<select id="tcolor" name="textcol" onchange="updateCard()">
<select id="tcolor" name="tcolor" onchange="updateCard()">
<option value="" disabled selected>Textcolor</option>
<option value="black-text">Black</option>
<option value="white-text">White</option>
@ -104,7 +104,7 @@
</div>
<div class="row">
<div class="input-field col s12">
<select id="goodRoles" name="goodRoles" onchange="updateCard()" multiple>
<select id="goodRoles" name="goodRoles[]" onchange="updateCard()" multiple="multiple">
<option value="" disabled> Choose your option </option>
<?php
$files = glob("roles/en/*.php");
@ -131,6 +131,16 @@
<label for="convars">Paste your role specific convars</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<input name="creator" id="creator" type="text" onkeyup="updateCard()">
<label for="creator">Steam Creator</label>
</div>
<div class="input-field col s6">
<input name="creatorurl" id="creatorurl" type="text" onkeyup="updateCard()">
<label for="creatorurl">Steeam Creator Link</label>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<textarea id="credits" name="credits" onkeyup="updateCard()" class="materialize-textarea"></textarea>