discourse-legacysite-perl/site/racecalendar/wiki_view.php
2024-06-17 22:42:14 +10:00

205 lines
6.1 KiB
PHP

<?PHP
if (!is_numeric($_GET[edit_id])) { header('Location:https://slowtwitch.com/calendar/?error=invalid_id'); }
include("config.php");
// only admins can validate
if(!is_admin($user)){
header('Location:https://slowtwitch.com/calendar/');
exit();
}
// get the info for the edit based on ID
// if the ID isn't valid, punt the user
$edit_id_here = intval(mysql_escape_string($_GET[edit_id]));
$results = mysql_query("SELECT edit_id, race_uid_fk, editor_user_id_fk, onetype, twotype, threetype, oneunit, twounit, threeunit, results, name, nametag, type, indivfee, teamfee, swim, bike, bike_surface, run, state, statetag, city, address, phone, email, courseinfo, moreinfo, directions, register, website, submitted_by, edit_timestamp, UNIX_TIMESTAMP(date) as foo, registration FROM gforum_TriathlonsEdits WHERE edit_id = '".$edit_id_here."'");
$row = mysql_fetch_array($results);
if (!$row) { header('Location:https://slowtwitch.com/calendar/?error=no_entry'); }
// Set the race type
$arrRaceType = array(1 => "Triathlon", 2 => "Duathlon", 3 => "Other");
echo $arrRaceType[$_POST[type]];
// set the page title
$pagetitle = $row[name];
// set meta tags
$meta_keywords = "triathlons, ".$row[name].", ".$row[state]." triathlon";
$meta_description = "Considering racing at the ".$row[name]."? Here is all of the information including date, time, location, and course information.";
include("include_common_head.php");
?>
<body class="listings">
<? include($common_path . "/ads/ad_wallpaper.html"); ?>
<div class="container">
<? include($common_path . "/templates/include_header.php"); ?>
<div class="main">
<div class="contentwrapper clearfix">
<? include("include_breadcrumb.php"); ?>
<section class="section listings section-has-widgets section-static remove-sidebar">
<div class="sidebar-b">
<? include("include_sidebar.php"); ?>
</div>
<div class="content content-has-widgets">
<div class="grid">
<div class="clearfix">
<h2 style="display: inline; height: 16px; margin-bottom: 20px;"><!-- class="content-title"--><? echo stripslashes($row[name]) ; echo " "; ?></h2>
<?
// wiki control buttons
include("wiki_buttons.php")
?>
<div style="margin-top: 10px;">
<?
$sqlWikiFetch = "SELECT user_username FROM gforum_User WHERE user_id = ".mysql_escape_string($row[editor_user_id_fk])." LIMIT 1";
$arrUser = mysql_fetch_array(mysql_query($sqlWikiFetch));
$strEditor = $arrUser[user_username];
?>
<strong>Editor:</strong> <? echo "<a href=\"http://forum.slowtwitch.com/gforum.cgi?username=".$strEditor.";\" target=\"_blank\">".$strEditor."</a>"; ?>
<br />
<strong>Edit Date:</strong> <? echo date("F j, Y", $row[edit_timestamp]); ?>
<br />
<strong>Date:</strong> <? echo date("F j, Y", $row[foo]); ?>
<br />
<strong>Race Type:</strong> <?
$arrRaceType = array(1 => "Triathlon", 2 => "Duathlon", 3 => "Other");
echo $arrRaceType[$row[type]];
?>
<br />
<? //Determine bike surface
if ($row[bike_surface] == 1)
{ $bike_surface = "Offroad"; }
else
{ $bike_surface = "Road"; }
?>
<strong>Bike Surface:</strong> <? echo $bike_surface; ?>
<br />
<? //Determine draft rules
if ($row[draft_legal] == 1)
{ $draft_legal = "Draft legal"; }
else
{ $draft_legal = "Non-drafting"; }
?>
<strong>Drafting rules:?</strong> <? echo $draft_legal; ?>
<br />
<? //Determine kids race
if ($row[kids_race] == 1)
{ $kids_race = "This *IS* a kids' race"; }
else
{ $kids_race = "*NOT* a kids' race"; }
?>
<strong>Kids Race?</strong> <? echo $kids_race; ?>
<br />
<strong>Course:</strong>
<?
$arrUnits = array(1 => "mile", 2 => "meter", 3 => "yard", 4 => "kilometer" );
$arrType = array(1 => "swim", 2 => "bike", 3 => "run", 4 => "paddle", 5 => "ski" );
echo $row[swim]." ".$arrUnits[$row[oneunit]]." ".$arrType[$row[onetype]].", ".$row[bike]." ".$arrUnits[$row[twounit]]." ".$arrType[$row[twotype]];
if ($row[run] != 0) { echo ", ".$row[run]." ".$arrUnits[$row[threeunit]]." ".$arrType[$row[threetype]]; }
?>
<br />
<strong>Start:</strong> <? echo date("g:i A", $row[foo]); ?>
<br />
<strong>Location:</strong> <? echo "$row[city], $row[state]"; ?>
<br />
<strong>Address:</strong> <? echo htmlspecialchars(stripslashes($row[address])); ?>
<br />
<td align="right" valign="top"><strong>Contact:</strong> <? echo "$row[phone] &nbsp;&nbsp; | &nbsp;&nbsp; <a href='mailto:$row[email]'>$row[email]</a>"; ?>
<br /><br />
<strong>Individual Price:</strong> <? echo $row[indivfee]; ?>
<br />
<strong>Team Price:</strong> <? echo $row[teamfee]; ?>
<br />
<? //Determine registration fees
if ($row[registration] == 1)
{ $registration = "Yes, all registration/convenience fees are included in price"; }
else
{ $registration = "Not specified whether registration/convenience fees are added. (NB: this is a new field in the calendar, so \"not specified\" does not definitely mean \"no.\")"; }
?>
<strong>Registration fees included?:</strong> <? echo $registration; ?>
<br /><br />
<strong>Course Info:</strong> <? echo htmlspecialchars(stripslashes($row[courseinfo])); echo "<br />"; ?>
<br />
<strong>More:</strong> <? echo htmlspecialchars(stripslashes($row[moreinfo])); echo "<br />"; ?>
<br />
<strong>Directions:</strong> <? echo htmlspecialchars(stripslashes($row[directions])); echo "<br />"; ?>
<br />
<? if(strlen($row[register]) > 0){
$substring = "http";
if (!is_int(strpos($row[register], $substring))) {
$row[register] = "http://".$row[register];
}
?>
<strong>Register:</strong> <? echo "<a target=\"_blank\" href=\"$row[register]\">Click here</a>"; ?>
<br />
<? } ?>
<?
$substring = "http";
if (!is_int(strpos($row[website], $substring))) {
$row[website] = "http://".$row[website];
}
?>
<strong>Website:</strong> <? echo "<a target=\"_blank\" href=\"$row[website]\">$row[name]</a>"; ?>
<br />
</div>
</div><!-- end col-2/3 -->
</div><!-- end grid -->
</div><!-- end content -->
</section>
</div><!-- end contentwrapper -->
</div> <!-- end main -->
<? include($common_path . "/templates/include_footer.php") ?>
</div> <!-- container -->
</body>
<? include($common_path . "/templates/include_global_js.php") ?>
</html>