fix bug-prone php short tags, fix event tag array, and use both country name and code correctly
All checks were successful
the build was successful

This commit is contained in:
2019-01-30 18:59:47 +01:00
parent a90d08ad46
commit 4e5445445f
5 changed files with 59 additions and 64 deletions

View File

@@ -52,12 +52,6 @@ function eval_date($date) {
return (!$dt['errors'] && $dt['year'] && preg_match("#^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$#", $date) === 1);
}
if (isset($_POST['tags'])) {
$tags = $_POST['tags'];
} else {
$tags = array();
}
function send_registration_mail($from, $to) {
$data = array(
'name' => $_POST['name'],
@@ -71,8 +65,9 @@ function send_registration_mail($from, $to) {
'url' => htmlspecialchars($_POST['url']),
'location' => $_POST['location'],
'city' => $_POST['city'],
'country' => $_POST['country'],
'tags' => $tags,
'countrycode' => explode('|', $_POST['country'])[0],
'countryname' => explode('|', $_POST['country'])[1],
'tags' => $_POST['tags']
);
$data['event'] = eval_template('registerevent/event.php', $data);

View File

@@ -79,34 +79,36 @@
<div class="form-group">
<label for="country">Country<span class="star">*</span></label>
<select name="country" class="form-control">
<option value="at">Austria</option>
<option value="be">Belgium</option>
<option value="bg">Bulgaria</option>
<option value="hr">Croatia</option>
<option value="dk">Denmark</option>
<option value="ee">Estonia</option>
<option value="fi">Finland</option>
<option value="fr">France</option>
<option value="de">Germany</option>
<option value="gr">Greece</option>
<option value="hu">Hungary</option>
<option value="ie">Ireland</option>
<option value="it">Italy</option>
<option value="lv">Latvia</option>
<option value="lt">Lithuania</option>
<option value="lu">Luxembourg</option>
<option value="mt">Malta</option>
<option value="nl">Netherlands</option>
<option value="pl">Poland</option>
<option value="pt">Portugal</option>
<option value="ro">Romania</option>
<option value="sk">Slovakia</option>
<option value="si">Slovenia</option>
<option value="es">Spain</option>
<option value="se">Sweden</option>
<option value="uk">United Kingdom</option>
<option value="other">Other</option>
</select>
<option value="at|Austria">Austria</option>
<option value="be|Belgium">Belgium</option>
<option value="bg|Bulgaria">Bulgaria</option>
<option value="hr|Croatia">Croatia</option>
<option value="dk|Denmark">Denmark</option>
<option value="ee|Estonia">Estonia</option>
<option value="fi|Finland">Finland</option>
<option value="fr|France">France</option>
<option value="de|Germany">Germany</option>
<option value="gr|Greece">Greece</option>
<option value="hu|Hungary">Hungary</option>
<option value="ie|Ireland">Ireland</option>
<option value="it|Italy">Italy</option>
<option value="lv|Latvia">Latvia</option>
<option value="lt|Lithuania">Lithuania</option>
<option value="lu|Luxembourg">Luxembourg</option>
<option value="mt|Malta">Malta</option>
<option value="nl|Netherlands">Netherlands</option>
<option value="pl|Poland">Poland</option>
<option value="pt|Portugal">Portugal</option>
<option value="ro|Romania">Romania</option>
<option value="sr|Serbia">Serbia</option>
<option value="sk|Slovakia">Slovakia</option>
<option value="si|Slovenia">Slovenia</option>
<option value="es|Spain">Spain</option>
<option value="se|Sweden">Sweden</option>
<option value="ch|Switzerland">Switzerland</option>
<option value="uk|United Kingdom">United Kingdom</option>
<option value="other|outside of Europe">Other</option>
</select>
</div>
<!--</fieldset>-->

View File

@@ -1,28 +1,26 @@
<?='<?xml version="1.0" encoding="utf-8"?>'?>
<?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?>
<eventset>
<event start="<?php echo htmlspecialchars($startdate) ?>" end="<?php if($enddate) { echo htmlspecialchars($enddate); } else { echo htmlspecialchars($startdate); }?>">
<title><?php echo htmlspecialchars($title) . " in " . htmlspecialchars($city) . ", " . htmlspecialchars($countryname); ?></title>
<body>
<p><?php echo $description?></p>
</body>
<?php if($url) { echo "<link>" . htmlspecialchars($url) . "</link>"; }?>
<tags>
<tag content=""><?php echo htmlspecialchars($countrycode); ?></tag>
<?php
foreach ($tags as $tag) {
echo sprintf('<tag content="">%s</tag>', htmlspecialchars($tag)) . "\n";
}
?>
<tag>front-page</tag>
</tags>
<eventset>
<event start="<?=htmlspecialchars($startdate)?>" end="<?if($enddate):?><?=htmlspecialchars($enddate)?><?else:?><?=htmlspecialchars($startdate)?><?endif;?>">
<title><?if($title):?><?=htmlspecialchars($title)?><?else:?>FSFE event<?endif;?><?if($city):?> in <?=htmlspecialchars($city)?><?endif;?><?if($country):?>, <?=htmlspecialchars($country)?><?endif;?></title>
<body>
<p><?=$description?></p>
</body><?if($url):?>
<link><?=htmlspecialchars($url)?></link><?endif;?>
<tags>
<tag content=""><?=htmlspecialchars($country)?></tag>
<?php
foreach ($tags as $tag) {
echo sprintf('<tag content="">%s</tag>', htmlspecialchars($tag));
}
?>
<tag>front-page</tag>
</tags>
</event>
</eventset>
</event>
</eventset>

View File

@@ -13,7 +13,7 @@ Below is the list of the information you gave.
Name: <?=$name?>
Email: <?=$email?>
Location: <?=$city?>, <?=$country?>
Location: <?=$city?>, <?=$countryname?>
You find all other information in the xml file attached. It will be uploaded
in the next 24 hours. If you like to withdraw your event or in case you like to change some information,

View File

@@ -4,7 +4,7 @@
= <?=$title?> =
Start:: <?=$startdate?>
End:: <?=$enddate?>
Location:: <?=$city?>, <?=$country?>
Location:: <?=$city?>, <?=$countryname?>
Link:: <?=$url?>
bgcolor:: #FFFFFF
Description:: <?=$description?>