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

166 lines
7.8 KiB
PHP

<?PHP include("config.php");
if(!is_admin($user)){
header('Location:https://slowtwitch.com/calendar/');
exit();
}
// Query to fetch non-validated races:
$results = mysql_query("SELECT edit_id, onetype, twotype, threetype, oneunit, twounit, threeunit, name, nametag, statetag, swim, bike, bike_surface, draft_legal, kids_race, run, city, state, courseinfo, moreinfo, edit_timestamp, submitted_by, editor_user_id_fk, UNIX_TIMESTAMP(date) as foo, registration FROM gforum_TriathlonsEdits ORDER BY edit_timestamp ASC");
// check to see if set is empty
$none = FALSE;
if (mysql_num_rows($results) == 0) { $none = TRUE; }
// set the page title
$pagetitle = "Admin: Race Edit Validation";
// set meta tags
$meta_keywords = "";
$meta_description = "";
?>
<? 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">
<div class="sidebar-b">
<? include("include_sidebar.php"); ?>
</div>
<div class="content content-has-widgets">
<div class="grid">
<div class="clearfix">
<h1 class="content-title"><strong>Unvalidated Public Edits</strong></h1>
<form method="post" action="wiki_validate_X.php" enctype="multipart/form-data">
<?
if($none == TRUE){
echo "There are no edits waiting to be validated.";
}
?>
<div class="dtable">
<?
while($row = mysql_fetch_array($results)){
$arrEditors = mysql_fetch_array(mysql_query("SELECT user_username FROM gforum_User WHERE user_id = ".$row[editor_user_id_fk]." LIMIT 1"));
$editor_user_username = $arrEditors[user_username];
$boolEditorIsOwner = false;
if ($row[editor_user_id_fk] == $row[submitted_by]) { $boolEditorIsOwner = true; }
?>
<div class="drow"><div class="dcell"><a class="sub-hdr" style="margin-left: 5px;" href="<? echo "wiki_view.php?edit_id=$row[edit_id]"; ?>"><? echo $row[name]; ?></a></div></div>
<div class="drow"><div class="dcell"><strong class="indent"><? echo date("F j, Y", $row[foo]); ?></strong></div></div>
<div class="drow"><div class="dcell"><strong class="indent">Edited on:</strong> <? echo date("F j, Y", $row[edit_timestamp]); ?> by <? echo "<a href=\"http://forum.slowtwitch.com/gforum.cgi?username=".$editor_user_username.";\" target=\"_blank\">".$editor_user_username."</a>"; if ($boolEditorIsOwner) { echo " (original race submitter)"; } else { echo ""; } ?></div></div>
<div class="drow"><?
$arrUnits = array(1 => "mile", 2 => "meter", 3 => "yard", 4 => "kilometer" );
$arrType = array(1 => "swim", 2 => "bike", 3 => "run", 4 => "paddle", 5 => "ski" );
?>
<div class="dcell"><strong class="indent">Course:</strong>
<?
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]];
}
?>
</div></div>
<div class="drow"><div class="dcell"><? //Determine bike surface
if ($row[bike_surface] == 1)
{ $bike_surface = "Offroad"; }
else
{ $bike_surface = "Road"; }
?>
<strong>Bike Surface:</strong> <? echo $bike_surface; ?>
</div></div>
<div class="drow"><div class="dcell"><? //Determine draft rules
if ($row[draft_legal] == 1)
{ $draft_legal = "Draft-legal"; }
else
{ $draft_legal = "Non-drafting"; }
?>
<strong>Drafting rules:</strong> <? echo $draft_legal; ?>
</div></div>
<div class="drow"><div class="dcell"><? //Determine kid race
if ($row[kids_race] == 1)
{ $kids_race = "This *IS* a kids' race"; }
else
{ $kids_race = "This is *NOT* a kids' race"; }
?>
<strong>Is this a kids' race?</strong> <? echo $kids_race; ?>
</div></div>
<div class="drow"><div class="dcell"><? //Determine reg fees
if ($row[registration] == 1)
{ $registration = "Registration fees ARE included"; }
else
{ $registration = "Registration fees not specified"; }
?>
<strong>Registration fees included:</strong> <? echo $registration; ?>
</div></div>
<div class="drow"><div class="dcell"><strong>Description:</strong>
<?
if(strlen($row[courseinfo]) > 400){
$phrase = "&hellip;"; }else{
$phrase = ""; }
echo substr(htmlspecialchars(stripslashes($row[courseinfo])), 0, 160);
echo $phrase;
?>
</div></div>
<div class="drow"><div class="dcell"><strong>Additional Info:</strong>
<?
if(strlen($row[moreinfo]) > 400){
$phrase = "&hellip;"; }else{
$phrase = ""; }
echo substr(htmlspecialchars(stripslashes($row[moreinfo])), 0, 160);
echo $phrase;
?>
</div></div>
<div class="drow"><div class="dcell" style="border-bottom: 1px solid #a4a4a4">
<strong>Location:</strong> <? echo "$row[city], $row[state]"; ?><br />
<a class="nav" href="<? echo "wiki_view.php?edit_id=$row[edit_id]"; ?>">More information</a>
<br /><input type="checkbox" value="<? echo($row[edit_id]); ?>" name="validate[]"> Validate this edit. <input type="checkbox" value="<? echo($row[edit_id]); ?>" name="delete[]"> Delete this edit.
</div></div>
<? } ?>
</div>
<input type="submit" value="Process Selected Races" class="btn">
</form>
</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>