<?PHP 

	if (!is_numeric($_GET[edit_id])) { header('Location:'.$site_url.'/?error=invalid_id'); }
	  
	include("config.php");
	
	// only admins can validate
	if(!is_admin($user)){
	    header('Location:'.$site_url.'/');
		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 * FROM ".$prefix."FittersEdits WHERE edit_id = '".$edit_id_here."'");
	$row = mysql_fetch_array($results);
	if (!$row) { header('Location:'.$site_url.'/?error=no_entry'); }
	
	// set the page title
	$pagetitle = $row[fitter_name];
	
	// set meta tags
	$meta_keywords = "triathlon, ".$row[fitter_name].", ".$row[fitter_state]." triathlon fitter";
	$meta_description = "Considering getting fit by ".$row[fitter_name]."? Here is all of the information about this fitter.";
	
	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[fitter_name]) ; echo " "; ?></h2>

<? 

	// wiki control buttons
	include("wiki_buttons.php") 

?>

<div style="margin-top: 10px;">


<?
	$sqlWikiFetch = "SELECT user_username FROM ".$prefix."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>Street Address: </strong><? echo stripslashes(htmlspecialchars($row[fitter_address])); ?>
<br />
<strong>Street Address Two: </strong><? echo stripslashes(htmlspecialchars($row[fitter_address_two])); ?>
<br />
<strong>City: </strong><? echo stripslashes(htmlspecialchars($row[fitter_city])); ?>
<br />
<strong>State: </strong><? echo stripslashes(htmlspecialchars($row[fitter_state])); ?>
<br />
<strong>Zip/Postal Code: </strong><? echo stripslashes(htmlspecialchars($row[fitter_zip])); ?>
<br />
<strong>Phone: </strong><? echo stripslashes(htmlspecialchars($row[fitter_phone])); ?>
<br />
<strong>Fax/Alt Phone: </strong><? echo stripslashes(htmlspecialchars($row[fitter_fax])); ?>
<br />
<strong>E-mail: </strong><a href="mailto:<? echo $row[fitter_email]; ?>"><? echo stripslashes(htmlspecialchars($row[fitter_email])); ?></a>
<br />
<strong>Website: </strong><a href="<? echo $row[fitter_website]; ?>" target="_blank"><? echo $row[fitter_website]; ?></a>
<br />
<strong>Portfolio: </strong><a href="<? echo $row[fitter_portfolio]; ?>" target="_blank"><? echo $row[fitter_portfolio]; ?></a>


<br />
<br />

<div class="indentlarge">
<? 
for ($i = 0; $i < 35; $i++) echo("*"); 
echo (" FIT INFO ");
for ($i = 0; $i < 35; $i++) echo("*"); 
?>
</div>

<br />
<strong>Default Tri-Fit Methodology: </strong><?

$sql = ("SELECT * FROM ".$prefix."FittersMethods WHERE fitter_method_id = ".$row[fitter_method]." LIMIT 1");

//echo $sql;

$fetch = mysql_query($sql) or die(mysql_error());

if (mysql_num_rows($fetch) > 0) {
	while ($method_list = mysql_fetch_array($fetch)) {
		echo ("$method_list[fitter_method_name]");
	}
} else {
	echo ("Unanswered");
}

?>


<br />
<strong>Certifications: </strong><?

$row[fitter_certifications] = ltrim(rtrim($row[fitter_certifications], ", "), ", ");
if ($row[fitter_certifications]) {
    $sql = ("SELECT * FROM gforum_FittersCertifications WHERE fitter_certification_id IN ($row[fitter_certifications]) ORDER BY fitter_certification_name ASC");

    //echo $sql;

    $fetch = mysql_query($sql) or die(mysql_error());

    $certification_list = "";
    while ($list = mysql_fetch_array($fetch)) {
        $certification_list  = $certification_list."$list[fitter_certification_name], ";
    }
    $certification_list = rtrim($certification_list, ', ');
}

if ($certification_list) {echo $certification_list;} else {echo "None";}

?>

<br />
<strong>Fit Bikes: </strong><?

$row[fitter_fitbikes] = ltrim(rtrim($row[fitter_fitbikes], ", "), ", ");
if ($row[fitter_fitbikes]) {
    $sql = ("SELECT * FROM gforum_FittersFitbikes WHERE fitter_fitbike_id IN ($row[fitter_fitbikes]) ORDER BY fitter_fitbike_name ASC");

    //echo $sql;

    $fetch = mysql_query($sql) or die(mysql_error());

    $fitbike_list = "";
    while ($list = mysql_fetch_array($fetch)) {
        $fitbike_list  = $fitbike_list."$list[fitter_fitbike_name], ";
    }
    $fitbike_list = rtrim($fitbike_list, ', ');
}

if ($fitbike_list) {echo $fitbike_list;} else {echo "None";}

?>

<br />
<strong>Motion-Capture Systems: </strong><?

$row[fitter_motioncapture] = ltrim(rtrim($row[fitter_motioncapture], ", "), ", ");

if ($row[fitter_motioncapture]) {

    $sql = ("SELECT * FROM gforum_FittersMotioncapture WHERE fitter_motioncapture_id IN ($row[fitter_motioncapture]) ORDER BY fitter_motioncapture_name ASC");

    //echo $sql;

    $fetch = mysql_query($sql) or die(mysql_error());

    $motioncapture_list = "";
    while ($list = mysql_fetch_array($fetch)) {
        $motioncapture_list  = $motioncapture_list."$list[fitter_motioncapture_name], ";
    }
    $motioncapture_list = rtrim($motioncapture_list, ', ');
}

if ($motioncapture_list) {echo $motioncapture_list;} else {echo "None";}

?>

<br />
<strong>Cost of Fit: </strong><? echo stripslashes(htmlspecialchars($row[fitter_cost])); ?>

<br /><br />
<div class="indentlarge">
<? 
for ($i = 0; $i < 80; $i++) echo("*"); 
?>
</div>

<br />
<strong>General Info: </strong><? echo stripslashes(stripslashes($row[fitter_info])) ?>
<br /><br />
<strong>Directions to Location(s): </strong><? echo stripslashes(stripslashes($row[fitter_directions])); ?>

<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>
