Fifth pass at adding key files

This commit is contained in:
dsainty 2024-06-17 22:42:14 +10:00
parent 67ccdbcc34
commit 9797a6824a
535 changed files with 95045 additions and 0 deletions

View File

@ -0,0 +1,157 @@
<?PHP include("config.php"); ?>
<!DOCTYPE html >
<html lang="en">
<head>
<title>&lt;:: Welcome to Slowtwitch.com ::&gt;: Bar to Head Tube Calculator</title>
<meta name="KEYWORDS" content="bike, geometry, custom" />
<meta name="DESCRIPTION" content="Need to know stack and reach from an X-Y bar-bore measurement? Use our calculator to help."/>
<? include($common_path . "/templates/include_global_head.php"); ?>
<? include($common_path . "/templates/google_analytics.html"); ?>
</head>
<body id="home">
<? 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">
<h1>F.I.S.T. Bar to Head Tube Calculator</h1>
<hr class="line" />
<p>All values are in millimeters!</p>
<form name="calcForm" id="calcForm" method="post" action="bar_bore_calc_X.php">
<div class="dtable form">
<div class="drow">
<div class="dcell name">Bar-Bore Y</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="serottaX" name="barboreY" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Bar-Bore X</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="serottaY" name="barboreX" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Head Angle</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="head_tube_angle" name="head_tube_angle" value="73" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Stem Length</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="stem_length" name="stem_length" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Stem Angle</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="stem_angle" name="stem_angle" class="txt shotext" /><br />Plug in actual stem pitch. Write 0 [the number zero] for an extension <strong>perpendicular to the steerer</strong>; -6 for 6&deg; down from perpendicular, 6 for 6&deg; up; -17&deg; for a "7-shaped" stem; and so forth.
</div>
</div>
<div class="drow">
<div class="dcell name">Stem Clamp Height</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="clamp" name="clamp" value="40" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Spacer Height</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="spacer" name="spacer" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Headset Topcap</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="headset" name="headset" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="checkbox" name="terms"> Agree to Terms
</div>
</div>
<div class="drow actions">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="button" name="calculateButton" value="Calculate" onclick="checkAgreeToTerms();" class="btn" /> <input type="button" name="allDefaultButton" value="Reset all Defaults" onclick="setAllDefaults();" class="btn" />
</div>
</div>
</div>
</form>
<p>The calculator above is designed to help fitters trained in the F.I.S.T. tri
bike fit protocol to generate geometries for custom triathlon bikes. Note
that the inputs required to use this calculator include "stack" and "reach."
These values are described at length in our <a href="/Bike_Fit/The_F.I.S.T._Method_for_fitting_triathletes_to_their_bikes_16.html ">tri bike fit articles</a> on Slowtwitch.com.
</p>
<div class="advert float-right">
<? include($common_path . "/ads/ad_300x250_roadblocks.html"); ?>
</div>
<p>
Even if the fit is performed correctly, pitfalls loom. You must have the
tools to accurately find the stack and reach of the bike that fits under the
rider. The fitter is required to account for the stem length, stem pitch,
height of the stem clamp, headset upper stack, spacers under the stem if
any, and of course the choice of aerobar. He then must have an accurate way
of generating the stack and reach measures, using either a fit bike (best is
the bike made by Exit Cycling) that accurately generates these values
(taking into consideration <a href="/Bike_Fit/Fudging_for_negative_reach_123.html">negative reach</a> if applicable), or he must use an external tool, such
as Serotta's X/Y tool.
</p>
<h3>TERMS OF USE</h3>
<p>
<a name="terms"></a>
This calculator consists of a set of trigonometric and geometric equations.
It solves math equations. That's all it does. There are no warranties
expressed or implied that these geometries cause a bike to be safe, or
comfortable, or powerful, or aerodynamic, or even be ridden; or indeed can
even be built. Should you build or cause to build a bike based on
geometries calculated by this generator, you do so at your own risk. You
agree to hold harmless Slowtwitch.com, its owners, employees and contractors
against all claims arising out of your use of this calculator. You agree to
assume all risk and liability associated with using this calculator. You
agree that the final determination of an appropriate geometry rests with you
and/or any customer for whom you may be building this bike, or causing it to
be built, and with the company building the bike.
</p>
</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>

View File

@ -0,0 +1,144 @@
<?PHP
include("config.php");
foreach ( $_POST as $key ) {
}
$xser = (float)$_POST['barboreX'];
$yser = (float)$_POST['barboreY'];
$stemlength = (float)$_POST['stem_length'];
$headangle = (float)$_POST['head_tube_angle'];
$stemangle = (float)$_POST['stem_angle'];
$clamp = (float)$_POST['clamp'];
$spacer = (float)$_POST['spacer'];
$headset = (float)$_POST['headset'];
$reach = 0;
$stack = 0;
// calculate stack and reach
$reach = $xser - ($stemlength*cos(deg2rad(90-$headangle+$stemangle))) + (($clamp/2) + $spacer + $headset)*cos(deg2rad($headangle));
$stack = $yser - ($stemlength*sin(deg2rad(90-$headangle+$stemangle))) - (($clamp/2) + $spacer + $headset)*sin(deg2rad($headangle));
//echo($xser." - (".$stemlength."*cos(deg2rad(90-".$headangle."+".$stemangle."))) - ((".$clamp."/2) + ".$spacer." + ".$headset.")*cos(deg2rad(".$headangle."))");
//$stack = $yser - ($stemlength*sin(deg2rad(90-$headangle+$stemangle))) - (($clamp/2) + $spacer + $headset)*sin(deg2rad($headangle));
$reach = round($reach, 0);
$stack = round($stack, 0);
//echo ("STACK: ".$stack);
//echo ("REACH: ".$reach);
//exit();
?>
<!DOCTYPE html >
<html lang="en">
<head>
<title>&lt;:: Welcome to Slowtwitch.com ::&gt;: Bar to Head Tube Calculator</title>
<meta name="KEYWORDS" content="bike, geometry, custom" />
<meta name="DESCRIPTION" content="Need to know stack and reach from an X-Y bar-bore measurement? Use our calculator to help."/>
<? include($common_path . "/templates/include_global_head.php"); ?>
<? include($common_path . "/templates/google_analytics.html"); ?>
</head>
<body id="home">
<? 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">
<h1>F.I.S.T. Bar to Head Tube Calculator</h1>
<hr class="line" />
<div class="clearfix">
<div class="col-2-3">
<h3 class="section-title">Input</h3>
<div class="dtable form">
<div class="drow">
<div class="dcell name">Bar-Bore Y</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $yser."mm"; ?></div>
</div>
<div class="drow">
<div class="dcell name">Bar-Bore X</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $xser."mm"; ?></div>
</div>
<div class="drow">
<div class="dcell name">Head Tube Angle</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $headangle."&deg;"; ?></div>
</div>
<div class="drow">
<div class="dcell name">Stem Length</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $stemlength."mm"; ?></div>
</div>
<div class="drow">
<div class="dcell name">Stem Angle</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $stemangle."&deg;"; ?></div>
</div>
<div class="drow">
<div class="dcell name">Stem Clamp Height</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $clamp."mm"; ?></div>
</div>
<div class="drow">
<div class="dcell name">Spacer Height</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $spacer."mm"; ?></div>
</div>
<div class="drow">
<div class="dcell name">Headset Topcap</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $headset."mm"; ?></div>
</div>
</div>
</div>
<div class="col-1-3">
<h3 class="section-title">Output</h3>
<p>Stack: <? echo $stack."mm"; ?></p>
<p>Reach: <? echo $reach."mm"; ?></p>
</div>
</div>
<div class="center">
<a href="bar_bore_calc.php" class="btn default">Return to the Bar-Bore to X-Y Calculator</a>
</div>
<p>
Even if the fit is performed correctly, pitfalls loom. You must have the
tools to accurately find the stack and reach of the bike that fits under the
rider. The fitter is required to account for the stem length, stem pitch,
height of the stem clamp, headset upper stack, spacers under the stem if
any, and of course the choice of aerobar. He then must have an accurate way
of generating the stack and reach measures, using either a fit bike (best is
the bike made by Exit Cycling) that accurately generates these values
(taking into consideration <a href = "/Bike_Fit/Fudging_for_negative_reach_123.html">negative reach</a> if applicable), or he must use an external tool, such
as Serotta's X/Y tool.
</p>
</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>

View File

@ -0,0 +1,21 @@
<?
include("../local/settings.php");
$sql = "SELECT * FROM ".$prefix."ResourceStates ORDER BY stateid";
$result = mysql_query($sql) OR die(mysql_error());
$state_list = array();
$state_tag_list = array();
while ($row = mysql_fetch_array($result)) {
$state_list[$row['stateid']] = $row['statelong'];
$state_tag_list[] = $row['statetag'];
}
function curPageURL() {
$isHTTPS = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on");
$port = (isset($_SERVER["SERVER_PORT"]) && ((!$isHTTPS && $_SERVER["SERVER_PORT"] != "80") || ($isHTTPS && $_SERVER["SERVER_PORT"] != "443")));
$port = ($port) ? ':'.$_SERVER["SERVER_PORT"] : '';
$url = ($isHTTPS ? 'https://' : 'http://').$_SERVER["SERVER_NAME"].$port.$_SERVER["REQUEST_URI"];
return $url;
}
?>

View File

@ -0,0 +1,214 @@
<?PHP
if ($_POST['coordinates'] == 'serotta_xy') {
foreach ( $_POST as $key )
{
}
$xser = (float)$_POST['serottaX'];
$yser = (float)$_POST['serottaY'];
$stemlength = (float)$_POST['stem_length'];
$headangle = (float)$_POST['head_angle'];
$stemangle = (float)$_POST['stem_angle'];
$clamp = (float)$_POST['clamp'];
$spacer = (float)$_POST['spacer'];
$headset = (float)$_POST['headset'];
$reach = 0;
$stack = 0;
// calculate stack and reach
$reach = $xser - ($stemlength*cos(deg2rad(90-$headangle+$stemangle))) + (($clamp/2) + $spacer + $headset)*cos(deg2rad($headangle));
$stack = $yser - ($stemlength*sin(deg2rad(90-$headangle+$stemangle))) - (($clamp/2) + $spacer + $headset)*sin(deg2rad($headangle));
//echo($xser." - (".$stemlength."*cos(deg2rad(90-".$headangle."+".$stemangle."))) - ((".$clamp."/2) + ".$spacer." + ".$headset.")*cos(deg2rad(".$headangle."))");
//$stack = $yser - ($stemlength*sin(deg2rad(90-$headangle+$stemangle))) - (($clamp/2) + $spacer + $headset)*sin(deg2rad($headangle));
$reach = round($reach, 0);
$stack = round($stack, 0);
//echo ("STACK: ".$stack);
//echo ("REACH: ".$reach);
//exit();
} else {
$stack = (float)$_POST['stack'];
$reach = (float)$_POST['reach'];
}
$seat_angle = (float)deg2rad((float)$_POST['seat_angle']);
$head_angle = (float)deg2rad((float)$_POST['head_angle']);
$fork_offset = (float)$_POST['fork_offset'];
$fork_length = (float)$_POST['fork_length'];
$bb_drop = (float)$_POST['bb_drop'];
$chain_stay = (float)$_POST['chain_stay'];
$rear_wheel = (float)$_POST['rear_wheel'];
$hs_lower_stack = (float)$_POST['hs_lower_stack'];
$wheel_size = (int)$_POST['wheel_size'];
$bb_height = round($rear_wheel - $bb_drop, 1);
$trail = round(($rear_wheel * cos($head_angle) - $fork_offset) / sin($head_angle), 1);
$tt_eff = round($reach + $stack / tan($seat_angle), 1);
$ht_length = round(($stack - $bb_drop) / sin($head_angle) + $fork_offset / tan($head_angle) - $fork_length - $hs_lower_stack, 1);
$front_center = round(pow(pow(($reach + ($stack - $bb_drop) / tan($head_angle) + $fork_offset / sin($head_angle)), 2) + pow($bb_drop, 2), 0.5), 1);
$wheelbase = round(pow(pow($chain_stay, 2) - pow($bb_drop, 2), 0.5) + pow(pow($front_center, 2) - pow($bb_drop, 2), 0.5), 1);
?>
<?PHP include("config.php"); ?>
<!DOCTYPE html >
<html lang="en">
<head>
<title>&lt;:: Welcome to Slowtwitch.com ::&gt;: Custom Tri Geometry Calculator</title>
<meta name="KEYWORDS" content="bike, geometry, custom" />
<meta name="DESCRIPTION" content="Are you trying to find custom geometry based off a fitting session? Use our calculator to help."/>
<? include($common_path . "/templates/include_global_head.php"); ?>
<? include($common_path . "/templates/google_analytics.html"); ?>
<script src="js/fit_calculator.js" type="text/javascript" language="JavaScript"></script>
</head>
<body id="home">
<? 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">
<h1>F.I.S.T Custom Bike Calculator</h1>
<div class="clearfix">
<div class="col-1-2">
<h3 class="section-title">Input</h3>
<div class="dtable form">
<div class="drow">
<div class="dcell name">Stack</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $stack; ?></div>
</div>
<div class="drow">
<div class="dcell name">Reach</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $reach; ?></div>
</div>
<div class="drow">
<div class="dcell name">Seat Angle</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo rad2deg($seat_angle); ?></div>
</div>
<div class="drow">
<div class="dcell name">Head Tube Angle</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo rad2deg($head_angle); ?></div>
</div>
<div class="drow">
<div class="dcell name">Fork Offset</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo rad2deg($fork_offset); ?></div>
</div>
<div class="drow">
<div class="dcell name">Fork Length</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo rad2deg($fork_length); ?></div>
</div>
<div class="drow">
<div class="dcell name">BB Drop</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo rad2deg($bb_drop); ?></div>
</div>
<div class="drow">
<div class="dcell name">Chainstay</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo rad2deg($chain_stay); ?></div>
</div>
<div class="drow">
<div class="dcell name">Rear Wheel</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo rad2deg($rear_wheel); ?></div>
</div>
<div class="drow">
<div class="dcell name">Headset Lower Stack</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo rad2deg($hs_lower_stack); ?></div>
</div>
<div class="drow">
<div class="dcell name">Wheel Size</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo rad2deg($wheel_size); ?></div>
</div>
</div>
</div>
<div class="col-1-2">
<h3 class="section-title">Frame Measurements</h3>
<div class="dtable form">
<div class="drow">
<div class="dcell name">BB Height</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $bb_height; ?></div>
</div>
<div class="drow">
<div class="dcell name">Trail</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $trail; ?></div>
</div>
<div class="drow">
<div class="dcell name">Eff. Top Tube Length</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $tt_eff; ?></div>
</div>
<div class="drow">
<div class="dcell name">Head Tube Length</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $ht_length; ?></div>
</div>
<div class="drow">
<div class="dcell name">Wheelbase</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $wheelbase; ?></div>
</div>
<div class="drow">
<div class="dcell name">Front Center</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo $front_center; ?></div>
</div>
</div>
</div>
</div>
<?
if( ($front_center < 560) && ($wheel_size == 700) ){
echo '<p class="error"><strong>WARNING: Your front center is too short!</strong></p>';
}
if( ($front_center < 525) && ($wheel_size == 650) ){
echo '<p class="error"><strong>WARNING: Your front center is too short!</strong></p>';
}
?>
<div class="center">
<a href="fit_calculator.php" class="btn default">Return to the Geometry Calculator</a>
</div>
</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>

View File

@ -0,0 +1,323 @@
<?PHP include("config.php"); ?>
<!DOCTYPE html >
<html lang="en">
<head>
<title>&lt;:: Welcome to Slowtwitch.com ::&gt;: Custom Tri Geometry Calculator</title>
<meta name="KEYWORDS" content="bike, geometry, custom" />
<meta name="DESCRIPTION" content="Are you trying to find custom geometry based off a fitting session? Use our calculator to help."/>
<? include($common_path . "/templates/include_global_head.php"); ?>
<? include($common_path . "/templates/google_analytics.html"); ?>
</head>
<body id="home">
<? 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">
<h1>F.I.S.T Custom Bike Calculator</h1>
<hr class="line" />
<p>All values are in millimeters!</p>
<form name="calcForm" id="calcForm" method="post" action="do_calc.php">
<div class="dtable form">
<? if ($_GET['use'] == 'serotta') { /** begin Serotta XY **/ ?>
<div class="drow">
<div class="dcell name">Serotta X</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="serottaX" name="serottaX" class="txt shotext" /> <a href="fit_calculator.php?">Click here to use Stack &amp; Reach</a>
</div>
</div>
<div class="drow">
<div class="dcell name">Head Angle</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="head_angle" name="head_angle" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Stem Length</div>
<div class="dcell divider"></div>
<div class="dcell value">
<select id="stem_length" name="stem_length">
<option value="50">50 mm</option>
<option value="60">60 mm</option>
<option value="70">70 mm</option>
<option value="80">80 mm</option>
<option value="90">90 mm</option>
<option value="100">100 mm</option>
<option value="110">110 mm</option>
<option value="120">120 mm</option>
<option value="130">130 mm</option>
<option value="140">140 mm</option>
<option value="150">150 mm</option>
</select>
</div>
</div>
<div class="drow">
<div class="dcell name">Stem Angle</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="stem_angle" name="stem_angle" class="txt shotext" /><br />
Plug in actual stem pitch. Write 0 [the number zero] for an extension <strong>perpendicular to the steerer</strong>; -6 for 6&deg; down from perpendicular, 6 for 6&deg; up; -17&deg; for a "7-shaped" stem; and so forth.
</div>
</div>
<div class="drow">
<div class="dcell name">Stem Clamp Height</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="clamp" name="clamp" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Spacer Height</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="spacer" name="spacer" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Headset Topcap</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="headset" name="headset" class="txt shotext" />
<input type="hidden" id="coordinates" name="coordinates" value="serotta_xy" />
<input type="hidden" name="stack" />
<input type="hidden" name="reach" />
</div>
</div>
<? } else { ?>
<div class="drow">
<div class="dcell name">Stack</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="stack" name="stack" class="txt shotext" /> <a href="fit_calculator.php?use=serotta">Click here to use Serotta XY</a>
</div>
</div>
<div class="drow">
<div class="dcell name">Reach</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="reach" name="reach" class="txt shotext" />
</div>
</div>
<? } // endif ?>
<div class="drow">
<div class="dcell name">Chain Stay</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="chain_stay" name="chain_stay" class="txt shotext" /><br />
(Note that some custom tri bike makers have a standard chain
stay length, because these builders fair the rear wheel with the trailing
edge of the seat tube. Find your chosen bike maker's chain
stay value before you send him calcs generated here.)
</div>
</div>
<div class="drow">
<div class="dcell name">Seat Angle</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="seat_angle" name="seat_angle" class="txt shotext" />
</div>
</div>
<? if ($_GET['use'] != 'serotta') { ?>
<div class="drow">
<div class="dcell name">Head Angle</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="head_angle" name="head_angle" class="txt shotext" />
</div>
</div>
<? } // endif ?>
<div class="drow">
<div class="dcell name">Fork Offset</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="fork_offset" name="fork_offset" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Fork Length</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="fork_length" name="fork_length" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
</div>
</div>
<div class="drow">
<div class="dcell name">HS Lower Stack</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="hs_lower_stack" name="hs_lower_stack" class="txt shotext" /><br />
(1.5mm is a typical value for integrated headsets; you'll want to change this if your custom builder builds with external headsets, which is frequently the case. The oft-used Chris King headset has a lower stack of 13.7mm.)
</div>
</div>
<div class="drow">
<div class="dcell name">BB Drop</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="bb_drop" name="bb_drop" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Rear Wheel</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="rear_wheel" name="rear_wheel" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Wheel Size</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="radio" id="wheel_size" name="wheel_size" checked onclick="set700Defaults();" value="700" /> 700C (Note: Changing this will reset certain values) </br>
<input type="radio" id="wheel_size" name="wheel_size" onclick="set650Defaults();" value="650" /> 650C
</div>
</div>
<div class="drow">
<div class="dcell name">Morphology</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="radio" id="morphology" name="morphology" checked onclick="setStandardLeggedDefaultValues();" /> Standard (Note: Changing this will reset certain values)<br />
<input type="radio" id="morphology" name="morphology" onclick="setLongLeggedDefaultValues();" /> Long Legged
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="checkbox" name="terms"> Agree to Terms
</div>
</div>
<div class="drow actions">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="button" name="calculateButton" value="Calculate" onclick="checkAgreeToTerms();" class="btn"/>
<input type="button" name="allDefaultButton" value="Reset all Defaults" onclick="setAllDefaults();" class="btn" />
</div>
</div>
</div>
</form>
<p>The calculator above is designed to help fitters trained in the F.I.S.T. tri
bike fit protocol to generate geometries for custom triathlon bikes. Note
that the inputs required to use this calculator include "stack" and "reach."
These values are described at length in our <a href="/Bike_Fit/The_F.I.S.T._Method_for_fitting_triathletes_to_their_bikes_16.html ">tri bike fit articles</a> on Slowtwitch.com.
</p>
<p>
The F.I.S.T. fitting protocol is a two-step process: First, the fitter
finds the rider's "fit coordinates," aka his "points in space." The second
part of the protocol focuses on finding the right production bike to match
those fit coordinates or, in this case, generating a custom geometry that
matches the fit coordinates. But, know this: It is remarkably easy to
calculate a "bad" custom geometry for a rider. The culprit is most often a
badly executed "Part I" of this protocol, that is, the fitter executed a
poor fit session. If this happens, the calculator below will faithfully
generate the geometry for a bad bike to perfectly match the bad fit.
Forewarned is forearmed.
</p>
<div class="advert float-right">
<? include($common_path . "/ads/ad_300x250_roadblocks.html"); ?>
</div>
<p>
Even if the fit is performed correctly, pitfalls loom. You must have the
tools to accurately find the stack and reach of the bike that fits under the
rider. The fitter is required to account for the stem length, stem pitch,
height of the stem clamp, headset upper stack, spacers under the stem if
any, and of course the choice of aerobar. He then must have an accurate way
of generating the stack and reach measures, using either a fit bike (best is
the bike made by Exit Cycling) that accurately generates these values
(taking into consideration <a href="/Bike_Fit/Fudging_for_negative_reach_123.html">negative reach</a> if applicable), or he must use an external tool, such
as Serotta's X/Y tool.
</p><p>
Anyone who uses this calculator can change any of the defaults below.
Toggling from 700c to 650c, or from standard to long-legged morphology, will
change the defaults, but you can still override our defaults and insert your
own values. There are explanatory notes below, and you are encouraged to
heed them.
</p><p>
<h3>OTHER NOTES</h3>
This calculator "refuses" to return geometry for bikes with
front/center values less than 560mm on a 700c bike and 525mm on a 650c bike.
This, because of shoe overlap. Some bike makers think these minimum values
should be even higher, by 5mm or 10mm. If the calculator displays this
error message, you'll need to add reach; or you'll need to shallow the head
angle and add fork offset; or both.
</p><p>
All bike makers, custom makers included, feature a minimum head tube length
for the bikes they can build. Find this value out, from your chosen custom
builder(s), because this calculator doesn't know what those minimum values
are for each builder. Keep in mind that if your custom builder builds with
external headsets, you must change the default lower headset stack in the
calculator, and you must account for the potentially significant upper
stack.
</p><p>
Morphologies: The calculator generates a geometry for long-legged,
short-torsoed riders by employing two tactical changes, designed to grant
the rider a lower center of mass, and a longer base of support for his
otherwise high center of mass. When you select "Long Legged" the calculator
drops the bottom bracket 10 extra millimeters below the bike's centerline;
and it also shallows the head angle one degree, and adds 6mm of fork offset
in order to keep the trail a constant value (our default settings generate a
trail of about 61mm, more or less). Of course, you can override these
defaults, and if your rider wishes (let us say) a higher bottom bracket
notwithstanding his high center of mass, so be it. Just change the default.
</p><p>
Yes, lengthening the front/center of the bike while keeping the cockpit
distance and trail constant can be achieved through shallowing the head
angle while adding to the fork offset. The calculator will employ this
tactic when you choose the long legged morphology option. This may result
in a fork with an offset greater than 45mm. Not many fork manufacturers
make forks with offsets greater than 45mm, so you'll want to check
availability before you build or cause to have built a bike requiring this
fork offset.
</p><p>
<h3>TERMS OF USE</h3>
<a name="terms"></a>
This calculator consists of a set of trigonometric and geometric equations.
It solves math equations. That's all it does. There are no warranties
expressed or implied that these geometries cause a bike to be safe, or
comfortable, or powerful, or aerodynamic, or even be ridden; or indeed can
even be built. Should you build or cause to build a bike based on
geometries calculated by this generator, you do so at your own risk. You
agree to hold harmless Slowtwitch.com, its owners, employees and contractors
against all claims arising out of your use of this calculator. You agree to
assume all risk and liability associated with using this calculator. You
agree that the final determination of an appropriate geometry rests with you
and/or any customer for whom you may be building this bike, or causing it to
be built, and with the company building the bike.
</p>
</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>

View File

@ -0,0 +1,5 @@
<div class="breadcrumb">
<a href="<? echo $main_site_url ?>">Home</a> &gt;
<a href="<? echo $main_site_url . "/Bike_Fit/index.html" ?>">Bike Fit</a> &gt;
<span class="lasttitle">F.I.S.T Custom Bike Calculator</span>
</div>

View File

@ -0,0 +1,5 @@
<? include($common_path . "/templates/include_local_listing.php"); ?>
<div class="widget-divider"></div>
<div class="advert hide-on-mobile">
<? include($common_path . "/ads/ad_300x600.html"); ?>
</div>

View File

@ -0,0 +1,151 @@
<?PHP include("config.php"); ?>
<!DOCTYPE html >
<html lang="en">
<head>
<title>&lt;:: Welcome to Slowtwitch.com ::&gt;: F.I.S.T STEM Calculator</title>
<meta name="KEYWORDS" content="bike, geometry, custom" />
<meta name="DESCRIPTION" content="Are you trying to calculate the rise and stretch of a stem? Use our calculator to help."/>
<? include($common_path . "/templates/include_global_head.php"); ?>
<? include($common_path . "/templates/google_analytics.html"); ?>
<!-- Begine script for calculator -->
<script src="js/fit_calculator.js" type="text/javascript" language="JavaScript"></script>
<!-- end script for calculator -->
</head>
<body id="home">
<? 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">
<h1>F.I.S.T STEM Calculator</h1>
<hr class="line" />
<p>All values are in millimeters! Except for angles, which are in degrees.</p>
<form name="calcForm" id="calcForm" method="post" action="stem_calc_X.php">
<div class="dtable form">
<div class="drow">
<div class="dcell name">Head Angle</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="head_tube_angle" name="head_tube_angle" value="73" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Stem Length</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="stem_length" name="stem_length" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Stem Angle</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="stem_angle" name="stem_angle" class="txt shotext"/><br />Plug in actual stem pitch. Write 0 [the number zero] for an extension <strong>perpendicular to the steerer</strong>; -6 for 6&deg; down from perpendicular, 6 for 6&deg; up; -17&deg; for a "7-shaped" stem; and so forth.</td>
</div>
</div>
<div class="drow">
<div class="dcell name">Stem Clamp Height</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="clamp" name="clamp" value="40" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Spacer Height</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="spacer" name="spacer" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Headset Topcap</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" id="headset" name="headset" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="checkbox" name="terms" /> Agree to <a href="#terms">Terms</a>
</div>
</div>
<div class="drow actions">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="hidden" name="coordinates" value="serotta_xy" />
<input type="hidden" name="stack" />
<input type="hidden" name="reach" />
<input type="button" name="calculateButton" value="Calculate" onclick="checkAgreeToTerms();" class="btn" />
<input type="button" name="allDefaultButton" value="Reset all Defaults" onclick="setAllDefaults();" class="btn" />
</div>
</div>
</div>
</form>
<p>The calculator above is designed to help fitters trained in the F.I.S.T. tri
bike fit protocol to generate geometries for custom triathlon bikes. Note
that the inputs required to use this calculator include "stack" and "reach."
These values are described at length in our <a href="/Bike_Fit/The_F.I.S.T._Method_for_fitting_triathletes_to_their_bikes_16.html ">tri bike fit articles</a> on Slowtwitch.com.
</p>
<div class="advert float-right">
<? include($common_path . "/ads/ad_300x250_roadblocks.html"); ?>
</div>
<p>
Even if the fit is performed correctly, pitfalls loom. You must have the
tools to accurately find the stack and reach of the bike that fits under the
rider. The fitter is required to account for the stem length, stem pitch,
height of the stem clamp, headset upper stack, spacers under the stem if
any, and of course the choice of aerobar. He then must have an accurate way
of generating the stack and reach measures, using either a fit bike (best is
the bike made by Exit Cycling) that accurately generates these values
(taking into consideration <a href="/Bike_Fit/Fudging_for_negative_reach_123.html">negative reach</a> if applicable), or he must use an external tool, such
as Serotta's X/Y tool.
</p>
<h3>TERMS OF USE</h3>
<p>
<a name="terms"></a>
This calculator consists of a set of trigonometric and geometric equations.
It solves math equations. That's all it does. There are no warranties
expressed or implied that these geometries cause a bike to be safe, or
comfortable, or powerful, or aerodynamic, or even be ridden; or indeed can
even be built. Should you build or cause to build a bike based on
geometries calculated by this generator, you do so at your own risk. You
agree to hold harmless Slowtwitch.com, its owners, employees and contractors
against all claims arising out of your use of this calculator. You agree to
assume all risk and liability associated with using this calculator. You
agree that the final determination of an appropriate geometry rests with you
and/or any customer for whom you may be building this bike, or causing it to
be built, and with the company building the bike.
</p>
</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>

View File

@ -0,0 +1,146 @@
<?PHP
foreach ( $_POST as $key )
{
}
$stemlength = (float)$_POST['stem_length'];
$headangle = (float)$_POST['head_tube_angle'];
$stemangle = (float)$_POST['stem_angle'];
$clamp = (float)$_POST['clamp'];
$spacer = (float)$_POST['spacer'];
$headset = (float)$_POST['headset'];
$reach = 0;
$stack = 0;
// calculate stack and reach
$stretch = ($stemlength*cos(deg2rad(90-$headangle+$stemangle))) - (($clamp/2) + $spacer + $headset)*cos(deg2rad($headangle));
$rise = ($stemlength*sin(deg2rad(90-$headangle+$stemangle))) + (($clamp/2) + $spacer + $headset)*sin(deg2rad($headangle));
//echo($xser." - (".$stemlength."*cos(deg2rad(90-".$headangle."+".$stemangle."))) - ((".$clamp."/2) + ".$spacer." + ".$headset.")*cos(deg2rad(".$headangle."))");
//$stack = $yser - ($stemlength*sin(deg2rad(90-$headangle+$stemangle))) - (($clamp/2) + $spacer + $headset)*sin(deg2rad($headangle));
$rise = round($rise, 0);
$stretch = round($stretch, 0);
//echo ("STACK: ".$stack);
//echo ("REACH: ".$reach);
//exit();
?>
<?PHP include("config.php"); ?>
<!DOCTYPE html >
<html lang="en">
<head>
<title>&lt;:: Welcome to Slowtwitch.com ::&gt;: Stem Rise &amp; Stretch Calculator</title>
<meta name="KEYWORDS" content="bike, geometry, custom" />
<meta name="DESCRIPTION" content="Are you trying to calculate the rise and stretch of a stem? Use our calculator to help."/>
<? include($common_path . "/templates/include_global_head.php"); ?>
<? include($common_path . "/templates/google_analytics.html"); ?>
<!-- Begine script for calculator -->
<script src="js/fit_calculator.js" type="text/javascript" language="JavaScript"></script>
<!-- end script for calculator -->
</head>
<body id="home">
<? 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">
<h1>F.I.S.T Stem Calculator</h1>
<hr class="line" />
<div class="clearfix">
<div class="col-2-3">
<h3>Input</h3>
<div class="dtable form">
<div class="drow">
<div class="dcell name">Head Tube Angle</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo $headangle."&deg;"; ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Stem Length</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo $stemlength."mm"; ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Stem Angle</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo $stemangle."&deg;"; ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Stem Clamp Height</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo $clamp."mm"; ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Spacer Height</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo $spacer."mm"; ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Headset Topcap</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo $headset."mm"; ?>
</div>
</div>
</div>
</div>
<div class="col-1-3">
<h3>Output</h3>
<p>Rise: <? echo $rise."mm"; ?></p>
<p>Stretch: <? echo $stretch."mm"; ?></p>
</div>
</div>
<p class="center"><a href="stem_calc.php" class="btn default">Return to the Stem Calculator</a></p>
<p>
Even if the fit is performed correctly, pitfalls loom. You must have the
tools to accurately find the stack and reach of the bike that fits under the
rider. The fitter is required to account for the stem length, stem pitch,
height of the stem clamp, headset upper stack, spacers under the stem if
any, and of course the choice of aerobar. He then must have an accurate way
of generating the stack and reach measures, using either a fit bike (best is
the bike made by Exit Cycling) that accurately generates these values
(taking into consideration <a href="/Bike_Fit/Fudging_for_negative_reach_123.html">negative reach</a> if applicable), or he must use an external tool, such
as Serotta's X/Y tool.
</p>
</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>

220
site/ads.txt Normal file
View File

@ -0,0 +1,220 @@
Insticator.com,058fb58a-5aac-432c-bb56-a8e3e300437c, DIRECT #Insticator_Version_2.0
33across.com, 0010b00001rrPUnAAM, DIRECT, bbea06d9c4d2853c
pubmatic.com, 158136, RESELLER, 5d62403b186f2ace
gumgum.com, 13318, RESELLER, ffdef49475d318a9
adtech.com, 12094, RESELLER
adtech.com, 9993, RESELLER
advangelists.com, 8d3bba7425e7c98c50f52ca1b52d3735, RESELLER, 60d26397ec060f98
rubiconproject.com, 21434, RESELLER, 0bfd66d529a55807
pubmatic.com, 158569, RESELLER, 5d62403b186f2ace
springserve.com, 868, DIRECT, a24eb641fc82e93d
contextweb.com, 526740, RESELLER, 89ff185a4c4e857c
appnexus.com, 7096, DIRECT
rhythmone.com, 1755648630, RESELLER, a670c89d4a324e47
rubiconproject.com, 18126, RESELLER, 0bfd66d529a55807
pubmatic.com, 157607, RESELLER, 5d62403b186f2ace
video.unrulymedia.com, UNRX-PUB-b7b8af13-0a12-4d37-8b27-0dc8aa90e3e2, RESELLER
advertising.com, 8656, RESELLER
lkqd.net, 39, RESELLER, 59c49fa9598a0117
spotxchange.com, 77201, RESELLER, 7842df1d2fe2db34
contextweb.com, 558458, RESELLER, 89ff185a4c4e857c
loopme.com, 5641, RESELLER, 6c8d5f95897a5a3b
tremorhub.com, u6pqo-bygoc, RESELLER, 1a4e959a1b50034a
mobfox.com, 67448, RESELLER
springserve.com, 5, RESELLER, a24eb641fc82e93d
google.com, pub-7630961163643137, DIRECT, f08c47fec0942fa0
aps.amazon.com, 70fb13d1-ab65-42ac-a7ca-0b4e680d5c92, DIRECT
openx.com, 540191398, RESELLER, 6a698e2ec38604c6
pubmatic.com, 157150, RESELLER, 5d62403b186f2ace
districtm.io, 100962, RESELLER
rubiconproject.com, 18020, RESELLER, 0bfd66d529a55807
rhythmone.com, 1654642120, RESELLER, a670c89d4a324e47
adtech.com, 12068, RESELLER
google.com, pub-0796790890307838, RESELLER, f08c47fec0942fa0
pubmatic.com, 157866, RESELLER, 5d62403b186f2ace
openx.com, 539624483, RESELLER, 6a698e2ec38604c6
rubiconproject.com, 18304, RESELLER, 0bfd66d529a55807
indexexchange.com, 186318, RESELLER
rhythmone.com, 1575167821, RESELLER
advertising.com, 10238, RESELLER
appnexus.com, 3695, RESELLER
beachfront.com, 13310, DIRECT, e2541279e8e2ca4d
EMXDGT.com, 22, DIRECT, 1e1d41537f7cad7f
Appnexus.com, 1356, RESELLER, f5ab79cb980f11d1
brightcom.com, 15800, DIRECT
google.com, pub-5231479214411897, RESELLER, f08c47fec0942fa0
google.com, pub-4207323757133151, RESELLER, f08c47fec0942fa0
lkqd.net, 49, RESELLER, 59c49fa9598a0117
advertising.com, 23302, RESELLER
freewheel.tv, 118529, RESELLER
freewheel.tv, 118537, RESELLER
beachfront.com, 1333, RESELLER, e2541279e8e2ca4d
advertising.com, 2270, RESELLER
advertising.com, 26347, RESELLER
advertising.com, 23889, RESELLER
conversantmedia.com, 40291, DIRECT, 03113cd04947736d
appnexus.com, 4052, RESELLER
openx.com, 540031703, RESELLER, 6a698e2ec38604c6
contextweb.com, 561998, RESELLER, 89ff185a4c4e857c
pubmatic.com, 158100, RESELLER, 5d62403b186f2ace
districtm.io, 100683, DIRECT, 3fd707be9c4527c3
appnexus.com, 1908, RESELLER, f5ab79cb980f11d1
lkqd.net, 252, RESELLER, 59c49fa9598a0117
lkqd.com, 252, RESELLER, 59c49fa9598a0117
springserve.com, 105, RESELLER, a24eb641fc82e93d
advertising.com, 3531, RESELLER
rhythmone.com, 2968119028, RESELLER, a670c89d4a324e47
pubmatic.com, 157903, RESELLER, 5d62403b186f2ace
openx.com, 540454059, RESELLER, 6a698e2ec38604c6
e-planning.net, ca658eed27b34b00, DIRECT
rubiconproject.com, 12186, RESELLER, 0bfd66d529a55807
pubmatic.com, 156631, RESELLER, 5d62403b186f2ace
rhythmone.com, 1767353092, RESELLER, a670c89d4a324e47
indexexchange.com, 190243, DIRECT
valo.ai, e4dffdb0d6a5e665b9f98e11abf61fa7, Direct
improvedigital.com, 1066, RESELLER
contextweb.com, 561954, RESELLER, 89ff185a4c4e857c
advertising.com, 18632, RESELLER
lkqd.net, 286, RESELLER, 59c49fa9598a0117
beachfront.com, 4469, RESELLER, e2541279e8e2ca4d
aniview.com, 57712eeef83f155c398b4567, reseller
cosmoshq.com, 1002, DIRECT
gumgum.com, 13344, DIRECT, ffdef49475d318a9
appnexus.com, 1001, reseller, f5ab79cb980f11d1
appnexus.com, 1942, reseller, f5ab79cb980f11d1
appnexus.com, 2758, reseller, f5ab79cb980f11d1
appnexus.com, 3135, reseller, f5ab79cb980f11d1
bidtellect.com, 1407, reseller, 1c34aa2d85d45e93
contextweb.com, 558355, reseller
openx.com, 537120563, reseller, 6a698e2ec38604c6
openx.com, 537149485, reseller, 6a698e2ec38604c6
spotx.tv, 147949, reseller, 7842df1d2fe2db34
spotxchange.com, 147949, reseller, 7842df1d2fe2db34
google.com, pub-9557089510405422, reseller, f08c47fec0942fa0
google.com, pub-3848273848634341, reseller, f08c47fec0942fa0
rhythmone.com, 78519861, reseller
appnexus.com, 7597, reseller, f5ab79cb980f11d1
33across.com, 0013300001r0t9mAAA, reseller
appnexus.com, 10239, reseller, f5ab79cb980f11d1
rubiconproject.com, 16414, reseller, 0bfd66d529a55807
pubmatic.com, 156423, reseller, 5d62403b186f2ace
openx.com, 539392223, reseller, 6a698e2ec38604c6
rhythmone.com, 2439829435, reseller, a670c89d4a324e47
emxdgt.com, 326, reseller, 1e1d41537f7cad7f
pubmatic.com, 157897, reseller, 5d62403b186f2ace
synacor.com, 82151, RESELLER, e108f11b2cdf7d5b
coxmt.com, 2000067995202, RESELLER
appnexus.com, 9316, RESELLER, f5ab79cb980f11d1
pubmatic.com, 156344, RESELLER, 5d62403b186f2ace
rubiconproject.com, 13344, RESELLER, 0bfd66d529a55807
improvedigital.com, 1277, DIRECT
improvedigital.com, 1276, DIRECT
indexexchange.com, 187071, DIRECT, 50b1c356f2c5c8fc
indexexchange.com, 187482, DIRECT, 50b1c356f2c5c8fc
openx.com, 537117488, RESELLER, 6a698e2ec38604c6
openx.com, 540105394, RESELLER, 6a698e2ec38604c6
Pubmatic.com, 95054, DIRECT, 5d62403b186f2ace
Pubmatic.com, 95054, RESELLER, 5d62403b186f2ace
Pubmatic.com, 157119, DIRECT, 5d62403b186f2ace
Pubmatic.com, 157119, RESELLER, 5d62403b186f2ace
contextweb.com, 561664, RESELLER, 89ff185a4c4e857c
rhythmone.com, 136898039, DIRECT, a670c89d4a324e47
Rhythmone.com, 527383184, DIRECT, a670c89d4a324e47
RTBHOUSE.COM, eDr4TCudLLHttcPmswNj, DIRECT
rubiconproject.com, 17062, DIRECT, 0bfd66d529a55807
rubiconproject.com, 17980, DIRECT, 0bfd66d529a55807
smartadserver.com, 3262, DIRECT
smartadserver.com, 3262, RESELLER
contextweb.com, 560288, RESELLER, 89ff185a4c4e857c
pubmatic.com, 156439, RESELLER
pubmatic.com, 154037, RESELLER
pubmatic.com, 156030, RESELLER, 5d62403b186f2ace
rubiconproject.com, 16114, RESELLER, 0bfd66d529a55807
rubiconproject.com, 13132, RESELLER, 0bfd66d529a55807
openx.com, 537149888, RESELLER, 6a698e2ec38604c6
appnexus.com, 3703, RESELLER, f5ab79cb980f11d1
groundtruth.com, 107, RESELLER, 81cbf0a75a5e0e9a
districtm.io, 101760, RESELLER, 3fd707be9c4527c3
loopme.com, s-2411, RESELLER, 6c8d5f95897a5a3b
loopme.com, 5679, RESELLER, 6c8d5f95897a5a3b
sonobi.com, e315a43aa9, DIRECT, d1a215d9eb5aee9e
rhythmone.com, 1059622079, RESELLER, a670c89d4a324e47
contextweb.com, 560606, RESELLER, 89ff185a4c4e857c
sonobi.com, 70bc4d0919, DIRECT, d1a215d9eb5aee9e
sovrn.com, 257618, DIRECT, fafdf38b16bf6b2b
lijit.com, 257618, DIRECT, fafdf38b16bf6b2b
appnexus.com, 1360, RESELLER, f5ab79cb980f11d1
gumgum.com, 11645, RESELLER, ffdef49475d318a9
openx.com, 538959099, RESELLER, 6a698e2ec38604c6
openx.com, 539924617, RESELLER, 6a698e2ec38604c6
pubmatic.com, 137711, RESELLER, 5d62403b186f2ace
pubmatic.com, 156212, RESELLER, 5d62403b186f2ace
pubmatic.com, 156700, RESELLER, 5d62403b186f2ace
rubiconproject.com, 17960, RESELLER, 0bfd66d529a55807
spotxchange.com, 110408, RESELLER, 7842df1d2fe2db34
spotx.tv, 110408, RESELLER, 7842df1d2fe2db34
springserve.com, 873, DIRECT, a24eb641fc82e93d
beachfront.com, 4969, RESELLER, e2541279e8e2ca4d
advertising.com, 26282, RESELLER
pubmatic.com, 157310, RESELLER, 5d62403b186f2ace
rhythmone.com, 2968119028, DIRECT, a670c89d4a324e47
spotxchange.com, 239904, RESELLER, 7842df1d2fe2db34
spotx.tv, 239904, RESELLER, 7842df1d2fe2db34
contextweb.com, 561910, RESELLER, 89ff185a4c4e857c
adtech.com, 4937, RESELLER
adtech.com, 11605, RESELLER
pubmatic.com, 158135, RESELLER, 5d62403b186f2ace
contextweb.com, 562056, RESELLER, 89ff185a4c4e857c
pubmatic.com, 148800, RESELLER, 5d62403b186f2ace
pubmatic.com, 156957, RESELLER, 5d62403b186f2ace
openx.com, 537143737, RESELLER, 6a698e2ec38604c6
openx.com, 540259865, RESELLER, 6a698e2ec38604c6
openx.com, 540423120, RESELLER, 6a698e2ec38604c6
google.com, pub-1772611089853771, RESELLER, f08c47fec0942fa0
google.com, pub-8268618999035658, RESELLER, f08c47fec0942fa0
google.com, pub-9328633604439863, RESELLER, f08c47fec0942fa0
google.com, pub-6968738577620513, RESELLER, f08c47fec0942fa0
google.com, pub-6254331789601537, RESELLER, f08c47fec0942fa0
ucfunnel.com, par-488A3E6BD8D997D0ED8B3BD34D8BA4B, RESELLER
advertising.com, 19623, RESELLER
indexexchange.com, 183965, RESELLER, 50b1c356f2c5c8fc
pubmatic.com, 156084, RESELLER, 5d62403b186f2ace
pubmatic.com, 156325, RESELLER, 5d62403b186f2ace
pubmatic.com, 156458, RESELLER, 5d62403b186f2ace
rubiconproject.com, 18222, RESELLER, 0bfd66d529a55807
districtm.io, 101769, RESELLER, 3fd707be9c4527c3
synacor.com, 82129, DIRECT, e108f11b2cdf7d5b
rubiconproject.com, 13344, DIRECT, 0bfd66d529a55807
beachfront.com, 5278, RESELLER, e2541279e8e2ca4d
openx.com, 539337395, RESELLER, 6a698e2ec38604c6
openx.com, 540170114, RESELLER, 6a698e2ec38604c6
pubmatic.com, 157568, RESELLER, 5d62403b186f2ace
advertising.com, 23218, RESELLER
adtech.com, 23218, RESELLER
beachfront.com, 10402, RESELLER, e2541279e8e2ca4d
freewheel.tv, 283074, RESELLER
freewheel.tv, 957521, RESELLER
freewheel.tv, 123433, RESELLER
districtm.io, 101633, DIRECT, 3fd707be9c4527c3
ucfunnel.com, par-BE7E7ADB8D34EE2BF7BBD2899BB62A77, DIRECT
aralego.com, par-BE7E7ADB8D34EE2BF7BBD2899BB62A77, DIRECT
appnexus.com, 9393, DIRECT
ssp.ynxs.io, 185, DIRECT
appnexus.com, 10617, DIRECT
advertising.com, 25034, DIRECT
aps.amazon.com,e9ebbf2b-e30e-4f2f-826f-2b583b80ad97,DIRECT
pubmatic.com,157150,RESELLER,5d62403b186f2ace
openx.com,540191398,RESELLER,6a698e2ec38604c6
rubiconproject.com,18020,RESELLER,0bfd66d529a55807
appnexus.com,1908,RESELLER,f5ab79cb980f11d1
smaato.com,1100044650,RESELLER,07bcf65f187117b4
adtech.com,12068,RESELLER,e1a5b5b6e3255540
ad-generation.jp,12474,RESELLER,7f4ea9029ac04e53
districtm.io,100962,RESELLER,3fd707be9c4527c3
appnexus.com,3663,RESELLER,f5ab79cb980f11d1
rhythmone.com,1654642120,RESELLER,a670c89d4a324e47
yahoo.com,55029,RESELLER,e1a5b5b6e3255540
gumgum.com,14141,RESELLER,ffdef49475d318a9
indexexchange.com,192410,RESELLER,50b1c356f2c5c8fc
pubmatic.com,160006,RESELLER,5d62403b186f2ace
pubmatic.com,160096,RESELLER,5d62403b186f2ace

336
site/articles/globals.txt Normal file
View File

@ -0,0 +1,336 @@
{
'cat_match' => 'sub {
my $fullname = shift || return;
my $url = $DB->table(\'Category\')->as_url($fullname);
if (index($url, "Bike_Fit") != -1) {
return "true";
} else {
return "false";
}
}',
'category_url' => 'sub {
my $fullname = shift || return;
my $url = $DB->table(\'Category\')->as_url($fullname);
return $url;
}',
'comscore' => '<!-- Begin comScore Tag -->
<script>
var _comscore = _comscore || [];
_comscore.push({ c1: "2", c2: "10037191" });
(function() {
var s = document.createElement("script"), el = document.getElementsByTagName("script")[0]; s.async = true;
s.src = (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js";
el.parentNode.insertBefore(s, el);
})();
</script>
<noscript>
<img src="https://b.scorecardresearch.com/p?c1=2&c2=10037191&cv=2.0&cj=1" />
</noscript>
<!-- End comScore Tag -->',
'convert_nl_br' => 'sub {
my $tags = GT::Template->tags;
foreach (keys %$tags) {
next if ($_ eq \'RelatedArticles\');
$tags->{$_} =~ s/\r//g;
$tags->{$_} =~ s/\n/<br \/>/g;
}
return $tags;
}',
'dans_series' => '- <a href="http://www.slowtwitch.com/News/F.I.S.T._Workshop_schedule_set_957.html">F.I.S.T. Workshops</a>
<br />- <a href="http://www.slowtwitch.com/Fit_Calculator/fit_calculator.php">Geometry Calculator</a>
<br />- <a href="http://www.slowtwitch.com/retailers/">Retailers</a>
<br />- <a href="http://www.slowtwitch.com/stackreach/index.php">Stack // Reach</a>
<br />- <a href="http://training.slowtwitch.com/">Training Log</a>
<br />- <a href="http://www.slowtwitch.com/triclubs/">Triathlon Clubs</a>',
'forum_url' => 'sub {
return \'http://forumdev.slowtwitch.com\';
}',
'ga_link_tracker' => '<!--Google Analytics Link Tracker -->
<script type="text/javascript">
function recordOutboundLink(link, category, action) {
_gat._getTrackerByName()._trackEvent(category, action);
setTimeout(\'document.location = "\' + link.href + \'"\', 100);
}
</script>',
'get_detailed_url' => 'sub {
my $id = shift;
return $CFG->{build_detail_url} . \'/\' . $DB->table(\'Links\')->detailed_url($id);
}',
'get_footer_categories' => 'sub {
# usage ($depth, $sb, $so);
my $category = $DB->table(\'Category\');
my $depth = shift || 0;
my $sb = shift || "Name";
my $so = shift ||"ASC";
my $pos = shift || 1;
$category->select_options("ORDER BY $sb $so");
my $sth = $category->select( { CatDepth => $depth, Cat_Pos => $pos });
my @loop;
while (my $link = $sth->fetchrow_hashref) {
$link->{URL} = "$CFG->{build_root_url}/" . $category->as_url($link->{Full_Name}) . "/" . ($CFG->{build_index_include} ? $CFG->{build_index} : \'\');
push @loop, $link;
}
return { \'category_links_loop\' => \@loop };
}',
'get_header_categories' => 'sub {
# usage ($depth, $sb, $so);
my $category = $DB->table(\'Category\');
my $depth = shift || 0;
my $sb = shift || "Name";
my $so = shift ||"ASC";
my $pos = shift || 0;
$category->select_options("ORDER BY $sb $so");
my $sth = $category->select( { CatDepth => $depth, Cat_Pos => $pos });
my @loop;
while (my $link = $sth->fetchrow_hashref) {
$link->{URL} = "$CFG->{build_root_url}/" . $category->as_url($link->{Full_Name}) . "/" . ($CFG->{build_index_include} ? $CFG->{build_index} : \'\');
push @loop, $link;
}
return { \'category_links_loop\' => \@loop };
}',
'get_links' => 'sub {
# usage ($type, $sb, $so);
my $db = $DB->table(\'Links\');
my $type = shift || "editorial";
my $sb = shift || "Add_Date";
my $so = shift ||"DESC";
my $mh = shift || 10;
$db->select_options("ORDER BY $sb $so", "LIMIT $mh");
my $sth = $db->select({ Type => $type }, VIEWABLE);
my @loop;
while (my $link = $sth->fetchrow_hashref) {
$link = Links::SiteHTML::tags(\'link\',$link);
push @loop, $link;
}
return { $type . \'_links_loop\' => \@loop };
}',
'get_links_categories' => 'sub {
my $links = shift;
my @ids = map { $_->{ID} } @$links;
my $catlink = $DB->table(\'CatLinks\',\'Category\');
my %names = $catlink->select(\'LinkID\', \'Full_Name\', { LinkID => \@ids })->fetchall_list;
return \%names;
}',
'glam_widget' => '<a href="mailto:slowman@slowtwitch.com?cc=lars@slowtwitch.com&Subject=Send me a Slowtwitch Media Guide"><img src="http://www.slowtwitch.com/images/advertise_160.png"></a>
',
'google_analytics' => '<!-- Google Analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push([\'_setAccount\', \'UA-2419103-1\']);
_gaq.push([\'_setDomainName\', \'.slowtwitch.com\']);
_gaq.push([\'_trackPageview\']);
(function() {
var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;
ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';
var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>',
'main_site_url' => 'sub {
return \'https://www.slowtwitch.com\';
}',
'old_related_articles' => 'sub {
my $related = shift || return;
my @ids = split ("\n",$related);
my @loop;
my $db = $DB->table(\'Links\');
require Links::SiteHTML;
foreach my $id (@ids) {
my $link = $db->get($id);
$link = Links::SiteHTML::tags(\'link\',$link);
push @loop, $link;
}
return { related_articles_loop => \@loop };
}',
'poll' => '<!--#include virtual="/cgi-bin/ssi_poll.cgi?poll=home" -->',
'quantcast' => '<!-- Quantcast Tag -->
<script type="text/javascript">
var _qevents = _qevents || [];
(function() {
var elem = document.createElement(\'script\');
elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js";
elem.async = true;
elem.type = "text/javascript";
var scpt = document.getElementsByTagName(\'script\')[0];
scpt.parentNode.insertBefore(elem, scpt);
})();
_qevents.push({
qacct:"p-wtcPAHdnETGn_"
});
</script>
<noscript>
<div style="display:none;">
<img src="//pixel.quantserve.com/pixel/p-wtcPAHdnETGn_.gif" border="0" height="1" width="1" alt="Quantcast"/>
</div>
</noscript>
<!-- End Quantcast tag -->',
'related_articles' => 'sub {
my $related = shift || return;
my @ids = split ("\n",$related);
my @loop;
my $db = $DB->table(\'Links\');
my $linkid = shift;
my $cond = GT::SQL::Condition->new();
$cond->add(\'RelatedArticles\',\'like\', \'%\' . $linkid . \'%\');
my $sth = $db->select($cond);
my $seen = {};
while (my $link = $sth->fetchrow_hashref()) {
$link = Links::SiteHTML::tags(\'link\',$link);
my @rids = split("\n", $link->{RelatedArticles});
my $found = 0;
for (@rids) {
my $tid = $_;
$tid =~ s/\s+//g;
$found = 1 if ($tid == $linkid);
}
push @loop, $link if ($found);
$seen->{$link->{ID}} = 1 if ($found);
}
require Links::SiteHTML;
foreach my $id (@ids) {
next if ($seen->{$id});
my $rlink = $db->get($id);
if ($rlink) {
$rlink = Links::SiteHTML::tags(\'link\',$rlink);
push @loop, { %$rlink };
}
}
return { related_articles_loop => \@loop };
}
',
'related_photos' => 'sub {
my $related = shift || return;
my @ids = split ("\n",$related);
my @loop;
use lib \'/home/slowtwitch/slowtwitch.com/cgi-bin/photos/admin\';
Links::init(\'/home/slowtwitch/slowtwitch.com/cgi-bin/photos/admin\');
require Plugins::SlideShow;
my $DBH = new GT::SQL \'/home/slowtwitch/slowtwitch.com/cgi-bin/photos/admin/defs\';
my $db = $DBH->table(\'Links\');
require Links::SiteHTML;
foreach my $id (@ids) {
my $link = $db->get($id);
my $fh = $db->file_info("Image1_thumbnail", $link->{ID});
my $fdir = $fh->File_Directory();
my $full_path = "$fh";
my $rel_path = $full_path;
$rel_path =~ s,$fdir,,;
$rel_path =~ s,%,%25,g;
$link->{Image1_thumbnail_path} = $rel_path;
$link = Links::SiteHTML::tags(\'link\',$link);
push @loop, $link;
}
return { related_photos_loop => \@loop };
}',
'replace_line_break' => 'sub {
my $text = shift;
$text =~ s/<br\s*\/?>/ /g;
return $text;
}',
'rewrite_detail_url' => 'sub {
my $tags = GT::Template->tags;
if ($tags->{detailed_url} and !$IN->param(\'d\')) {
$tags->{detailed_url} =~ s/(\d+)\.html$/j$1.html/;
}
return $tags;
}',
'round' => 'sub {
my $num = shift;
return sprintf("%.1f", $num - 0.05);
}
',
'shorten_it' => 'sub {
my $str = shift;
my $length = shift || 160;
if ($length > 0 and length $str > $length) {
$str = substr($str,0,$length);
$str =~ s/\s+\w+$//g;
$str .= " ...";
}
return $str;
}',
'sidenav' => '<ul class="sidenav">
<li><a href="http://www.slowtwitch.com/retailers/">Bike Shops</a></li>
<li><a href="http://www.slowtwitch.com/coaches/">Coaches</a></li>
<li><a href="http://www.slowtwitch.com/Bike_Fit/F.I.S.T._2010/11_Schedule_live_1426.html">F.I.S.T. Workshops</a></li>
<li><a href="http://www.slowtwitch.com/fitters/">Fitters</a></li>
<li><a href="http://www.slowtwitch.com/Fit_Calculator/fit_calculator.php">Geometry Calculator</a></li>
<li><a href="http://www.slowtwitch.com/runshops/">Running Stores</a></li>
<li><a href="http://www.slowtwitch.com/stackreach/">Stack // Reach</a></li>
<li><a href="http://training.slowtwitch.com/">Training Log</a></li>
<li><a class="last" href="http://www.slowtwitch.com/triclubs/">Triathlon Clubs</a></li>
</ul>',
'sidenav_fitter' => '<ul class="sidenav">
<li><a href="http://www.slowtwitch.com/Bike_Fit/index.html">Bike Fit Articles</a></li>
<li><a href="http://www.slowtwitch.com/Bike_Fit/F_I_S_T__Workshops/index.html">F.I.S.T. Workshops </a></li>
<li><a href="http://www.slowtwitch.com/stackreach/">Stack/Reach Database</a></li>
<li><a href="http://www.slowtwitch.com/Fit_Calculator/stem_calc.php">Stem Calculator</a></li>
<li><a href="http://www.slowtwitch.com/Fit_Calculator/bar_bore_calc.php">Bar to HT Calculator</a></li>
<li><a href="http://www.slowtwitch.com/Fit_Calculator/fit_calculator.php">Tri Geometry Calculator</a></li>
<li><a href="http://www.slowtwitch.com/fitters/">Fitters Database</a></li>
<li><a href="http://www.slowtwitch.com/retailers/">Bike Shops Database</a></li>
<li><a class="last" href="http://forum.slowtwitch.com/gforum.cgi?forum=10;">Fitter\'s Forum</a></li>
</ul>',
'site_title' => '&lt;:: Welcome to Slowtwitch.com ::&gt;',
'site_title_short' => 'Slowtwitch.com',
'slowdrive' => '<form action="https://secure.slowtwitch.com/cgi-bin/glist.cgi" method="post" name="subdrive">
<input type="hidden" name="do" value="user_subscribe">
<input type=hidden name="lid" value="158">
<div style="width: 158px; border: 1px solid #000000; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;">
<span style="float: left; padding-top: 0px; margin-top: 0px; padding-bottom: 0px; margin-bottom: 0px;"><img src="http://www.slowtwitch.com/images/glinks/slowtwitch_subdrive_top_blugry_160.png" style="padding-bottom: 0px; margin-bottom: 0px;"/></span>
<span style="clear: both; float: left; padding-top: 0px; margin-top: 0px; padding-bottom: 0px; margin-bottom: 0px;"><input type="text" id="searchbox" name="email" class="text" style="width: 130px; vertical-align: baseline; margin-top: 8px; margin-left: 4px;"></span>
<span style="float: right; padding-top: 0px; margin-top: 0px; padding-bottom: 0px; margin-bottom: 0px;"><img src="http://www.slowtwitch.com/images/glinks/clear_shim.gif" height=1 width=4><input type="image" value="Submit" alt="Sign Up!" src="http://www.slowtwitch.com/images/glinks/slowtwitch_subdrive_right_blugry.png"></span>
<img src="http://www.slowtwitch.com/images/glinks/slowtwitch_subdrive_bottom_blugry_160.png" style="border: none; vertical-align: bottom;" /></div>
</form>',
'thumbnail' => 'sub {
my $link = shift;
my $image1_thumbnail_path = shift;
if ($image1_thumbnail_path) {
return $image1_thumbnail_path;
} elsif ($link->{Link_Type} ne \'video\') {
return;
}
if ($link->{Thumbnail_URL} and $link->{Thumbnail_URL} ne \'http://\') {
return $link->{Thumbnail_URL};
} else {
require Plugins::ConvertVideo;
my $field = Plugins::ConvertVideo::get_file_path($link->{ID}, "thumbnail_file_field");
if ($field->{thumbnail_file_field_path}) {
return $field->{thumbnail_file_field_path};
}
}
return;
}',
'ticker_loop' => 'sub {
my @coupon_links_loop;
my $db = $DB->table(\'Ticker\');
my $sth = $db->do(\'SELECT ticker_text, ticker_link FROM glinks_Ticker ORDER BY ticker_text ASC\');
while (my $result = $sth->fetchrow_hashref) {
push @coupon_links_loop, {
coupon => $result->{ticker_text},
url => $result->{ticker_link}
};
}
return { \'coupon_links_loop\' => \@coupon_links_loop };
}'
};
# vim:syn=perl:ts=4:noet

183
site/articles/language.txt Normal file
View File

@ -0,0 +1,183 @@
{
'ADD_BADREFER' => 'Sorry, this site does not accept submissions from \'%s\'.',
'ADD_BADSTATUS' => 'Your link could not be added because it is not accessible: %s.',
'ADD_ILLEGALVAL' => '%s cannot contain the value \'%s\'',
'ADD_INVALIDCAT' => 'Unable to find category with ID \'%s\'.',
'ADD_NOCATEGORIES' => 'There are no categories to add a link to.',
'ADD_NOCATEGORY' => 'You did not specify a category for this link.',
'ADD_NOTNULL' => 'Column %s cannot be left blank.',
'ADD_SELCAT' => 'Please first visit the category you wish to add or move your link to, then click on Add/Modify a Link.',
'ADD_UNIQUE' => 'The column \'%s\' must be unique, and already has an entry \'%s\'.',
'BOOKMARK_BAD_FOLDER' => 'Please enter a valid folder name.',
'BOOKMARK_BAD_FOLDER_ID' => 'There is no folder with the id \'%s\'.',
'BOOKMARK_COMMENTS_EDITED' => 'The comment has been updated.',
'BOOKMARK_DISABLED' => 'Bookmarks have been disabled.',
'BOOKMARK_FOLDER_DEFAULT' => 'You can\'t remove a default folder.',
'BOOKMARK_FOLDER_DUPLICATE' => 'A folder with name \'%s\' already exists.',
'BOOKMARK_FOLDER_INVALID' => 'The folder is invalid.',
'BOOKMARK_FOLDER_LIMIT' => 'You have reached your folder limit and cannot create any more.',
'BOOKMARK_FOLDER_MODIFIED' => 'The folder has been updated.',
'BOOKMARK_FOLDER_NOTEMPTY' => 'You cannot delete a folder that is not empty.',
'BOOKMARK_FOLDER_NOTEXISTS' => 'The folder does not exist.',
'BOOKMARK_FOLDER_NOTPUBLIC' => 'The folder you tried to access is not open to the public.',
'BOOKMARK_FOLDER_NO_MOVE' => 'You cannot move links to the folder with id \'%s\'.',
'BOOKMARK_FOLDER_REMOVED' => 'The folder %s has been removed.',
'BOOKMARK_LINK_ADDED' => 'The link has been bookmarked.',
'BOOKMARK_LINK_EXISTS' => 'This link has already been bookmarked in the selected folder.',
'BOOKMARK_LINK_LIMIT' => 'You may not add any more links as you have reached your limit.',
'BOOKMARK_LINK_MOVED' => '%s link(s) have been moved to folder %s.',
'BOOKMARK_LINK_NOTEXISTS' => 'The link with id \'%s\' doesn\'t exist in your bookmarks.',
'BOOKMARK_LINK_REMOVED' => '%s link(s) have been removed from your bookmarks.',
'BOOKMARK_NO_ACTION' => 'No action passed.',
'BOOKMARK_PREFERENCES' => 'The bookmark preferences have been updated.',
'BOOKMARK_PREF_INVALIDPERPAGE' => 'Links per page must be greater than 0.',
'BOOKMARK_PUBLIC_USER' => 'You do not have permission to access %s\'s folders.',
'BOOKMARK_USER_NOTEXISTS' => 'The user %s does not exist.',
'BUILD_DETAILED_ARGS' => 'Invalid argument passed to build_detailed: %s',
'BUILD_DETAILED_DISABLED' => 'Detailed pages are not enabled.',
'BUILD_DETAILED_EXPIRED' => 'The link has not been paid for or has expired.',
'BUILD_DETAILED_INVALIDID' => 'Invalid link id passed to build_detailed: %s',
'BUILD_DETAILED_UNVAL' => 'The link has not yet been validated.',
'DATE_UNIT_DAY' => 'Day',
'DATE_UNIT_DAYS' => 'Days',
'DATE_UNIT_MONTH' => 'Month',
'DATE_UNIT_MONTHS' => 'Months',
'DATE_UNIT_WEEK' => 'Week',
'DATE_UNIT_WEEKS' => 'Weeks',
'DATE_UNIT_YEAR' => 'Year',
'DATE_UNIT_YEARS' => 'Years',
'FILE_TABLE' => 'Table "%s" could not be loaded because "%s".',
'FILE_TABLEFORMAT' => 'Table name for request improperly formed or possibly insecure.',
'FILE_UNKNOWN' => 'Unknown File requested.',
'GENERAL_BANNED' => 'Your host has been banned; please contact the site owner for details.',
'GENERAL_DISABLED' => 'The site is down for maintenance, please try again shortly.',
'GENERAL_ERROR' => 'An error has occurred.',
'JUMP_INVALIDID' => 'Unable to find link with id: \'%s\'.',
'LINKS_ADD' => 'Add a Link',
'LINKS_ADD_SUCCESS' => 'Link Added',
'LINKS_BOOKMARK' => 'Bookmarks',
'LINKS_COOL' => 'Cool',
'LINKS_EMAILPASS' => 'Forgotten Password',
'LINKS_ERROR' => 'Error',
'LINKS_LOGIN' => 'User Login',
'LINKS_MODIFY' => 'Modify a Link',
'LINKS_MODIFY_SUCCESS' => 'Link Modified',
'LINKS_NEW' => 'New',
'LINKS_NEWSLETTER' => 'Newsletter',
'LINKS_PAGE' => 'Page %s',
'LINKS_PAYMENT' => 'Payment',
'LINKS_PAYMENT_SUCCESS' => 'Payment Confirmation',
'LINKS_RATE' => 'Rate a Link',
'LINKS_REVIEW' => 'Reviews',
'LINKS_REVIEW_ADD' => 'Add a Review',
'LINKS_REVIEW_EDIT' => 'Edit Review',
'LINKS_SEARCH' => 'Search',
'LINKS_SEARCH_RESULTS' => 'Search Results',
'LINKS_SIGNUP' => 'User Sign Up',
'LINKS_TOP' => 'Home',
'LINKS_TOPRATED' => 'Top Rated Links',
'LINKS_VALIDATE' => 'Validation',
'MODIFY_BADSTATUS' => 'Your link could not be modified because it is not accessible: %s.',
'MODIFY_BADURL' => 'We were unable to find the URL \'%s\' in the database. Please make sure you typed it in exactly as it appears in the directory.',
'MODIFY_INVALIDLINKID' => 'Invalid link ID.',
'MODIFY_NOCATEGORY' => 'You did not specify a category for this link.',
'MODIFY_NOLINKS' => 'You do not have any links to modify.',
'MODIFY_NOTOWNER' => 'You are not authorized to modify this link.',
'MODIFY_NOURL' => 'You did not specify a link to modify.',
'MODIFY_REJECTSUB' => 'Your change has been rejected.',
'MODIFY_SELCAT' => 'Before you can modify your link, please go to the category your link is in, or the category you want to put it in and click modify.',
'NEWSLETTERERR_ALREADYSUB' => 'You are already subscribed to the Newsletter.',
'NEWSLETTERERR_NOACTION' => 'You did not specify what you want to do with the list.',
'NEWSLETTERERR_NOCATSUB' => 'You didn\'t specify which category to subscribe to.',
'NEWSLETTERERR_NOCATUNSUB' => 'You didn\'t specify which category to unsubscribe from.',
'NEWSLETTERERR_NOTSUB' => 'You aren\'t subscribed to the Newsletter.',
'NEWSLETTER_CATSUB' => 'You have subscribed to the selected categories.',
'NEWSLETTER_CATUNSUB' => 'You have unsubscribed from the selected categories.',
'NEWSLETTER_CATUPDATED' => 'Your subscriptions have been updated.',
'NEWSLETTER_ROOTCAT' => 'Home',
'NEWSLETTER_SUBSCRIBED' => 'You have successfully subscribed to the Newsletter.',
'NEWSLETTER_UNSUBSCRIBED' => 'You have successfully unsubscribed from the Newsletter.',
'PAGE_INVALIDCAT' => 'Category \'%s\' does not exist.',
'PAGE_INVALIDDETAIL' => 'Unable to find detailed page: \'%s\'.',
'PAYLOG_DEL_SUCCESS' => 'Payment log entry deleted.',
'PAYLOG_INVALID_ID' => 'Invalid log ID.',
'PAYMENTERR_DECLINED' => 'Your payment was declined.',
'PAYMENTERR_DIRECT' => 'Your payment could not be processed. Please check the fields below and resubmit your payment.',
'PAYMENTERR_INVALIDCATID' => 'Invalid category ID.',
'PAYMENTERR_INVALIDLEVEL' => 'You have selected an invalid payment level.',
'PAYMENTERR_INVALIDLINKID' => 'Invalid link ID.',
'PAYMENTERR_INVALIDMETHOD' => 'You have selected an invalid payment method.',
'PAYMENTERR_INVALIDTERM' => 'You have selected an invalid payment term.',
'PAYMENTERR_NOLEVEL' => 'You must select a payment level.',
'PAYMENTERR_NOMETHOD' => 'You must select a payment method.',
'PAYMENTERR_NOTACCEPTED' => 'Payments are not accepted for the category the link is in.',
'PAYMENTERR_NOTOWNER' => 'You can only make payments to your own links.',
'PAYMENT_CURRENCY_FORMAT' => '$%s ',
'PAYMENT_DIRECT_AuthorizeDotNet' => 'Authorize.Net',
'PAYMENT_DIRECT_Moneris' => 'Moneris',
'PAYMENT_REMOTE_2CheckOut' => '2CheckOut',
'PAYMENT_REMOTE_APPROVED' => 'Approved remote payment received from %s',
'PAYMENT_REMOTE_CANCELLED' => 'Cancelled payment notification received from %s',
'PAYMENT_REMOTE_INVALIDIP' => 'A payment notification was received from %s with an unauthorized IP address.',
'PAYMENT_REMOTE_INVALIDPW' => 'A payment notification was received from %s with an invalid password.',
'PAYMENT_REMOTE_Manual' => 'Manual',
'PAYMENT_REMOTE_PayPal' => 'PayPal',
'PAYMENT_REMOTE_RECURRING_ACCEPTED' => 'Recurring payment notification received from %s',
'PAYMENT_REMOTE_RECURRING_DECLINED' => 'Declined payment notification received from %s',
'PAYMENT_REMOTE_REFUND' => 'Notification of payment refund received from %s',
'PAYMENT_REMOTE_WorldPay' => 'WorldPay',
'PAYMENT_TYPE_AMEX' => 'American Express',
'PAYMENT_TYPE_DELTA' => 'Delta',
'PAYMENT_TYPE_DINERS' => 'Diners Club',
'PAYMENT_TYPE_DISC' => 'Discover',
'PAYMENT_TYPE_EURO' => 'Eurocard',
'PAYMENT_TYPE_JCB' => 'JCB',
'PAYMENT_TYPE_MANUAL' => 'Manual',
'PAYMENT_TYPE_MC' => 'MasterCard',
'PAYMENT_TYPE_NOVA' => 'Nova',
'PAYMENT_TYPE_PAYPAL' => 'PayPal',
'PAYMENT_TYPE_SOLO' => 'Solo',
'PAYMENT_TYPE_SWITCH' => 'Switch',
'PAYMENT_TYPE_VISA' => 'VISA',
'PAYMENT_TYPE_VISA_DEBIT' => 'VISA Debit',
'RANDOM_NOLINKS' => 'No available links.',
'RATE_INVALIDID' => 'Unable to find link with ID: \'%s\'.',
'RATE_INVALIDRATE' => 'Please enter a number from 1 to 10.',
'RATE_VOTED' => 'You have already voted for this link.',
'REVIEW_ADD_WAIT' => 'You have already submitted a review for this link. Please wait for it to be validated.',
'REVIEW_GUEST_EMAIL_REQUIRED' => 'Please enter your e-mail address to add a review!',
'REVIEW_GUEST_NAME_REQUIRED' => 'Please fill out your name to add a review!',
'REVIEW_INVALIDID' => 'Invalid Link ID : %s.',
'REVIEW_INVALID_ACTION' => 'Invalid action!',
'REVIEW_INVALID_UPDATE' => 'Unable to update review database. User is invalid for this review or the review is not validated.',
'REVIEW_MAX_REVIEWS' => 'You can only add %s review(s) to a link.',
'REVIEW_MODIFY_DENIED' => 'You do not have permission to modify your review.',
'REVIEW_MODIFY_TIMEOUT' => 'The edit time for the review has expired.',
'REVIEW_NORESULTS' => 'No reviews are available.',
'REVIEW_NOT_EXISTS' => 'Review doesn\'t exist!',
'REVIEW_RATING' => 'Please select a rating from 1 to 5 only.',
'REVIEW_VOTED' => 'You have already voted for this review.',
'SEARCH_NOLINKS' => 'No results found for your search',
'SUBSCRIBE_ALREADYSUB' => 'You are already subscribed to this mailing list.',
'SUBSCRIBE_ERROR' => 'No action and/or e-mail specified.',
'SUBSCRIBE_INVALIDLIST' => 'Unable to find mailing list: \'%s\'.',
'SUBSCRIBE_NOTSUB' => 'You are not subscribed to this mailing list.',
'SUBSCRIBE_SUCCESS' => 'You have successfully subscribed to the mailing list.',
'SUBSCRIBE_UNSUBSUCCESS' => 'You have successfully unsubscribed from the mailing list.',
'USER_AUTHERROR' => 'Authentication error: %s',
'USER_BADLOGIN' => 'Invalid username/password.',
'USER_EMAILTAKEN' => 'The e-mail address you entered is already taken.',
'USER_INVALIDEMAIL' => 'Invalid e-mail address: \'%s\'',
'USER_INVALIDNAME' => 'Invalid name: \'%s\'',
'USER_INVALIDSIGNUP' => 'Please fill out all fields completely.',
'USER_INVALIDUSERNAME' => 'Invalid format for username: %s',
'USER_INVALIDVAL' => 'Invalid validation code.',
'USER_LOGOUT' => 'You have been successfully logged out.',
'USER_NAMETAKEN' => 'The username you requested is already taken.',
'USER_NOEMAIL' => 'No user with that e-mail address.',
'USER_NOTVAL' => 'This account has not yet been validated.',
'USER_PASSSENT' => 'Your password has been successfully e-mailed to you.',
'USER_VALSENT' => 'Your validation code has been sent!'
};
# vim:syn=perl:ts=4:noet

View File

@ -0,0 +1,198 @@
{
'ad_300x250' => '<!-- BEGIN ADVERTSERVE CODE -->
<!--
Zone #107: 2023 - 300x250 - Roadblock
Size #8: Medium Rectangle [300x250]
Automatic Refresh: 30 seconds
Secure (HTTPS): enabled
-->
<div data-tagid="avp_zid_107">
<script type="text/javascript">
var _avp = _avp || [];
_avp.push({ tagid: \'avp_zid_107\', alias: \'/\', type: \'banner\', zid: 107, pid: 0, iframe: true, width: 300, height: 250, refresh: 30, refresh_limit: 60, inview: true, secure: true });
</script>
</div>
<!-- END ADVERTSERVE CODE -->',
'ad_300x250_1' => '<!-- BEGIN ADVERTSERVE CODE -->
<!--
Zone #107: 2023 - 300x250 - Roadblock
Size #8: Medium Rectangle [300x250]
Automatic Refresh: 30 seconds
Secure (HTTPS): enabled
-->
<div data-tagid="avp_zid_107">
<script type="text/javascript">
var _avp = _avp || [];
_avp.push({ tagid: \'avp_zid_107\', alias: \'/\', type: \'banner\', zid: 107, pid: 0, iframe: true, width: 300, height: 250, refresh: 30, refresh_limit: 60, inview: true, secure: true });
</script>
</div>
<!-- END ADVERTSERVE CODE -->',
'ad_300x250_noroadblocks' => '<!-- BEGIN ADVERTSERVE CODE -->
<!--
Zone #107: 2023 - 300x250 - Roadblock
Size #8: Medium Rectangle [300x250]
Automatic Refresh: 30 seconds
Secure (HTTPS): enabled
-->
<div data-tagid="avp_zid_107">
<script type="text/javascript">
var _avp = _avp || [];
_avp.push({ tagid: \'avp_zid_107\', alias: \'/\', type: \'banner\', zid: 107, pid: 0, iframe: true, width: 300, height: 250, refresh: 30, refresh_limit: 60, inview: true, secure: true });
</script>
</div>
<!-- END ADVERTSERVE CODE -->',
'ad_300x250_roadblocks' => '<!-- BEGIN ADVERTSERVE CODE -->
<!--
Zone #107: 2023 - 300x250 - Roadblock
Size #8: Medium Rectangle [300x250]
Automatic Refresh: 30 seconds
Secure (HTTPS): enabled
-->
<div data-tagid="avp_zid_107">
<script type="text/javascript">
var _avp = _avp || [];
_avp.push({ tagid: \'avp_zid_107\', alias: \'/\', type: \'banner\', zid: 107, pid: 0, iframe: true, width: 300, height: 250, refresh: 30, refresh_limit: 60, inview: true, secure: true });
</script>
</div>
<!-- END ADVERTSERVE CODE -->',
'ad_300x600' => '<!-- BEGIN ADVERTSERVE CODE -->
<!--
Zone #111: 2023 - 300x600 - Roadblock
Size #27: Filmstrip (Half Page Ad) [300x600]
Automatic Refresh: 30 seconds
Secure (HTTPS): enabled
-->
<div data-tagid="avp_zid_111">
<script type="text/javascript">
var _avp = _avp || [];
_avp.push({ tagid: \'avp_zid_111\', alias: \'/\', type: \'banner\', zid: 111, pid: 0, iframe: true, width: 300, height: 600, refresh: 30, refresh_limit: 60, inview: true, secure: true });
</script>
</div>
<!-- END ADVERTSERVE CODE -->',
'ad_728x90' => '<!-- BEGIN ADVERTSERVE CODE -->
<!--
Zone #109: 2023 - 728x90 - Roadblock
Size #19: Jumbo Banner [728x90]
Automatic Refresh: 30 seconds
Secure (HTTPS): enabled
-->
<div data-tagid="avp_zid_109">
<script type="text/javascript">
var _avp = _avp || [];
_avp.push({ tagid: \'avp_zid_109\', alias: \'/\', type: \'banner\', zid: 109, pid: 0, iframe: true, width: 728, height: 90, refresh: 30, refresh_limit: 60, inview: true, secure: true });
</script>
</div>
<!-- END ADVERTSERVE CODE -->',
'ad_728x90_roadblocks' => '<!-- BEGIN ADVERTSERVE CODE -->
<!--
Zone #109: 2023 - 728x90 - Roadblock
Size #19: Jumbo Banner [728x90]
Automatic Refresh: 30 seconds
Secure (HTTPS): enabled
-->
<div data-tagid="avp_zid_109">
<script type="text/javascript">
var _avp = _avp || [];
_avp.push({ tagid: \'avp_zid_109\', alias: \'/\', type: \'banner\', zid: 109, pid: 0, iframe: true, width: 728, height: 90, refresh: 30, refresh_limit: 60, inview: true, secure: true });
</script>
</div>
<!-- END ADVERTSERVE CODE -->',
'ad_970x250' => '<!-- BEGIN ADVERTSERVE CODE -->
<!--
Zone #113: 2023 - 970x250 - Roadblock
Size #30: Billboard [970x250]
Automatic Refresh: 30 seconds
Secure (HTTPS): enabled
-->
<div data-tagid="avp_zid_113">
<script type="text/javascript">
var _avp = _avp || [];
_avp.push({ tagid: \'avp_zid_113\', alias: \'/\', type: \'banner\', zid: 113, pid: 0, iframe: true, width: 970, height: 250, refresh: 30, refresh_limit: 60, inview: true, secure: true });
</script>
</div>
<!-- END ADVERTSERVE CODE -->',
'ad_wallpaper' => '<!-- BEGIN ADVERTSERVE CODE -->
<!--
Zone #106: 2023 - Wallpaper
Secure (HTTPS): enabled
-->
<script type="text/javascript">
var _avp = _avp || [];
_avp.push({ alias: \'/\', type: \'wallpaper\', zid: 106, pid: 0, secure: \'true\' });
</script>
<!-- END ADVERTSERVE CODE -->',
'advertserve_ajax' => '<!-- BEGIN ADVERTSERVE CODE -->
<script type="text/javascript">
var _avp = _avp || [];
(function() {
var s = document.createElement(\'script\');
s.type = \'text/javascript\'; s.async = true; s.src = \'https://reach.slowtwitch.com/js/libcode3.js\';
var x = document.getElementsByTagName(\'script\')[0];
x.parentNode.insertBefore(s, x);
})();
</script>
<!-- END ADVERTSERVE CODE -->',
'calendar_url' => 'https://www.slowtwitch.com/calendar',
'comscore' => '',
'current_year' => 'sub {
use POSIX qw(strftime);
my $now_string = strftime "%Y", localtime;
return $now_string;
}',
'exclusive_ad_test' => 'sub {
my $regex_match = $ID =~ /7629/;
return $regex_match;
}',
'forum_url' => 'sub {
return \'https://forum.slowtwitch.com\';
}',
'get_image_context' => 'sub {
my $index = shift || return;
my $tags = GT::Template->tags;
return { description => $tags->{"Image$index" . "_description"} || \'\', paragraph => $tags->{"Paragraph$index"} || \'\' };
}',
'google_tag_manager' => '<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-4JP2WEE0TF"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(\'js\', new Date());
gtag(\'config\', \'G-4JP2WEE0TF\');
</script>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=G-4JP2WEE0TF"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->',
'is_old_article' => 'sub {
my $date = shift;
require GT::Date;
return GT::Date::date_is_greater($date, \'2016-08-03\') ? 0 : 1;
}',
'old_detailed_url' => 'sub {
my $url = shift || return;
$url =~ s,^https://,http://,;
return { http_detailed_url => $url };
}',
'quantcast' => '',
'shorten_it' => 'sub {
my $str = shift || return;
my $length = shift || 160;
$str =~ s/<(?:[^>\'"]*|([\'"]).*?\1)*>//gs;
if ($length > 0 and length $str > $length) {
$str = substr($str,0,$length);
$str =~ s/\s+\w+$//g;
$str .= " ...";
}
return $str;
}',
'site_description' => 'Online triathlon magazine with product reviews, a bike fit guide, training tips, and several regular columnists. The editor is Dan Empfield, the founder of Quintana Roo.',
'site_keywords' => 'triathlon, swim, bike, run, ironman, 70.3, ITU, Olympic, USAT, slowtwitch',
'static_url' => 'sub {
return $CFG->{build_static_url};
}'
};
# vim:syn=perl:ts=4:noet

54
site/coaches/_notes.txt Normal file
View File

@ -0,0 +1,54 @@
Advanced search options will be:
******************* EDUCATION ******************
Undergrad degree [ ] Undergrad sci degree or ex sci [ ]
Graduate degree [ ] Graduate science or ex sci degree [ ]
***************** CERTIFICATIONS ****************
F.I.S.T certified [ ] Serrotta certified [ ]
USAT level 1 [ ] USAT level 2 [ ] USAT level 3 [ ]
USA Cycling level 1 [ ] USA Cycling level 2 [ ]
USA Swimming level 1 [ ] USA Swimming level 2 [ ]
**************** SERVICES OFFERED ***************
Regular group swim workouts on pool deck [ ]
One-on-one swim instruction on pool deck [ ]
Local fitting [ ]
Regular track workouts in person [ ]
Online coaching [ ]
***************** LOCATION ****************
What we have before, plus:
Outside the United states [ ]
--<<< OTHER FIELDS FOR COACHES AND COACHES TO FILL OUT WOULD BE >>>--
Street address
Street address two
City
State
Zip
Phone
Fax/alt phone
Email
Website
--<< TEXT AREA >>--
More Info
Rates &amp; Fees
Camps

568
site/coaches/add.php Normal file
View File

@ -0,0 +1,568 @@
<?PHP
include("config.php");
if(!is_logged_in($user)){
header('Location: '.$site_url);
exit();
}
$useruid = base64_decode($_SESSION['user_id']);
// set the page title
$pagetitle = "Add a Coach";
// set meta tags
$meta_keywords = "add coach";
$meta_description = "Do you want to include a coach in our online triathlon coach database? Then use this form to send us your information, and we will add it to our website.";
?>
<? include("include_common_head.php"); ?>
<?
if($_POST[add_coach] == true){
include("add_X.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">
<?
if( $insert_success == true || $_GET[confirmed] == "yes" ) { ?>
<h1 class="content-title"><strong>Thank you</strong></h1>
<p class="cont">Thank you. Your coach information should be added within 24 hours. You will now be redirected back to the add page.</p>
<META HTTP-EQUIV=Refresh CONTENT="4; URL=add.php">
<?
unset($insert_success);
unset($confirm_coach);
?>
<? } else if( $confirm_coach == true ) { ?>
<h1 class="content-title"><strong>Add a Coach: Step 2 of 2</strong></h1>
<? }else if( ($confirm_coach != true) || ($_POST[add_coach] != true) ){ ?>
<h1 class="content-title"><strong>Add a Coach: Step 1 of 2</strong></h1>
<? if (!$errmsg) { ?>
<p class="cont">If you would like to add a coach to our website, simply fill out the form below. Be sure to fill out every field. After filling out each field, click submit. <span style="color: red;">You will then be prompted to confirm your information before the information is sent to us.</span></p>
<? } else { ?>
<p class="cont"><span style="color: red;"><? echo $errmsg; ?></span></p>
<? } ?>
<? }
// begin insert form
if( (($_POST[add_coach] != true) || ($errmsg) || (($confirm_coach != true) && ($_POST[insert_coach] != true))) && $_GET[confirmed] != "yes") {
?>
<form enctype="multipart/form-data" action="add.php" method="post">
<div class="dtable form">
<div class="drow">
<div class="dcell name">Name</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes($_POST[name]); ?>" type="text" name="name" class="txt lngtext" maxlength="80">
</div>
</div>
<div class="drow">
<div class="dcell name">Street Address</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($_POST[address])); ?>" type="text" name="address" class="txt lngtext">
</div>
</div>
<div class="drow">
<div class="dcell name">Street Address Two (optional)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($_POST[address_two])); ?>" type="text" name="address_two" class="txt lngtext">
</div>
</div>
<div class="drow">
<div class="dcell name">City</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($_POST[city])); ?>" type="text" name="city" class="txt shotext">
</div>
</div>
<div class="drow">
<div class="dcell name">State</div>
<div class="dcell divider"></div>
<div class="dcell value">
<SELECT name="state">
<OPTION value="0">Choose a State/Province/Country</OPTION>
<? //use loop for dropdown box of states
foreach($state_list as $key=>$value){
if(strcmp($_POST[state], $value) == 0){
$str = " selected=\"selected\"";
}
echo "<option value=\"$value\"$str>$value</option>";
$str = "";
}
?>
</SELECT>
</div>
</div>
<div class="drow">
<div class="dcell name">Zip/Postal Code</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($_POST[zip])); ?>" type="text" name="zip" class="txt shotext">
</div>
</div>
<div class="drow">
<div class="dcell name">Phone</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($_POST[phone])); ?>" type="text" name="phone" class="txt shotext">
</div>
</div>
<div class="drow">
<div class="dcell name">Fax / Alternate Phone</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($_POST[fax])); ?>" type="text" name="fax" class="txt shotext">
</div>
</div>
<div class="drow">
<div class="dcell name">E-mail</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($_POST[email])); ?>" type="text" name="email" class="txt midtext">
</div>
</div>
<div class="drow">
<div class="dcell name">Website</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo $_POST[website]; ?>" type="text" name="website" class="txt lngtext" placeholder="http://">
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<h3>Info</h3>
</div>
</div>
<div class="drow">
<div class="dcell name">Certifications</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table cellpadding=0 cellspacing=0 width="100%"><?
$explosion = array("");
if (!is_array($_POST[certifications])){ $explosion = explode(",", $_POST[certifications]); } else { $explosion = $_POST[certifications]; }
$fetch = mysql_query("SELECT * FROM ".$prefix."CoachesCertifications ORDER BY coach_certification_id ASC") OR die(mysql_error());
$i = 0;
$grouping = 1;
echo("<tr>");
echo("<input type=\"hidden\" name=\"certifications[]\" value=\"0\" >");
while ($list = mysql_fetch_array($fetch)) {
if(($grouping != $list[coach_certification_group]) OR !($i%3)) {
if (!($i%3)) echo ("<td width=\"33%\">&nbsp;</td>");
echo "</tr><tr>";
$grouping = $list[coach_certification_group];
$i = 0;
}
echo("<td width=\"33%\"><input type=\"checkbox\" name=\"certifications[]\" value=\"$list[coach_certification_id]\" ");
if (in_array($list['coach_certification_id'], $explosion)){ echo "checked "; }
echo(">$list[coach_certification_name]</td>\n");
$i++;
}
while ($i<3) {
echo ("<td width=\"33%\">&nbsp;</td>\n");
$i++;
}
echo("</tr>");
?>
</table>
</div>
</div>
<div class="drow">
<div class="dcell name">Services</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table cellpadding=0 cellspacing=0 width="100%"><?
$explosion = array("");
if (!is_array($_POST[services])){ $explosion = explode(",", $_POST[services]); } else { $explosion = $_POST[services]; }
$results = mysql_query("SELECT * FROM ".$prefix."CoachesServices ORDER BY coach_service_id ASC");
$i = 0;
echo("<tr>");
echo("<input type=\"hidden\" name=\"services[]\" value=\"0\" >");
while ($row = mysql_fetch_array($results)) {
if(!($i%1)) echo "</tr><tr>";
echo("<td width=\"100%\"><input type=\"checkbox\" name=\"services[]\" value=\"$row[coach_service_id]\" ");
if (in_array($row[coach_service_id], $explosion)){ echo "checked "; }
echo(">$row[coach_service_name]</td>\n");
$i++;
}
echo("</tr>");
?>
</table>
</div>
</div>
<div class="drow">
<div class="dcell name">Education</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table cellpadding=0 cellspacing=0 width="100%"><?
$explosion = array("");
if (!is_array($_POST[degrees])){ $explosion = explode(",", $_POST[degrees]); } else { $explosion = $_POST[degrees]; }
$results = mysql_query("SELECT * FROM ".$prefix."CoachesDegrees ORDER BY coach_degree_id ASC");
$i = 0;
echo("<tr>");
echo("<input type=\"hidden\" name=\"degrees[]\" value=\"0\" >");
while ($row = mysql_fetch_array($results)) {
if(!($i%2)) echo "</tr><tr>";
echo("<td width=\"50%\"><input type=\"checkbox\" name=\"degrees[]\" value=\"$row[coach_degree_id]\" ");
if (in_array($row[coach_degree_id], $explosion)){ echo "checked "; }
echo(">$row[coach_degree_name]</td>\n");
$i++;
}
echo("</tr>");
?>
</table>
</div>
</div>
<div class="drow">
<div class="dcell name">General Info</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="info" class="txt lngtext" rows="7" placeholder="Please write some information about your coaching business."><? if($_POST[info]){ echo strip_tags(stripslashes($_POST[info])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Rates &amp; Fees</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="cost" rows="7" class="txt lngtext" placeholder="Please describe your rates and fees."><? if($_POST[cost]){ echo strip_tags(stripslashes($_POST[cost])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Camps</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="camps" rows="7" class="txt lngtext" placeholder="Please describe any training camps your put on."><? if($_POST[camps]){ echo strip_tags(stripslashes($_POST[camps])); } ?></textarea>
</div>
</div>
<div class="drow actions">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="submit" value="Submit" class="btn">
<input type="hidden" name="add_coach" value="true">
</div>
</div>
</div>
</form>
<? }
// end insert form
// begin confirmation form
if($confirm_coach == true){
?>
Please confirm your information. If everything is correct, click the submit button. Otherwise, you may click the edit button to change your information before submitting.</div>
<br />
<div class="dtable form">
<div class="drow">
<div class="dcell name">Name</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes($_POST[name]); ?>
</div>
</div>
<? // check the db for similar matches
$name_tag = strtolower(str_replace(" ","", $_POST['name']));
$name_superstart = substr($name_tag, 0, 4);
$name_superend = substr($name_tag, -4, 4);
$name_supermid = substr($name_tag, ((strlen($name_tag))/2 - 2), 4);
//echo $name_supermid;
$match_sql = "SELECT coach_id, coach_name, coach_name_tag, coach_city, coach_state FROM ".$prefix."Coaches WHERE coach_valid = 1 AND (coach_name_tag LIKE '%".$name_superstart."%' OR coach_name_tag LIKE '%".$name_superend."%' OR coach_name_tag LIKE '%".$name_supermid."%')";
//echo $match_sql;
$match_fetch = mysql_query($match_sql) OR die(mysql_error());
$i = false;
while ($match_row = mysql_fetch_array($match_fetch)) {
similar_text($match_row['coach_name'], $_POST['name'], $percent);
if ($percent >= 50) {
if ($i == false) {
echo ("<tr><td align=\"right\">Duplicate Alert:</td><td>");
}
if ($i == true) {echo ("<br />");}
echo ("<a href=\"".$site_url."/individual.php?coach_id=".$match_row['coach_id']."\">".$match_row['coach_name']." (".$match_row['coach_city'].", ".$match_row['coach_state'].")</a> (Similarity: ".(round($percent, 0))."%)");
$i = true;
}
}
if ($i == true) { echo("</td></tr>"); }
?>
<div class="drow">
<div class="dcell name">Street Address</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[address])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Street Address Two</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[address_two])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">City</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[city])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">State</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[state])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Zip/Postal Code</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[zip])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Phone</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[phone])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Fax</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[fax])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">E-mail</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[email])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Website</div>
<div class="dcell divider"></div>
<div class="dcell value">
<a href="<? echo $_POST[website]; ?>" target="_blank"><? echo $_POST[website]; ?></a>
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<h3>Info</h3>
</div>
</div>
<div class="drow">
<div class="dcell name">Certifications</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$explosion = implode(",", $_POST[certifications]);
$sql = ("SELECT * FROM ".$prefix."CoachesCertifications WHERE coach_certification_id IN ($explosion) ORDER BY coach_certification_name ASC");
//echo $sql;
$results = mysql_query($sql) or die(mysql_error());
$certification_list = "";
while ($row = mysql_fetch_array($results)) {
$certification_list = $certification_list."$row[coach_certification_name], ";
}
$certification_list = rtrim($certification_list, ', ');
echo $certification_list;
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Services</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$explosion = implode(",", $_POST[services]);
$sql = ("SELECT * FROM ".$prefix."CoachesServices WHERE coach_service_id IN ($explosion) ORDER BY coach_service_name ASC");
//echo $sql;
$results = mysql_query($sql) or die(mysql_error());
$service_list = "";
while ($row = mysql_fetch_array($results)) {
$service_list = $service_list."$row[coach_service_name], ";
}
$service_list = rtrim($service_list, ', ');
echo $service_list;
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Education</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$explosion = implode(",", $_POST[degrees]);
$sql = ("SELECT * FROM ".$prefix."CoachesDegrees WHERE coach_degree_id IN ($explosion) ORDER BY coach_degree_name ASC");
//echo $sql;
$results = mysql_query($sql) or die(mysql_error());
$degree_list = "";
while ($row = mysql_fetch_array($results)) {
$degree_list = $degree_list."$row[coach_degree_name], ";
}
$degree_list = rtrim($degree_list, ', ');
echo $degree_list;
?>
</div>
</div>
<div class="drow">
<div class="dcell name">General Info</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[info])) ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Rates &amp; Fees</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[cost])) ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Camps</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[camps])) ?>
</div>
</div>
<div class="drow actions">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<form action="add.php" method="post">
<input type="hidden" name="name" value="<? echo stripslashes(htmlspecialchars($_POST[name])); ?>">
<input type="hidden" name="address" value="<? echo stripslashes(htmlspecialchars($_POST[address])); ?>">
<input type="hidden" name="address_two" value="<? echo stripslashes(htmlspecialchars($_POST[address_two])); ?>">
<input type="hidden" name="city" value="<? echo stripslashes(htmlspecialchars($_POST[city])); ?>">
<input type="hidden" name="state" value="<? echo $_POST[state]; ?>">
<input type="hidden" name="zip" value="<? echo $_POST[zip]; ?>">
<input type="hidden" name="phone" value="<? echo $_POST[phone]; ?>">
<input type="hidden" name="fax" value="<? echo $_POST[fax]; ?>">
<input type="hidden" name="email" value="<? echo $_POST[email]; ?>">
<input type="hidden" name="website" value="<? echo $_POST[website]; ?>">
<input type="hidden" name="certifications" value="<? echo(implode(',', $_POST[certifications])); ?>">
<input type="hidden" name="services" value="<? echo(implode(',', $_POST[services])); ?>">
<input type="hidden" name="degrees" value="<? echo(implode(',', $_POST[degrees])); ?>">
<input type="hidden" name="cost" value="<? echo stripslashes(htmlspecialchars($_POST[cost])); ?>">
<input type="hidden" name="info" value="<? echo stripslashes(htmlspecialchars($_POST[info])); ?>">
<input type="hidden" name="camps" value="<? echo stripslashes(htmlspecialchars($_POST[camps])); ?>">
<input type="hidden" name="add_coach" value="true">
<input type="hidden" name="insert_coach" value="true">
<input type="hidden" name="submitted_by" value="<? echo $useruid; ?>" >
<input type="submit" name="submit" value="Submit Info" class="btn float-left" style="margin-right: 5px;"/>
</form>
<form action="add.php" method="post">
<input type="hidden" name="name" value="<? echo stripslashes(htmlspecialchars($_POST[name])); ?>">
<input type="hidden" name="address" value="<? echo stripslashes(htmlspecialchars($_POST[address])); ?>">
<input type="hidden" name="address_two" value="<? echo stripslashes(htmlspecialchars($_POST[address_two])); ?>">
<input type="hidden" name="city" value="<? echo stripslashes(htmlspecialchars($_POST[city])); ?>">
<input type="hidden" name="state" value="<? echo $_POST[state]; ?>">
<input type="hidden" name="zip" value="<? echo $_POST[zip]; ?>">
<input type="hidden" name="phone" value="<? echo $_POST[phone]; ?>">
<input type="hidden" name="fax" value="<? echo $_POST[fax]; ?>">
<input type="hidden" name="email" value="<? echo $_POST[email]; ?>">
<input type="hidden" name="website" value="<? echo $_POST[website]; ?>">
<input type="hidden" name="certifications" value="<? echo(implode(',', $_POST[certifications])); ?>">
<input type="hidden" name="services" value="<? echo(implode(',', $_POST[services])); ?>">
<input type="hidden" name="degrees" value="<? echo(implode(',', $_POST[degrees])); ?>">
<input type="hidden" name="cost" value="<? echo stripslashes(htmlspecialchars($_POST[cost])); ?>">
<input type="hidden" name="info" value="<? echo stripslashes(htmlspecialchars($_POST[info])); ?>">
<input type="hidden" name="camps" value="<? echo stripslashes(htmlspecialchars($_POST[camps])); ?>">
<input type="hidden" name="confirm_coach" value="0">
<input type="submit" name="submit" value="Edit Information" class="btn float-left" />
</form>
</div>
</div>
</div>
<?
}
//end confirmation 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>

115
site/coaches/add_X.php Normal file
View File

@ -0,0 +1,115 @@
<?PHP
if (!$_POST){ header('Location: '.$site_url); }
/*
FIELD NAMES:
coach_id
coach_name
coach_name_tag
coach_address
coach_address_two
coach_city
coach_state
coach_state_tag
coach_zip
coach_phone
coach_fax
coach_email
coach_website
coach_certifications
coach_services
coach_degrees
coach_cost
coach_info
coach_camps
coach_submitted_by
coach_valid
coach_user_tags
*/
/* Need to ltrim and rtrim commas before insertion */
//Insert into database
//$pass = 'abc123';
$errmsg = NULL;
$insert_success = NULL;
//Check for blank fields
if ((!$_POST[name])) $errmsg = $errmsg."Shop name, ";
if (!$_POST[city]) $errmsg = $errmsg."City, ";
if (!$_POST[state]) $errmsg = $errmsg."State, ";
if (!$_POST[address]) $errmsg = $errmsg."Address, ";
if (!$_POST[phone]) $errmsg = $errmsg."Phone, ";
if (!$_POST[email]) $errmsg = $errmsg."Email, ";
if (!$_POST[website]) $errmsg = $errmsg."Website, ";
if (strlen($_POST[cost]) < 4) $errmsg = $errmsg."Rates &amp; Fees, ";
if (strlen($_POST[info]) < 4) $errmsg = $errmsg."General Info, ";
if (strlen($_POST[camps]) < 4) $errmsg = $errmsg."Camps, ";
if (isset($errmsg)) {
$errmsg = "The following fields cannot be left blank: ".$errmsg."<br />";
$errmsg = rtrim($errmsg, ", ");
}
$start_url = "(http(s)?\:\/\/)?"; // start url
$dots = "([\w_-]{2,}\.)+"; // one or more parts containing a '.' at the end
$last_part = "([\w_-]{2,})"; // last part doesn't contain a dot
$user = "((\/)(\~)[\w_=-]+)?((\/)[\w_=-]+)*"; // maybe subdirectories - possibly with user ~
$end = "((\/)|(\/)[\w_-]+\.[\w]{2,})?"; // maybe a slash at the end or slash+file+extension
$qstring1 = "((\?[\w_-]+\=([^\#]+)){0,1}"; // querystring - first argument (?a=b)
$qstring2 = "(\&[\w_-]+\=([^\#]+))*)?"; // querystring - following arguments (&c=d)
$bkmrk = "(#[\w_-]+)?"; // bookmark
$exp = "/^".$start_url.$dots.$last_part.$user.$end.$qstring1.$qstring2.$bkmrk."$/i";
if( !preg_match($exp, $_POST[website]) ) {
// Contains invalid characters.
$errmsg = $errmsg."Invalid Web Address<br />";
}
if( preg_match('/[^a-zA-Z0-9\. ]/', $_POST[name]) ) {
// Contains invalid characters.
$errmsg = $errmsg."Please use only letters and numbers in the name<br />";
}
// begin error message check
if(!$errmsg){
$name = trim($_POST[name]);
$name_tag = strtolower(str_replace(" ","", $name));
//if(strlen($name_tag) > 12){ //Shorten it
$name_tag = substr($name_tag, 0, 12);
//} // need to update a typo here in other dbs
$address = mysql_escape_string(trim($_POST[address]));
if (isset($_POST['address_two'])) { $address_two = mysql_escape_string(trim($_POST[address_two])); } else { $address_two = NULL; }
$city = mysql_escape_string(trim($_POST[city]));
$state = $_POST[state];
$state_tag = strtolower(str_replace(" ","", $state));
$zip = mysql_escape_string(trim($_POST[zip]));
$phone = trim($_POST[phone]);
$fax = trim($_POST[fax]);
$email = mysql_escape_string(trim($_POST[email]));
$website = mysql_escape_string(trim($_POST[website]));
$certifications = $_POST[certifications];
$services = $_POST[services];
$degrees = $_POST[degrees];
$cost = mysql_escape_string(nl2br(substr(trim($_POST[cost]), 0, 4096)));
$info = mysql_escape_string(nl2br(substr(trim($_POST[info]), 0, 4096)));
$camps = mysql_escape_string(nl2br(substr(trim($_POST[camps]), 0, 4096)));
$submitted_by = $_POST[submitted_by];
// begin boolean check to see if we should insert the coach into the dbase
if($_POST[insert_coach] == true){
$sql = "INSERT INTO ".$prefix."Coaches (coach_name, coach_name_tag, coach_address, coach_address_two, coach_city, coach_state, coach_state_tag, coach_zip, coach_phone, coach_fax, coach_email, coach_website, coach_certifications, coach_services, coach_degrees, coach_cost, coach_info, coach_camps, coach_submitted_by, coach_valid) VALUES ('$name', '$name_tag', '$address', '$address_two', '$city', '$state', '$state_tag', '$zip', '$phone', '$fax', '$email', '$website', ',$certifications,', ',$services,', ',$degrees,', '$cost', '$info', '$camps', $submitted_by, 0)";
//echo("shop entered!");
//echo($sql);
mysql_query($sql) OR die(mysql_error());
//exit();
$insert_success = true;
}else{
//echo("shop NOT entered.");
$confirm_coach = true;
}
// end insert check
}
// end error message check
?>

View File

@ -0,0 +1,19 @@
<?php
require_once("rating/classes/include.all.php");
// Check that the data was sent
if (sizeof($_POST) == 0
|| $_POST['parent'] == null
|| strlen(trim($_POST['parent'])) == 0
|| $_POST['item'] == null
|| strlen(trim($_POST['item'])) == 0
|| $_POST['rating'] == null
|| strlen(trim($_POST['rating'])) == 0
|| $_POST['classes'] == null
|| strlen(trim($_POST['classes'])) == 0)
{
die("You shouldn't be attempting to access this file in this manner.");
}
echo Rating::RateItem($_POST['parent'], $_POST['item'], $_POST['rating'], $_POST['classes']);
?>

View File

@ -0,0 +1,35 @@
<?PHP
if (eregi("comments_add.php", $_SERVER['SCRIPT_NAME'])) {
Header("Location: ".$site_url."/index.php"); die();
}
?>
<form action="comments_add_X.php" method="post">
<input type="hidden" name="coach_id" value="<? echo $row[coach_id]; ?>" />
<input type="hidden" name="editor_id" value="<? echo $useruid; ?>" />
<input type="hidden" name="add_this_review" value="1" />
<div class="row required clear content-title-no" style="background-color: #cecece; padding-left: 2px;">
<a name="comment"></a>
<strong>Add A Comment </strong>
</div>
<div class="row required clear" style="background-color: #cecece;">
<label for="Review_Subject" class="name">Subject: </label>
<div class="value">
<input type="text" id="Review_Subject" name="Review_Subject" value="" class="text" />
</div>
</div>
<div class="row required clear" style="background-color: #cecece;">
<label for="Review_Contents" class="name">Your Review: </label>
<div class="value">
<textarea id="Review_Contents" name="Review_Contents" rows="3" cols="42"></textarea>
</div>
<div class="formsubmit" style="background-color: #cecece;">
<input type="submit" name="add_review" value="Add Review" class="nobutton" />
</div>
</div>
</form>

View File

@ -0,0 +1,33 @@
<?PHP
// do I need to do additional security checks to make sure the script is being called appropriately?
include("config.php");
if (!$_POST){ header('Location: '.$site_url); }
// error checking
if (isset($_POST[Review_Subject]) && isset($_POST[Review_Contents])) {
if ($_SERVER['HTTP_X_FORWARD_FOR']) {
$ip = $_SERVER['HTTP_X_FORWARD_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$tsNow = time();
$coach_id = $_POST[coach_id];
$editor_id = $_POST[editor_id];
$subject = mysql_escape_string(trim($_POST[Review_Subject]));
$message = mysql_escape_string(nl2br(htmlspecialchars(substr(trim($_POST[Review_Contents]), 0, 4096))));
// build the SQL query to delete the edits that are bad
$sql = "INSERT INTO ".$prefix."CoachesComment (coach_id_fk, comment_time, user_id_fk, comment_subject, comment_message, comment_ip, comment_valid) VALUES ($coach_id, '$tsNow', '$editor_id', '$subject', '$message', '$ip', 0)";
//echo $sql;
mysql_query($sql) or die(mysql_error());
}
header('Location: '.$site_url.'/individual.php?coach_id='.$coach_id.'&review_add=ok');
exit();
?>

View File

@ -0,0 +1,19 @@
<?PHP
if (eregi("comments_show.php", $_SERVER['SCRIPT_NAME'])) {
Header("Location: index.php"); die();
}
//$sqlComments = "SELECT * FROM gforum_TriathlonsComment WHERE triathlon_id_fk = $row[uid] AND comment_valid = 1 ORDER BY comment_time DESC";
//$objComments = mysql_query($sqlComments) OR die(mysql_error());
$fb_xid = intval(mysql_escape_string($_GET[uid]));
?>
<a name="comment"></a>
<? /*<div class="fb-comments" data-href="<? echo(curPageURL()); ?>" data-num-posts="5" data-width="500"></div>*/ ?>
<? /**<fb:comments href="<? echo(curPageURL()); ?>" num_posts="5" width="500"></fb:comments>**/ ?>
<fb:comments href="<? echo(curPageURL()); ?>" num_posts="5" width="622"></fb:comments>

View File

@ -0,0 +1,88 @@
<?PHP include("config.php");
if(is_logged_in($user)){
$username = base64_decode($_SESSION['user']);
if($username != "Slowman" && $username != "Rappstar" && $username != "Herbert") {
header('Location: '.$site_url);
exit();
}
} else {
header('Location: '.$site_url);
exit();
}
// Query to fetch non-validated races:
$results = mysql_query("SELECT * FROM ".$prefix."CoachesComment WHERE comment_valid = 0 ORDER BY comment_time DESC") OR die(mysql_error());
// check to see if set is empty
$none = FALSE;
if (mysql_num_rows($results) == 0) { $none = TRUE; }
// set the page title
$pagetitle = "Admin: Comment Validation";
// set meta tags
$meta_keywords = "";
$meta_description = "";
?>
<? include("include_common_head.php"); ?>
<? include("include_common_content.php"); ?>
<!-- Start outer -->
<div id="outer">
<!-- BODY -->
<div class="content">
<!-- LEFT COLUMN -->
<!-- End left column -->
<!-- Content col -->
<h1 class="content-title"><strong>Unvalidated Comments</strong></h1>
<form method="post" action="comments_validate_X.php" enctype="multipart/form-data">
<div class="indent">
<?
if($none == TRUE){
echo "There are no comments waiting to be validated.";
}
?>
<table border="0" cellspacing="1" cellpadding="1" width="100%">
<?
$x = 0;
while($arrComments = mysql_fetch_array($results)){
$x++;
if($x % 2 == 0){ $bg = '#cecece'; }else{ $bg = '#ececec'; }
$arrCommenters = mysql_fetch_array(mysql_query("SELECT user_username FROM ".$prefix."User WHERE user_id = ".$arrComments[user_id_fk]." LIMIT 1"));
$arrClubs = mysql_fetch_array(mysql_query("SELECT coach_name FROM ".$prefix."Coaches WHERE coach_id = ".$arrComments[coach_id_fk]." LIMIT 1"));
$commenter_user_username = $arrCommenters[user_username];
$coach_name = $arrClubs[coach_name];
?>
<tr bgcolor="<? echo "$bg"; ?>"><td><span class="sub-hdr" style="margin-left: 5px;"><strong><? echo $arrComments[comment_subject]; ?></strong></span><div class="indent">Reviewed by: <? echo "<a href=\"http://forum.slowtwitch.com/gforum.cgi?username=".$commenter_user_username.";\" target=\"_blank\">".$commenter_user_username."</a>"; echo " on ".date("F j, Y g:i A", $arrComments[comment_time]); echo " about <a href=\"".$site_url."/individual.php?coach_id=".$arrComments[coach_id_fk]."\">".$coach_name."</a>";?></div><div class="indent" style="background-color: #eeeef9; border: 1px solid black; margin-top: 2px; margin-right: 5px; margin-bottom: 5px; padding: 5px; ">
<? echo stripslashes(stripslashes($arrComments[comment_message])); ?>
</div><div class="indent"><input type="checkbox" value="<? echo($arrComments[comment_id]); ?>" name="validate[]"> Validate this comment. <input type="checkbox" value="<? echo($arrComments[comment_id]); ?>" name="delete[]"> Delete this comment.<br /></div></td></tr>
<?
}
?>
</table>
<br />
<input type="submit" value="Process Selected Comments">
</div>
</form>
<!-- End content col -->
</div>
<!-- End BODY -->
</div>
<!-- End Outer -->
<? include("include_common_footer.php"); ?>

View File

@ -0,0 +1,37 @@
<?PHP
// do I need to do additional security checks to make sure the script is being called appropriately?
include("config.php");
if (!$_POST){ header('Location: '.$site_url); }
// error checking
if(!isset($_POST)) exit();
if (isset($_POST[delete])) {
// convert the array to a SQL friendly format
$deleteList = "(".implode(",", $_POST[delete]).")";
// build the SQL query to delete the edits that are bad
$sql = "DELETE FROM ".$prefix."CoachesComment WHERE comment_id IN $deleteList";
mysql_query($sql) or die(mysql_error());
}
if (isset($_POST[validate])) {
// convert the array to a SQL friendly format
$comment_idlist = "(".implode(",", $_POST[validate]).")";
// build the SQL query
$sql = "UPDATE ".$prefix."CoachesComment
SET comment_valid = 1
WHERE comment_id IN $comment_idlist;";
mysql_query($sql) or die(mysql_error());
}
header('Location: '.$site_url.'/comments_validate.php');
?>

148
site/coaches/config.php Normal file
View File

@ -0,0 +1,148 @@
<?
###########################################
#-----------Users login system------------#
###########################################
/*=========================================\
Author : Mohammed Ahmed(M@@king) \\
Version : 1.0 \\
Date Created: Aug 20 2005 \\
---------------------------- \\
Last Update: August 22 2005 \\
---------------------------- \\
Country : Palestine \\
City : Gaza \\
E-mail : m@maaking.com \\
MSN : m@maaking.com \\
AOL-IM : maa2pal \\
WWW : http://www.maaking.com \\
Mobile/SMS : 00972-599-622235 \\
\\
===========================================\
------------------------------------------*/
// NEED TO CHECK AGAINST SERVER VERSION
//skip the config file if somebody call it from the browser.
session_start();
if (eregi("config.php", $_SERVER['SCRIPT_NAME'])) {
Header("Location: index.php"); die();
}
$main_table = "Coaches";
$field_lead = "coach_";
$site_url = "/coaches";
include("../local/settings.php");
$st_id = 22;
//added new code to fix compatibility issues.
//09-Nov-2005
$phpver = phpversion();
if ($phpver < '4.1.0') {
$_GET = $HTTP_GET_VARS;
$_POST = $HTTP_POST_VARS;
$_SERVER = $HTTP_SERVER_VARS;
}
if ($phpver >= '4.0.4pl1' && strstr($_SERVER["HTTP_USER_AGENT"],'compatible')) {
if (extension_loaded('zlib')) {
ob_end_clean();
ob_start('ob_gzhandler');
}
} else if ($phpver > '4.0') {
if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) {
if (extension_loaded('zlib')) {
$do_gzip_compress = TRUE;
ob_start(array('ob_gzhandler',5));
ob_implicit_flush(0);
header('Content-Encoding: gzip');
}
}
}
$phpver = explode(".", $phpver);
$phpver = "$phpver[0]$phpver[1]";
if ($phpver >= 41) {
$PHP_SELF = $_SERVER['PHP_SELF'];
}
if (!ini_get("register_globals")) {
#import_request_variables('GPC');
}
function curPageURL() {
$isHTTPS = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on");
$port = (isset($_SERVER["SERVER_PORT"]) && ((!$isHTTPS && $_SERVER["SERVER_PORT"] != "80") || ($isHTTPS && $_SERVER["SERVER_PORT"] != "443")));
$port = ($port) ? ':'.$_SERVER["SERVER_PORT"] : '';
$url = ($isHTTPS ? 'https://' : 'http://').$_SERVER["SERVER_NAME"].$port.$_SERVER["REQUEST_URI"];
return $url;
}
$statecount = mysql_num_rows(mysql_query("SELECT * FROM gforum_Coaches WHERE coach_valid = 1"));
//Array of states for use in the form
$state_list = array('AL'=>"Alabama",
'AK'=>"Alaska",
'AB'=>'Alberta',
'AZ'=>"Arizona",
'AR'=>"Arkansas",
'BC'=>'British Columbia',
'CB'=>"Caribbean",
'CA'=>"California",
'CM'=>"Central America",
'CO'=>"Colorado",
'CT'=>"Connecticut",
'DE'=>"Delaware",
'DC'=>"District of Columbia",
'FL'=>"Florida",
'GA'=>"Georgia",
'HI'=>"Hawaii",
'ID'=>"Idaho",
'IL'=>"Illinois",
'IN'=>"Indiana",
'IA'=>"Iowa",
'KS'=>"Kansas",
'KY'=>"Kentucky",
'LA'=>"Louisiana",
'ME'=>"Maine",
'MB'=>'Manitoba',
'MD'=>"Maryland",
'MA'=>"Massachusetts",
'MX'=>"Mexico",
'MI'=>"Michigan",
'MN'=>"Minnesota",
'MS'=>"Mississippi",
'MO'=>"Missouri",
'MT'=>"Montana",
'NE'=>"Nebraska",
'NV'=>"Nevada",
'NB'=>'New Brunswick',
'NL'=>'Newfoundland',
'NH'=>"New Hampshire",
'NJ'=>"New Jersey",
'NM'=>"New Mexico",
'NY'=>"New York",
'NC'=>"North Carolina",
'ND'=>"North Dakota",
'NS'=>'Nova Scotia',
'OH'=>"Ohio",
'OK'=>"Oklahoma",
'ON'=>'Ontario',
'OR'=>"Oregon",
'PA'=>"Pennsylvania",
'PE'=>'Prince Edward Island',
'QC'=>'Quebec',
'RI'=>"Rhode Island",
'SK'=>'Saskatchewan',
'SC'=>"South Carolina",
'SD'=>"South Dakota",
'TN'=>"Tennessee",
'TX'=>"Texas",
'UT'=>"Utah",
'VT'=>"Vermont",
'VA'=>"Virginia",
'WA'=>"Washington",
'WV'=>"West Virginia",
'WI'=>"Wisconsin",
'WY'=>"Wyoming",
// New Foreign "States",
'OA'=>"Outside N. America");
?>

29
site/coaches/delete_X.php Normal file
View File

@ -0,0 +1,29 @@
<?PHP
include("config.php");
if (!$_POST){ header('Location: '.$site_url); }
$sql = "DELETE FROM gforum_Coaches WHERE coach_id = '$_POST[coach_id]'";
mysql_query($sql) or die(mysql_error());
$sql = "DELETE FROM gforum_CoachesEdits WHERE coach_id_fk = '$_POST[coach_id]'";
mysql_query($sql) or die(mysql_error());
$sql = "DELETE FROM gforum_CoachesEditors WHERE coach_id_fk = '$_POST[coach_id]'";
mysql_query($sql) or die(mysql_error());
$sql = "DELETE FROM gforum_CoachesComment WHERE coach_id_fk = '$_POST[coach_id]'";
mysql_query($sql) or die(mysql_error());
$sql = "DELETE FROM gforum_CoachesRating WHERE coach_id_fk = '$_POST[coach_id]'";
mysql_query($sql) or die(mysql_error());
header('Location: '.$site_url);
?>

View File

@ -0,0 +1,12 @@
<div class="breadcrumb">
<a href="<? echo $main_site_url ?>">Home</a> &gt;
<a href="<? echo $main_site_url . "/local/" ?>">Local Listings</a> &gt;
<? if ( $regionname or $statename or $row[coach_name]) { ?>
<a href="<? echo $site_url ?>">Triathlon Coaches</a>
<? } else { ?>
<span class="lasttitle">Triathlon Coaches</span>
<? } ?>
<? if ( $regionname ) { echo "&gt; " . $regionname; } ?>
<? if ( $statename ) { echo "&gt; " . $statename . " State"; } ?>
<? if ($row[coach_name]) { echo "&gt; " . $row[coach_name]; } ?>
</div>

View File

@ -0,0 +1,107 @@
<?PHP
if(is_logged_in($user)){
$tagtext = "I got fit here";
$actionlink = "individual.php?coach_id=$row[coach_id]&".get_sid();
}else{
$tagtext = "Log in to tag this coach";
$actionlink = "$forum_url/forum/?do=login&from=coaches";
$tagstatus = "no";
}
if(is_logged_in($user)){
//Get user's uid
//$testresults = mysql_query("SELECT user_id FROM ".$prefix."User WHERE user_username=\"$username\"") or die(mysql_error());
//$testrow = mysql_fetch_array($testresults);
//$useruid = $testrow[user_id];
$useruid = base64_decode($_SESSION['user_id']);
// is the current user the owner of the coach?
$coach_submitted_by = FALSE;
if($useruid == $row[coach_submitted_by]){
$coach_submitted_by = TRUE;
}
$tagresults = mysql_query("SELECT coach_user_tags FROM ".$prefix."Coaches WHERE coach_id=$row[coach_id]");
$tagrow = mysql_fetch_array($tagresults);
$tags = explode(",", $tagrow[coach_user_tags]);
$profileresults = mysql_query("SELECT user_coachtags FROM ".$prefix."User WHERE user_id='$useruid'") or die(mysql_error());
$profilerow = mysql_fetch_array($profileresults);
$profiletags = explode(",", $profilerow[user_coachtags]);
if($_POST[status] == "tag"){
//tag the coach
if(array_search($useruid, $tags) == FALSE){
array_push($tags, $useruid);
}
$tags = implode(",", $tags);
mysql_query("UPDATE ".$prefix."Coaches SET coach_user_tags='$tags' WHERE coach_id=$row[coach_id]") or die(mysql_error());
$tags = explode(",", $tags);
if(array_search($row[coach_id], $profiletags) == FALSE){
array_push($profiletags, $row[coach_id]);
}
$profiletags = implode(",", $profiletags);
mysql_query("UPDATE ".$prefix."User SET user_coachtags='$profiletags' WHERE user_id='$useruid'") or die(mysql_error());
}else if($_POST[status] == "untag"){
//untag the coach
$key = array_search($useruid, $tags);
unset($tags[$key]);
$tags = implode(",", $tags);
mysql_query("UPDATE ".$prefix."Coaches SET coach_user_tags='$tags' WHERE coach_id=$row[coach_id]") or die(mysql_error());
$tags = explode(",", $tags);
$key = array_search($row[coach_id], $profiletags);
unset($profiletags[$key]);
$profiletags = implode(",", $profiletags);
mysql_query("UPDATE ".$prefix."User SET user_coachtags='$profiletags' WHERE user_id=$useruid");
}
//Is the coach tagged already?
if(array_search($useruid, $tags) !== FALSE){ $tagged = TRUE; }else{ $tagged = FALSE; }
if($tagged){ $tagstatus = "untag"; $tagtext = "Untag this coach";}else{ $tagstatus = "tag"; $tagtext = "I'm coached";}
}
?>
<div>
<form action="<? echo $actionlink; ?>" method="post" style="display: inline;">
<input type="hidden" value="<? echo $tagstatus; ?>" name="status" />
</form>
<form method="post" action="<? echo "individual.php?coach_id=$row[coach_id]#tagged"; ?>" style="display: inline;">
<input type="submit" value="Who's coached?" class="btn" />
<? if (is_logged_in($user)) { ?>
<input type="submit" value="<? echo $tagtext; ?>" class="btn" />
<? } else { ?>
<a href="<? echo $actionlink ?>" class="btn"><? echo $tagtext; ?></a>
<? } ?>
</form>
<? if(is_logged_in($user)){ ?>
<form method="post" action="<? echo "individual.php?coach_id=$row[coach_id]#comment"; ?>" style="display: inline;">
<input type="submit" value="Comment on this coach" class="btn" />
</form>
<form method="post" action="<? echo "wiki_edit.php?coach_id=$row[coach_id]"; ?>" style="display: inline;">
<input type="submit" value="Edit this coach (wiki)" class="btn" />
</form>
<?
if(is_admin($user)) {
?>
<form method="post" action="delete_X.php" style="display: inline;">
<input type="hidden" name="coach_id" value="<? echo($row[coach_id]); ?>" />
<input type="submit" value="Delete this coach" class="btn" onclick="return confirm('Are you sure you want to DELETE this coach?');" />
</form>
<?
//Get user's username
$testresults = mysql_query("SELECT user_username FROM ".$prefix."User WHERE user_id='$row[coach_submitted_by]'") or die(mysql_error());
$testrow = mysql_fetch_array($testresults);
$username = $testrow[user_username];
echo("<br /><br /><strong>Entered By: </strong> <a href='http://forum.slowtwitch.com/gforum.cgi?username=$username;'>$username</a>");
}
}
?>
</div>

View File

@ -0,0 +1,40 @@
<? $xmlURL = "http://www.slowtwitch.com/googlemaps/coaches_xml.php" ?>
<body id="home" <? if (eregi("index.php", $_SERVER['SCRIPT_NAME'])) { echo ("onload=\"initializeAllMap('$xmlURL')\""); } ?>>
<? include("/var/home/slowtwitch/slowtwitch.com/www/db_templates/fb_sdk.html"); ?>
<div id="accessibility"><a href="#content">Skip to Content</a></div>
<hr class="hide" />
<div id="wrapper">
<div id="header">
<div id="ad_728x90"><!-- BEGIN ADVERTPRO CODE BLOCK -->
<? include "../db_templates/ad_728x90.html"; ?>
<!-- END ADVERTPRO CODE BLOCK --></div>
<div id="logo"><h1><a href="http://www.slowtwitch.com">&lt;:: Welcome to Slowtwitch.com ::&gt;</a></h1></div>
</div>
<? include "../db_templates/common_nav.html"; ?>
<hr class="hide" />
<div id="ocwrapper" class="clear">
<div id="icwrapper" class="clear">
<div id="leftsidebar">
<?
include("include_status.php");
?>
<?
include("include_navigation.php");
?>
</div>
<div id="contentwrapper" class="shadowleft">
<div class="shadowtop"><div class="shadowtopleft"></div><div class="shadowtopright"></div></div>
<div class="shadowright">
<div id="content">
<div class="clear"></div>

View File

@ -0,0 +1 @@
<?PHP include("../db_templates/include_common_footer.php"); ?>

View File

@ -0,0 +1,19 @@
<?PHP
if (eregi("include", $_SERVER['SCRIPT_NAME'])) {
Header("Location: ".$site_url."/index.php"); die();
}
?>
<!DOCTYPE html >
<html lang="en">
<head>
<base href="<? echo $site_url ?>/" />
<title>Slowtwitch.com Coach Database: <? echo $pagetitle; ?></title>
<? include($common_path . "/templates/include_global_head.php"); ?>
<? include($common_path . "/templates/google_analytics.html"); ?>
<? include($common_path . "/templates/fb_sdk.html"); ?>
<!-- begin script to create random number for ads -->
<script language="Javascript">
<!--
sgi_ord=Math.random()*10000000000000000;
//-->
</script>

View File

@ -0,0 +1,71 @@
<?PHP
$outsideflag = "Europe";
$sqlregionlist = "SELECT gtr.regionlong AS regionlong, gtr.regionid AS regionid, gtr.regionname AS regionname, gts.statetag AS statetag, gts.statelong AS statelong, COUNT(gf.coach_id) AS numclubs
FROM ".$prefix."CoachesStates AS gts
LEFT JOIN ".$prefix."Coaches AS gf
ON gts.statetag = gf.coach_state_tag AND gf.coach_valid = 1
LEFT JOIN ".$prefix."CoachesRegions AS gtr
ON gts.regionid = gtr.regionid
GROUP BY gtr.regionlong, gts.statetag ORDER BY gtr.regionlong ASC";
//echo $sqlregionlist;
$resultregionlist = mysql_query($sqlregionlist);
?>
<div class="widget">
<h2>Browse Coaches</h2>
<div class="region-list">
<?
$currentregion = '';
$regioncount = '';
$tempstring = '';
$currenttag = '';
$showhide = '';
$region_dropdown = '';
$state_string = '';
while($rowregionlist = mysql_fetch_array($resultregionlist)){
$selected_region = '';
$selected_state = '';
if ($currentregion != $rowregionlist[regionlong]) {
if ($selected_item == $currentrid) {
$selected_region = ' selected="seleted"';
}
if ($currentregion != '') {
if ($currentregion == $outsideflag) { echo ("<br /><strong>Outside N. America</strong><br />"); }
$region_dropdown .= "<option value=\"$site_url/regionlist.php?region=$currentrid\"$selected_region>$currentregion ($regioncount)</option>$state_string";
echo ("<div class='list-item'><a href='$site_url/regionlist.php?region=$currentrid'>" . $currentregion . " (" . $regioncount . ")</a><span>+</span><div class='sublist' id='". $currenttag . "'>");
echo $tempstring;
echo ('</div></div>');
}
$currentregion = $rowregionlist[regionlong];
$currentrid = $rowregionlist[regionid];
$currenttag = $rowregionlist[regionname];
$regioncount = 0;
$tempstring = '';
$state_string = '';
}
if ($selected_item == $rowregionlist[statetag]) {
$selected_state = ' selected="selected"';
}
$state_string .= "<option value=\"$site_url/statelist.php?state=$rowregionlist[statetag]\"$selected_state>&nbsp;&nbsp;&nbsp;$rowregionlist[statelong] ($rowregionlist[numclubs])</option>";
$tempstring = $tempstring. "<a href='$site_url/statelist.php?state=$rowregionlist[statetag]".get_sid()."' class='lhdr' title='$rowregionlist[statelong]'>$rowregionlist[statelong] ($rowregionlist[numclubs])</a>\n";
$regioncount += $rowregionlist[numclubs];
}
echo ("<div class='list-item'><a href='$site_url/regionlist.php?region=$currentrid'>".$currentregion." (".$regioncount.")</a><span>+</span><div class='sublist' id='".$currenttag."'>");
echo $tempstring;
echo ('</div></div>');
if ( $selected_item == 'top') { $selected_region = ' selected="selected"'; }
$region_dropdown .= "<option value=\"" . $site_url . '/top.php' . "\"$selected_region>Top Ranked</option>";
?>
<div class="advsearch">
<a href="<? echo $site_url . '/search.php' ?>">Search Coaches</a> <span class="sprite-magnify">&nbsp;</span>
</div>
</div>
</div>

View File

@ -0,0 +1,14 @@
<?
$selected_local = 'coaches';
include($common_path . "/templates/include_local_listing.php");
?>
<div class="widget-divider"></div>
<? include("include_status.php"); ?>
<? include("include_navigation.php"); ?>
<div class="widget-divider"></div>
<div class="advert hide-on-mobile">
<? include($common_path . "/ads/ad_300x600.html"); ?>
</div>

View File

@ -0,0 +1,12 @@
<?PHP ?>
<?
if(is_admin()){
echo("<br /><br /><strong style=\"text-decoration: underline;\">Admin:</strong>");
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table." WHERE ".$field_lead."valid = 0"));
echo("<br /><a href='validate.php'><strong>Validate Entries (".$unvalid_count.")</strong></a>");
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table."Edits"));
echo("<br /><a href='wiki_validate.php'><strong>Validate Edits (".$unvalid_count.")</strong></a>");
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table."Comment WHERE comment_valid = 0"));
echo("<br /><a href='comments_validate.php'><strong>Validate Comments (".$unvalid_count.")</strong></a>");
}
?>

View File

@ -0,0 +1,27 @@
<div class="list-block grid">
<div class="col-1-1 clearfix">
<h3 class="float-left"><a href="<? echo "individual.php?coach_id=$row[coach_id]"; ?>"><? echo $row[coach_name]; ?></a> <? if ($row[coach_certifications]) {
$temp_arr = explode(",", $row[coach_certifications]);
if (in_array($st_id, $temp_arr)) {echo "<img src='images/st_cert_16.gif' alt='Slowtwitch Certified Coach'></h3>"; } else { echo "</h3>";}
}
?>
</div>
<? if ($rating_text) { ?>
<p>(Avg. rating <? echo($row[score]); ?> based on <? echo(int_to_words($row[respondents])); if($row[respondents] == 1) { echo(" respondent"); } else { echo(" respondents"); } ?>)</p>
<? } ?>
<div class="col-1-2">
<?
echo ("$row[coach_address]");
if ($row[coach_address_two]) { echo ("<br />$row[coach_address_two]"); }
echo("<br />$row[coach_city], $row[coach_state] $row[coach_zip]");
?>
<br />Phone: <? echo $row[coach_phone] ?>
<br />Fax: <? echo $row[coach_fax] ?>
</div>
<div class="col-1-2">
Email: <? echo "<a href='mailto:$row[coach_email]'>$row[coach_email]</a>"; ?><br/>
Website: <? echo "<a href='$row[coach_website]' target='_blank'>$row[coach_website]</a>"; ?><br/>
<? if ($row[coach_cart] == 1) { echo ("**eCommerce Shopping Cart**<br />"); } ?>
<a href="<? echo "individual.php?coach_id=$row[coach_id]"; ?>">More info &gt;</a>
</div>
</div>

120
site/coaches/index.php Normal file
View File

@ -0,0 +1,120 @@
<?PHP include("config.php");
// set the page title
$pagetitle = "Triathlon Coaches";
// set meta tags
$meta_keywords = "triathlon, trifind, duathlon";
$meta_description = "Are you trying to find triathlon coaches in near your area? You can browse all triathlon coaches organized by states, to find which ones you want to use.";
?>
<? 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">
<h1 class="float-left">Triathlon Coaches</h1>
<? if (is_logged_in($user)) { ?>
<a href="<? echo $site_url . '/add.php' ?>" class="btn btn-white float-right">Add Coach</a>
<? } ?>
<hr class="line" />
<? include("../runshops/include_region_list.php"); ?>
<div class="map-container">
<div id="map" class="map" data-name="coach" data-json="<? echo $main_site_url ?>/googlemaps/json/coach.json"></div><!--xml relative path from js folder -->
</div>
<?
$num = mysql_num_rows(mysql_query("SELECT coach_id FROM ".$prefix."Coaches WHERE coach_valid=1"));
?>
<h3>Welcome to Slowtwitch.com's North American Triathlon Coach Database</h3>
<p><? echo($num) ?> coaches and counting. This collection of coaches is the most complete and comprehensive
selection of triathlon coaches in North America.</p>
<h3>Searching the database</h3>
<p>
Our Advanced Search is very potent, and will help you drill down to that set
of coaches conforming to a specific purpose you have in mind.
</p>
<h3>Browsing the database</h3>
<p>
You do not need to log in to do this. You'll find a list of coaches in
your region by clicking the regional links on the left. Click the (+) sign
and the region will expand to expose the individual states. Click on the
state to show that list of coaches in it. If you want to see coaches in
multiple states, but not those states we've aggregated into the regions you
see at left, you may do this via our Advanced Search.
</p>
<h3>Showing solidarity with your coach</h3>
<p>
When you see your personal coach listed here, you may click the "I AM COACHED" button. Your User Name will be added to the coaches's list of clients,
just like your User Name appends to those races you choose when you build
your Slowtwitch Personal Race Calendar. Likewise, your Forum User Profile
will show that this is your coach of choice.
</p>
<div class="advert float-left">
<? include($common_path . "/ads/ad_300x250_roadblocks.html"); ?>
</div>
<h3>How to enter a coach</h3>
<p>
You must be a registered user to add a coach to the database. There is
one common type of registration on Slowtwitch, and if you are registered to
post on our Reader Forum you are one of
<?
$num_users = mysql_num_rows(mysql_query("SELECT user_id FROM ".$prefix."User WHERE 1=1"));
echo number_format($num_users);
?>
who have made a registration,
and this means you're able to add coaches to our database.
<br /><br />
If you're not registered, the login prompt is to the left of the page, near
the top. The registration process is straightforward, easy, and free. It
will require you to receive an email and click on a link to complete your
registration. All this should take you only a minute or two. Then...
<br /><br />
1. Click the ADD A COACH button to begin adding to the database.
<br /><br />
2. Once you SUBMIT your coach, you'll also need to CONFIRM your submission
via a link at the bottom of the page.
<br /><br />
3. Once you successfully add your coach, it will not immediately be visible
to you. We must validate the addition on our end before anyone can see it.
We do this so that spammers won't use the coach registration as a way to spam
our database.
</p>
<h3>How to edit published information about a coach</h3>
<p>Any registered user may edit information for a listing. We will review the full contents of each update before confirming any changes that are made. A list of all editors who have made changes is visible at the bottom of each listing. If an entry has been updated, but those changes have not yet been confirmed, this is evident via a note on the individual page for that particular entry. This is to prevent conflicting updates from occuring simultaneously. If you wish to update an entry with pending changes, please wait until we have had a chance to review those changes first. Someone may have already changed the information you were going to change yourself. </p>
<h3>How to comment on a coach</h3>
<p>Any registered user may make a comment on a coach listing. These comments are subject to validation by an administrator before being published.</p>
<h3>Global coach map</h3>
<p>The map below shows the location of all registered Slowtwitch coaches around the globe. You can drag the map, zoom-in, zoom-out, and use any other of the standard Google Maps features. Anywhere you see a red icon, you can click to see the name of that coach and a street address.</p>
</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>

245
site/coaches/individual.php Normal file
View File

@ -0,0 +1,245 @@
<?PHP
include("config.php");
require_once("rating/classes/include.all.php");
$coach_idhere = intval(mysql_escape_string($_GET[coach_id]));
$results = mysql_query("SELECT * FROM ".$prefix."Coaches WHERE coach_id='".$coach_idhere."' LIMIT 1");
$row = mysql_fetch_array($results);
if (!$row){header('Location: '.$site_url.'/?error=invalid_id');}
if($row[coach_valid] == 0) {
if(!is_admin($user)){
header('Location: '.$site_url);
exit();
}
}
// set the page title
$pagetitle = $row[coach_name];
// set meta tags
$meta_keywords = "triathlon, ".$row[coach_name].", ".$row[coach_state]." bike fit";
$meta_description = "Considering getting fit by ".$row[coach_name]."? Here is all of the information about this triathlon coach.";
?>
<? 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">
<? $selected_item = strtolower($row[coach_state]); ?>
<? include("include_sidebar.php"); ?>
</div>
<div class="content content-has-widgets">
<div class="grid">
<div class="clearfix">
<h1 class="float-left">Triathlon Coaches</h1>
<? if ($user) { ?>
<form method="post" action="wiki_edit.php?retailer_id=<? echo $row[coach_id] ?>">
<input type="submit" value="Edit (wiki)" class="nobutton btn btn-white float-right">
</form>
<? } ?>
<a href="" class="btn btn-white float-right">Back</a>
<hr class="line" />
<? include("../runshops/include_region_list.php"); ?>
<? if($_GET[review_add] == 'ok') { ?>
<p class="success"><strong>Commenter:</strong> your comments have been submitted and will be validated within 24 hours.</p>
<? } ?>
<? if($_GET[wiki_change] == 'success') { ?>
<p class="success"><strong>Editor:</strong> your changes have been submitted and will be validated within 24 hours.</p>
<? } ?>
<? $wikiFetchSQL = "SELECT edit_id FROM ".$prefix."CoachesEdits WHERE coach_id_fk = '".intval(mysql_escape_string($_GET[coach_id]))."'";
$boolEdits = mysql_num_rows(mysql_query($wikiFetchSQL));
if($boolEdits !== 0 && $_GET[wiki_change] != 'success') { ?>
<p class="error"><strong>Group Edits:</strong> there are group edits waiting to be validated.</p>
<? } ?>
<div class="details grid">
<div class="col-9-12">
<h2><? echo stripslashes(stripslashes($row[coach_name])) ; echo " "; ?>
<? if ($row[coach_certifications]) {
$temp_arr = explode(",", $row[coach_certifications]);
if (in_array($st_id, $temp_arr)) {echo "<img src='images/st_cert_22.gif' alt='Slowtwitch Certified Coach'></h2><strong>Slowtwitch Certified Coach</strong>"; } else { echo "</h2>";}
}
?>
</div>
<div class="col-3-12 right">
<? if(is_logged_in($user)) { ?><a href="#comment">Comment</a><? }?>
</div>
<div class="clearfix"></div>
<div class="col-6-12 address">
<? echo stripslashes(htmlspecialchars($row[coach_address])); ?><br />
<? if ( $row[coach_address_two] ) { echo stripslashes(htmlspecialchars($row[coach_address_two]) . "<br />"); } ?>
<? echo stripslashes(htmlspecialchars($row[coach_city])); ?>, <? echo stripslashes(htmlspecialchars($row[coach_state])); ?> <? echo stripslashes(htmlspecialchars($row[coach_zip])); ?><br />
Phone: <? echo stripslashes(htmlspecialchars($row[coach_phone])); ?><br />
Fax: <? echo stripslashes(htmlspecialchars($row[coach_fax])); ?>
</div>
<div class="col-6-12 contact">
Email: <a href="mailto:<? echo $row[coach_email]; ?>"><? echo stripslashes(htmlspecialchars($row[coach_email])); ?></a><br />
<span class="briefy-b">Website: <a href="<? echo $row[coach_website]; ?>" target="_blank"><? echo stripslashes(htmlspecialchars($row[coach_website])); ?></a></span>
</div>
<div class="clearfix"></div>
<br />
<div class="col-1-1">
<? include("include_buttons.php"); ?>
</div>
<div class="col-1-1 detail-block">
<h3>Info</h3>
<div class="highlight-block">
<strong>Education: </strong>
<?
$row[coach_degrees] = ltrim(rtrim($row[coach_degrees], ", "), ", ");
if ($row[coach_degrees]) {
$sql = ("SELECT * FROM ".$prefix."CoachesDegrees WHERE coach_degree_id IN ($row[coach_degrees]) ORDER BY coach_degree_name ASC") OR die(mysql_error());
//echo $sql;
$fetch = mysql_query($sql) or die(mysql_error());
$degree_list = "";
while ($list = mysql_fetch_array($fetch)) {
$degree_list = $degree_list."$list[coach_degree_name], ";
}
$degree_list = rtrim($degree_list, ', ');
}
if ($degree_list) {echo $degree_list;} else {echo "None";}
?><br />
<strong>Certifications: </strong>
<?
$row[coach_certifications] = ltrim(rtrim($row[coach_certifications], ", "), ", ");
if ($row[coach_certifications]) {
$sql = ("SELECT * FROM ".$prefix."CoachesCertifications WHERE coach_certification_id IN ($row[coach_certifications]) ORDER BY coach_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[coach_certification_name], ";
}
$certification_list = rtrim($certification_list, ', ');
}
if ($certification_list) {echo $certification_list;} else {echo "None";}
?><br />
<strong>Services: </strong>
<?
$row[coach_services] = ltrim(rtrim($row[coach_services], ", "), ", ");
if ($row[coach_services]) {
$sql = ("SELECT * FROM ".$prefix."CoachesServices WHERE coach_service_id IN ($row[coach_services]) ORDER BY coach_service_name ASC");
//echo $sql;
$fetch = mysql_query($sql) or die(mysql_error());
$service_list = "";
while ($list = mysql_fetch_array($fetch)) {
$service_list = $service_list."$list[coach_service_name], ";
}
$service_list = rtrim($service_list, ', ');
}
if ($service_list) {echo $service_list;} else {echo "None";}
?>
</div>
</div>
<div class="col-1-1 detail-block">
<h3>General Info</h3>
<div class="highlight-block">
<strong>General Info: </strong><? echo stripslashes(stripslashes($row[coach_info])) ?><br />
<strong>Rates &amp; Fees: </strong><? echo stripslashes(stripslashes($row[coach_cost])); ?><br />
<strong>Training Camps Offered: </strong><? echo stripslashes(stripslashes($row[coach_camps])); ?>
</div>
</div>
<div class="col-1-1">
<div id="map" class="map map-single" data-name="single" data-category="coach" data-lat="<? echo $row[coach_lat] ?>" data-lng="<? echo $row[coach_lng] ?>">
</div>
<div class="map-description">
<small>
Map location is based off of a geocode of the addressed entered using Google's Google Maps API. If your address does not geocode properly, you can either update the address (we will attempt to re-geocode after any updates to your entry) <strong>or</strong> you can use Google's geocoding tool found here: <a href="http://gmaps-samples.googlecode.com/svn/trunk/geocoder/singlegeocode.html">http://gmaps-samples.googlecode.com/svn/trunk/geocoder/singlegeocode.html</a> to obtain a lat/long for your location and enter that. To use the utility, type in an address that is close to your location and then drag-and-drop the marker to obtain the desired lat/long. If you choose to enter a lat/long, you <strong>must</strong> check the box on the edit page that says, "override geocode with entered lat/long."
</small>
</div>
</div>
<div class="col-1-1 detail-block">
<h3>Who's coached?</h3>
<div class="highlight-block">
<?
$testresults = mysql_query("SELECT coach_user_tags FROM ".$prefix."Coaches WHERE coach_id=$row[coach_id]");
$testrow = mysql_fetch_array($testresults);
$tags = explode(",", $testrow[coach_user_tags]);
$numcount = count($tags) - 1;
if($numcount == 0){ $phrase = "No users have tagged this coach yet."; }
else if($numcount == 1){ $phrase = "There is 1 user who has tagged this coach:"; }
else{ $phrase = "There are $numcount users who have tagged this coach: "; }
?>
<a name="tagged"></a><? echo $phrase; ?>
<?
//List users
$i = 0;
foreach($tags as $value){
if($i > 0){
$tempresults = mysql_query("SELECT user_username FROM ".$prefix."User WHERE user_id='$value'") or die (mysql_error());
$temprow = mysql_fetch_array($tempresults);
if($i > 1){ echo ", "; }
// TODO: SLOWTWITCH EDIT
//echo "<a href=\"profiles/$temprow[user_username].html\">$temprow[user_username]</a>";
// replace the link above with the link below for integration into gforum
echo "<a href=\"http://forum.slowtwitch.com/gforum.cgi?username=$temprow[user_username]&session=".$_SESSION['session_id']."&from=coaches\">$temprow[user_username]</a>";
// TODO: SLOWTWITCH EDIT END
}
$i++;
}
?>
</div>
</div>
</div>
<div class="col-1-1 detail-block">
<?
$testresults = mysql_query("SELECT * FROM ".$prefix."CoachesEditors WHERE coach_id_fk=$row[coach_id] ORDER BY edit_timestamp DESC");
$numcount = mysql_num_rows($testresults);
if($numcount == 0){ $phrase = "No updates have been made this coach yet."; }
else if($numcount == 1){ $phrase = "There has been 1 update to this coach:"; }
else{ $phrase = "There have been $numcount updates to this coach: "; }
echo "<br />";
?>
<h3><a name="editors"></a><? echo $phrase; ?></h3>
<div class="highlight-block">
<?
//List users
$i = 0;
while($row=mysql_fetch_array($testresults)){
if($i >= 0) {
$tempresults = mysql_query("SELECT user_username FROM ".$prefix."User WHERE user_id='$row[user_id_fk]'") or die (mysql_error());
$temprow = mysql_fetch_array($tempresults);
if ($i >= 1) { echo "<br />"; }
echo "<a href=\"http://forum.slowtwitch.com/gforum.cgi?username=$temprow[user_username]&session=".$_SESSION['session_id']."&from=coach\">$temprow[user_username]</a> at ".date("F j, Y g:i A", $row[edit_timestamp]);
}
$i++;
}
if($numcount <= 0) { echo "No users"; }
?>
</div>
</div>
</div>
<div class="content-divider-bottom"></div>
<? include ('comments_show.php'); ?>
</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>

7
site/coaches/logout.php Normal file
View File

@ -0,0 +1,7 @@
<?PHP
include("config.php");
session_unset();
session_destroy();
$_SESSION = array();
header("Location: http://forum.slowtwitch.com/gforum.cgi?do=logout&from=coaches");
?>

View File

@ -0,0 +1,339 @@
<?PHP
###########################################
#-----------Users login system------------#
###########################################
/*=========================================\
Author : Mohammed Ahmed(M@@king) \\
Version : 1.0 \\
Date Created: Aug 20 2005 \\
---------------------------- \\
Last Update: August 22 2005 \\
---------------------------- \\
Country : Palestine \\
City : Gaza \\
E-mail : m@maaking.com \\
MSN : m@maaking.com \\
AOL-IM : maa2pal \\
WWW : http://www.maaking.com \\
Mobile/SMS : 00972-599-622235 \\
\\
===========================================\
------------------------------------------*/
if (eregi("mysql.class.php", $_SERVER['SCRIPT_NAME'])) {
Header("Location: index.php"); die();
}
//db class
if(!defined("SQL_LAYER"))
{
define("SQL_LAYER","mysql");
class sql_db
{
var $db_connect_id;
var $query_result;
var $row = array();
var $rowset = array();
var $num_queries = 0;
//
// Constructor
//
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->server = $sqlserver;
$this->dbname = $database;
if($this->persistency)
{
$this->db_connect_id = @mysql_pconnect($this->server, $this->user, $this->password);
}
else
{
$this->db_connect_id = @mysql_connect($this->server, $this->user, $this->password);
}
if($this->db_connect_id)
{
if($database != "")
{
$this->dbname = $database;
$dbselect = @mysql_select_db($this->dbname);
if(!$dbselect)
{
@mysql_close($this->db_connect_id);
$this->db_connect_id = $dbselect;
}
}
return $this->db_connect_id;
}
else
{
return false;
}
}
//
// Other base methods
//
function sql_close()
{
if($this->db_connect_id)
{
if($this->query_result)
{
@mysql_free_result($this->query_result);
}
$result = @mysql_close($this->db_connect_id);
return $result;
}
else
{
return false;
}
}
//
// Base query method
//
function sql_query($query = "", $transaction = FALSE)
{
// Remove any pre-existing queries
unset($this->query_result);
if($query != "")
{
$this->query_result = @mysql_query($query, $this->db_connect_id);
}
if($this->query_result)
{
unset($this->row[$this->query_result]);
unset($this->rowset[$this->query_result]);
return $this->query_result;
}
else
{
return ( $transaction == END_TRANSACTION ) ? true : false;
}
}
//
// Other query methods
//
function sql_numrows($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @mysql_num_rows($query_id);
return $result;
}
else
{
return false;
}
}
function sql_affectedrows()
{
if($this->db_connect_id)
{
$result = @mysql_affected_rows($this->db_connect_id);
return $result;
}
else
{
return false;
}
}
function sql_numfields($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @mysql_num_fields($query_id);
return $result;
}
else
{
return false;
}
}
function sql_fieldname($offset, $query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @mysql_field_name($query_id, $offset);
return $result;
}
else
{
return false;
}
}
function sql_fieldtype($offset, $query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @mysql_field_type($query_id, $offset);
return $result;
}
else
{
return false;
}
}
function sql_fetchrow($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$this->row[$query_id] = @mysql_fetch_array($query_id);
return $this->row[$query_id];
}
else
{
return false;
}
}
function sql_fetchrowset($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
unset($this->rowset[$query_id]);
unset($this->row[$query_id]);
while($this->rowset[$query_id] = @mysql_fetch_array($query_id))
{
$result[] = $this->rowset[$query_id];
}
return $result;
}
else
{
return false;
}
}
function sql_fetchfield($field, $rownum = -1, $query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
if($rownum > -1)
{
$result = @mysql_result($query_id, $rownum, $field);
}
else
{
if(empty($this->row[$query_id]) && empty($this->rowset[$query_id]))
{
if($this->sql_fetchrow())
{
$result = $this->row[$query_id][$field];
}
}
else
{
if($this->rowset[$query_id])
{
$result = $this->rowset[$query_id][$field];
}
else if($this->row[$query_id])
{
$result = $this->row[$query_id][$field];
}
}
}
return $result;
}
else
{
return false;
}
}
function sql_rowseek($rownum, $query_id = 0){
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @mysql_data_seek($query_id, $rownum);
return $result;
}
else
{
return false;
}
}
function sql_nextid(){
if($this->db_connect_id)
{
$result = @mysql_insert_id($this->db_connect_id);
return $result;
}
else
{
return false;
}
}
function sql_freeresult($query_id = 0){
if(!$query_id)
{
$query_id = $this->query_result;
}
if ( $query_id )
{
unset($this->row[$query_id]);
unset($this->rowset[$query_id]);
@mysql_free_result($query_id);
return true;
}
else
{
return false;
}
}
function sql_error($query_id = 0)
{
$result["message"] = @mysql_error($this->db_connect_id);
$result["code"] = @mysql_errno($this->db_connect_id);
return $result;
}
} // class sql_db
} // if ... define
?>

View File

@ -0,0 +1,406 @@
<?php
//////////////////////////////////////////////////////////////////////////////
// Database Class
//============================================================================
// Dependencies:
//----------------------------------------------------------------------------
// None
//============================================================================
// Modification History:
//----------------------------------------------------------------------------
// 2006-11-04: Created
//////////////////////////////////////////////////////////////////////////////
class Database extends Error
{
## CONSTANT VARIABLES
const DB_TYPES = 'mysql,mysqli'; // NO SPACES!
## END CONSTANT VARIABLES
## PUBLIC VARIABLES
## END PUBLIC VARIABLES
## PRIVATE VARIABLES
private static $host;
private static $port;
private static $database;
private static $username;
private static $password;
private static $type;
private static $connection;
private static $savedQueries;
private static $savedResults;
## END PRIVATE VARIABLES
## CONSTRUCTOR
## END CONSTRUCTOR
## DECONSTRUCTOR
## END DECONSTRUCTOR
## PUBLIC METHODS
// Initialize the Variables
// Does not return anything, but acts like a constructor for Static classes
public static function Initialize($varType, $varHost, $varPort, $varDatabase, $varUsername, $varPassword)
{
Error::Initialize();
if (!self::ValidDatabaseTypes($varType))
{
Error::LogError("Database Type Invalid", "Database Type must be one of: " . self::DB_TYPES);
}
self::$host = $varHost;
self::$port = $varPort;
self::$type = strtolower($varType);
self::$database = $varDatabase;
self::$password = $varPassword;
self::$username = $varUsername;
self::$savedQueries = array();
self::$savedResults = array();
self::$connection = self::ConnectToDatabase();
self::SelectTheDatabase();
}
// DeInitialize the Variables
// Does not return anything, but acts like a destructor for Static classes
public static function DeInitialize()
{
// Remove Saved Queries
for ($saved = 0; $saved < sizeof(self::$savedQueries); $saved++)
{
unset(self::$savedQueries[$saved]);
}
// Remove Saved Results
for ($saved = 0; $saved < sizeof(self::$savedResults); $saved++)
{
unset(self::$savedResults[$saved]);
}
// Close the Database Connection
switch (self::$type)
{
case "mysql":
@mysql_close(self::$connection) or Error::LogError("MySQL Failed to Close", mysql_error(self::$connection));
break;
case "mysqli":
@mysqli_close(self::$connection) or Error::LogError("MySQL Failed to Close", mysqli_error(self::$connection));
break;
}
// Destroy Variables
self::$host = null;
self::$port = null;
self::$type = null;
self::$database = null;
self::$password = null;
self::$username = null;
self::$connection = null;
self::$savedQueries = null;
self::$savedResults = null;
Error::DeInitialize();
}
// Database Types
// Returns an array of database types
public static function DatabaseTypes()
{
return split(",", self::DB_TYPES);
}
// Build Order By
// Returns the SQL Syntax for ORDER BY
public static function BuildOrderBy($varColumnName, $varDirection)
{
$orderby = "";
if (self::$connection)
{
switch (self::$type)
{
case "mysql":
case "mysqli":
$orderby = "ORDER BY `{$varColumnName}` {$varDirection}";
break;
}
}
return $orderby;
}
// Build Limit
// Returns the SQL Syntax for LIMIT
public static function BuildLimit($varStartingRow, $varNumberOfRows)
{
$limit = "";
if (self::$connection)
{
switch (self::$type)
{
case "mysql":
case "mysqli":
$limit = "LIMIT {$varStartingRow}, {$varNumberOfRows}";
break;
}
}
return $limit;
}
// Execute SQL Query
// Returns the result of the query, which is typically a resource id
public static function ExecuteQuery($sql, $name)
{
if (self::$connection)
{
if (strlen(trim($name)) != 0)
{
switch (self::$type)
{
case "mysql":
if (!array_key_exists($name, self::$savedQueries))
{
self::$savedQueries[$name] = @mysql_query($sql, self::$connection) or Error::LogError("Query Failed", mysql_error(self::$connection));
}
break;
case "mysqli":
if (!array_key_exists($name, self::$savedQueries))
{
self::$savedQueries[$name] = @mysqli_query(self::$connection, $sql) or Error::LogError("Query Failed", mysqli_error(self::$connection));
}
break;
}
return self::$savedQueries[$name];
}
else
{
Error::LogError("Execute Query Name Missing", "The name parameter was empty, please provide a name for the query.");
}
}
return null;
}
// Fetch Results
// Returns an array of the query results
public static function FetchResults($name)
{
$results = array();
if (self::$connection)
{
if (strlen(trim($name)) != 0 && (array_key_exists($name, self::$savedQueries) || array_key_exists($name, self::$savedResults)))
{
if (array_key_exists($name, self::$savedQueries))
{
switch (self::$type)
{
case "mysql":
$row = 0;
while ($currentResult = @mysql_fetch_assoc(self::$savedQueries[$name]))
{
$col = 0;
foreach ($currentResult as $key => $value)
{
$results[$row][$col] = $value;
$results[$row][$key] = $value;
$col++;
}
$row++;
}
break;
case "mysqli":
$row = 0;
while ($currentResult = @mysqli_fetch_assoc(self::$savedQueries[$name]))
{
$col = 0;
foreach ($currentResult as $key => $value)
{
$results[$row][$col] = $value;
$results[$row][$key] = $value;
$col++;
}
$row++;
}
break;
}
self::$savedResults[$name] = $results;
}
else
{
$results = self::$savedResults[$name];
}
}
else
{
if (strlen(trim($name)) == 0)
{
Error::LogError("Fetch Results Name Missing", "The name parameter was empty, the name is required so it knows which results to return.");
}
else
{
Error::LogError("Fetch Results Name ('{$name}') Not Found", "The name provided did not have any query results associated with it.");
}
}
}
return $results;
}
// Free SQL Query Results
// Returns nothing
public static function FreeResults($name)
{
if (self::$connection)
{
if (strlen(trim($name)) != 0 && array_key_exists($name, self::$savedQueries))
{
switch (self::$type)
{
case "mysql":
@mysql_free_result(self::$savedQueries[$name]) or Error::LogError("Free Results Error", mysql_error(self::$connection));
unset(self::$savedQueries[$name]);
break;
case "mysqli":
@mysqli_free_result(self::$savedQueries[$name]) or Error::LogError("Free Results Error", mysqli_error(self::$connection));
unset(self::$savedQueries[$name]);
break;
}
}
else
{
if (strlen(trim($name)) == 0)
{
Error::LogError("Free Results Name Missing", "The name parameter was empty, the name is required so it knows which results to free up from memory.");
}
else
{
Error::LogWarning("Free Results Name ('{$name}') Not Found", "The name provided did not have any query results associated with it.");
}
}
}
}
// Remove Saved Results
// Returns nothing
public static function RemoveSavedResults($name)
{
if (strlen(trim($name)) != 0 && array_key_exists($name, self::$savedResults))
{
unset(self::$savedResults[$name]);
}
else
{
if (strlen(trim($name)) == 0)
{
Error::LogError("Remove Saved Result Name Missing", "The name parameter was empty, the name is required so it knows which query to remove.");
}
else
{
Error::LogWarning("Remove Saved Result Name ('{$name}') Not Found", "The name provided was not a saved query.");
}
}
}
// Attempt Connect To Database
// Returns true or false depending on if the connection failed or succeeded
public static function AttemptConnectToDatabase($varType, $varHost, $varPort, $varDatabase, $varUsername, $varPassword)
{
self::$type = $varType;
self::$host = $varHost;
self::$port = $varPort;
self::$database = $varDatabase;
self::$username = $varUsername;
self::$password = $varPassword;
Error::ClearErrors();
self::$connection = self::ConnectToDatabase();
if (!Error::HasErrors())
{
return true;
}
else
{
return false;
}
}
// MySQL Version
// Returns the mysql version number
public static function MysqlVersion()
{
$version = "";
if (self::$connection)
{
switch (self::$type)
{
case "mysql":
$version = mysql_get_server_info(self::$connection);
break;
case "mysqli":
$version = mysqli_get_server_info(self::$connection);
break;
}
}
return $version;
}
## END PUBLIC METHODS
## PRIVATE METHODS
// Connect to Database
// Returns the database connection resource
private static function ConnectToDatabase()
{
$link = null;
switch (self::$type)
{
case "mysql":
if (strlen(trim(self::$port)) != 0)
{
$link = mysql_connect(self::$host . ":" . self::$port, self::$username, self::$password) or Error::LogError("Database Error", mysql_error());
}
else
{
$link = mysql_connect(self::$host, self::$username, self::$password) or Error::LogError("Database Error", mysql_error());
}
break;
case "mysqli":
$link = mysqli_connect(self::$host, self::$username, self::$password, self::$database, self::$port) or Error::LogError("Database Error", mysqli_connect_error());
break;
}
return $link;
}
// Select the Database
// Returns nothing
private static function SelectTheDatabase()
{
switch (self::$type)
{
case "mysql":
@mysql_select_db(self::$database, self::$connection) or Error::LogError("Database Selection", mysql_error(self::$connection));
break;
}
}
// Valid Database Types
// Returns true or false depending on if the database type is valid
private static function ValidDatabaseTypes($varType)
{
$types = split(',', str_replace(" ", "", self::DB_TYPES));
return in_array($varType, $types);
}
## END PRIVATE METHODS
## PROTECTED METHODS
## END PROTECTED METHODS
}
?>

View File

@ -0,0 +1,258 @@
<?php
//////////////////////////////////////////////////////////////////////////////
// Error Class
//============================================================================
// Dependencies:
//----------------------------------------------------------------------------
// none
//============================================================================
// Modification History:
//----------------------------------------------------------------------------
// 2006-11-04: Created
//////////////////////////////////////////////////////////////////////////////
class Error
{
## CONSTANT VARIABLES
## END CONSTANT VARIABLES
## PUBLIC VARIABLES
## END PUBLIC VARIABLES
## PRIVATE VARIABLES
private static $title;
private static $type;
private static $description;
private static $datetime;
private static $numErrors;
private static $numWarnings;
## END PRIVATE VARIABLES
## CONSTRUCTOR
## END CONSTRUCTOR
## DECONSTRUCTOR
## END DECONSTRUCTOR
## PUBLIC METHODS
// Initialize the Variables
// Does not return anything, but acts like a constructor for Static classes
public static function Initialize()
{
self::$title = array();
self::$type = array();
self::$description = array();
self::$datetime = array();
self::$numErrors = 0;
self::$numWarnings = 0;
}
// DeInitialize the Variables
// Does not return anything, but acts like a destructor for Static classes
public static function DeInitialize()
{
self::$title = null;
self::$type = null;
self::$description = null;
self::$datetime = null;
self::$numErrors = null;
self::$numWarnings = null;
}
// Log Error Method (receives Name and Description)
// Returns true or false depending on if the logging of the error was successful
public static function LogError($varTitle, $varDescription)
{
// Check Parameters
if (strlen(trim($varTitle)) != 0 && strlen(trim($varDescription)) != 0)
{
array_push(self::$title, $varTitle);
array_push(self::$type, "ERROR");
array_push(self::$description, $varDescription);
array_push(self::$datetime, date("m/d/Y H:i:s"));
self::$numErrors++;
return true;
}
return false;
}
// Show Error Messages
// Returns the Error Message Output (in HTML format)
public static function ShowErrorMessages()
{
$output = "";
// Check to see if 1 error occurred or more than one.
if (self::$numErrors > 0)
{
if (self::$numErrors > 1)
{
$error = "ERRORS";
}
else
{
$error = "ERROR";
}
// Loop through Error Messages
for ($i = 0; $i < sizeof(self::$title); $i++)
{
if (self::$type[$i] == "ERROR")
{
// Output each individual Error
$output .= " <div class=\"divErrorTitle\">\r\n" .
" " . self::$title[$i] . "\r\n" .
" <span class=\"spnErrorDateTime\">at " . self::$datetime[$i] . "</span>\r\n" .
" </div>\r\n" .
" <div class=\"divErrorDesc\">" . self::$description[$i] . "<br /><br /></div>\r\n";
}
}
// Write Error Template Output
$output = "<div class=\"divErrorBox\">\r\n" .
" <div class=\"divErrorBoxTitle\"><img src=\"icons/24-em-cross.png\" align=\"left\" /> {$error}:</div>\r\n" .
" <div class=\"divErrors\">\r\n" . $output . "\r\n </div>\r\n" .
"</div>\r\n";
}
// Return the Error Message Output
return $output;
}
// Retrieve Last Error
// Returns the title and description of the last error in an array
public static function RetrieveLastError()
{
$output = array();
// Check to see if 1 error occurred or more than one.
if (self::$numErrors > 0)
{
for ($i = sizeof(self::$title) - 1; $i >= 0; $i++)
{
if (self::$type[$i] == "ERROR")
{
array_push($output, self::$title[$i]);
array_push($output, self::$description[$i]);
break;
}
}
}
return $output;
}
// Clear Errors
// Returns nothing
public static function ClearErrors()
{
self::$numErrors = 0;
for ($i = 0; $i < sizeof(self::$type); $i++)
{
if (self::$type[$i] == "ERROR")
{
self::$title[$i] = null;
self::$type[$i] = null;
self::$description[$i] = null;
self::$datetime[$i] = null;
}
}
}
// Has Errors
// Returns true or false on whether errors exist
public static function HasErrors()
{
if (self::$numErrors > 0)
{
return true;
}
return false;
}
// Log Warning Method (receives Name and Description)
// Returns true or false depending on if logging the warning was successful
public static function LogWarning($varTitle, $varDescription)
{
// Check Parameters
if (strlen(trim($varTitle)) != 0 && strlen(trim($varDescription)) != 0)
{
array_push(self::$title, $varTitle);
array_push(self::$type, "WARNING");
array_push(self::$description, $varDescription);
array_push(self::$datetime, date("m/d/Y H:i:s"));
self::$numWarnings++;
return true;
}
return false;
}
// Show Warning Messages
// Returns the Warning Message Output (in HTML format)
public static function ShowWarningMessages()
{
$output = "";
// Check to see if 1 warning occurred or more than one.
if (self::$numWarnings > 0)
{
if (self::$numWarnings > 1)
{
$warning = "WARNINGS";
}
else
{
$warning = "WARNING";
}
// Loop through Warning Messages
for ($i = 0; $i < sizeof(self::$title); $i++)
{
if (self::$type[$i] == "WARNING")
{
// Output each individual Warning
$output .= " <div class=\"divWarningTitle\">\r\n" .
" " . self::$title[$i] . "\r\n" .
" <span class=\"spnWarningDateTime\">at " . self::$datetime[$i] . "</span>\r\n" .
" </div>\r\n" .
" <div class=\"divWarningDesc\">" . self::$description[$i] . "<br /><br /></div>\r\n";
}
}
// Write Warning Template Output
$output = "<div id=\"divWarningBox\">\r\n" .
" <div id=\"divWarningBoxTitle\"><img src=\"designs/icons/24-message-warn.png\" align=\"left\" /> {$warning}:</div>\r\n" .
" <div id=\"divWarnings\">\r\n" . $output . "\r\n </div>\r\n" .
"</div>\r\n";
}
// Return the Warning Message Output
return $output;
}
// Has Warnings
// Returns true or false on whether there are any Warnings
public static function HasWarnings()
{
if (self::$numWarnings > 0)
{
return true;
}
return false;
}
## END PUBLIC METHODS
## PRIVATE METHODS
## END PRIVATE METHODS
## PROTECTED METHODS
## END PROTECTED METHODS
}
?>

View File

@ -0,0 +1,7 @@
<?php
require_once("error.class.php");
require_once("database.class.php");
require_once("rating.class.php");
Database::Initialize("mysql", $dbhost, "3306", $dbname, $dbuname, $dbpass);
?>

View File

@ -0,0 +1,279 @@
<?php
class Rating
{
## PRIVATE VARIABLES
## END PRIVATE VARIABLES
## PUBLIC METHODS
// Output the Rating information
// Returns a string of HTML
public static function OutputRating($varParent, $varItem)
{
// Verify $varItem was provided
if ($varItem != null && strlen(trim($varItem)) != 0 && $varParent != null && strlen(trim($varParent)) != 0)
{
// Check if Magic QUotes is ON
if (!get_magic_quotes_gpc())
{
$varItem = addslashes($varItem);
$varParent = addslashes($varParent);
}
// Information for the Output
$averageStars = Rating::CalculateAverageRating($varParent, $varItem);
// Check to see that the user has not already rated this item
if (Rating::CheckRatingsByIp($varParent, $varItem) == 0)
{
$classes = "rating " . Rating::ShowStars($averageStars);
$cat_info = Rating::FetchCategoryInfo($varItem);
// Write Output HTML for the Rating Data
$output = "\r\n";
$output .= "<div class=\"rating-table\"><div><strong>{$cat_info['rating_cat_name']}</strong></div>\r\n";
$output .= "<div>{$cat_info['rating_cat_min']}</div><div><div class=\"rated\"><ul class=\"{$classes}\" style='margin: 0px 0px 10px 0px;' id=\"{$varParent}_{$varItem}\">\r\n";
$output .= " <li class=\"one\"><a href=\"javascript:RateItem('{$varParent}','{$varItem}', 1);\" title=\"1 Star\">1</a></li>\r\n";
$output .= " <li class=\"two\"><a href=\"javascript:RateItem('{$varParent}','{$varItem}', 2);\" title=\"2 Stars\">2</a></li>\r\n";
$output .= " <li class=\"three\"><a href=\"javascript:RateItem('{$varParent}','{$varItem}', 3);\" title=\"3 Stars\">3</a></li>\r\n";
$output .= " <li class=\"four\"><a href=\"javascript:RateItem('{$varParent}','{$varItem}', 4);\" title=\"4 Stars\">4</a></li>\r\n";
$output .= " <li class=\"five\"><a href=\"javascript:RateItem('{$varParent}','{$varItem}', 5);\" title=\"5 Stars\">5</a></li>\r\n";
$output .= "</ul></div></div><div> {$cat_info['rating_cat_max']}</div></div>\r\n";
}
else
{
$classes = "rated " . Rating::ShowStars($averageStars);
$cat_info = Rating::FetchCategoryInfo($varItem);
// Write Output HTML for the Rating Data
$output = "\r\n";
$output .= "<div class=\"rating-table\"><div><strong>{$cat_info['rating_cat_name']}</strong></div>\r\n";
$output .= "<div>{$cat_info['rating_cat_min']}</div><div><div class=\"rated\"><ul class=\"{$classes}\" style='margin: 0px 0px 10px 0px;' id=\"{$varParent}_{$varItem}\">\r\n";
$output .= " <li class=\"one\">1</li>\r\n";
$output .= " <li class=\"two\">2</li>\r\n";
$output .= " <li class=\"three\">3</li>\r\n";
$output .= " <li class=\"four\">4</li>\r\n";
$output .= " <li class=\"five\">5</li>\r\n";
$output .= "</ul></div></div><div> {$cat_info['rating_cat_max']}</div></div>\r\n";
}
}
else
{
$output = "";
// This is a major issue. NO information can be retrieve if an item name is not passed.
Error::LogError("Variable Missing", "You must provide the item name for this function to find the average.");
}
return $output;
}
public static function OutputParentRating($varParent)
{
// Verify $varParent was provided
if ($varParent != null && strlen(trim($varParent)) != 0)
{
// Check if Magic QUotes is ON
if (!get_magic_quotes_gpc())
{
$varParent = addslashes($varParent);
}
// Information for the Output
$averageStars = Rating::CalculateAverageParentRating($varParent);
$classes = "rated " . Rating::ShowStars($averageStars);
//$parent_info = Rating::FetchParentInfo($varParent);
// Write Output HTML for the Rating Data
$output = "\r\n";
//$output .= "<div style='clear:both;'>Overall Rating</div>";
$output .= "<div style='height: 16px; width: 80px; position: relative;'><ul class=\"{$classes}\" id=\"{$varParent}\" style='margin: 0px 0px 10px 0px;'>\r\n";
$output .= " <li class=\"one\">1</li>\r\n";
$output .= " <li class=\"two\">2</li>\r\n";
$output .= " <li class=\"three\">3</li>\r\n";
$output .= " <li class=\"four\">4</li>\r\n";
$output .= " <li class=\"five\">5</li>\r\n";
$output .= "</ul></div>\r\n";
}
else
{
$output = "";
// This is a major issue. NO information can be retrieve if an item name is not passed.
Error::LogError("Variable Missing", "You must provide the parent name for this function to find the average.");
}
return $output;
}
// Rate an Item
// Returns the name/value pair of new class names and the item name
public static function RateItem($varParent, $varItem, $varRating, $varClasses)
{
$newClassNames = $varClasses;
// Verify $varName was provided
if ($varParent != null && strlen(trim($varParent)) != 0
&& $varItem != null && strlen(trim($varItem)) != 0
&& $varRating != null && strlen(trim($varRating)) != 0 && is_numeric($varRating)
&& $varClasses != null && strlen(trim($varClasses)) != 0)
{
// Check if Magic Quotes is ON
if (!get_magic_quotes_gpc())
{
$varItem = addslashes($varItem);
$varParent = addslashes($varParent);
}
// Check to see that the user has not already rated this item
if (Rating::CheckRatingsByIp($varParent, $varItem) == 0)
{
$ipAddress = $_SERVER['REMOTE_ADDR'];
$tempTime = time();
Database::ExecuteQuery("INSERT INTO `gforum_CoachesRating` (`coach_id_fk`, `category_id_fk`, `rating_vote`, `rating_ip`, `rating_date`) VALUES ('{$varParent}', '{$varItem}', {$varRating}, '{$ipAddress}', '{$tempTime}')", "InsertRating");
Database::FetchResults("InsertRating");
Database::FreeResults("InsertRating");
Database::RemoveSavedResults("InsertRating");
// Information for the Output
$averageStars = Rating::CalculateAverageRating($varParent, $varItem);
$newClassNames = "rated " . Rating::ShowStars($averageStars);
$averageStars = Rating::CalculateAverageParentRating($varParent);
$newClassParent = "rated " . Rating::ShowStars($averageStars);
}
}
else
{
// This is a major issue. NOT enough information was sent to log the item
Error::LogError("Variable(s) Missing", "You must provide all of the information to log the rating of this item.");
}
// Build Name/Value Pair to return
$nameValue = "classes={$newClassNames}&item={$varItem}&parent={$varParent}&parentClass={$newClassParent}";
return $nameValue;
}
## END PUBLIC METHODS
## PRIVATE METHODS
// Fetch Category Names & Min/Max Values
private static function FetchCategoryInfo($varItem)
{
// Query Category Info for a specific Category ID
Database::ExecuteQuery("SELECT * FROM `gforum_CoachesRatingCategory` WHERE `rating_cat_id`='{$varItem}'", "CategoryInfo");
$results = Database::FetchResults("CategoryInfo");
Database::FreeResults("CategoryInfo");
Database::RemoveSavedResults("CategoryInfo");
return $results[0];
}
// Calculate Average Rating
// Returns the number of stars to show
private static function CalculateAverageRating($varParent, $varItem)
{
$averageStars = 0;
// Query Average Rating for a specific Item
Database::ExecuteQuery("SELECT AVG(`rating_vote`) AS `averageRating` FROM `gforum_CoachesRating` WHERE `category_id_fk`='{$varItem}' AND `coach_id_fk`='{$varParent}'", "AverageRating");
$results = Database::FetchResults("AverageRating");
Database::FreeResults("AverageRating");
Database::RemoveSavedResults("AverageRating");
// Round the Average into a Whole Number
if (sizeof($results) == 1)
{
if ($results[0]['averageRating'] != null)
{
$averageStars = round($results[0]["averageRating"], 0);
}
}
else
{
// This is simply a warning, as it isn't vital if no results were found, as the item may be new.
Error::LogWarning("Rating Data Missing", "No entries were found for '{$varName}', this might be the first entry.");
}
return $averageStars;
}
// Calculate Average Rating
// Returns the number of stars to show
private static function CalculateAverageParentRating($varParent)
{
$averageStars = 0;
// Query Average Rating for a specific Item
Database::ExecuteQuery("SELECT AVG(`rating_vote`) AS `averageRating` FROM `gforum_CoachesRating` WHERE `coach_id_fk`='{$varParent}'", "AverageRating");
$results = Database::FetchResults("AverageRating");
Database::FreeResults("AverageRating");
Database::RemoveSavedResults("AverageRating");
// Round the Average into a Whole Number
if (sizeof($results) == 1)
{
if ($results[0]['averageRating'] != null)
{
$averageStars = round($results[0]["averageRating"], 0);
}
}
else
{
// This is simply a warning, as it isn't vital if no results were found, as the item may be new.
Error::LogWarning("Rating Data Missing", "No entries were found for '{$varName}', this might be the first entry.");
}
return $averageStars;
}
// Show Stars
// Returns the class information for the number of stars to show
private static function ShowStars($varStars)
{
// Select the Number of Stars Class
switch ($varStars)
{
case 1:
$classes .= "onestar";
break;
case 2:
$classes .= "twostar";
break;
case 3:
$classes .= "threestar";
break;
case 4:
$classes .= "fourstar";
break;
case 5:
$classes .= "fivestar";
break;
default:
$classes .= "nostar";
break;
}
return $classes;
}
// Check Ratings By IP Address
// Returns the number of ratings for an item by an ip address
private static function CheckRatingsByIp($varParent, $varItem)
{
$ipAddress = $_SERVER['REMOTE_ADDR'];
Database::ExecuteQuery("SELECT COUNT(*) AS `totalRatings` FROM `gforum_CoachesRating` WHERE `category_id_fk`='{$varItem}' AND `coach_id_fk`='{$varParent}' AND `rating_ip`='{$ipAddress}'", "AlreadyRated");
$results = Database::FetchResults("AlreadyRated");
Database::FreeResults("AlreadyRated");
Database::RemoveSavedResults("AlreadyRated");
// Check to see that the user has not already rated this item
if ($results != null && $results[0]['totalRatings'] != null)
{
return $results[0]['totalRatings'];
}
return 0;
}
## END PRIVATE METHODS
}
?>

View File

@ -0,0 +1,55 @@
<?php
$nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", 30 => "thirty", 40 => "forty", 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", 90 => "ninety" );
function int_to_words($x) {
global $nwords;
if(!is_numeric($x))
$w = '#';
else if(fmod($x, 1) != 0)
$w = '#';
else {
if($x < 0) {
$w = 'minus ';
$x = -$x;
} else
$w = '';
// ... now $x is a non-negative integer.
if($x < 21) // 0 to 20
$w .= $nwords[$x];
else if($x < 100) { // 21 to 99
$w .= $nwords[10 * floor($x/10)];
$r = fmod($x, 10);
if($r > 0)
$w .= '-'. $nwords[$r];
} else if($x < 1000) { // 100 to 999
$w .= $nwords[floor($x/100)] .' hundred';
$r = fmod($x, 100);
if($r > 0)
$w .= ' and '. int_to_words($r);
} else if($x < 1000000) { // 1000 to 999999
$w .= int_to_words(floor($x/1000)) .' thousand';
$r = fmod($x, 1000);
if($r > 0) {
$w .= ' ';
if($r < 100)
$w .= 'and ';
$w .= int_to_words($r);
}
} else { // millions
$w .= int_to_words(floor($x/1000000)) .' million';
$r = fmod($x, 1000000);
if($r > 0) {
$w .= ' ';
if($r < 100)
$word .= 'and ';
$w .= int_to_words($r);
}
}
}
return $w;
}
?>

View File

@ -0,0 +1,71 @@
<?php
require_once("classes/include.all.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>CSS Star Rating System fully functional using AJAX</title>
<link type="text/css" href="styles/rating.css" rel="stylesheet" media="all" />
<script type="text/javascript" src="scripts/prototype.js"></script>
<script type="text/javascript" src="scripts/rating.js"></script>
</head>
<body>
<h4>Race Rating System:</h4>
<?php
$ratingData = Rating::OutputParentRating('1');
if (Error::HasErrors())
{
echo Error::ShowErrorMessages();
Error::ClearErrors();
}
else
{
echo $ratingData;
}
?>
<?php
$ratingData = Rating::OutputRating('1','1');
if (Error::HasErrors())
{
echo Error::ShowErrorMessages();
Error::ClearErrors();
}
else
{
echo $ratingData;
}
?>
<?php
$ratingData = Rating::OutputRating('1','2');
if (Error::HasErrors())
{
echo Error::ShowErrorMessages();
Error::ClearErrors();
}
else
{
echo $ratingData;
}
?>
<?php
$ratingData = Rating::OutputRating('1','3');
if (Error::HasErrors())
{
echo Error::ShowErrorMessages();
Error::ClearErrors();
}
else
{
echo $ratingData;
}
?>
</body>
</html>
<?php
Database::DeInitialize();
?>

View File

@ -0,0 +1,85 @@
<?PHP include("config.php");
require_once("rating/classes/include.all.php");
$results = mysql_query("SELECT regionlong FROM ".$prefix."CoachesRegions WHERE regionid = '".intval(mysql_escape_string($_GET[region]))."' LIMIT 1") OR die(mysql_error());
if (mysql_num_rows($results) == 0) {
header('Location: '.$site_url.'?mysql_error');
}
$row = mysql_fetch_array($results);
$regionname = $row[regionlong];
$selected_item = mysql_real_escape_string($_GET[region]);
$results = mysql_query("SELECT gf.coach_id, gf.coach_name, gf.coach_address, gf.coach_address_two, gf.coach_city, gf.coach_state, gf.coach_zip, gf.coach_phone, gf.coach_fax, gf.coach_email, gf.coach_website, gf.coach_certifications
FROM ".$prefix."Coaches AS gf
RIGHT JOIN ".$prefix."CoachesStates AS gts
ON gts.regionid = '".intval(mysql_escape_string($_GET[region]))."' AND gf.coach_state_tag = gts.statetag
WHERE gf.coach_valid = 1 ORDER BY gf.coach_name ASC") OR die(mysql_error());
$none = FALSE;
if (mysql_num_rows($results) == 0) {
$none = TRUE;
}
// set the page title
$pagetitle = $regionname;
// set meta tags
$meta_keywords = "triathlon coaches in ".$regionname;
$meta_description = "Trying to find triathlon coaches in ".$regionname."? Here is a listing of all ".$regionname." triathlon coaches.";
?>
<? 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">
<h1 class="float-left">Triathlon Coaches</h1>
<a href="<? echo $site_url ?>" class="btn btn-white float-right">Back</a>
<? if (is_logged_in($user)) { ?>
<a href="<? echo $site_url . "/add.php" ?>" class="btn btn-white float-right">Add Coach</a>
<? } ?>
<hr class="line" />
<? include("../runshops/include_region_list.php"); ?>
<h2><? echo $regionname ?> Region</h2>
<hr />
<?
if($none == TRUE){
echo "<p>No triathlon coaches have been entered yet for $regionname.</p>";
}
?>
<? while ($row = mysql_fetch_array($results)) {
include("include_store.php");
} ?>
</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>

229
site/coaches/search.php Normal file
View File

@ -0,0 +1,229 @@
<?PHP include("config.php");
// set the page title
$pagetitle = "Search The Database";
// set meta tags
$meta_keywords = "search coaches";
$meta_description = "Do you want to search for coaches in our online triathlon coach database? Then use this form to enter your criteria.";
?>
<? include("include_common_head.php"); ?>
<?
//Array of states for use in the form
$state_list = mysql_query("SELECT * FROM ".$prefix."CoachesStates");
?>
<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">
<h1>Search For A Coach</h1>
<p>If you would like to search for a coach, please use the form below. None of the fields are mandatory. Checking no box in a field indicates you don't care if a coach has or does not have certifications, a fit bike, or motion capture system. Checking regions selects all states in that region. Checking any state's box selects or deselects that state.</p>
<form enctype="multipart/form-data" action="search_X.php" method="post" name="searchform">
<p class="cont"><font color="red"><? echo $errmsg; ?></font></p>
<div class="dtable form">
<div class="drow">
<div class="dcell name">Name Search</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="keyword" class="txt lngtext" />
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<h3>Info</h3>
</div>
</div>
<div class="drow">
<div class="dcell name">Certifications</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table width="100%" cellpadding="2" cellspacing="2">
<?
$results = mysql_query("SELECT * FROM gforum_CoachesCertifications ORDER BY coach_certification_id ASC");
$i = 0;
$grouping = 1;
echo("<tr>");
while ($row = mysql_fetch_array($results)) {
if(($grouping != $row[coach_certification_group]) OR !($i%3)) {
if (!($i%3)) echo ("<td width=\"33%\">&nbsp;</td>");
echo "</tr><tr>";
$grouping = $row[coach_certification_group];
$i = 0;
}
echo("<td width=\"33%\"><input type=\"checkbox\" name=\"certifications[]\" value=\"$row[coach_certification_id]\" >$row[coach_certification_name]</td>\n");
$i++;
}
while($i<3) {
echo("<td width=\"33%\">&nbsp;</td>");
$i++;
}
if(!($i%3)) echo "</tr><tr>";
echo("<td width=\"33%\"><input type=\"checkbox\" name=\"certifications[]\" value=\"999\" ><strong>ANY</strong></td>\n");
$i++;
while($i<3) {
echo("<td width=\"33%\">&nbsp;</td>");
$i++;
}
if(!($i%3)) echo "</tr><tr>";
echo("</tr>");
?>
</table>
</div>
</div>
<div class="drow">
<div class="dcell name">Services Offered</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table width="100%" cellpadding="2" cellspacing="2"><?
$results = mysql_query("SELECT * FROM gforum_CoachesServices ORDER BY coach_service_id ASC");
$i = 0;
echo("<tr>");
//echo("<input type=\"hidden\" name=\"services[]\" value=\"0\" >");
while ($row = mysql_fetch_array($results)) {
if(!($i%1)) echo "</tr><tr>";
echo("<td width=\"100%\"><input type=\"checkbox\" name=\"services[]\" value=\"$row[coach_service_id]\" >$row[coach_service_name]</td>\n");
$i++;
}
if(!($i%1)) echo "</tr><tr>";
echo("<td width=\"100%\"><input type=\"checkbox\" name=\"services[]\" value=\"999\" ><strong>ANY</strong></td>\n");
echo("</tr>");
?>
</table>
</div>
</div>
<div class="drow">
<div class="dcell name">Education</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table width="100%" cellpadding="2" cellspacing="2"><?
$results = mysql_query("SELECT * FROM gforum_CoachesDegrees ORDER BY coach_degree_id ASC");
$i = 0;
echo("<tr>");
//echo("<input type=\"hidden\" name=\"degree[]\" value=\"0\" >");
while ($row = mysql_fetch_array($results)) {
if(!($i%2)) echo "</tr><tr>";
echo("<td><input type=\"checkbox\" name=\"degree[]\" value=\"$row[coach_degree_id]\" >$row[coach_degree_name]</td>\n");
$i++;
}
if(!($i%2)) echo "</tr><tr>";
echo("<td><input type=\"checkbox\" name=\"degree[]\" value=\"999\" ><strong>ANY</strong></td>\n<td>&nbsp;</td>");
echo("</tr>");
?>
</table>
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<h3>Location</h3>
</div>
</div>
<div class="drow">
<div class="dcell name">Region</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table width="100%" cellpadding="2" cellspacing="2">
<?
$regions = array();
$regionsql = "SELECT gts.statetag AS statetag, gtr.regionlong AS regionlong
FROM ".$prefix."CoachesStates AS gts
LEFT JOIN ".$prefix."CoachesRegions AS gtr
ON gts.regionid = gtr.regionid
ORDER BY gtr.regionid";
$region_list = mysql_query($regionsql);
//use loop for check box array
while($row = mysql_fetch_array($region_list)){
if (!is_array($regions[$row[regionlong]])) { $regions[$row[regionlong]] = array(); }
array_push($regions[$row[regionlong]], $row[statetag]);
}
$i = 0;
echo "<tr>";
foreach($regions AS $region => $statetag) {
if(!($i%4)) echo "</tr><tr>";
echo("<td><input type=\"checkbox\" name=\"region\" value=\"$region\" onClick=\"javascript: checkUncheck(this,'".implode("', '", $statetag)."');\">$region</td>\n");
$i++;
}
?>
</tr>
</table>
<p><em>*Selecting a region will select all states in that region. You can then deselect or select any additional states. Only the selected states will be included in your search. Leaving all boxes blank will select races in all states.</em></p>
</div>
</div>
<div class="drow">
<div class="dcell name">State</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table width="100%" cellpadding="2" cellspacing="2">
<? //use loop for check box array
$i = 0;
echo "<tr>";
while($row = mysql_fetch_array($state_list)){
if(!($i%4)) echo "</tr><tr>";
echo "<td><input type='checkbox' id='states' name='states[]' value=\"$row[statetag]\"> $row[statelong]</td>\n";
$i++;
}
?>
</tr>
</table>
<p><em>*Leave blank to select all.</em></p>
</div>
</div>
<div class="drow actions">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="hidden" name="search_form" value="coach">
<input type="submit" value="Search" class="btn default">
</div>
</div>
</div>
</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>

200
site/coaches/search_X.php Normal file
View File

@ -0,0 +1,200 @@
<?PHP
/** TO DO **
- Allow users to search by start time
- Allow users to search by entry fee
************/
include("config.php");
require_once("rating/classes/include.all.php");
if (!$_POST){ header('Location: '.$site_url); }
// build the SQL query
$sql = "SELECT coach_id, coach_name, coach_address, coach_address_two, coach_city, coach_state, coach_zip, coach_phone, coach_fax, coach_email, coach_website FROM ".$prefix."Coaches WHERE coach_valid=1 ";
// add coaches
if (isset($_POST[certifications])) {
if (in_array("999", $_POST[certifications])) {
$sql = $sql." AND coach_certifications <> ',0,'";
} else {
foreach ($_POST[certifications] AS $value) {
$sql = $sql." AND coach_certifications LIKE '%,$value,%'";
}
}
}
if (isset($_POST[services])) {
if (in_array("999", $_POST[services])) {
$sql = $sql." AND coach_services <> ',0,'";
} else {
foreach ($_POST[services] AS $value) {
$sql = $sql." AND coach_services LIKE '%,$value,%'";
}
}
}
if (isset($_POST[degree])) {
if (in_array("999", $_POST[degree])) {
$sql = $sql." AND coach_degrees <> ',0,'";
} else {
foreach ($_POST[degree] AS $value) {
$sql = $sql." AND coach_degrees LIKE '%,$value,%'";
}
}
}
// regions are checkboxes that then check off all states within that region
// add states
if (isset($_POST[states])) {
$glue = "','";
$statelist = "('".implode($glue, $_POST[states])."')";
$sql = $sql." AND coach_state_tag IN $statelist";
}
$sql = $sql." ORDER BY coach_name ASC";
//echo $sql;
$results = mysql_query($sql) OR die(mysql_error());
$none = FALSE;
if (mysql_num_rows($results) == 0) {
$none = TRUE;
}
$coach_count = mysql_num_rows($results);
//keyword search
// trim redundant keywords: triathlon, duathlon
$trim_words = array(" the ", " a ", " an ", "and ", " half ", "triathlon", "duathlon");
foreach ($trim_words AS $word) {
$_POST['keyword'] = str_ireplace($word, " ", $_POST['keyword']);
}
$bool_Keywords = false;
if (isset($_POST['keyword']) && $_POST['keyword'] != "") {
$bool_Keywords = true;
while($row_coaches = mysql_fetch_array($results)) {
// build an array that we can loop through.
$arr_coaches[$i] = $row_coaches;
$i++;
}
$arr_Matches = array();
foreach ($arr_coaches AS $coach) {
if (stripos($coach['coach_name'], $_POST['keyword']) !== false) {
// push this onto the array of matches
$coach['percent'] = 100;
array_push($arr_Matches, $coach);
} else {
$name_nospace = str_replace(" ", "", $coach['coach_name']);
$keyword_nospace = str_replace(" ", "", $_POST['keyword']);
if (stripos($name_nospace, $keyword_nospace) !== false) {
// push this onto the array of matches
$coach['percent'] = 90;
array_push($arr_Matches, $coach);
} else {
// trim redundant keywords
$coach_name = $coach['coach_name'];
foreach ($trim_words AS $word) {
$coach_name = str_ireplace($word, " ", $coach_name);
}
//$coach_name = str_ireplace(" ", "", $coach_name);
$coach_name = strtolower($coach_name);
$arr_coach_name = explode(" ", $coach_name);
$_POST['keyword'] = strtolower($_POST['keyword']);
$_POST['keyword'] = str_replace(" ", "", $_POST['keyword']);
foreach ($arr_coach_name AS $test_word) {
similar_text($test_word, $_POST['keyword'], $percent);
if ($percent >= 70) {
// push this onto the array of matches
$coach['percent'] = round($percent, 0);
//$coach['trimmed'] = $coach_name;
array_push($arr_Matches, $coach);
break;
}
}
}
}
}
if (count($arr_Matches) == 0) {
$none = TRUE;
}
$coach_count = count($arr_Matches);
//sort the array by keyword match success instead of by date
function cmp($a, $b)
{
if ($a['percent'] == $b['percent']) {
return 0;
}
return ($a['percent'] > $b['percent']) ? -1 : 1;
}
usort($arr_Matches, "cmp");
}
//end keyword search
// set the page title
$pagetitle = "Search Results";
// set meta tags
$meta_keywords = "search, coaches, triathlon, results";
$meta_description = "Triathlon coaches matching a user's search query. A list of matching coaches.";
?>
<? 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">
<h1>Search Results</h1>
<p><b><? echo $coach_count; ?></b> Coaches Match Your Search</p>
<table border="0" cellspacing="0" cellpadding="1" width="580">
<?
$x = 0;
if ($bool_Keywords == true) {
foreach ($arr_Matches AS $row) {
include("include_store.php");
} //end foreach
} else { //else bool_keyword
while ($row = mysql_fetch_array($results)) {
include("include_store.php");
} //end while ?>
<? } // end if/else ?>
</table>
</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>

View File

@ -0,0 +1,70 @@
<?PHP include("config.php");
require_once("rating/classes/include.all.php");
include("rating/int.to.words.php");
$results = mysql_query("SELECT * FROM `".$prefix."Coaches` AS gf WHERE `coach_certifications` LIKE '%".$st_id."%'") OR die(mysql_error());
$none = FALSE;
if (mysql_num_rows($results) == 0) {
$none = TRUE;
}
// set the page title
$pagetitle = "Slowtwitch Certified Triathlon Coaches";
// set meta tags
$meta_keywords = "slowtwitch certified triathlon coaches";
$meta_description = "coaches who have completed the Slowtwitch coaching certification course.";
?>
<? 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">
<? $selected_item = 'top'; ?>
<? include("include_sidebar.php"); ?>
</div>
<div class="content content-has-widgets">
<div class="grid">
<div class="clearfix">
<h1>Slowtwitch Certified Coaches</h1>
<hr class="line" />
<? include("../runshops/include_region_list.php"); ?>
<?
if($none == TRUE){
echo "No triathlon coaches have enough votes yet.";
}
?>
<p/>
<? $rating_text = 0;
while($row = mysql_fetch_array($results)) {
include("include_store.php");
} ?>
</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>

131
site/coaches/statelist.php Normal file
View File

@ -0,0 +1,131 @@
<?PHP include("config.php");
require_once("rating/classes/include.all.php");
$results = mysql_query("SELECT coach_state FROM ".$prefix."Coaches WHERE coach_state_tag='".substr(mysql_escape_string($_GET[state]),0,20)."' AND coach_valid = 1 LIMIT 1") OR die(mysql_error());
if (mysql_num_rows($results) == 0) {
header('Location: '.$site_url.'?mysql_error');
}
$row = mysql_fetch_array($results);
$none = FALSE;
$statename = $row[coach_state];
if(mysql_num_rows($results) < 1){
if($statename == "districtofcolumbia"){
$statename = "District of Columbia";
}
if($statename == "centralamerica"){
$statename = "Central America";
}
if(($statename == "newhampshire")){
$statename = "New Hampshire";
}
if($statename == "newjersey"){
$statename = "New Jersey";
}
if($statename == "newmexico"){
$statename = "New Mexico";
}
if($statename == "newyork"){
$statename = "New York";
}
if($statename == "northcarolina"){
$statename = "North Carolina";
}
if($statename == "northdakota"){
$statename = "North Dakota";
}
if($statename == "southcarolina"){
$statename = "South Carolina";
}
if($statename == "southdakota"){
$statename = "South Dakota";
}
if($statename == "westvirginia"){
$statename = "West Virginia";
}
if($statename == "britishcolumbia"){
$statename = "British Columbia";
}
if($statename == "newbrunswick"){
$statename = "New Brunswick";
}
if($statename == "novascotia"){
$statename = "Nova Scotia";
}
if($statename == "princeedwardisland"){
$statename = "Prince Edward Island";
}
$statename = ucfirst($statename);
$none = TRUE;
}
$results = mysql_query("SELECT coach_id, coach_name, coach_address, coach_address_two, coach_city, coach_state, coach_zip, coach_phone, coach_fax, coach_email, coach_website, coach_certifications FROM ".$prefix."Coaches WHERE coach_state_tag='".substr(mysql_escape_string($_GET[state]),0,20)."' AND coach_valid=1 ORDER BY coach_name ASC");
$none = FALSE;
if (mysql_num_rows($results) == 0) {
$none = TRUE;
}
// set the page title
$pagetitle = $statename;
$selected_item = substr(mysql_real_escape_string($_GET[state]),0,20);
// set meta tags
$meta_keywords = "triathlon coaches in ".$statename;
$meta_description = "Trying to find triathlon coaches in ".$statename."? Here is a listing of all ".$statename." triathlon coaches. Users can even rate and comment on these coaches.";
?>
<? 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">
<h1 class="float-left">Triathlon Coaches</h1>
<a href="<? echo $site_url ?>" class="btn btn-white float-right">Back</a>
<? if (is_logged_in($user)) { ?>
<a href="<? echo $site_url . "/add.php" ?>" class="btn btn-white float-right">Add Coach</a>
<? } ?>
<hr class="line" />
<? include("../runshops/include_region_list.php"); ?>
<h2><? echo $statename ?> State</h2>
<hr />
<?
if($none == TRUE){
echo "No triathlon coaches have been entered yet for $statename.";
}
?>
<? while ($row = mysql_fetch_array($results)) {
include("include_store.php");
} ?>
</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>

70
site/coaches/top.php Normal file
View File

@ -0,0 +1,70 @@
<?PHP include("config.php");
require_once("rating/classes/include.all.php");
include("rating/int.to.words.php");
$results = mysql_query("SELECT COUNT(DISTINCT(gfr.rating_ip)) AS respondents, ROUND(AVG(gfr.rating_vote), 2) AS score, COUNT(gfr.rating_vote) AS votes, gf.coach_id, gf.coach_name, gf.coach_address, gf.coach_address_two, gf.coach_city, gf.coach_state, gf.coach_zip, gf.coach_phone, gf.coach_fax, gf.coach_email, gf.coach_website FROM ".$prefix."CoachesRating AS gfr RIGHT JOIN ".$prefix."Coaches AS gf ON gf.coach_id = gfr.coach_id_fk GROUP BY gfr.coach_id_fk HAVING COUNT(gfr.rating_vote) > 10 ORDER BY score DESC, votes DESC LIMIT 10") OR die(mysql_error());
$none = FALSE;
if (mysql_num_rows($results) == 0) {
$none = TRUE;
}
// set the page title
$pagetitle = "Top Triathlon Coaches";
// set meta tags
$meta_keywords = "top ranked triathlon coaches";
$meta_description = "Top ranked triathlon coaches based on rankings submitted by the user.";
?>
<? 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">
<? $selected_item = 'top'; ?>
<? include("include_sidebar.php"); ?>
</div>
<div class="content content-has-widgets">
<div class="grid">
<div class="clearfix">
<h1>Top Ranked Triathlon Coaches</h1>
<hr class="line" />
<? include("../runshops/include_region_list.php"); ?>
<?
if($none == TRUE){
echo "No triathlon coaches have enough votes yet.";
}
?>
<p/>
<? $rating_text = 1;
while($row = mysql_fetch_array($results)) {
include("include_store.php");
} ?>
</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>

88
site/coaches/validate.php Normal file
View File

@ -0,0 +1,88 @@
<?PHP
include("config.php");
if(!is_admin($user)){
header('Location:'.$site_url.'/');
}
// Query to fetch non-validated races:
$results = mysql_query("SELECT coach_id, coach_name, coach_address, coach_address_two, coach_city, coach_state, coach_phone, coach_fax, coach_zip, coach_email, coach_website FROM ".$prefix."Coaches WHERE coach_valid=0 ORDER BY coach_name ASC");
// check to see if set is empty
$none = FALSE;
if (mysql_num_rows($results) == 0) { $none = TRUE; }
// set the page title
$pagetitle = "Admin: Coach 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><strong>Unvalidated Coaches</strong></h1>
<form method="post" action="validate_X.php" enctype="multipart/form-data">
<?
if($none == TRUE){
echo "There are no coaches waiting to be validated.";
}
?>
<div class="dtable">
<? while($row = mysql_fetch_array($results)){ ?>
<div class="drow"><div class="dcell"><a class="sub-hdr" style="margin-left: 5px;" href="<? echo "individual.php?coach_id=$row[coach_id]"; ?>"><? echo $row[coach_name]; ?></a></div></div>
<div class="drow"><div class="dcell">Address: <? echo ("$row[coach_address]"); if($row[coach_address_two]) { echo ("<br /><span class='indent'>$row[coach_address_two]</span>"); } echo("<br /><span class='indent'>$row[coach_city], $row[coach_state] $row[coach_zip]</span>"); ?></div></div>
<div class="drow">
<div class="dcell">
<?
echo "Phone: </strong>$row[coach_phone]<br /><strong class='indent'>Fax/Alt Phone: </strong> $row[coach_fax]";
?>
</div>
</div>
<div class="drow">
<div class="dcel">
<strong>Website:</strong> <? echo "<a href='$row[coach_website]' target='_blank'>$row[coach_website]</a>"; ?>
<br>
<a class="nav" href="<? echo "individual.php?coach_id=$row[coach_id]"; ?>">More information</a>
<br /><input type="checkbox" value="<? echo($row[coach_id]); ?>" name="validate[]"> Validate this coach. <input type="checkbox" value="<? echo($row[coach_id]); ?>" name="delete[]"> Delete this coach.
</div>
</div>
<? } ?>
</div>
<input type="submit" value="Validate Selected Coaches" 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>

View File

@ -0,0 +1,35 @@
<?PHP
include("config.php");
if (!$_POST){ header('Location: '.$site_url); }
// error checking
if(!isset($_POST)) exit();
if (isset($_POST[delete])) {
// convert the array to a SQL friendly format
$deleteList = "(".implode(",", $_POST[delete]).")";
// build the SQL query to delete the edits that are bad
$sql = "DELETE FROM ".$prefix."Coaches WHERE coach_id IN $deleteList";
mysql_query($sql) or die(mysql_error());
}
if (isset($_POST[validate])) {
// convert the array to a SQL friendly format
$idlist = "(".implode(",", $_POST[validate]).")";
// build the SQL query
$sql = "UPDATE ".$prefix."Coaches
SET coach_valid = 1
WHERE coach_id IN $idlist;";
mysql_query($sql) or die(mysql_error());
}
header('Location: '.$site_url.'/validate.php');
?>

View File

@ -0,0 +1,21 @@
<?PHP
if (eregi("wiki_buttons.php", $_SERVER['SCRIPT_NAME'])) {
Header("Location: index.php"); die();
}
?>
<div>
<form method="post" action="wiki_validate_X.php" style="display: inline;">
<input type="hidden" name="validate[]" value="<? echo($row[edit_id]); ?>" />
<input type="submit" value="Validate This Edit" class="btn" onclick="return confirm('Are you sure you want to VALIDATE this coach?');" />
</form>
<form method="post" action="wiki_validate_X.php" style="display: inline;">
<input type="hidden" name="delete[]" value="<? echo($row[edit_id]); ?>" />
<input type="submit" value="Delete This Edit" class="btn" onclick="return confirm('Are you sure you want to DELETE this coach?');" />
</form>
</div>

587
site/coaches/wiki_edit.php Normal file
View File

@ -0,0 +1,587 @@
<?PHP
include("config.php");
if(!isset($_GET[coach_id]) AND !$_POST AND !is_numeric($_GET[coach_id])) {
header('Location: '.$site_url.'/?error=no_id_or_no_post');
exit();
}
if(!is_logged_in($user)){
header('Location: '.$site_url.'/?error=not_logged_in_one');
exit();
}
// Populate with post data or populate with edit return data
if (isset($_POST['edit_return']) || isset($_POST['edit_coach'])) {
$row = $_POST;
} else {
$coach_idhere = intval(mysql_escape_string($_GET[coach_id]));
$results = mysql_query("SELECT * FROM ".$prefix."Coaches WHERE coach_id='".$coach_idhere."'");
$row = mysql_fetch_array($results) OR die(mysql_error());
}
//Get user's session data information
$username = base64_decode($_SESSION['user']);
$useruid = base64_decode($_SESSION['user_id']);
if ($username != "Slowman" && $username != "Rappstar" && $username != "Herbert") {
if ( $row[coach_valid] != 1 ) {
header('Location: '.$site_url.'/?error=coach_not_valid');
exit();
}
}
// set the page title
$pagetitle = "Edit A Triathlon Coach";
// set meta tags
$meta_keywords = "edit a triathlon coach";
$meta_description = "edit screen for triathlon coach information";
?>
<? include("include_common_head.php"); ?>
<?
if($_POST[edit_coach] == true){
include("wiki_edit_X.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">
<? if( $confirm_coach == true ) { ?>
<h1 class="content-title"><strong>Edit a Coach: Step 2 of 2</strong></h1>
<? }else if( ($confirm_coach != true) || ($_POST[edit_coach] != true) ){ ?>
<h1 class="content-title"><strong>Edit a Coach: Step 1 of 2</strong></h1>
<? if (!$errmsg) { ?>
<p class="cont"><p class="cont">To edit a coach, simply change the data you wish. If you make a mistake, just hit the reset button. <span style="color: red;">To save the changes as a NEW coach (for instance, if you have multiple chapters), hit the "SAVE AS A NEW COACH" button. To save changes to the existing coach entry, hit the "SAVE CHANGES TO YOUR COACH" button. You will have a chance to review the data before confirming.</span> <span style="color: red;">You will then be prompted to confirm your information before the information is sent to us.</span></p>
<? } else { ?>
<p class="cont"><span style="color: red;"><? echo $errmsg; ?></span></p>
<? } ?>
<? }
// begin insert form
if( ($_POST[edit_coach] != true) || ($errmsg) || (($confirm_coach != true) && ($_POST[insert_coach] != true)) ) {
?>
<form enctype="multipart/form-data" action="wiki_edit.php" method="post">
<div class="dtable form">
<div class="drow">
<div class="dcell name">Name</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes($row[coach_name]); ?>" type="text" name="coach_name" class="txt lngtext">
</div>
</div>
<div class="drow">
<div class="dcell name">Street Address</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($row[coach_address])); ?>" type="text" name="coach_address" class="txt lngtext">
</div>
</div>
<div class="drow">
<div class="dcell name">Street Address Two (Optional)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($row[coach_address_two])); ?>" type="text" name="coach_address_two" class="txt lngtext">
</div>
</div>
<div class="drow">
<div class="dcell name">City</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($row[coach_city])); ?>" type="text" name="coach_city" class="txt smltext">
</div>
</div>
<div class="drow">
<div class="dcell name">State</div>
<div class="dcell divider"></div>
<div class="dcell value">
<SELECT name="coach_state">
<OPTION value="0">Choose a State/Province/Country</OPTION>
<? //use loop for dropdown box of states
foreach($state_list as $key=>$value){
if(strcmp($row[coach_state], $value) == 0){
$str = " selected=\"selected\"";
}
echo "<option value=\"$value\"$str>$value</option>";
$str = "";
}
?>
</SELECT>
</div>
</div>
<div class="drow">
<div class="dcell name">Zip/Postal Code</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($row[coach_zip])); ?>" type="text" name="coach_zip" class="txt smltext">
</div>
</div>
<div class="drow">
<div class="dcell name">Phone</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($row[coach_phone])); ?>" type="text" name="coach_phone" class="txt smltext">
</div>
</div>
<div class="drow">
<div class="dcell name">Fax/Alternate Phone</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($row[coach_fax])); ?>" type="text" name="coach_fax" class="txt smltext">
</div>
</div>
<div class="drow">
<div class="dcell name">E-mail</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($row[coach_email])); ?>" type="text" name="coach_email" class="txt medtext">
</div>
</div>
<div class="drow">
<div class="dcell name">Website</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo $row[coach_website]; ?>" type="text" name="coach_website" size="30" maxlength="200" class="txt lngtext">
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<h3>Info</h3>
</div>
</div>
<div class="drow">
<div class="dcell name">Certifiations</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table cellpadding=0 cellspacing=0 width="100%"><?
$explosion = array("");
if (!is_array($row[coach_certifications])){ $explosion = explode(",", $row[coach_certifications]); } else { $explosion = $row[coach_certifications]; }
$fetch = mysql_query("SELECT * FROM ".$prefix."CoachesCertifications ORDER BY coach_certification_group ASC, coach_certification_id ASC") OR die(mysql_error());
$i = 0;
$grouping = 1;
echo("<tr>");
echo("<input type=\"hidden\" name=\"coach_certifications[]\" value=\"0\" >");
while ($list = mysql_fetch_array($fetch)) {
if(($grouping != $list[coach_certification_group]) OR !($i%3)) {
if (!($i%3)) echo ("<td width=\"33%\">&nbsp;</td>");
echo "</tr><tr>";
$grouping = $list[coach_certification_group];
$i = 0;
}
echo("<td width=\"33%\"><input type=\"checkbox\" name=\"coach_certifications[]\" value=\"$list[coach_certification_id]\" ");
if (in_array($list[coach_certification_id], $explosion)){ echo "checked "; }
echo(">$list[coach_certification_name]</td>\n");
$i++;
}
while ($i<3) {
echo ("<td width=\"33%\">&nbsp;</td>\n");
$i++;
}
echo("</tr>");
?>
</table>
</div>
</div>
<div class="drow">
<div class="dcell name">Service</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table cellpadding=0 cellspacing=0 width="100%"><?
$explosion = array("");
if (!is_array($row[coach_services])){ $explosion = explode(",", $row[coach_services]); } else { $explosion = $row[coach_services]; }
$fetch = mysql_query("SELECT * FROM ".$prefix."CoachesServices ORDER BY coach_service_id ASC");
$i = 0;
echo("<tr>");
echo("<input type=\"hidden\" name=\"coach_services[]\" value=\"0\" >");
while ($list = mysql_fetch_array($fetch)) {
if(!($i%1)) echo "</tr><tr>";
echo("<td width=\"100%\"><input type=\"checkbox\" name=\"coach_services[]\" value=\"$list[coach_service_id]\" ");
if (in_array($list[coach_service_id], $explosion)){ echo "checked "; }
echo(">$list[coach_service_name]</td>\n");
$i++;
}
echo("</tr>");
?>
</table>
</div>
</div>
<div class="drow">
<div class="dcell name">Education</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table cellpadding=0 cellspacing=0 width="100%"><?
$explosion = array("");
if (!is_array($row[coach_degrees])){ $explosion = explode(",", $row[coach_degrees]); } else { $explosion = $row[coach_degrees]; }
$fetch = mysql_query("SELECT * FROM ".$prefix."CoachesDegrees ORDER BY coach_degree_id ASC");
$i = 0;
echo("<tr>");
echo("<input type=\"hidden\" name=\"coach_degrees[]\" value=\"0\" >");
while ($list = mysql_fetch_array($fetch)) {
if(!($i%2)) echo "</tr><tr>";
echo("<td width=\"50%\"><input type=\"checkbox\" name=\"coach_degrees[]\" value=\"$list[coach_degree_id]\" ");
if (in_array($list[coach_degree_id], $explosion)){ echo "checked "; }
echo(">$list[coach_degree_name]</td>\n");
$i++;
}
echo("</tr>");
?>
</table>
</div>
</div>
<div class="drow">
<div class="dcell name">General Info</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="coach_info" cols="45" class="txt lngtext"><? if($row[coach_info]){ echo strip_tags(stripslashes($row[coach_info])); }else{ echo("Please write some information about your coaching business."); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Rates &amp; Fees</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="coach_cost" rows="7" class="txt lngtext"><? if($row[coach_cost]){ echo strip_tags(stripslashes($row[coach_cost])); }else{ echo("Please describe your rates and fees."); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Camps</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="coach_camps" rows="7" class="txt lngtext"><? if($row[coach_camps]){ echo strip_tags(stripslashes($row[coach_camps])); }else{ echo("Please describe any training camps you put on."); } ?></textarea>
</div>
</div>
<div class="drow actions">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="submit" name="save_changes" value="Save Changes" class="btn">
<input type="submit" name="new_coach" value="Save As A New Coach" class="btn">
<input type="reset" value="Reset" class="btn">
<input type="hidden" name="edit_coach" value="true">
<input type="hidden" name="coach_id" value="<? echo($row[coach_id]); ?>">
<? // need to temporary set the field as being valid ?>
<input type="hidden" name="coach_valid" value="1">
<input type="hidden" name="coach_submitted_by" value="<? echo($row[coach_submitted_by]); ?>">
<input type="hidden" name="edited_by" value="<? echo($useruid); ?>">
</div>
</div>
</div>
</form>
<? }
// end insert form
// begin confirmation form
if($confirm_coach == true){
?>
<div class="indent">
Please confirm your information. If everything is correct, click the submit button. Otherwise, you may click the edit button to change your information before submitting.</div>
<br />
<div class="dtable form">
<div class="drow">
<div class="dcell name">Name</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes($_POST[coach_name]); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Street Address</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[coach_address])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Street Address Two</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[coach_address_two])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">City</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[coach_city])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">State</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[coach_state])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Zip/Postal Code</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[coach_zip])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Phone</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[coach_phone])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Fax/Alternate Phone</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[coach_fax])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">E-mail</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[coach_email])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Website</div>
<div class="dcell divider"></div>
<div class="dcell value">
<a href="<? echo $_POST[coach_website]; ?>" target="_blank"><? echo $_POST[coach_website]; ?></a>
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<h3>Info</h3>
</div>
</div>
<div class="drow">
<div class="dcell name">Certifications</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$explosion = implode(",", $_POST[coach_certifications]);
$sql = ("SELECT * FROM ".$prefix."CoachesCertifications WHERE coach_certification_id IN ($explosion) ORDER BY coach_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[coach_certification_name], ";
}
$certification_list = rtrim($certification_list, ', ');
echo $certification_list;
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Services</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$explosion = implode(",", $_POST[coach_services]);
$sql = ("SELECT * FROM ".$prefix."CoachesServices WHERE coach_service_id IN ($explosion) ORDER BY coach_service_name ASC");
//echo $sql;
$fetch = mysql_query($sql) or die(mysql_error());
$service_list = "";
while ($list = mysql_fetch_array($fetch)) {
$service_list = $service_list."$list[coach_service_name], ";
}
$service_list = rtrim($service_list, ', ');
echo $service_list;
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Education</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$explosion = implode(",", $_POST[coach_degrees]);
$sql = ("SELECT * FROM ".$prefix."CoachesDegrees WHERE coach_degree_id IN ($explosion) ORDER BY coach_degree_name ASC");
//echo $sql;
$fetch = mysql_query($sql) or die(mysql_error());
$degree_list = "";
while ($list = mysql_fetch_array($fetch)) {
$degree_list = $degree_list."$list[coach_degree_name], ";
}
$degree_list = rtrim($degree_list, ', ');
echo $degree_list;
?>
</div>
</div>
<div class="drow">
<div class="dcell name">General Info</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[coach_info])) ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Rates &amp; Fees</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[coach_cost])) ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Camps</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[coach_camps])) ?>
</div>
</div>
<div class="drow actions">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<form action="wiki_edit.php" method="post">
<input type="hidden" name="coach_name" value="<? echo stripslashes(htmlspecialchars($_POST[coach_name])); ?>">
<input type="hidden" name="coach_address" value="<? echo stripslashes(htmlspecialchars($_POST[coach_address])); ?>">
<input type="hidden" name="coach_address_two" value="<? echo stripslashes(htmlspecialchars($_POST[coach_address_two])); ?>">
<input type="hidden" name="coach_city" value="<? echo stripslashes(htmlspecialchars($_POST[coach_city])); ?>">
<input type="hidden" name="coach_state" value="<? echo $_POST[coach_state]; ?>">
<input type="hidden" name="coach_zip" value="<? echo $_POST[coach_zip]; ?>">
<input type="hidden" name="coach_phone" value="<? echo $_POST[coach_phone]; ?>">
<input type="hidden" name="coach_fax" value="<? echo $_POST[coach_fax]; ?>">
<input type="hidden" name="coach_email" value="<? echo $_POST[coach_email]; ?>">
<input type="hidden" name="coach_website" value="<? echo $_POST[coach_website]; ?>">
<input type="hidden" name="coach_certifications" value="<? echo(implode(',', $_POST[coach_certifications])); ?>">
<input type="hidden" name="coach_services" value="<? echo(implode(',', $_POST[coach_services])); ?>">
<input type="hidden" name="coach_degrees" value="<? echo(implode(',', $_POST[coach_degrees])); ?>">
<input type="hidden" name="coach_cost" value="<? echo stripslashes(htmlspecialchars($_POST[coach_cost])); ?>">
<input type="hidden" name="coach_info" value="<? echo stripslashes(htmlspecialchars($_POST[coach_info])); ?>">
<input type="hidden" name="coach_camps" value="<? echo stripslashes(htmlspecialchars($_POST[coach_camps])); ?>">
<? // need to temporary set the field as being valid ?>
<input type="hidden" name="coach_valid" value="1">
<input type="hidden" name="edit_coach" value="true">
<input type="hidden" name="insert_coach" value="true">
<input type="hidden" name="coach_submitted_by" value="<? echo $useruid; ?>" >
<? if(isset($_POST[new_coach])){ ?>
This data will be saved as a NEW COACH.
<input type="hidden" name="new_coach" value="1" />
<input type="hidden" name="coach_submitted_by" value="<? echo($_POST[edited_by]); ?>" />
<? } else { ?>
This data will be saved as a modification to the EXISTING COACH.
<input type="hidden" name="save_changes" value="1" />
<input type="hidden" name="edited_by" value="<? echo($_POST[edited_by]); ?>">
<input type="hidden" name="coach_submitted_by" value="<? echo($_POST[coach_submitted_by]); ?>" />
<input type="hidden" name="coach_id" value="<? echo($_POST[coach_id]); ?>" />
<? } ?>
<br><input type="submit" name="coach_submit" value="Submit Info" class="btn float-left" style="margin-right: 5px">
</form>
<form action="wiki_edit.php" method="post">
<input type="hidden" name="coach_name" value="<? echo stripslashes(htmlspecialchars($_POST[coach_name])); ?>">
<input type="hidden" name="coach_address" value="<? echo stripslashes(htmlspecialchars($_POST[coach_address])); ?>">
<input type="hidden" name="coach_address_two" value="<? echo stripslashes(htmlspecialchars($_POST[coach_address_two])); ?>">
<input type="hidden" name="coach_city" value="<? echo stripslashes(htmlspecialchars($_POST[coach_city])); ?>">
<input type="hidden" name="coach_state" value="<? echo $_POST[coach_state]; ?>">
<input type="hidden" name="coach_zip" value="<? echo $_POST[coach_zip]; ?>">
<input type="hidden" name="coach_phone" value="<? echo $_POST[coach_phone]; ?>">
<input type="hidden" name="coach_fax" value="<? echo $_POST[coach_fax]; ?>">
<input type="hidden" name="coach_email" value="<? echo $_POST[coach_email]; ?>">
<input type="hidden" name="coach_website" value="<? echo $_POST[coach_website]; ?>">
<input type="hidden" name="coach_certifications" value="<? echo(implode(',', $_POST[coach_certifications])); ?>">
<input type="hidden" name="coach_services" value="<? echo(implode(',', $_POST[coach_services])); ?>">
<input type="hidden" name="coach_degrees" value="<? echo(implode(',', $_POST[coach_degrees])); ?>">
<input type="hidden" name="coach_cost" value="<? echo stripslashes(htmlspecialchars($_POST[coach_cost])); ?>">
<input type="hidden" name="coach_info" value="<? echo stripslashes(htmlspecialchars($_POST[coach_info])); ?>">
<input type="hidden" name="coach_camps" value="<? echo stripslashes(htmlspecialchars($_POST[coach_camps])); ?>">
<input type="hidden" name="confirm_coach" value="0">
<input type="hidden" name="edit_return" value="true">
<? // need to temporary set the field as being valid ?>
<input type="hidden" name="coach_valid" value="1">
<input type="hidden" name="coach_id" value="<? echo($_POST[coach_id]); ?>" />
<input type="hidden" name="coach_submitted_by" value="<? echo $submitted_by; ?>">
<input type="submit" name="submit" value="Edit Information" class="btn btn-left">
</form>
</div>
</div>
</div>
<?
}
//end confirmation 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>

View File

@ -0,0 +1,124 @@
<?PHP
if (!$_POST){ header('Location: '.$site_url.'/?error=no_post'); }
/*
FIELD NAMES:
coach_id
coach_name
coach_name_tag
coach_address
coach_address_two
coach_city
coach_state
coach_state_tag
coach_zip
coach_phone
coach_fax
coach_email
coach_website
coach_certifications
coach_services
coach_degrees
coach_cost
coach_info
coach_camps
coach_submitted_by
coach_valid
coach_user_tags
*/
/* Need to ltrim and rtrim commas before insertion */
//Insert into database
$errmsg = NULL;
//Check for blank fields
if ((!$_POST[coach_name])) $errmsg = $errmsg."Shop name, ";
if (!$_POST[coach_city]) $errmsg = $errmsg."City, ";
if (!$_POST[coach_state]) $errmsg = $errmsg."State, ";
if (!$_POST[coach_address]) $errmsg = $errmsg."Address, ";
if (!$_POST[coach_phone]) $errmsg = $errmsg."Phone, ";
if (!$_POST[coach_email]) $errmsg = $errmsg."Email, ";
if (!$_POST[coach_website]) $errmsg = $errmsg."Website, ";
if (strlen($_POST[coach_cost]) < 4) $errmsg = $errmsg."Rates &amp; Fees, ";
if (strlen($_POST[coach_info]) < 4) $errmsg = $errmsg."General Info, ";
if (strlen($_POST[coach_camps]) < 4) $errmsg = $errmsg."Camps, ";
if (isset($errmsg)) {
$errmsg = "The following fields cannot be left blank: ".$errmsg."<br />";
$errmsg = rtrim($errmsg, ", ");
}
$start_url = "(http(s)?\:\/\/)?"; // start url
$dots = "([\w_-]{2,}\.)+"; // one or more parts containing a '.' at the end
$last_part = "([\w_-]{2,})"; // last part doesn't contain a dot
$user = "((\/)(\~)[\w_=-]+)?((\/)[\w_=-]+)*"; // maybe subdirectories - possibly with user ~
$end = "((\/)|(\/)[\w_-]+\.[\w]{2,})?"; // maybe a slash at the end or slash+file+extension
$qstring1 = "((\?[\w_-]+\=([^\#]+)){0,1}"; // querystring - first argument (?a=b)
$qstring2 = "(\&[\w_-]+\=([^\#]+))*)?"; // querystring - following arguments (&c=d)
$bkmrk = "(#[\w_-]+)?"; // bookmark
$exp = "/^".$start_url.$dots.$last_part.$user.$end.$qstring1.$qstring2.$bkmrk."$/i";
if( !preg_match($exp, $_POST[coach_website]) ) {
// Contains invalid characters.
$errmsg = $errmsg."Invalid Web Address<br />";
}
if( preg_match('/[^a-zA-Z0-9\. ]/', $_POST[coach_name]) ) {
// Contains invalid characters.
$errmsg = $errmsg."Please use only letters and numbers in the name<br />";
}
if(!$errmsg){
$name = trim($_POST[coach_name]);
$name_tag = strtolower(str_replace(" ","", $name));
if(strlen($nametag) > 12){ //Shorten it
$name_tag = substr($nametag, 0, 12);
}
$address = mysql_escape_string(trim($_POST[coach_address]));
if (isset($_POST['coach_address_two'])) { $address_two = mysql_escape_string(trim($_POST[coach_address_two])); } else { $address_two = NULL; }
$city = mysql_escape_string(trim($_POST[coach_city]));
$state = $_POST[coach_state];
$state_tag = strtolower(str_replace(" ","", $state));
$zip = mysql_escape_string(trim($_POST[coach_zip]));
$phone = trim($_POST[coach_phone]);
$fax = trim($_POST[coach_fax]);
$email = mysql_escape_string(trim($_POST[coach_email]));
$website = mysql_escape_string(trim($_POST[coach_website]));
$certifications = $_POST[coach_certifications];
$services = $_POST[coach_services];
$degrees = $_POST[coach_degrees];
$cost = mysql_escape_string(nl2br(substr(trim($_POST[coach_cost]), 0, 4096)));
$info = mysql_escape_string(nl2br(substr(trim($_POST[coach_info]), 0, 4096)));
$camps = mysql_escape_string(nl2br(substr(trim($_POST[coach_camps]), 0, 4096)));
$submitted_by = $_POST[coach_submitted_by];
$id = $_POST[coach_id];
$edited_by = $_POST[edited_by];
$edit_timestamp = time();
// BEGIN CONFIRM ENTRY CHECK
if($_POST[insert_coach] == true){
if(isset($_POST[new_coach])){
$sql = "INSERT INTO ".$prefix."Coaches (coach_name, coach_name_tag, coach_address, coach_address_two, coach_city, coach_state, coach_state_tag, coach_zip, coach_phone, coach_fax, coach_email, coach_website, coach_certifications, coach_services, coach_degrees, coach_cost, coach_info, coach_camps, coach_submitted_by, coach_valid) VALUES ('$name', '$name_tag', '$address', '$address_two', '$city', '$state', '$state_tag', '$zip', '$phone', '$fax', '$email', '$website', ',$certifications,', ',$services,', ',$degrees,', '$cost', '$info', '$camps', $submitted_by, 0)";
//echo("coach entered!");
//echo($sql);
mysql_query($sql) OR die(mysql_error());
header('Location: '.$site_url.'/add.php?confirmed=yes');
} elseif(isset($_POST[save_changes])) {
$sql = "INSERT INTO ".$prefix."CoachesEdits (coach_id_fk, editor_user_id_fk, edit_timestamp, coach_name, coach_name_tag, coach_address, coach_address_two, coach_city, coach_state, coach_state_tag, coach_zip, coach_phone, coach_fax, coach_email, coach_website, coach_certifications, coach_services, coach_degrees, coach_cost, coach_info, coach_camps, coach_submitted_by, coach_valid) VALUES ('$id', '$edited_by', '$edit_timestamp', '$name', '$name_tag', '$address', '$address_two', '$city', '$state', '$state_tag', '$zip', '$phone', '$fax', '$email', '$website', ',$certifications,', ',$services,', ',$degrees,', '$cost', '$info', '$camps', $submitted_by, 0)";
//echo $sql;
//exit;
mysql_query($sql) OR die(mysql_error());
header('Location: '.$site_url.'/individual.php?coach_id='.$id.'&wiki_change=success');
} else {
header('Location: '.$site_url.'/individual.php?coach_id='.$id.'&changes=failure');
}
} else {
//echo("coach NOT entered.");
$confirm_coach = true;
}
// END CONFIRM ENTRY CHECK
}
// END ERROR MESSAGE CHECK
?>

View File

@ -0,0 +1,92 @@
<?PHP include("config.php");
if(!is_admin($user)){
header('Location:'.$site_url.'/');
}
// Query to fetch non-validated coaches:
$results = mysql_query("SELECT edit_id, coach_name, coach_city, coach_state, coach_info, edit_timestamp, coach_submitted_by, editor_user_id_fk FROM ".$prefix."CoachesEdits 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: Coach 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><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 ".$prefix."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[coach_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[coach_name]; ?></a></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 coach submitter)"; } else { echo ""; } ?></div></div>
<div class="drow"><div class="dcell"><strong>Info:</strong>
<?
if(strlen($row[coach_info]) > 400){
$phrase = "&hellip;"; }else{
$phrase = ""; }
echo substr(htmlspecialchars(strip_tags(stripslashes($row[coach_info]))), 0, 160);
echo $phrase;
?>
</div></div>
<div class="drow"><div class="dcell">
<strong>Location:</strong> <? echo "$row[coach_city], $row[coach_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.<br />
</div></div>
<? } ?>
</div>
<input type="submit" value="Process Selected Coaches" 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>

View File

@ -0,0 +1,97 @@
<?PHP
// do I need to do additional security checks to make sure the script is being called appropriately?
/*
FIELD NAMES:
coach_id
coach_name
coach_name_tag
coach_address
coach_address_two
coach_city
coach_state
coach_state_tag
coach_zip
coach_phone
coach_fax
coach_email
coach_website
coach_certifications
coach_services
coach_degrees
coach_cost
coach_info
coach_camps
coach_submitted_by
coach_valid
coach_user_tags
*/
include("config.php");
if (!$_POST){ header('Location: '.$site_url.'/'); }
// error checking
if(!isset($_POST)) exit();
if (isset($_POST[delete])) {
// convert the array to a SQL friendly format
$deleteList = "(".implode(",", $_POST[delete]).")";
// build the SQL query to delete the edits that are bad
$sql = "DELETE FROM ".$prefix."CoachesEdits WHERE edit_id IN $deleteList";
mysql_query($sql) or die(mysql_error());
}
if (isset($_POST[validate])) {
// convert the array to a SQL friendly format
$validateList = "(".implode(",", $_POST[validate]).")";
$sql = "SELECT * FROM ".$prefix."CoachesEdits WHERE edit_id IN $validateList";
$results = mysql_query($sql) OR die(mysql_error());
// Loop through coaches shifting edits over
while($row = mysql_fetch_array($results)) {
$sql = "UPDATE ".$prefix."Coaches
SET coach_name = '".mysql_escape_string($row[coach_name])."',
coach_name_tag = '".mysql_escape_string($row[coach_name_tag])."',
coach_address = '".mysql_escape_string($row[coach_address])."',
coach_address_two = '".mysql_escape_string($row[coach_address_two])."',
coach_city = '".mysql_escape_string($row[coach_city])."',
coach_state = '".mysql_escape_string($row[coach_state])."',
coach_state_tag = '".mysql_escape_string($row[coach_state_tag])."',
coach_phone = '".mysql_escape_string($row[coach_phone])."',
coach_fax = '".mysql_escape_string($row[coach_fax])."',
coach_zip = '".mysql_escape_string($row[coach_zip])."',
coach_email = '".mysql_escape_string($row[coach_email])."',
coach_website = '".mysql_escape_string($row[coach_website])."',
coach_certifications = '".mysql_escape_string($row[coach_certifications])."',
coach_services = '".mysql_escape_string($row[coach_services])."',
coach_degrees = '".mysql_escape_string($row[coach_degrees])."',
coach_cost = '".mysql_escape_string($row[coach_cost])."',
coach_info = '".mysql_escape_string($row[coach_info])."',
coach_camps = '".mysql_escape_string($row[coach_camps])."'
WHERE coach_id = '".mysql_escape_string($row[coach_id_fk])."'";
//echo $sql;
//exit();
mysql_query($sql) OR die(mysql_error());
$sql = "INSERT INTO ".$prefix."CoachesEditors (coach_id_fk, user_id_fk, edit_timestamp) VALUES ('$row[coach_id_fk]', '$row[editor_user_id_fk]', '$row[edit_timestamp]')";
mysql_query($sql) OR die(mysql_error());
$sql = "DELETE FROM ".$prefix."CoachesEdits WHERE edit_id = $row[edit_id]";
mysql_query($sql) OR die(mysql_error());
}
}
header('Location: '.$site_url.'/wiki_validate.php');
?>

198
site/coaches/wiki_view.php Normal file
View File

@ -0,0 +1,198 @@
<?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."CoachesEdits 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[coach_name];
// set meta tags
$meta_keywords = "triathlon, ".$row[coach_name].", ".$row[coach_state]." triathlon coach";
$meta_description = "Considering getting fit by ".$row[coach_name]."? Here is all of the information about this coach.";
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><!-- class="content-title"--><? echo stripslashes($row[coach_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[coach_address])); ?>
<br />
<strong>Street Address Two: </strong><? echo stripslashes(htmlspecialchars($row[coach_address_two])); ?>
<br />
<strong>City: </strong><? echo stripslashes(htmlspecialchars($row[coach_city])); ?>
<br />
<strong>State: </strong><? echo stripslashes(htmlspecialchars($row[coach_state])); ?>
<br />
<strong>Zip/Postal Code: </strong><? echo stripslashes(htmlspecialchars($row[coach_zip])); ?>
<br />
<strong>Phone: </strong><? echo stripslashes(htmlspecialchars($row[coach_phone])); ?>
<br />
<strong>Fax/Alt Phone: </strong><? echo stripslashes(htmlspecialchars($row[coach_fax])); ?>
<br />
<strong>E-mail: </strong><a href="mailto:<? echo $row[coach_email]; ?>"><? echo stripslashes(htmlspecialchars($row[coach_email])); ?></a>
<br />
<strong>Website: </strong><a href="<? echo $row[coach_website]; ?>" target="_blank"><? echo $row[coach_website]; ?></a>
<br />
<br />
<div class="indentlarge">
<?
for ($i = 0; $i < 39; $i++) echo("*");
echo (" INFO ");
for ($i = 0; $i < 39; $i++) echo("*");
?>
</div>
<br />
<strong>Education: </strong><?
$row[coach_degrees] = ltrim(rtrim($row[coach_degrees], ", "), ", ");
$sql = ("SELECT * FROM gforum_CoachesDegrees WHERE coach_degree_id IN ($row[coach_degrees]) ORDER BY coach_degree_name ASC");
//echo $sql;
$fetch = mysql_query($sql) or die(mysql_error());
$degree_list = "";
while ($list = mysql_fetch_array($fetch)) {
$degree_list = $degree_list."$list[coach_degree_name], ";
}
$degree_list = rtrim($degree_list, ', ');
if ($degree_list) {echo $degree_list;} else {echo "None";}
?>
<br />
<strong>Certifications: </strong><?
$row[coach_certifications] = ltrim(rtrim($row[coach_certifications], ", "), ", ");
$sql = ("SELECT * FROM gforum_CoachesCertifications WHERE coach_certification_id IN ($row[coach_certifications]) ORDER BY coach_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[coach_certification_name], ";
}
$certification_list = rtrim($certification_list, ', ');
if ($certification_list) {echo $certification_list;} else {echo "None";}
?>
<br />
<strong>Services: </strong><?
$row[coach_services] = ltrim(rtrim($row[coach_services], ", "), ", ");
$sql = ("SELECT * FROM gforum_CoachesServices WHERE coach_service_id IN ($row[coach_services]) ORDER BY coach_service_name ASC");
//echo $sql;
$fetch = mysql_query($sql) or die(mysql_error());
$service_list = "";
while ($list = mysql_fetch_array($fetch)) {
$service_list = $service_list."$list[coach_service_name], ";
}
$service_list = rtrim($service_list, ', ');
if ($service_list) {echo $service_list;} else {echo "None";}
?>
<br /><br />
<div class="indentlarge">
<?
for ($i = 0; $i < 80; $i++) echo("*");
?>
</div>
<br />
<strong>General Info: </strong><? echo stripslashes(stripslashes($row[coach_info])) ?>
<br /><br />
<strong>Rates &amp; Fees: </strong><? echo stripslashes(stripslashes($row[coach_cost])); ?>
<br /><br />
<strong>Training Camps Offered: </strong><? echo stripslashes(stripslashes($row[coach_camps])); ?>
<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>

View File

@ -0,0 +1,69 @@
<div class="footer">
<div class="section-divider"></div>
<!--section class="section advert-large"-->
<div class="ad">
<script type="text/javascript">
if (winWidth> 1024) { document.write('<div class="adwrapper">' + "<!-- BEGIN ADVERTSERVE CODE -->\n<script type=\"text\/javascript\">\ndocument.write(\'<scr\'+\'ipt src=\"https:\/\/reach.slowtwitch.com\/servlet\/view\/banner\/javascript\/zone?zid=64&pid=0&resolution=\'+(window.innerWidth||screen.width)+\'x\'+(window.innerHeight||screen.height)+\'&random=\'+Math.floor(89999999*Math.random()+10000000)+\'&millis=\'+new Date().getTime()+\'&referrer=\'+encodeURIComponent((window!=top&&window.location.ancestorOrigins)?window.location.ancestorOrigins[window.location.ancestorOrigins.length-1]:document.location)+\'\" type=\"text\/javascript\"><\/scr\'+\'ipt>\');\n<\/script>\n<!-- END ADVERTSERVE CODE -->" + '</div>'); } else { document.write('<div class="adwrapper">' + "<!-- BEGIN ADVERTSERVE CODE -->\n<script type=\"text\/javascript\">\ndocument.write(\'<scr\'+\'ipt src=\"https:\/\/reach.slowtwitch.com\/servlet\/view\/banner\/javascript\/zone?zid=43&pid=0&resolution=\'+(window.innerWidth||screen.width)+\'x\'+(window.innerHeight||screen.height)+\'&random=\'+Math.floor(89999999*Math.random()+10000000)+\'&millis=\'+new Date().getTime()+\'&referrer=\'+encodeURIComponent((window!=top&&window.location.ancestorOrigins)?window.location.ancestorOrigins[window.location.ancestorOrigins.length-1]:document.location)+\'\" type=\"text\/javascript\"><\/scr\'+\'ipt>\');\n<\/script>\n<!-- END ADVERTSERVE CODE -->" + '</div>'); }
</script>
<br />
</div>
<!--/section-->
<?
$fetch_sponsors = mysql_query("SELECT * FROM glinks_Ticker ORDER BY ticker_text ASC");
$sponsors = array();
while ($row = mysql_fetch_array($fetch_sponsors)) {
array_push($sponsors, '<a href="' . $row[ticker_link] .'">' . $row[ticker_text] . '</a>');
}
?>
<? if (count($sponsors) > 0) { ?>
<section class="sponsors">
<hr class="line">
<nav>
<? echo join(" | ", $sponsors); ?>
</nav>
</section>
<? } ?>
<div class="masfoot clearfix">
<div class="navbar menu">
<ul class="nav">
<li><a href="<? echo $main_site_url ?>/aboutus.html" class="aboutus">About</a></li>
<li><a href="<? echo $main_site_url ?>/advertise.html" class="aboutus">Advertise</a></li>
<li><a href="<? echo $main_site_url ?>/privacy.html" class="policy">Privacy Policy</a></li>
<li><a href="javascript: Cookiebot.renew()">Cookie Consent</a></li>
<li><a href="<? echo $main_site_url ?>/agreement.html" class="agreement">User Agreement</a></li>
</ul>
</div>
<div class="social clearfix">
<? include($common_path . "/templates/include_social.html"); ?>
</div>
</div>
<div class="masfoot-b clearfix">
<div class="newsletter">
<h2 class="forum">newsletter</h2>
Sign up for the Slowtwitch newsletter
<? include($common_path . "/templates/include_subscribe.html"); ?>
</div>
<div class="contact-us clearfix">
<span class="sprite-logo"></span>
<p class="addr">transition-DOT-area-AT-slowtwitch-DOT-com</p>
</div>
</div>
<div class="bg-1 clearfix">
<div class="col-5">
<div class="adv-withus clearfix">
<span class="sprite-logo-sm"></span>
<a href="<? echo $main_site_url ?>/advertise.html">Advertise with us</a>
</div>
</div>
<div class="col-7">
<div class="copyright">
<p>&copy;1999-<? $year = date("Y"); echo $year; ?> Slowtwitch, Inc., and Slowtwitch.com<br />Reproduction of material from any Slowtwitch.com page<br />without written permission is strictly prohibited.</p>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,86 @@
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="keywords" content="<? echo($meta_keywords); ?>" />
<meta name="description" content="<? echo($meta_description); ?>"/>
<meta name="author" content="Slowtwitch.com" />
<meta name="facebook-domain-verification" content="bjsr7t1emgzf0nk5gxqumecuu2oxbr" />
<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-cbid="fb3f174d-6745-4525-a42d-2d75a3368149" data-blockingmode="auto" type="text/javascript"></script>
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" href="/images/slowtwitch_apple.png" />
<link rel="alternate" type="application/rss+xml" title="Slowtwitch.com - RSS" href="https://www.slowtwitch.com/rss" />
<link href='https://fonts.googleapis.com/css?family=Open+Sans|Oswald|Roboto+Slab' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBDttorbDzy7Fa5IGeyvolnJZpiOVeQdBA"></script>
<? if ($mini_version) { ?>
<link type="text/css" rel="stylesheet" href="<? echo $static_url ?>/r<? echo $mini_version ?>/css/style.min.css" />
<? } else { ?>
<link type="text/css" rel="stylesheet" href="<? echo $static_url ?>/css/jquery-ui.min.css" />
<link type="text/css" rel="stylesheet" href="<? echo $static_url ?>/css/lightbox.min.css" />
<link type="text/css" rel="stylesheet" href="<? echo $static_url ?>/css/core.css" />
<link type="text/css" rel="stylesheet" href="<? echo $static_url ?>/css/style.css" />
<link type="text/css" rel="stylesheet" href="<? echo $static_url ?>/css/swiper.min.css">
<? } ?>
<script type="text/javascript">
var winWidth = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
</script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-4JP2WEE0TF"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-4JP2WEE0TF');
</script>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=G-4JP2WEE0TF"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<!-- Google Analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2419103-1']);
_gaq.push(['_setDomainName', '.slowtwitch.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- BEGIN ADVERTSERVE CODE -->
<script type="text/javascript">
var _avp = _avp || [];
(function() {
var s = document.createElement('script');
s.type = 'text/javascript'; s.async = true; s.src = 'https://reach.slowtwitch.com/js/libcode3.js';
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
})();
</script>
<!-- END ADVERTSERVE CODE -->
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '895910530528995');
fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=895910530528995&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->

View File

@ -0,0 +1,86 @@
<? $mini_version = isset($mini_version) ? $mini_version : false; ?>
<? if ($mini_version) { ?>
<script type="text/javascript" src="<? echo $static_url ?>/r<? echo $mini_version ?>/js/base.min.js"></script>
<? } else { ?>
<script type="text/javascript" src="<? echo $static_url ?>/js/jquery.min.js"></script>
<script type="text/javascript" src="<? echo $static_url ?>/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="<? echo $static_url ?>/js/jquery.form.min.js"></script>
<script type="text/javascript" src="<? echo $static_url ?>/js/jquery.jcarousellite.min.js"></script>
<script type="text/javascript" src="<? echo $static_url ?>/js/jquery.autocomplete.min.js"></script>
<script type="text/javascript" src="<? echo $static_url ?>/js/core.js"></script>
<script type="text/javascript" src="<? echo $static_url ?>/js/swiper.min.js"></script>
<script type="text/javascript" src="<? echo $static_url ?>/js/markerclusterer_compiled.js"></script>
<script type="text/javascript" src="<? echo $static_url ?>/js/main.js"></script>
<script type="text/javascript" src="<? echo $static_url ?>/js/map.js"></script>
<script type="text/javascript" src="<? echo $static_url ?>/js/rating.js"></script>
<script type="text/javascript" src="<? echo $static_url ?>/js/fit_calculator.js"></script>
<? } ?>
<script type="text/javascript">
function load_poll(url) {
$.ajax({
url: url,
success: function(html) {
$('#poll_widget').html(html).find('a').click(function() {
load_poll($(this).attr('href'));
return false;
});
$('#poll_widget form[name=forum_poll]').ajaxForm({
success: function(html) {
$('#poll').html(html).find('a').click(function() {
load_poll($(this).attr('href'));
return false;
});
}
});
}
});
}
if ($('#poll_widget').length > 0) {
load_poll("<? echo $main_site_url . '/cgi-bin/poll.cgi' ?>");
}
/* load editor's threads pick */
if ($('.widget-threads').length > 0) {
$('.widget-threads').each(function() {
var container = $(this).find('.list');
$.ajax({
url: "<%config.db_cgi_url%>/threads.cgi?id=" + container.attr('data'),
success: function(html) {
container.html(html);
}
})
});
}
$(document).ready(function() {
$('#roadshow-btn').click(function() {
$('#appform').dialog({
resizable: 'auto',
height: 600,
width: 620,
modal: true
})
return false;
})
})
</script>
<script type="text/javascript">
setTimeout(
function() {
AdvertInteractiveRegistry.forEach(
function(el){if (el.tagId === 'WallpaperAd'){el.finishViewableTimeTracking()}}
);
var wallpaper = document.getElementById('WallpaperAd');
if (wallpaper) { wallpaper.parentNode.parentNode.removeChild(wallpaper.parentNode); }
var shim = document.getElementById('WallpaperShim');
if (shim) { document.body.removeChild(shim); }
var pushdown = document.getElementById('WallpaperPushdown');
if (pushdown) { document.body.removeChild(pushdown); }
_avp.push({ tagid: 'avp_zid_106', alias: '/', type: 'wallpaper', zid: 106, pid: 0, secure: true });
AVP.load();
},
30000
);
</script>

View File

@ -0,0 +1,233 @@
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NF47Q8S"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<div id="consent_blackbar"></div>
<div class="header clearfix">
<div class="mashead clearfix">
<div class="utils">
<a href="<? echo $main_site_url ?>/Swim/index.html" class="sprite-swim">Swim</a>
<a href="<? echo $main_site_url ?>/Bike/index.html" class="sprite-bike">Bike</a>
<a href="<? echo $main_site_url ?>/Run/index.html" class="sprite-run">Run</a>
</div>
<div class="grphead clearfix">
<div class="brand">
<a href="<? echo $main_site_url ?>" alt="Slowtwitch" class="sprite-brand">Slowtwitch.com</a>
</div>
<div class="navbar utility">
<ul class="nav">
<li class="welcome">
<? if (is_logged_in($user)) { ?>
<a href="<? echo $forum_url . "?do=logout" ?>" class="logout">Log out</a>
<? } else { ?>
<a href="<? echo $forum_url . "?do=login" ?>">Login <span>&gt;</span></a>
<? } ?>
</li>
<li class="subscribe">
<a href="#>">Subscribe <span>&gt;</span></a>
<div class="subscribe-form clearfix">
<? include $common_path . "/templates/include_subscribe.html" ?>
</div>
</li>
<li><a href="<? echo $main_site_url ?>/store/">Shop <span>&gt;</span></a></li>
</ul>
<div class="clearall"></div>
<div class="brand-b clearfix">
<a href="<? echo $main_site_url ?>" alt="Slowtwitch" class="sprite-brand">Slowtwitch.com</a>
<div class="controller">
<a rel="main-search" href="#" class="sprite-magnify">Search</a>
<a href="#" class="sprite-menu">menu</a>
<div class="navbar menu-b"></div>
</div>
</div>
</div>
</div>
<!-- tablet & mobile floating search box -->
<div id="main-search" class="form search-form search-widget">
<? $search_url = $main_site_url . '/cgi-bin/articles/search.cgi'; ?>
<form action="<? echo $search_url ?>" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="do" value="search_results" />
<div class="row-b">
<span class="sprite-search-btn"></span>
<input type="text" name="query" class="txt article_keyword" placeholder="Search keyword..." />
<a href="<? echo $main_site_url ?>" class="sprite-x">x</a>
</div>
<div class="row">
<select>
<option value="<? echo $search_url ?>" selected>Knowledge Base</option>
<option value="<? echo $forum_url . '/gforum.cgi' ?>">All forums</option>
</select>
<a href="<? echo $search_url ?>" title="Advanced Search">Advanced Search</a>
<input type="submit" value="Search" class="btn" />
</div>
</form>
</div>
</div><!-- end mashead -->
<div class="mashead-b clearfix">
<a href="<? echo $main_site_url ?>" class="sprite-logo">Logo</a>
<div class="adbox">
<div class="adhori">
<? include($common_path . "/ads/ad_728x90.html"); ?>
</div>
</div>
<div class="social-sm">
<? include $common_path . "/templates/include_social.html" ?>
<div class="main-search search-widget">
<form action="<? echo $search_url ?>" method="get">
<input type="hidden" name="do" value="search_results" />
<select>
<option value="<? echo $search_url ?>" selected>Knowledge Base</option>
<option value="<? echo $forum_url . '/gforum.cgi' ?>">Forum</option>
<option value="<? echo $search_url ?>">Advanced Search</option>
</select>
<input type="text" name="query" class="txt article_keyword" placeholder="Search keyword..." />
</form>
</div>
<a href="#" class="sprite-magnify">Search</a>
</div>
</div><!-- end mashead-b -->
<div id="menu" class="navbar menu">
<ul class="nav">
<li>
<a href="<? echo $main_site_url ?>/Products/index.html" rel="products">Products</a>
<span class="expand"><a class="sprite-expand"></a></span>
<div class="subnav clearfix">
<ul>
<li><a href="<? echo $main_site_url ?>/Products/Running_Footwear_by_brand/index.html">Running Footwear</a></li>
<li><a href="<? echo $main_site_url ?>/Products/Cycling_footwear/index.html">Cycling Footwear</a></li>
<li><a href="<? echo $main_site_url ?>/Products/Wetsuit_by_brand/index.html">Wetsuits</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Products/Components/index.html">Components</a></li>
<li><a href="<? echo $main_site_url ?>/Products/Electronics/index.html">Electronics</a></li>
<li><a href="<? echo $main_site_url ?>/Products/Lights/index.html">Lights</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Products/Saddles/index.html">Saddles</a></li>
<li><a href="<? echo $main_site_url ?>/Products/Handlebars/index.html">Handlebars</a></li>
<li><a href="<? echo $main_site_url ?>/Products/index.html">Tri Bike</a></li>
<!-- <li><a href="<? echo $main_site_url ?>/Products/Stationary/index.html">Stationary</a></li> -->
<li><a href="<? echo $main_site_url ?>/Products/Things_that_Roll/index.html">Things that Roll</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Products/Old_reviews/index.html">Archive</a></li>
</ul>
</div>
</li>
<li>
<a href="<? echo $main_site_url ?>/local/" rel="local">Local Listing</a>
<span class="expand"><a class="sprite-expand"></a></span>
<div class="subnav clearfix">
<ul>
<li><a href="<? echo $main_site_url ?>/runshops/">Running Stores</a></li>
<li><a href="<? echo $main_site_url ?>/retailers/">Bike Shops</a></li>
<li><a href="<? echo $main_site_url ?>/coaches/">Coaches</a></li>
<li><a href="<? echo $main_site_url ?>/fitters/">Fitter's Database</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/triclubs/">Triathlon Clubs</a></li>
<li><a href="<? echo $main_site_url ?>/calendar/">Race Calendar</a></li>
<li><a href="<? echo $main_site_url ?>/local/map.php">Map Of Everything</a></li>
<li><a href="<? echo $main_site_url ?>/local/user_listings.php">Your Local Listings</a></li>
</ul>
</div>
</li>
<li>
<a href="<? echo $main_site_url ?>/Articles/index.html" rel="articles">Articles</a>
<span class="expand"><a class="sprite-expand"></a></span>
<div class="subnav clearfix">
<ul>
<li><a href="<? echo $main_site_url ?>/News/index.html">News</a></li>
<li><a href="<? echo $main_site_url ?>/Features/index.html">Features</a></li>
<li><a href="<? echo $main_site_url ?>/Lifestyle/index.html">Lifestyle</a></li>
<li><a href="<? echo $main_site_url ?>/Opinion/index.html">Opinion</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Interview/index.html">Interviews</a></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Tech/index.html">Tech</a></li>
<li><a href="<? echo $main_site_url ?>/Training/index.html">Training</a></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/index.html">Bike Fit</a><hr /></li>
</ul>
</div>
</li>
<li>
<a href="<? echo $main_site_url ?>/Photos/index.html" rel="photos">Photos</a>
</li>
<li>
<a href="<? echo $main_site_url ?>/Indoor_Training/index.html" rel="indoor_training">Indoor</a>
</li>
<li>
<a href="<? echo $main_site_url ?>/Races/index.html" rel="races">Race</a>
<span class="expand"><a class="sprite-expand"></a></span>
<div class="subnav clearfix">
<ul>
<li><a href="<? echo $main_site_url ?>/calendar/">Race Calendar</a></li>
<li><a href="<? echo $main_site_url ?>/RD_Aids/index.html">RD Aids</a></li>
</ul>
</div>
</li>
<li>
<a href="<? echo $main_site_url ?>/Training/index.html" rel="training">Train</a>
<span class="expand"><a class="sprite-expand"></a></span>
<div class="subnav clearfix">
<ul>
<li><a href="<? echo $main_site_url ?>/Training/Beginners/index.html">Beginner</a></li>
<li><a href="<? echo $main_site_url ?>/Training/General_Training/index.html">General Training</a></li>
<li><a href="<? echo $main_site_url ?>/Training/General_Physiology/index.html">General Physiology</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Training/Swimming/index.html">Swimming</a></li>
<li><a href="<? echo $main_site_url ?>/Training/Running/index.html">Running</a></li>
<li><a href="<? echo $main_site_url ?>/Training/Cycling/index.html">Cycling</a></li>
</ul>
</div>
</li>
<li>
<a href="https://shop.slowtwitch.com/" rel="shop">Shop</a>
</li>
<li>
<a href="<? echo $main_site_url ?>/Podcast/index.html" rel="podcast">Podcast</a>
</li>
<li>
<a href="<? echo $main_site_url ?>/Bike_Fit/index.html" rel="bikefit">Bike Fit</a>
<span class="expand"><a class="sprite-expand"></a></span>
<div class="subnav clearfix">
<ul>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/General_Fit_Articles/index.html">General</a></li>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/Bike_Fit_Equipment_and_Tools/index.html">Equipment and tools</a></li>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/Geometry_and_Handling/index.html">Geometry &amp; Handling</a></li>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/Choosing_a_Tri_Bike_via_Stack_and_Reach/index.html">Choosing via Stack/Reach</a><hr /></li>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/Road_Bike_Fit/index.html">Road Bike Fit</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/F_I_S_T__Workshops/index.html">F.I.S.T. Workshops</a></li>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/F_I_S_T__Tri_bike_fit_system/index.html">F.I.S.T. Tri Bike System</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/fit_calculator/stem_calc.php">STEM Calculator</a></li>
<li><a href="<? echo $main_site_url ?>/fit_calculator/bar_bore_calc.php">Bar to HT Calculator</a></li>
<li><a href="<? echo $main_site_url ?>/fit_calculator/fit_calculator.php">TRI Geometry Calculator</a><hr /></li>
<li><a href="<? echo $main_site_url ?>/stackreach/">Stack/Reach Database</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/fitters/">Fitter's Database</a></li>
<li><a href="<? echo $forum_url ?>?forum=10">Fitter's Forum</a></li>
</ul>
</div>
</li>
<li>
<a href="<? echo $forum_url ?>">Forum</a>
</li>
</ul>
</div><!-- end navbar -->
</div><!-- end header -->

View File

@ -0,0 +1,12 @@
<div class="widget">
<select class="full-width select" onchange="if (this.value) window.location.href=this.value;">
<option></option>
<option value="<? echo $main_site_url . '/runshops' ?>"<? if ($selected_local == 'runshops') { echo " selected=\"selected\""; } ?>>Running Stores</option>
<option value="<? echo $main_site_url . '/retailers' ?>"<? if ($selected_local == 'retailers') { echo " selected=\"selected\""; } ?>>Bike Shops</option>
<option value="<? echo $main_site_url . '/coaches' ?>"<? if ($selected_local == 'coaches') { echo " selected=\"selected\""; } ?>>Coaches</option>
<option value="<? echo $main_site_url . '/fitters' ?>"<? if ($selected_local == 'fitters') { echo " selected=\"selected\""; } ?>>Fitters</option>
<option value="<? echo $main_site_url . '/triclubs' ?>"<? if ($selected_local == 'triclubs') { echo " selected=\"selected\""; } ?>>Triathlon Clubs</option>
<option value="<? echo $main_site_url . '/calendar/' ?>"<? if ($selected_local == 'calendar') { echo " selected=\"selected\""; } ?>>Race Calendar</option>
<option value="<? echo $main_site_url . '/local/map.php' ?>"<? if ($selected_local == 'map') { echo " selected=\"selected\""; } ?>>Map Of Everything</option>
</select>
</div>

View File

@ -0,0 +1,56 @@
<div class="footer">
<?
$fetch_sponsors = mysql_query("SELECT * FROM glinks_Ticker ORDER BY ticker_text ASC");
$sponsors = array();
while ($row = mysql_fetch_array($fetch_sponsors)) {
array_push($sponsors, '<a href="' . $row[ticker_link] .'">' . $row[ticker_text] . '</a>');
}
?>
<? if (count($sponsors) > 0) { ?>
<section class="sponsors">
<hr class="line">
<nav>
<? echo join(" | ", $sponsors); ?>
</nav>
</section>
<? } ?>
<div class="masfoot clearfix">
<div class="navbar menu">
<ul class="nav">
<li><a href="<? echo $main_site_url ?>/aboutus.html" class="aboutus">About Us</a></li>
<li><a href="<? echo $main_site_url ?>/aboutus.html" class="aboutus">Advertise</a></li>
<li><a href="<? echo $main_site_url ?>/privacy.html" class="policy">Privacy Policy</a></li>
<li><a href="<? echo $main_site_url ?>/agreement.html" class="agreement">User Agreement</a></li>
</ul>
</div>
<div class="social clearfix">
<? include($common_path . "/templates/include_social.html"); ?>
</div>
</div>
<div class="masfoot-b clearfix">
<div class="newsletter">
<h2 class="forum">newsletter</h2>
Sign up for the Slowtwitch newsletter
<? include($common_path . "/templates/include_subscribe.html"); ?>
</div>
<div class="contact-us clearfix">
<span class="sprite-logo"></span>
<p class="addr">transition-DOT-area-AT-slowtwitch-DOT-com</p>
</div>
</div>
<div class="bg-1 clearfix">
<div class="col-5">
<div class="adv-withus clearfix">
<span class="sprite-logo-sm"></span>
<a href="<? echo $main_site_url ?>/advertise.html">Advertise with us</a>
</div>
</div>
<div class="col-7">
<div class="copyright">
<p>&copy;1999-<? $year = date("Y"); echo $year; ?> Slowtwitch, Inc., and Slowtwitch.com<br />Reproduction of material from any Slowtwitch.com page<br />without written permission is strictly prohibited.</p>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,85 @@
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="keywords" content="<? echo($meta_keywords); ?>" />
<meta name="description" content="<? echo($meta_description); ?>"/>
<meta name="author" content="Slowtwitch.com" />
<meta name="facebook-domain-verification" content="bjsr7t1emgzf0nk5gxqumecuu2oxbr" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" href="/images/slowtwitch_apple.png" />
<link rel="alternate" type="application/rss+xml" title="Slowtwitch.com - RSS" href="https://www.slowtwitch.com/rss" />
<link href='https://fonts.googleapis.com/css?family=Open+Sans|Oswald|Roboto+Slab' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBDttorbDzy7Fa5IGeyvolnJZpiOVeQdBA"></script>
<? if ($mini_version) { ?>
<link type="text/css" rel="stylesheet" href="<? echo $static_url ?>/r<? echo $mini_version ?>/css/style.min.css" />
<? } else { ?>
<link type="text/css" rel="stylesheet" href="<? echo $static_url ?>/css/jquery-ui.min.css" />
<link type="text/css" rel="stylesheet" href="<? echo $static_url ?>/css/lightbox.min.css" />
<link type="text/css" rel="stylesheet" href="<? echo $static_url ?>/css/core.css" />
<link type="text/css" rel="stylesheet" href="<? echo $static_url ?>/css/style.css" />
<link type="text/css" rel="stylesheet" href="<? echo $static_url ?>/css/swiper.min.css">
<? } ?>
<script type="text/javascript">
var winWidth = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
</script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-4JP2WEE0TF"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-4JP2WEE0TF');
</script>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=G-4JP2WEE0TF"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<!-- Google Analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2419103-1']);
_gaq.push(['_setDomainName', '.slowtwitch.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- BEGIN ADVERTSERVE CODE -->
<script type="text/javascript">
var _avp = _avp || [];
(function() {
var s = document.createElement('script');
s.type = 'text/javascript'; s.async = true; s.src = 'https://reach.slowtwitch.com/js/libcode3.js';
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
})();
</script>
<!-- END ADVERTSERVE CODE -->
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '895910530528995');
fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=895910530528995&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->

View File

@ -0,0 +1,230 @@
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NF47Q8S"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<div class="header clearfix">
<div class="mashead clearfix">
<div class="utils">
<a href="<? echo $main_site_url ?>/Swim/index.html" class="sprite-swim">Swim</a>
<a href="<? echo $main_site_url ?>/Bike/index.html" class="sprite-bike">Bike</a>
<a href="<? echo $main_site_url ?>/Run/index.html" class="sprite-run">Run</a>
</div>
<div class="grphead clearfix">
<div class="brand">
<a href="<? echo $main_site_url ?>" alt="Slowtwitch" class="sprite-brand">Slowtwitch.com</a>
</div>
<div class="navbar utility">
<ul class="nav">
<li class="welcome">
<? if (is_logged_in($user)) { ?>
<a href="<? echo $forum_url . "?do=logout" ?>" class="logout">Log out</a>
<? } else { ?>
<a href="<? echo $forum_url . "?do=login" ?>">Login <span>&gt;</span></a>
<? } ?>
</li>
<li class="subscribe">
<a href="#>">Subscribe <span>&gt;</span></a>
<div class="subscribe-form clearfix">
<? include $common_path . "/templates/include_subscribe.html" ?>
</div>
</li>
</ul>
<div class="clearall"></div>
<div class="brand-b clearfix">
<a href="<? echo $main_site_url ?>" alt="Slowtwitch" class="sprite-brand">Slowtwitch.com</a>
<div class="controller">
<a rel="main-search" href="#" class="sprite-magnify">Search</a>
<a href="#" class="sprite-menu">menu</a>
<div class="navbar menu-b"></div>
</div>
</div>
</div>
</div>
<!-- tablet & mobile floating search box -->
<div id="main-search" class="form search-form search-widget">
<? $search_url = $main_site_url . '/cgi-bin/articles/search.cgi'; ?>
<form action="<? echo $search_url ?>" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="do" value="search_results" />
<div class="row-b">
<span class="sprite-search-btn"></span>
<input type="text" name="query" class="txt article_keyword" placeholder="Search keyword..." />
<a href="<? echo $main_site_url ?>" class="sprite-x">x</a>
</div>
<div class="row">
<select>
<option value="<? echo $search_url ?>" selected>Knowledge Base</option>
<option value="<? echo $forum_url . '/gforum.cgi' ?>">All forums</option>
</select>
<a href="<? echo $search_url ?>" title="Advanced Search">Advanced Search</a>
<input type="submit" value="Search" class="btn" />
</div>
</form>
</div>
</div><!-- end mashead -->
<div class="mashead-b clearfix">
<a href="<? echo $main_site_url ?>" class="sprite-logo">Logo</a>
<div class="adbox">
<div class="adhori">
<? include($common_path . "/ads/ad_728x90.html"); ?>
</div>
</div>
<div class="social-sm">
<? include $common_path . "/templates/include_social.html" ?>
<div class="main-search search-widget">
<form action="<? echo $search_url ?>" method="get">
<input type="hidden" name="do" value="search_results" />
<select>
<option value="<? echo $search_url ?>" selected>Knowledge Base</option>
<option value="<? echo $forum_url . '/gforum.cgi' ?>">Forum</option>
<option value="<? echo $search_url ?>">Advanced Search</option>
</select>
<input type="text" name="query" class="txt article_keyword" placeholder="Search keyword..." />
</form>
</div>
<a href="#" class="sprite-magnify">Search</a>
</div>
</div><!-- end mashead-b -->
<div id="menu" class="navbar menu">
<ul class="nav">
<li>
<a href="<? echo $main_site_url ?>/Products/index.html" rel="products">Products</a>
<span class="expand"><a class="sprite-expand"></a></span>
<div class="subnav clearfix">
<ul>
<li><a href="<? echo $main_site_url ?>/Products/Running_Footwear_by_brand/index.html">Running Footwear</a></li>
<li><a href="<? echo $main_site_url ?>/Products/Cycling_footwear/index.html">Cycling Footwear</a></li>
<li><a href="<? echo $main_site_url ?>/Products/Wetsuit_by_brand/index.html">Wetsuits</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Products/Components/index.html">Components</a></li>
<li><a href="<? echo $main_site_url ?>/Products/Electronics/index.html">Electronics</a></li>
<li><a href="<? echo $main_site_url ?>/Products/Lights/index.html">Lights</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Products/Saddles/index.html">Saddles</a></li>
<li><a href="<? echo $main_site_url ?>/Products/Handlebars/index.html">Handlebars</a></li>
<li><a href="<? echo $main_site_url ?>/Products/index.html">Tri Bike</a></li>
<!-- <li><a href="<? echo $main_site_url ?>/Products/Stationary/index.html">Stationary</a></li> -->
<li><a href="<? echo $main_site_url ?>/Products/Things_that_Roll/index.html">Things that Roll</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Products/Old_reviews/index.html">Archive</a></li>
</ul>
</div>
</li>
<li>
<a href="<? echo $main_site_url ?>/local/" rel="local">Local Listing</a>
<span class="expand"><a class="sprite-expand"></a></span>
<div class="subnav clearfix">
<ul>
<li><a href="<? echo $main_site_url ?>/runshops/">Running Stores</a></li>
<li><a href="<? echo $main_site_url ?>/retailers/">Bike Shops</a></li>
<li><a href="<? echo $main_site_url ?>/coaches/">Coaches</a></li>
<li><a href="<? echo $main_site_url ?>/fitters/">Fitter's Database</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/triclubs/">Triathlon Clubs</a></li>
<li><a href="<? echo $main_site_url ?>/calendar/">Race Calendar</a></li>
<li><a href="<? echo $main_site_url ?>/local/map.php">Map Of Everything</a></li>
<li><a href="<? echo $main_site_url ?>/local/user_listings.php">Your Local Listings</a></li>
</ul>
</div>
</li>
<li>
<a href="<? echo $main_site_url ?>/Articles/index.html" rel="articles">Articles</a>
<span class="expand"><a class="sprite-expand"></a></span>
<div class="subnav clearfix">
<ul>
<li><a href="<? echo $main_site_url ?>/News/index.html">News</a></li>
<li><a href="<? echo $main_site_url ?>/Features/index.html">Features</a></li>
<li><a href="<? echo $main_site_url ?>/Lifestyle/index.html">Lifestyle</a></li>
<li><a href="<? echo $main_site_url ?>/Opinion/index.html">Opinion</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Interview/index.html">Interviews</a></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Tech/index.html">Tech</a></li>
<li><a href="<? echo $main_site_url ?>/Training/index.html">Training</a></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/index.html">Bike Fit</a><hr /></li>
</ul>
</div>
</li>
<li>
<a href="<? echo $main_site_url ?>/Photos/index.html" rel="photos">Photos</a>
</li>
<li>
<a href="<? echo $main_site_url ?>/Indoor_Training/index.html" rel="indoor_training">Indoor</a>
</li>
<li>
<a href="<%main_site_url%>/Races/index.html" rel="races">Race</a>
<span class="expand"><a class="sprite-expand"></a></span>
<div class="subnav clearfix">
<ul>
<li><a href="<? echo $main_site_url ?>/calendar/">Race Calendar</a></li>
<li><a href="<? echo $main_site_url ?>/RD_Aids/index.html">RD Aids</a></li>
</ul>
</div>
</li>
<li>
<a href="<? echo $main_site_url ?>/Training/index.html" rel="training">Train</a>
<span class="expand"><a class="sprite-expand"></a></span>
<div class="subnav clearfix">
<ul>
<li><a href="<? echo $main_site_url ?>/Training/Beginners/index.html">Beginner</a></li>
<li><a href="<? echo $main_site_url ?>/Training/General_Training/index.html">General Training</a></li>
<li><a href="<? echo $main_site_url ?>/Training/General_Physiology/index.html">General Physiology</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Training/Swimming/index.html">Swimming</a></li>
<li><a href="<? echo $main_site_url ?>/Training/Running/index.html">Running</a></li>
<li><a href="<? echo $main_site_url ?>/Training/Cycling/index.html">Cycling</a></li>
</ul>
</div>
</li>
<li>
<a href="https://shop.slowtwitch.com/" rel="shop">Shop</a>
</li>
<li>
<a href="<? echo $main_site_url ?>/Podcast/index.html" rel="podcast">Podcast</a>
</li>
<li>
<a href="<? echo $main_site_url ?>/Bike_Fit/index.html" rel="bikefit">Bike Fit</a>
<span class="expand"><a class="sprite-expand"></a></span>
<div class="subnav clearfix">
<ul>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/General_Fit_Articles/index.html">General</a></li>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/Bike_Fit_Equipment_and_Tools/index.html">Equipment and tools</a></li>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/Geometry_and_Handling/index.html">Geometry &amp; Handling</a></li>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/Choosing_a_Tri_Bike_via_Stack_and_Reach/index.html">Choosing via Stack/Reach</a><hr /></li>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/Road_Bike_Fit/index.html">Road Bike Fit</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/F_I_S_T__Workshops/index.html">F.I.S.T. Workshops</a></li>
<li><a href="<? echo $main_site_url ?>/Bike_Fit/F_I_S_T__Tri_bike_fit_system/index.html">F.I.S.T. Tri Bike System</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/fit_calculator/stem_calc.php">STEM Calculator</a></li>
<li><a href="<? echo $main_site_url ?>/fit_calculator/bar_bore_calc.php">Bar to HT Calculator</a></li>
<li><a href="<? echo $main_site_url ?>/fit_calculator/fit_calculator.php">TRI Geometry Calculator</a><hr /></li>
<li><a href="<? echo $main_site_url ?>/stackreach/">Stack/Reach Database</a><hr /></li>
</ul>
<ul>
<li><a href="<? echo $main_site_url ?>/fitters/">Fitter's Database</a></li>
<li><a href="<? echo $forum_url ?>?forum=10">Fitter's Forum</a></li>
</ul>
</div>
</li>
<li>
<a href="<? echo $forum_url ?>">Forum</a>
</li>
</ul>
</div><!-- end navbar -->
</div><!-- end header -->

337
site/fitters/add.php Normal file
View File

@ -0,0 +1,337 @@
<?PHP
include("config.php");
if(!is_logged_in($user)){
header('Location: '.$site_url);
exit();
}
$useruid = base64_decode($_SESSION['user_id']);
// set the page title
$pagetitle = "Add a Fitter";
// set meta tags
$meta_keywords = "add fitter";
$meta_description = "Do you want to include a fitter in our online bike fitter database? Then use this form to send us your information, and we will add it to our website.";
?>
<? include("include_common_head.php"); ?>
<?
if($_POST[add_fitter] == true){
include("add_X.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">
<? if( $insert_success == true || $_GET[confirmed] == "yes" ) { ?>
<h1>Thank you</h1>
<p>Thank you. Your fitter information should be added within 24 hours. You will now be redirected back to the add page.</p>
<META HTTP-EQUIV=Refresh CONTENT="4; URL=add.php">
<?
unset($insert_success);
unset($confirm_fitter);
?>
<? } else if( $confirm_fitter == true ) { ?>
<h1>Add a Fitter: Step 2 of 2</h1>
<? } else if( ($confirm_fitter != true) || ($_POST[add_fitter] != true) ) { ?>
<h1>Add a Fitter: Step 1 of 2</h1>
<hr class="line" />
<? include("../runshops/include_region_list.php"); ?>
<? if (!$errmsg) { ?>
<p >If you would like to add a fitter to our website, simply fill out the form below. Be sure to fill out every field. After filling out each field, click submit. <span style="color: red;">You will then be prompted to confirm your information before the information is sent to us.</span></p>
<? } else { ?>
<p><span style="color: red;"><? echo $errmsg; ?></span></p>
<? } ?>
<? }
// begin insert form
if( (($_POST[add_fitter] != true) || ($errmsg) || (($confirm_fitter != true) && ($_POST[insert_fitter] != true))) && $_GET[confirmed] != "yes") {
?>
<form enctype="multipart/form-data" action="add.php" method="post">
<div class="dtable form">
<div class="drow">
<div class="dcell name">Fitter Name</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="name" value="<? echo stripslashes($_POST[name]); ?>" class="txt lngtext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Address</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="address" value="<? echo stripslashes(htmlspecialchars($_POST[address])); ?>" class="txt lngtext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Address 2</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="address_two" value="<? echo stripslashes(htmlspecialchars($_POST[address_two])); ?>" class="txt lngtext" />
</div>
</div>
<div class="drow">
<div class="dcell name">City</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="city" value="<? echo stripslashes(htmlspecialchars($_POST[city])); ?>" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">State</div>
<div class="dcell divider"></div>
<div class="dcell value">
<select name="state">
<option value="0">Choose a State/Province</option>
<?
foreach($state_list as $key=>$value) {
if(strcmp($_POST[state], $value) == 0){
$str = " selected=\"selected\"";
}
echo "<option value=\"$value\"$str>$value</option>";
$str = "";
}
?>
</select>
</div>
</div>
<div class="drow">
<div class="dcell name">Zip/Postal Code</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="zip" value="<? echo stripslashes(htmlspecialchars($_POST[zip])); ?>" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Override Address With Lat/Lng</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="true" type="checkbox" name="latlng_override" <? if ($_POST[latlng_override] == true) { echo ("checked"); }?> > Check this if you know your physical address doesn't geocode properly using Google's API.<br />Then enter the desired lat/lng in the boxes below.
</div>
</div>
<div class="drow">
<div class="dcell name">Latitude</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($_POST[lat])); ?>" type="text" name="lat" class="txt shotext"/>
</div>
</div>
<div class="drow">
<div class="dcell name">Longitude</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($_POST[lng])); ?>" type="text" name="lng" class="txt shotext"/>
</div>
</div>
<div class="drow">
<div class="dcell name">Phone</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="phone" value="<? echo stripslashes(htmlspecialchars($_POST[phone])); ?>" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Fax</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="fax" value="<? echo stripslashes(htmlspecialchars($_POST[fax])); ?>" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">E-mail</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="email" value="<? echo stripslashes(htmlspecialchars($_POST[email])); ?>" class="txt lngtext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Website</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="website" value="<? echo stripslashes(htmlspecialchars($_POST[website])); ?>" class="txt lngtext" placeholder="http://" />
</div>
</div>
<div class="drow">
<div class="dcell name">Portfolio</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="portfolio" value="<? echo stripslashes(htmlspecialchars($_POST[portfolio])); ?>" class="txt lngtext" placeholder="http://" />
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
for ($i = 0; $i < 25; $i++) echo("*");
echo (" FIT INFO ");
for ($i = 0; $i < 25; $i++) echo("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Default Tri-Fit Methodology</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$fetch = mysql_query("SELECT * FROM ".$prefix."FittersMethods ORDER BY fitter_method_name ASC") OR die(mysql_error());
echo("<input type=\"hidden\" name=\"methods\" value=\"0\" >");
while ($list = mysql_fetch_array($fetch)) {
echo("<span class=\"col2\"><input type=\"radio\" name=\"methods\" value=\"$list[fitter_method_id]\" ");
if ($list['fitter_method_id'] == $_POST[methods]){ echo "checked "; }
echo(">$list[fitter_method_name]</span>\n");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Certifications</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$explosion = array("");
if (!is_array($_POST[certifications])){ $explosion = explode(",", $_POST[certifications]); } else { $explosion = $_POST[certifications]; }
$fetch = mysql_query("SELECT * FROM ".$prefix."FittersCertifications ORDER BY fitter_certification_name ASC") OR die(mysql_error());
echo("<input type=\"hidden\" name=\"certifications[]\" value=\"0\" >");
while ($list = mysql_fetch_array($fetch)) {
echo("<span class=\"col\"><input type=\"checkbox\" name=\"certifications[]\" value=\"$list[fitter_certification_id]\" ");
if (in_array($list['fitter_certification_id'], $explosion)){ echo "checked "; }
echo(">$list[fitter_certification_name]</span>\n");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Fit Bikes</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$explosion = array("");
if (!is_array($_POST[fitbikes])){ $explosion = explode(",", $_POST[fitbikes]); } else { $explosion = $_POST[fitbikes]; }
$results = mysql_query("SELECT * FROM ".$prefix."FittersFitbikes ORDER BY fitter_fitbike_name ASC");
echo("<input type=\"hidden\" name=\"fitbikes[]\" value=\"0\" >");
while ($row = mysql_fetch_array($results)) {
echo("<span class=\"col\"><input type=\"checkbox\" name=\"fitbikes[]\" value=\"$row[fitter_fitbike_id]\" ");
if (in_array($row[fitter_fitbike_id], $explosion)){ echo "checked "; }
echo(">$row[fitter_fitbike_name]</span>\n");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Motion-Capture Systems</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$explosion = array("");
if (!is_array($_POST[motioncapture])){ $explosion = explode(",", $_POST[motioncapture]); } else { $explosion = $_POST[motioncapture]; }
$results = mysql_query("SELECT * FROM ".$prefix."FittersMotioncapture ORDER BY fitter_motioncapture_name ASC");
echo("<input type=\"hidden\" name=\"motioncapture[]\" value=\"0\" >");
while ($row = mysql_fetch_array($results)) {
echo("<span class=\"col\"><input type=\"checkbox\" name=\"motioncapture[]\" value=\"$row[fitter_motioncapture_id]\" ");
if (in_array($row[fitter_motioncapture_id], $explosion)){ echo "checked "; }
echo(">$row[fitter_motioncapture_name]</span>\n");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Brand Friendly</div>
<div class="dcell divider"></div>
<div class="dcell value">
Brands where the fitter has a specific *verified* expertise in this brand.<br />
<?
$explosion = array("");
if (!is_array($_POST[brandfriendly])){ $explosion = explode(",", $_POST[brandfriendly]); } else { $explosion = $_POST[brandfriendly]; }
$results = mysql_query("SELECT * FROM ".$prefix."FittersBrandFriendly ORDER BY fitter_brand_name ASC");
echo("<input type=\"hidden\" name=\"brandfriendly[]\" value=\"0\" >");
while ($row = mysql_fetch_array($results)) {
echo("<span class=\"col\"><input type=\"checkbox\" name=\"brandfriendly[]\" value=\"$row[fitter_brand_id]\" ");
if (in_array($row[fitter_brand_id], $explosion)){ echo "checked "; }
echo(">$row[fitter_brand_name]</span>\n");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Cost of Fit</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($_POST[cost])); ?>" type="text" name="cost" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">General Info</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="info" class="txt lngtext" placeholder="Please write some information about your fitting business.">
<? if($_POST[info]){ echo strip_tags(stripslashes($_POST[info])); } ?>
</textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Directions</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="directions" class="txt lngtext" placeholder="Please describe how to get to your shop from your surrounding area.">
<? if($_POST[directions]) { echo strip_tags(stripslashes($_POST[directions])); } ?>
</textarea>
</div>
</div>
<div class="drow actions">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="submit" value="Submit" class="btn" />
<input type="hidden" name="add_fitter" value="true" />
</div>
</div>
</div>
</form>
<? }
if ($confirm_fitter == true) {
include("include_add_confirm.php");
} ?>
</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>

152
site/fitters/add_X.php Normal file
View File

@ -0,0 +1,152 @@
<?PHP
if (!$_POST){ header('Location: '.$site_url); }
/*
FIELD NAMES:
fitter_id
fitter_name
fitter_name_tag
fitter_address
fitter_address_two
fitter_city
fitter_state
fitter_state_tag
fitter_zip
fitter_phone
fitter_fax
fitter_email
fitter_website
fitter_certifications
fitter_fitbikes
fitter_motioncapture
fitter_cost
fitter_info
fitter_directions
fitter_submitted_by
fitter_valid
fitter_user_tags
*/
/* Need to ltrim and rtrim commas before insertion */
//Insert into database
//$pass = 'abc123';
$errmsg = NULL;
$insert_success = NULL;
//Check for blank fields
if ((!$_POST[name])) $errmsg = $errmsg."Shop name, ";
if (!$_POST[city]) $errmsg = $errmsg."City, ";
if (!$_POST[state]) $errmsg = $errmsg."State, ";
if (!$_POST[address]) $errmsg = $errmsg."Address, ";
if ((!$_POST[lat] || !$_POST[lng]) && $_POST[latlng_override] == true) $errmsg = $errmsg."Lat/Lng cannot be left blank if you wish to override address, ";
if (!$_POST[phone]) $errmsg = $errmsg."Phone, ";
if (!$_POST[email]) $errmsg = $errmsg."Email, ";
if (!$_POST[website]) $errmsg = $errmsg."Website, ";
if (!$_POST[cost]) $errmsg = $errmsg."Cost, ";
if (strlen($_POST[info]) < 4) $errmsg = $errmsg."General Info, ";
if (strlen($_POST[directions]) < 4) $errmsg = $errmsg."Directions, ";
if (isset($errmsg)) {
$errmsg = "The following fields cannot be left blank: ".$errmsg."<br />";
$errmsg = rtrim($errmsg, ", ");
}
$start_url = "(http(s)?\:\/\/)?"; // start url
$dots = "([\w_-]{2,}\.)+"; // one or more parts containing a '.' at the end
$last_part = "([\w_-]{2,})"; // last part doesn't contain a dot
$user = "((\/)(\~)[\w_=-]+)?((\/)[\w_=-]+)*"; // maybe subdirectories - possibly with user ~
$end = "((\/)|(\/)[\w_-]+\.[\w]{2,})?"; // maybe a slash at the end or slash+file+extension
$qstring1 = "((\?[\w_-]+\=([^\#]+)){0,1}"; // querystring - first argument (?a=b)
$qstring2 = "(\&[\w_-]+\=([^\#]+))*)?"; // querystring - following arguments (&c=d)
$bkmrk = "(#[\w_-]+)?"; // bookmark
$exp = "/^".$start_url.$dots.$last_part.$user.$end.$qstring1.$qstring2.$bkmrk."$/i";
if( !preg_match($exp, $_POST[website]) ) {
// Contains invalid characters.
$errmsg = $errmsg."Invalid Web Address<br />";
}
if($_POST[portfolio] != "" && !preg_match($exp, $_POST[portfolio]) ) {
// Contains invalid characters.
$errmsg = $errmsg."Invalid Portfolio Address<br />";
}
if( preg_match('/[^a-zA-Z0-9\. ]/', $_POST[name]) ) {
// Contains invalid characters.
$errmsg = $errmsg."Please use only letters and numbers in the name<br />";
}
// begin error message check
if(!$errmsg){
$name = trim($_POST[name]);
$name_tag = strtolower(str_replace(" ","", $name));
//if(strlen($name_tag) > 12){ //Shorten it
$name_tag = substr($name_tag, 0, 12);
//} // need to update a typo here in other dbs
$address = mysql_escape_string(trim($_POST[address]));
$full_address = $address;
if (isset($_POST['address_two'])) { $address_two = mysql_escape_string(trim($_POST[address_two])); } else { $address_two = NULL; $full_address = $full_address.", ".$address_two; }
$city = mysql_escape_string(trim($_POST[city]));
$full_address = $full_address.", ".$city;
$state = $_POST[state];
$full_address = $full_address.", ".$state;
$state_tag = strtolower(str_replace(" ","", $state));
$zip = mysql_escape_string(trim($_POST[zip]));
$full_address = $full_address." ".$zip;
$latlng_override = $_POST[latlng_override];
if ($latlng_override == true) {
$lat = $_POST[lat];
$lng = $_POST[lng];
} else {
//geocode
//echo ($full_address);
$geocode_status = geocode($full_address);
//echo (is_array($geocode_status));
if (is_array($geocode_status)) {
$geocode_error = false;
$lat = $geocode_status[0];
$_POST[lat] = $lat;
$lng = $geocode_status[1];
$_POST[lng] = $lng;
//echo ($lat.", ".$lng);
} else {
$geocode_error = true;
$lat = 0;
$_POST[lat] = $lat;
$lng = 0;
$_POST[lng] = $lng;
$geocode_message = $geocode_status;
}
}
$phone = trim($_POST[phone]);
$fax = trim($_POST[fax]);
$email = mysql_escape_string(trim($_POST[email]));
$website = mysql_escape_string(trim($_POST[website]));
$portfolio = mysql_escape_string(trim($_POST[portfolio]));
$methods = mysql_escape_string(trim($_POST[methods]));
$certifications = mysql_escape_string($_POST[certifications]);
$fitbikes = mysql_escape_string($_POST[fitbikes]);
$motioncapture = mysql_escape_string($_POST[motioncapture]);
$brandfriendly = mysql_escape_string($_POST[brandfriendly]);
$cost = mysql_escape_string(trim($_POST[cost]));
$info = mysql_escape_string(nl2br(substr(trim($_POST[info]), 0, 4096)));
$directions = mysql_escape_string(nl2br(substr(trim($_POST[directions]), 0, 4096)));
$submitted_by = $_POST[submitted_by];
// begin boolean check to see if we should insert the fitter into the dbase
if($_POST[insert_fitter] == true){
$sql = "INSERT INTO ".$prefix."Fitters (fitter_name, fitter_name_tag, fitter_address, fitter_address_two, fitter_city, fitter_state, fitter_state_tag, fitter_zip, fitter_lat, fitter_lng, fitter_phone, fitter_fax, fitter_email, fitter_website, fitter_method, fitter_certifications, fitter_fitbikes, fitter_motioncapture, fitter_brandfriendly, fitter_cost, fitter_info, fitter_directions, fitter_submitted_by, fitter_valid, fitter_portfolio) VALUES ('$name', '$name_tag', '$address', '$address_two', '$city', '$state', '$state_tag', '$zip', '$lat', '$lng', '$phone', '$fax', '$email', '$website', '$methods', ',$certifications,', ',$fitbikes,', ',$motioncapture,', ',$brandfriendly,', '$cost', '$info', '$directions', $submitted_by, 0, '$portfolio')";
//echo("shop entered!");
//echo($sql);
mysql_query($sql) OR die(mysql_error());
//exit();
$insert_success = true;
}else{
//echo("shop NOT entered.");
$confirm_fitter = true;
}
// end insert check
}
// end error message check
?>

View File

@ -0,0 +1,19 @@
<?php
require_once("class/rating/classes/include.all.php");
// Check that the data was sent
if (sizeof($_POST) == 0
|| $_POST['parent'] == null
|| strlen(trim($_POST['parent'])) == 0
|| $_POST['item'] == null
|| strlen(trim($_POST['item'])) == 0
|| $_POST['rating'] == null
|| strlen(trim($_POST['rating'])) == 0
|| $_POST['classes'] == null
|| strlen(trim($_POST['classes'])) == 0)
{
die("You shouldn't be attempting to access this file in this manner.");
}
echo Rating::RateItem($_POST['parent'], $_POST['item'], $_POST['rating'], $_POST['classes']);
?>

View File

@ -0,0 +1,339 @@
<?PHP
###########################################
#-----------Users login system------------#
###########################################
/*=========================================\
Author : Mohammed Ahmed(M@@king) \\
Version : 1.0 \\
Date Created: Aug 20 2005 \\
---------------------------- \\
Last Update: August 22 2005 \\
---------------------------- \\
Country : Palestine \\
City : Gaza \\
E-mail : m@maaking.com \\
MSN : m@maaking.com \\
AOL-IM : maa2pal \\
WWW : http://www.maaking.com \\
Mobile/SMS : 00972-599-622235 \\
\\
===========================================\
------------------------------------------*/
if (eregi("mysql.class.php", $_SERVER['SCRIPT_NAME'])) {
Header("Location: index.php"); die();
}
//db class
if(!defined("SQL_LAYER"))
{
define("SQL_LAYER","mysql");
class sql_db
{
var $db_connect_id;
var $query_result;
var $row = array();
var $rowset = array();
var $num_queries = 0;
//
// Constructor
//
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->server = $sqlserver;
$this->dbname = $database;
if($this->persistency)
{
$this->db_connect_id = @mysql_pconnect($this->server, $this->user, $this->password);
}
else
{
$this->db_connect_id = @mysql_connect($this->server, $this->user, $this->password);
}
if($this->db_connect_id)
{
if($database != "")
{
$this->dbname = $database;
$dbselect = @mysql_select_db($this->dbname);
if(!$dbselect)
{
@mysql_close($this->db_connect_id);
$this->db_connect_id = $dbselect;
}
}
return $this->db_connect_id;
}
else
{
return false;
}
}
//
// Other base methods
//
function sql_close()
{
if($this->db_connect_id)
{
if($this->query_result)
{
@mysql_free_result($this->query_result);
}
$result = @mysql_close($this->db_connect_id);
return $result;
}
else
{
return false;
}
}
//
// Base query method
//
function sql_query($query = "", $transaction = FALSE)
{
// Remove any pre-existing queries
unset($this->query_result);
if($query != "")
{
$this->query_result = @mysql_query($query, $this->db_connect_id);
}
if($this->query_result)
{
unset($this->row[$this->query_result]);
unset($this->rowset[$this->query_result]);
return $this->query_result;
}
else
{
return ( $transaction == END_TRANSACTION ) ? true : false;
}
}
//
// Other query methods
//
function sql_numrows($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @mysql_num_rows($query_id);
return $result;
}
else
{
return false;
}
}
function sql_affectedrows()
{
if($this->db_connect_id)
{
$result = @mysql_affected_rows($this->db_connect_id);
return $result;
}
else
{
return false;
}
}
function sql_numfields($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @mysql_num_fields($query_id);
return $result;
}
else
{
return false;
}
}
function sql_fieldname($offset, $query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @mysql_field_name($query_id, $offset);
return $result;
}
else
{
return false;
}
}
function sql_fieldtype($offset, $query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @mysql_field_type($query_id, $offset);
return $result;
}
else
{
return false;
}
}
function sql_fetchrow($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$this->row[$query_id] = @mysql_fetch_array($query_id);
return $this->row[$query_id];
}
else
{
return false;
}
}
function sql_fetchrowset($query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
unset($this->rowset[$query_id]);
unset($this->row[$query_id]);
while($this->rowset[$query_id] = @mysql_fetch_array($query_id))
{
$result[] = $this->rowset[$query_id];
}
return $result;
}
else
{
return false;
}
}
function sql_fetchfield($field, $rownum = -1, $query_id = 0)
{
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
if($rownum > -1)
{
$result = @mysql_result($query_id, $rownum, $field);
}
else
{
if(empty($this->row[$query_id]) && empty($this->rowset[$query_id]))
{
if($this->sql_fetchrow())
{
$result = $this->row[$query_id][$field];
}
}
else
{
if($this->rowset[$query_id])
{
$result = $this->rowset[$query_id][$field];
}
else if($this->row[$query_id])
{
$result = $this->row[$query_id][$field];
}
}
}
return $result;
}
else
{
return false;
}
}
function sql_rowseek($rownum, $query_id = 0){
if(!$query_id)
{
$query_id = $this->query_result;
}
if($query_id)
{
$result = @mysql_data_seek($query_id, $rownum);
return $result;
}
else
{
return false;
}
}
function sql_nextid(){
if($this->db_connect_id)
{
$result = @mysql_insert_id($this->db_connect_id);
return $result;
}
else
{
return false;
}
}
function sql_freeresult($query_id = 0){
if(!$query_id)
{
$query_id = $this->query_result;
}
if ( $query_id )
{
unset($this->row[$query_id]);
unset($this->rowset[$query_id]);
@mysql_free_result($query_id);
return true;
}
else
{
return false;
}
}
function sql_error($query_id = 0)
{
$result["message"] = @mysql_error($this->db_connect_id);
$result["code"] = @mysql_errno($this->db_connect_id);
return $result;
}
} // class sql_db
} // if ... define
?>

View File

@ -0,0 +1,406 @@
<?php
//////////////////////////////////////////////////////////////////////////////
// Database Class
//============================================================================
// Dependencies:
//----------------------------------------------------------------------------
// None
//============================================================================
// Modification History:
//----------------------------------------------------------------------------
// 2006-11-04: Created
//////////////////////////////////////////////////////////////////////////////
class Database extends Error
{
## CONSTANT VARIABLES
const DB_TYPES = 'mysql,mysqli'; // NO SPACES!
## END CONSTANT VARIABLES
## PUBLIC VARIABLES
## END PUBLIC VARIABLES
## PRIVATE VARIABLES
private static $host;
private static $port;
private static $database;
private static $username;
private static $password;
private static $type;
private static $connection;
private static $savedQueries;
private static $savedResults;
## END PRIVATE VARIABLES
## CONSTRUCTOR
## END CONSTRUCTOR
## DECONSTRUCTOR
## END DECONSTRUCTOR
## PUBLIC METHODS
// Initialize the Variables
// Does not return anything, but acts like a constructor for Static classes
public static function Initialize($varType, $varHost, $varPort, $varDatabase, $varUsername, $varPassword)
{
Error::Initialize();
if (!self::ValidDatabaseTypes($varType))
{
Error::LogError("Database Type Invalid", "Database Type must be one of: " . self::DB_TYPES);
}
self::$host = $varHost;
self::$port = $varPort;
self::$type = strtolower($varType);
self::$database = $varDatabase;
self::$password = $varPassword;
self::$username = $varUsername;
self::$savedQueries = array();
self::$savedResults = array();
self::$connection = self::ConnectToDatabase();
self::SelectTheDatabase();
}
// DeInitialize the Variables
// Does not return anything, but acts like a destructor for Static classes
public static function DeInitialize()
{
// Remove Saved Queries
for ($saved = 0; $saved < sizeof(self::$savedQueries); $saved++)
{
unset(self::$savedQueries[$saved]);
}
// Remove Saved Results
for ($saved = 0; $saved < sizeof(self::$savedResults); $saved++)
{
unset(self::$savedResults[$saved]);
}
// Close the Database Connection
switch (self::$type)
{
case "mysql":
@mysql_close(self::$connection) or Error::LogError("MySQL Failed to Close", mysql_error(self::$connection));
break;
case "mysqli":
@mysqli_close(self::$connection) or Error::LogError("MySQL Failed to Close", mysqli_error(self::$connection));
break;
}
// Destroy Variables
self::$host = null;
self::$port = null;
self::$type = null;
self::$database = null;
self::$password = null;
self::$username = null;
self::$connection = null;
self::$savedQueries = null;
self::$savedResults = null;
Error::DeInitialize();
}
// Database Types
// Returns an array of database types
public static function DatabaseTypes()
{
return split(",", self::DB_TYPES);
}
// Build Order By
// Returns the SQL Syntax for ORDER BY
public static function BuildOrderBy($varColumnName, $varDirection)
{
$orderby = "";
if (self::$connection)
{
switch (self::$type)
{
case "mysql":
case "mysqli":
$orderby = "ORDER BY `{$varColumnName}` {$varDirection}";
break;
}
}
return $orderby;
}
// Build Limit
// Returns the SQL Syntax for LIMIT
public static function BuildLimit($varStartingRow, $varNumberOfRows)
{
$limit = "";
if (self::$connection)
{
switch (self::$type)
{
case "mysql":
case "mysqli":
$limit = "LIMIT {$varStartingRow}, {$varNumberOfRows}";
break;
}
}
return $limit;
}
// Execute SQL Query
// Returns the result of the query, which is typically a resource id
public static function ExecuteQuery($sql, $name)
{
if (self::$connection)
{
if (strlen(trim($name)) != 0)
{
switch (self::$type)
{
case "mysql":
if (!array_key_exists($name, self::$savedQueries))
{
self::$savedQueries[$name] = @mysql_query($sql, self::$connection) or Error::LogError("Query Failed", mysql_error(self::$connection));
}
break;
case "mysqli":
if (!array_key_exists($name, self::$savedQueries))
{
self::$savedQueries[$name] = @mysqli_query(self::$connection, $sql) or Error::LogError("Query Failed", mysqli_error(self::$connection));
}
break;
}
return self::$savedQueries[$name];
}
else
{
Error::LogError("Execute Query Name Missing", "The name parameter was empty, please provide a name for the query.");
}
}
return null;
}
// Fetch Results
// Returns an array of the query results
public static function FetchResults($name)
{
$results = array();
if (self::$connection)
{
if (strlen(trim($name)) != 0 && (array_key_exists($name, self::$savedQueries) || array_key_exists($name, self::$savedResults)))
{
if (array_key_exists($name, self::$savedQueries))
{
switch (self::$type)
{
case "mysql":
$row = 0;
while ($currentResult = @mysql_fetch_assoc(self::$savedQueries[$name]))
{
$col = 0;
foreach ($currentResult as $key => $value)
{
$results[$row][$col] = $value;
$results[$row][$key] = $value;
$col++;
}
$row++;
}
break;
case "mysqli":
$row = 0;
while ($currentResult = @mysqli_fetch_assoc(self::$savedQueries[$name]))
{
$col = 0;
foreach ($currentResult as $key => $value)
{
$results[$row][$col] = $value;
$results[$row][$key] = $value;
$col++;
}
$row++;
}
break;
}
self::$savedResults[$name] = $results;
}
else
{
$results = self::$savedResults[$name];
}
}
else
{
if (strlen(trim($name)) == 0)
{
Error::LogError("Fetch Results Name Missing", "The name parameter was empty, the name is required so it knows which results to return.");
}
else
{
Error::LogError("Fetch Results Name ('{$name}') Not Found", "The name provided did not have any query results associated with it.");
}
}
}
return $results;
}
// Free SQL Query Results
// Returns nothing
public static function FreeResults($name)
{
if (self::$connection)
{
if (strlen(trim($name)) != 0 && array_key_exists($name, self::$savedQueries))
{
switch (self::$type)
{
case "mysql":
@mysql_free_result(self::$savedQueries[$name]) or Error::LogError("Free Results Error", mysql_error(self::$connection));
unset(self::$savedQueries[$name]);
break;
case "mysqli":
@mysqli_free_result(self::$savedQueries[$name]) or Error::LogError("Free Results Error", mysqli_error(self::$connection));
unset(self::$savedQueries[$name]);
break;
}
}
else
{
if (strlen(trim($name)) == 0)
{
Error::LogError("Free Results Name Missing", "The name parameter was empty, the name is required so it knows which results to free up from memory.");
}
else
{
Error::LogWarning("Free Results Name ('{$name}') Not Found", "The name provided did not have any query results associated with it.");
}
}
}
}
// Remove Saved Results
// Returns nothing
public static function RemoveSavedResults($name)
{
if (strlen(trim($name)) != 0 && array_key_exists($name, self::$savedResults))
{
unset(self::$savedResults[$name]);
}
else
{
if (strlen(trim($name)) == 0)
{
Error::LogError("Remove Saved Result Name Missing", "The name parameter was empty, the name is required so it knows which query to remove.");
}
else
{
Error::LogWarning("Remove Saved Result Name ('{$name}') Not Found", "The name provided was not a saved query.");
}
}
}
// Attempt Connect To Database
// Returns true or false depending on if the connection failed or succeeded
public static function AttemptConnectToDatabase($varType, $varHost, $varPort, $varDatabase, $varUsername, $varPassword)
{
self::$type = $varType;
self::$host = $varHost;
self::$port = $varPort;
self::$database = $varDatabase;
self::$username = $varUsername;
self::$password = $varPassword;
Error::ClearErrors();
self::$connection = self::ConnectToDatabase();
if (!Error::HasErrors())
{
return true;
}
else
{
return false;
}
}
// MySQL Version
// Returns the mysql version number
public static function MysqlVersion()
{
$version = "";
if (self::$connection)
{
switch (self::$type)
{
case "mysql":
$version = mysql_get_server_info(self::$connection);
break;
case "mysqli":
$version = mysqli_get_server_info(self::$connection);
break;
}
}
return $version;
}
## END PUBLIC METHODS
## PRIVATE METHODS
// Connect to Database
// Returns the database connection resource
private static function ConnectToDatabase()
{
$link = null;
switch (self::$type)
{
case "mysql":
if (strlen(trim(self::$port)) != 0)
{
$link = mysql_connect(self::$host . ":" . self::$port, self::$username, self::$password) or Error::LogError("Database Error", mysql_error());
}
else
{
$link = mysql_connect(self::$host, self::$username, self::$password) or Error::LogError("Database Error", mysql_error());
}
break;
case "mysqli":
$link = mysqli_connect(self::$host, self::$username, self::$password, self::$database, self::$port) or Error::LogError("Database Error", mysqli_connect_error());
break;
}
return $link;
}
// Select the Database
// Returns nothing
private static function SelectTheDatabase()
{
switch (self::$type)
{
case "mysql":
@mysql_select_db(self::$database, self::$connection) or Error::LogError("Database Selection", mysql_error(self::$connection));
break;
}
}
// Valid Database Types
// Returns true or false depending on if the database type is valid
private static function ValidDatabaseTypes($varType)
{
$types = split(',', str_replace(" ", "", self::DB_TYPES));
return in_array($varType, $types);
}
## END PRIVATE METHODS
## PROTECTED METHODS
## END PROTECTED METHODS
}
?>

View File

@ -0,0 +1,258 @@
<?php
//////////////////////////////////////////////////////////////////////////////
// Error Class
//============================================================================
// Dependencies:
//----------------------------------------------------------------------------
// none
//============================================================================
// Modification History:
//----------------------------------------------------------------------------
// 2006-11-04: Created
//////////////////////////////////////////////////////////////////////////////
class Error
{
## CONSTANT VARIABLES
## END CONSTANT VARIABLES
## PUBLIC VARIABLES
## END PUBLIC VARIABLES
## PRIVATE VARIABLES
private static $title;
private static $type;
private static $description;
private static $datetime;
private static $numErrors;
private static $numWarnings;
## END PRIVATE VARIABLES
## CONSTRUCTOR
## END CONSTRUCTOR
## DECONSTRUCTOR
## END DECONSTRUCTOR
## PUBLIC METHODS
// Initialize the Variables
// Does not return anything, but acts like a constructor for Static classes
public static function Initialize()
{
self::$title = array();
self::$type = array();
self::$description = array();
self::$datetime = array();
self::$numErrors = 0;
self::$numWarnings = 0;
}
// DeInitialize the Variables
// Does not return anything, but acts like a destructor for Static classes
public static function DeInitialize()
{
self::$title = null;
self::$type = null;
self::$description = null;
self::$datetime = null;
self::$numErrors = null;
self::$numWarnings = null;
}
// Log Error Method (receives Name and Description)
// Returns true or false depending on if the logging of the error was successful
public static function LogError($varTitle, $varDescription)
{
// Check Parameters
if (strlen(trim($varTitle)) != 0 && strlen(trim($varDescription)) != 0)
{
array_push(self::$title, $varTitle);
array_push(self::$type, "ERROR");
array_push(self::$description, $varDescription);
array_push(self::$datetime, date("m/d/Y H:i:s"));
self::$numErrors++;
return true;
}
return false;
}
// Show Error Messages
// Returns the Error Message Output (in HTML format)
public static function ShowErrorMessages()
{
$output = "";
// Check to see if 1 error occurred or more than one.
if (self::$numErrors > 0)
{
if (self::$numErrors > 1)
{
$error = "ERRORS";
}
else
{
$error = "ERROR";
}
// Loop through Error Messages
for ($i = 0; $i < sizeof(self::$title); $i++)
{
if (self::$type[$i] == "ERROR")
{
// Output each individual Error
$output .= " <div class=\"divErrorTitle\">\r\n" .
" " . self::$title[$i] . "\r\n" .
" <span class=\"spnErrorDateTime\">at " . self::$datetime[$i] . "</span>\r\n" .
" </div>\r\n" .
" <div class=\"divErrorDesc\">" . self::$description[$i] . "<br /><br /></div>\r\n";
}
}
// Write Error Template Output
$output = "<div class=\"divErrorBox\">\r\n" .
" <div class=\"divErrorBoxTitle\"><img src=\"icons/24-em-cross.png\" align=\"left\" /> {$error}:</div>\r\n" .
" <div class=\"divErrors\">\r\n" . $output . "\r\n </div>\r\n" .
"</div>\r\n";
}
// Return the Error Message Output
return $output;
}
// Retrieve Last Error
// Returns the title and description of the last error in an array
public static function RetrieveLastError()
{
$output = array();
// Check to see if 1 error occurred or more than one.
if (self::$numErrors > 0)
{
for ($i = sizeof(self::$title) - 1; $i >= 0; $i++)
{
if (self::$type[$i] == "ERROR")
{
array_push($output, self::$title[$i]);
array_push($output, self::$description[$i]);
break;
}
}
}
return $output;
}
// Clear Errors
// Returns nothing
public static function ClearErrors()
{
self::$numErrors = 0;
for ($i = 0; $i < sizeof(self::$type); $i++)
{
if (self::$type[$i] == "ERROR")
{
self::$title[$i] = null;
self::$type[$i] = null;
self::$description[$i] = null;
self::$datetime[$i] = null;
}
}
}
// Has Errors
// Returns true or false on whether errors exist
public static function HasErrors()
{
if (self::$numErrors > 0)
{
return true;
}
return false;
}
// Log Warning Method (receives Name and Description)
// Returns true or false depending on if logging the warning was successful
public static function LogWarning($varTitle, $varDescription)
{
// Check Parameters
if (strlen(trim($varTitle)) != 0 && strlen(trim($varDescription)) != 0)
{
array_push(self::$title, $varTitle);
array_push(self::$type, "WARNING");
array_push(self::$description, $varDescription);
array_push(self::$datetime, date("m/d/Y H:i:s"));
self::$numWarnings++;
return true;
}
return false;
}
// Show Warning Messages
// Returns the Warning Message Output (in HTML format)
public static function ShowWarningMessages()
{
$output = "";
// Check to see if 1 warning occurred or more than one.
if (self::$numWarnings > 0)
{
if (self::$numWarnings > 1)
{
$warning = "WARNINGS";
}
else
{
$warning = "WARNING";
}
// Loop through Warning Messages
for ($i = 0; $i < sizeof(self::$title); $i++)
{
if (self::$type[$i] == "WARNING")
{
// Output each individual Warning
$output .= " <div class=\"divWarningTitle\">\r\n" .
" " . self::$title[$i] . "\r\n" .
" <span class=\"spnWarningDateTime\">at " . self::$datetime[$i] . "</span>\r\n" .
" </div>\r\n" .
" <div class=\"divWarningDesc\">" . self::$description[$i] . "<br /><br /></div>\r\n";
}
}
// Write Warning Template Output
$output = "<div id=\"divWarningBox\">\r\n" .
" <div id=\"divWarningBoxTitle\"><img src=\"designs/icons/24-message-warn.png\" align=\"left\" /> {$warning}:</div>\r\n" .
" <div id=\"divWarnings\">\r\n" . $output . "\r\n </div>\r\n" .
"</div>\r\n";
}
// Return the Warning Message Output
return $output;
}
// Has Warnings
// Returns true or false on whether there are any Warnings
public static function HasWarnings()
{
if (self::$numWarnings > 0)
{
return true;
}
return false;
}
## END PUBLIC METHODS
## PRIVATE METHODS
## END PRIVATE METHODS
## PROTECTED METHODS
## END PROTECTED METHODS
}
?>

View File

@ -0,0 +1,7 @@
<?php
require_once("error.class.php");
require_once("database.class.php");
require_once("rating.class.php");
Database::Initialize("mysql", $dbhost, "3306", $dbname, $dbuname, $dbpass);
?>

View File

@ -0,0 +1,279 @@
<?php
class Rating
{
## PRIVATE VARIABLES
## END PRIVATE VARIABLES
## PUBLIC METHODS
// Output the Rating information
// Returns a string of HTML
public static function OutputRating($varParent, $varItem)
{
// Verify $varItem was provided
if ($varItem != null && strlen(trim($varItem)) != 0 && $varParent != null && strlen(trim($varParent)) != 0)
{
// Check if Magic QUotes is ON
if (!get_magic_quotes_gpc())
{
$varItem = addslashes($varItem);
$varParent = addslashes($varParent);
}
// Information for the Output
$averageStars = Rating::CalculateAverageRating($varParent, $varItem);
// Check to see that the user has not already rated this item
if (Rating::CheckRatingsByIp($varParent, $varItem) == 0)
{
$classes = "rating " . Rating::ShowStars($averageStars);
$cat_info = Rating::FetchCategoryInfo($varItem);
// Write Output HTML for the Rating Data
$output = "\r\n";
$output .= "<div class=\"rating-table\"><div><strong>{$cat_info['rating_cat_name']}</strong></div>\r\n";
$output .= "<div>{$cat_info['rating_cat_min']}</div><div><div class=\"rated\"><ul class=\"{$classes}\" style='margin: 0px 0px 10px 0px;' id=\"{$varParent}_{$varItem}\">\r\n";
$output .= " <li class=\"one\"><a href=\"javascript:RateItem('{$varParent}','{$varItem}', 1);\" title=\"1 Star\">1</a></li>\r\n";
$output .= " <li class=\"two\"><a href=\"javascript:RateItem('{$varParent}','{$varItem}', 2);\" title=\"2 Stars\">2</a></li>\r\n";
$output .= " <li class=\"three\"><a href=\"javascript:RateItem('{$varParent}','{$varItem}', 3);\" title=\"3 Stars\">3</a></li>\r\n";
$output .= " <li class=\"four\"><a href=\"javascript:RateItem('{$varParent}','{$varItem}', 4);\" title=\"4 Stars\">4</a></li>\r\n";
$output .= " <li class=\"five\"><a href=\"javascript:RateItem('{$varParent}','{$varItem}', 5);\" title=\"5 Stars\">5</a></li>\r\n";
$output .= "</ul></div></div><div> {$cat_info['rating_cat_max']}</div></div>\r\n";
}
else
{
$classes = "rated " . Rating::ShowStars($averageStars);
$cat_info = Rating::FetchCategoryInfo($varItem);
// Write Output HTML for the Rating Data
$output = "\r\n";
$output .= "<div class=\"rating-table\"><div><strong>{$cat_info['rating_cat_name']}</strong></div>\r\n";
$output .= "<div>{$cat_info['rating_cat_min']}</div><div><div class=\"rated\"><ul class=\"{$classes}\" style='margin: 0px 0px 10px 0px;' id=\"{$varParent}_{$varItem}\">\r\n";
$output .= " <li class=\"one\">1</li>\r\n";
$output .= " <li class=\"two\">2</li>\r\n";
$output .= " <li class=\"three\">3</li>\r\n";
$output .= " <li class=\"four\">4</li>\r\n";
$output .= " <li class=\"five\">5</li>\r\n";
$output .= "</ul></div></div><div> {$cat_info['rating_cat_max']}</div></div>\r\n";
}
}
else
{
$output = "";
// This is a major issue. NO information can be retrieve if an item name is not passed.
Error::LogError("Variable Missing", "You must provide the item name for this function to find the average.");
}
return $output;
}
public static function OutputParentRating($varParent)
{
// Verify $varParent was provided
if ($varParent != null && strlen(trim($varParent)) != 0)
{
// Check if Magic QUotes is ON
if (!get_magic_quotes_gpc())
{
$varParent = addslashes($varParent);
}
// Information for the Output
$averageStars = Rating::CalculateAverageParentRating($varParent);
$classes = "rated " . Rating::ShowStars($averageStars);
//$parent_info = Rating::FetchParentInfo($varParent);
// Write Output HTML for the Rating Data
$output = "\r\n";
//$output .= "<div style='clear:both;'>Overall Rating</div>";
$output .= "<div style='height: 16px; width: 80px; position: relative;'><ul class=\"{$classes}\" id=\"{$varParent}\" style='margin: 0px 0px 10px 0px;'>\r\n";
$output .= " <li class=\"one\">1</li>\r\n";
$output .= " <li class=\"two\">2</li>\r\n";
$output .= " <li class=\"three\">3</li>\r\n";
$output .= " <li class=\"four\">4</li>\r\n";
$output .= " <li class=\"five\">5</li>\r\n";
$output .= "</ul></div>\r\n";
}
else
{
$output = "";
// This is a major issue. NO information can be retrieve if an item name is not passed.
Error::LogError("Variable Missing", "You must provide the parent name for this function to find the average.");
}
return $output;
}
// Rate an Item
// Returns the name/value pair of new class names and the item name
public static function RateItem($varParent, $varItem, $varRating, $varClasses)
{
$newClassNames = $varClasses;
// Verify $varName was provided
if ($varParent != null && strlen(trim($varParent)) != 0
&& $varItem != null && strlen(trim($varItem)) != 0
&& $varRating != null && strlen(trim($varRating)) != 0 && is_numeric($varRating)
&& $varClasses != null && strlen(trim($varClasses)) != 0)
{
// Check if Magic Quotes is ON
if (!get_magic_quotes_gpc())
{
$varItem = addslashes($varItem);
$varParent = addslashes($varParent);
}
// Check to see that the user has not already rated this item
if (Rating::CheckRatingsByIp($varParent, $varItem) == 0)
{
$ipAddress = $_SERVER['REMOTE_ADDR'];
$tempTime = time();
Database::ExecuteQuery("INSERT INTO `gforum_FittersRating` (`fitter_id_fk`, `category_id_fk`, `rating_vote`, `rating_ip`, `rating_date`) VALUES ('{$varParent}', '{$varItem}', {$varRating}, '{$ipAddress}', '{$tempTime}')", "InsertRating");
Database::FetchResults("InsertRating");
Database::FreeResults("InsertRating");
Database::RemoveSavedResults("InsertRating");
// Information for the Output
$averageStars = Rating::CalculateAverageRating($varParent, $varItem);
$newClassNames = "rated " . Rating::ShowStars($averageStars);
$averageStars = Rating::CalculateAverageParentRating($varParent);
$newClassParent = "rated " . Rating::ShowStars($averageStars);
}
}
else
{
// This is a major issue. NOT enough information was sent to log the item
Error::LogError("Variable(s) Missing", "You must provide all of the information to log the rating of this item.");
}
// Build Name/Value Pair to return
$nameValue = "classes={$newClassNames}&item={$varItem}&parent={$varParent}&parentClass={$newClassParent}";
return $nameValue;
}
## END PUBLIC METHODS
## PRIVATE METHODS
// Fetch Category Names & Min/Max Values
private static function FetchCategoryInfo($varItem)
{
// Query Category Info for a specific Category ID
Database::ExecuteQuery("SELECT * FROM `gforum_FittersRatingCategory` WHERE `rating_cat_id`='{$varItem}'", "CategoryInfo");
$results = Database::FetchResults("CategoryInfo");
Database::FreeResults("CategoryInfo");
Database::RemoveSavedResults("CategoryInfo");
return $results[0];
}
// Calculate Average Rating
// Returns the number of stars to show
private static function CalculateAverageRating($varParent, $varItem)
{
$averageStars = 0;
// Query Average Rating for a specific Item
Database::ExecuteQuery("SELECT AVG(`rating_vote`) AS `averageRating` FROM `gforum_FittersRating` WHERE `category_id_fk`='{$varItem}' AND `fitter_id_fk`='{$varParent}'", "AverageRating");
$results = Database::FetchResults("AverageRating");
Database::FreeResults("AverageRating");
Database::RemoveSavedResults("AverageRating");
// Round the Average into a Whole Number
if (sizeof($results) == 1)
{
if ($results[0]['averageRating'] != null)
{
$averageStars = round($results[0]["averageRating"], 0);
}
}
else
{
// This is simply a warning, as it isn't vital if no results were found, as the item may be new.
Error::LogWarning("Rating Data Missing", "No entries were found for '{$varName}', this might be the first entry.");
}
return $averageStars;
}
// Calculate Average Rating
// Returns the number of stars to show
private static function CalculateAverageParentRating($varParent)
{
$averageStars = 0;
// Query Average Rating for a specific Item
Database::ExecuteQuery("SELECT AVG(`rating_vote`) AS `averageRating` FROM `gforum_FittersRating` WHERE `fitter_id_fk`='{$varParent}'", "AverageRating");
$results = Database::FetchResults("AverageRating");
Database::FreeResults("AverageRating");
Database::RemoveSavedResults("AverageRating");
// Round the Average into a Whole Number
if (sizeof($results) == 1)
{
if ($results[0]['averageRating'] != null)
{
$averageStars = round($results[0]["averageRating"], 0);
}
}
else
{
// This is simply a warning, as it isn't vital if no results were found, as the item may be new.
Error::LogWarning("Rating Data Missing", "No entries were found for '{$varName}', this might be the first entry.");
}
return $averageStars;
}
// Show Stars
// Returns the class information for the number of stars to show
private static function ShowStars($varStars)
{
// Select the Number of Stars Class
switch ($varStars)
{
case 1:
$classes .= "onestar";
break;
case 2:
$classes .= "twostar";
break;
case 3:
$classes .= "threestar";
break;
case 4:
$classes .= "fourstar";
break;
case 5:
$classes .= "fivestar";
break;
default:
$classes .= "nostar";
break;
}
return $classes;
}
// Check Ratings By IP Address
// Returns the number of ratings for an item by an ip address
private static function CheckRatingsByIp($varParent, $varItem)
{
$ipAddress = $_SERVER['REMOTE_ADDR'];
Database::ExecuteQuery("SELECT COUNT(*) AS `totalRatings` FROM `gforum_FittersRating` WHERE `category_id_fk`='{$varItem}' AND `fitter_id_fk`='{$varParent}' AND `rating_ip`='{$ipAddress}'", "AlreadyRated");
$results = Database::FetchResults("AlreadyRated");
Database::FreeResults("AlreadyRated");
Database::RemoveSavedResults("AlreadyRated");
// Check to see that the user has not already rated this item
if ($results != null && $results[0]['totalRatings'] != null)
{
return $results[0]['totalRatings'];
}
return 0;
}
## END PRIVATE METHODS
}
?>

View File

@ -0,0 +1,55 @@
<?php
$nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", 30 => "thirty", 40 => "forty", 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", 90 => "ninety" );
function int_to_words($x) {
global $nwords;
if(!is_numeric($x))
$w = '#';
else if(fmod($x, 1) != 0)
$w = '#';
else {
if($x < 0) {
$w = 'minus ';
$x = -$x;
} else
$w = '';
// ... now $x is a non-negative integer.
if($x < 21) // 0 to 20
$w .= $nwords[$x];
else if($x < 100) { // 21 to 99
$w .= $nwords[10 * floor($x/10)];
$r = fmod($x, 10);
if($r > 0)
$w .= '-'. $nwords[$r];
} else if($x < 1000) { // 100 to 999
$w .= $nwords[floor($x/100)] .' hundred';
$r = fmod($x, 100);
if($r > 0)
$w .= ' and '. int_to_words($r);
} else if($x < 1000000) { // 1000 to 999999
$w .= int_to_words(floor($x/1000)) .' thousand';
$r = fmod($x, 1000);
if($r > 0) {
$w .= ' ';
if($r < 100)
$w .= 'and ';
$w .= int_to_words($r);
}
} else { // millions
$w .= int_to_words(floor($x/1000000)) .' million';
$r = fmod($x, 1000000);
if($r > 0) {
$w .= ' ';
if($r < 100)
$word .= 'and ';
$w .= int_to_words($r);
}
}
}
return $w;
}
?>

View File

@ -0,0 +1,71 @@
<?php
require_once("classes/include.all.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>CSS Star Rating System fully functional using AJAX</title>
<link type="text/css" href="styles/rating.css" rel="stylesheet" media="all" />
<script type="text/javascript" src="scripts/prototype.js"></script>
<script type="text/javascript" src="scripts/rating.js"></script>
</head>
<body>
<h4>Race Rating System:</h4>
<?php
$ratingData = Rating::OutputParentRating('1');
if (Error::HasErrors())
{
echo Error::ShowErrorMessages();
Error::ClearErrors();
}
else
{
echo $ratingData;
}
?>
<?php
$ratingData = Rating::OutputRating('1','1');
if (Error::HasErrors())
{
echo Error::ShowErrorMessages();
Error::ClearErrors();
}
else
{
echo $ratingData;
}
?>
<?php
$ratingData = Rating::OutputRating('1','2');
if (Error::HasErrors())
{
echo Error::ShowErrorMessages();
Error::ClearErrors();
}
else
{
echo $ratingData;
}
?>
<?php
$ratingData = Rating::OutputRating('1','3');
if (Error::HasErrors())
{
echo Error::ShowErrorMessages();
Error::ClearErrors();
}
else
{
echo $ratingData;
}
?>
</body>
</html>
<?php
Database::DeInitialize();
?>

View File

@ -0,0 +1,35 @@
<?PHP
if (eregi("comments_add.php", $_SERVER['SCRIPT_NAME'])) {
Header("Location: ".$site_url."/index.php"); die();
}
?>
<form action="comments_add_X.php" method="post">
<input type="hidden" name="fitter_id" value="<? echo $row[fitter_id]; ?>" />
<input type="hidden" name="editor_id" value="<? echo $useruid; ?>" />
<input type="hidden" name="add_this_review" value="1" />
<div class="row required clear content-title-no" style="background-color: #cecece; padding-left: 2px;">
<a name="comment"></a>
<strong>Add A Comment </strong>
</div>
<div class="row required clear" style="background-color: #cecece;">
<label for="Review_Subject" class="name">Subject: </label>
<div class="value">
<input type="text" id="Review_Subject" name="Review_Subject" value="" class="text" />
</div>
</div>
<div class="row required clear" style="background-color: #cecece;">
<label for="Review_Contents" class="name">Your Review: </label>
<div class="value">
<textarea id="Review_Contents" name="Review_Contents" rows="3" cols="42"></textarea>
</div>
<div class="formsubmit" style="background-color: #cecece;">
<input type="submit" name="add_review" value="Add Review" class="nobutton" />
</div>
</div>
</form>

View File

@ -0,0 +1,33 @@
<?PHP
// do I need to do additional security checks to make sure the script is being called appropriately?
include("config.php");
if (!$_POST){ header('Location: '.$site_url); }
// error checking
if (isset($_POST[Review_Subject]) && isset($_POST[Review_Contents])) {
if ($_SERVER['HTTP_X_FORWARD_FOR']) {
$ip = $_SERVER['HTTP_X_FORWARD_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$tsNow = time();
$fitter_id = $_POST[fitter_id];
$editor_id = $_POST[editor_id];
$subject = mysql_escape_string(trim($_POST[Review_Subject]));
$message = mysql_escape_string(nl2br(htmlspecialchars(substr(trim($_POST[Review_Contents]), 0, 4096))));
// build the SQL query to delete the edits that are bad
$sql = "INSERT INTO ".$prefix."FittersComment (fitter_id_fk, comment_time, user_id_fk, comment_subject, comment_message, comment_ip, comment_valid) VALUES ($fitter_id, '$tsNow', '$editor_id', '$subject', '$message', '$ip', 0)";
//echo $sql;
mysql_query($sql) or die(mysql_error());
}
header('Location: '.$site_url.'/individual.php?fitter_id='.$fitter_id.'&review_add=ok');
exit();
?>

View File

@ -0,0 +1,19 @@
<?PHP
if (eregi("comments_show.php", $_SERVER['SCRIPT_NAME'])) {
Header("Location: index.php"); die();
}
//$sqlComments = "SELECT * FROM gforum_TriathlonsComment WHERE triathlon_id_fk = $row[uid] AND comment_valid = 1 ORDER BY comment_time DESC";
//$objComments = mysql_query($sqlComments) OR die(mysql_error());
$fb_xid = intval(mysql_escape_string($_GET[uid]));
?>
<a name="comment"></a>
<? /*<div class="fb-comments" data-href="<? echo(curPageURL()); ?>" data-num-posts="5" data-width="500"></div>*/ ?>
<? /**<fb:comments href="<? echo(curPageURL()); ?>" num_posts="5" width="500"></fb:comments>**/ ?>
<fb:comments href="<? echo(curPageURL()); ?>" num_posts="5" width="622"></fb:comments>

View File

@ -0,0 +1,88 @@
<?PHP include("config.php");
if(is_logged_in($user)){
$username = base64_decode($_SESSION['user']);
if($username != "Slowman" && $username != "Rappstar" && $username != "Herbert") {
header('Location: '.$site_url);
exit();
}
} else {
header('Location: '.$site_url);
exit();
}
// Query to fetch non-validated races:
$results = mysql_query("SELECT * FROM ".$prefix."FittersComment WHERE comment_valid = 0 ORDER BY comment_time DESC") OR die(mysql_error());
// check to see if set is empty
$none = FALSE;
if (mysql_num_rows($results) == 0) { $none = TRUE; }
// set the page title
$pagetitle = "Admin: Comment Validation";
// set meta tags
$meta_keywords = "";
$meta_description = "";
?>
<? include("include_common_head.php"); ?>
<? include("include_common_content.php"); ?>
<!-- Start outer -->
<div id="outer">
<!-- BODY -->
<div class="content">
<!-- LEFT COLUMN -->
<!-- End left column -->
<!-- Content col -->
<h1 class="content-title"><strong>Unvalidated Comments</strong></h1>
<form method="post" action="comments_validate_X.php" enctype="multipart/form-data">
<div class="indent">
<?
if($none == TRUE){
echo "There are no comments waiting to be validated.";
}
?>
<table border="0" cellspacing="1" cellpadding="1" width="100%">
<?
$x = 0;
while($arrComments = mysql_fetch_array($results)){
$x++;
if($x % 2 == 0){ $bg = '#cecece'; }else{ $bg = '#ececec'; }
$arrCommenters = mysql_fetch_array(mysql_query("SELECT user_username FROM ".$prefix."User WHERE user_id = ".$arrComments[user_id_fk]." LIMIT 1"));
$arrClubs = mysql_fetch_array(mysql_query("SELECT fitter_name FROM ".$prefix."Fitters WHERE fitter_id = ".$arrComments[fitter_id_fk]." LIMIT 1"));
$commenter_user_username = $arrCommenters[user_username];
$fitter_name = $arrClubs[fitter_name];
?>
<tr bgcolor="<? echo "$bg"; ?>"><td><span class="sub-hdr" style="margin-left: 5px;"><strong><? echo $arrComments[comment_subject]; ?></strong></span><div class="indent">Reviewed by: <? echo "<a href=\"http://forum.slowtwitch.com/gforum.cgi?username=".$commenter_user_username.";\" target=\"_blank\">".$commenter_user_username."</a>"; echo " on ".date("F j, Y g:i A", $arrComments[comment_time]); echo " about <a href=\"".$site_url."/individual.php?fitter_id=".$arrComments[fitter_id_fk]."\">".$fitter_name."</a>";?></div><div class="indent" style="background-color: #eeeef9; border: 1px solid black; margin-top: 2px; margin-right: 5px; margin-bottom: 5px; padding: 5px; ">
<? echo stripslashes(stripslashes($arrComments[comment_message])); ?>
</div><div class="indent"><input type="checkbox" value="<? echo($arrComments[comment_id]); ?>" name="validate[]"> Validate this comment. <input type="checkbox" value="<? echo($arrComments[comment_id]); ?>" name="delete[]"> Delete this comment.<br /></div></td></tr>
<?
}
?>
</table>
<br />
<input type="submit" value="Process Selected Comments">
</div>
</form>
<!-- End content col -->
</div>
<!-- End BODY -->
</div>
<!-- End Outer -->
<? include("include_common_footer.php"); ?>

View File

@ -0,0 +1,37 @@
<?PHP
// do I need to do additional security checks to make sure the script is being called appropriately?
include("config.php");
if (!$_POST){ header('Location: '.$site_url); }
// error checking
if(!isset($_POST)) exit();
if (isset($_POST[delete])) {
// convert the array to a SQL friendly format
$deleteList = "(".implode(",", $_POST[delete]).")";
// build the SQL query to delete the edits that are bad
$sql = "DELETE FROM ".$prefix."FittersComment WHERE comment_id IN $deleteList";
mysql_query($sql) or die(mysql_error());
}
if (isset($_POST[validate])) {
// convert the array to a SQL friendly format
$comment_idlist = "(".implode(",", $_POST[validate]).")";
// build the SQL query
$sql = "UPDATE ".$prefix."FittersComment
SET comment_valid = 1
WHERE comment_id IN $comment_idlist;";
mysql_query($sql) or die(mysql_error());
}
header('Location: '.$site_url.'/comments_validate.php');
?>

226
site/fitters/config.php Normal file
View File

@ -0,0 +1,226 @@
<?
###########################################
#-----------Users login system------------#
###########################################
/*=========================================\
Author : Mohammed Ahmed(M@@king) \\
Version : 1.0 \\
Date Created: Aug 20 2005 \\
---------------------------- \\
Last Update: August 22 2005 \\
---------------------------- \\
Country : Palestine \\
City : Gaza \\
E-mail : m@maaking.com \\
MSN : m@maaking.com \\
AOL-IM : maa2pal \\
WWW : http://www.maaking.com \\
Mobile/SMS : 00972-599-622235 \\
\\
===========================================\
------------------------------------------*/
// NEED TO CHECK AGAINST SERVER VERSION
//skip the config file if somebody call it from the browser.
session_start();
if (eregi("config.php", $_SERVER['SCRIPT_NAME'])) {
Header("Location: index.php"); die();
}
$main_table = "Fitters";
$field_lead = "fitter_";
$site_url = "/fitters";
include("../local/settings.php");
//added new code to fix compatibility issues.
//09-Nov-2005
$phpver = phpversion();
if ($phpver < '4.1.0') {
$_GET = $HTTP_GET_VARS;
$_POST = $HTTP_POST_VARS;
$_SERVER = $HTTP_SERVER_VARS;
}
if ($phpver >= '4.0.4pl1' && strstr($_SERVER["HTTP_USER_AGENT"],'compatible')) {
if (extension_loaded('zlib')) {
ob_end_clean();
ob_start('ob_gzhandler');
}
} else if ($phpver > '4.0') {
if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) {
if (extension_loaded('zlib')) {
$do_gzip_compress = TRUE;
ob_start(array('ob_gzhandler',5));
ob_implicit_flush(0);
header('Content-Encoding: gzip');
}
}
}
$phpver = explode(".", $phpver);
$phpver = "$phpver[0]$phpver[1]";
if ($phpver >= 41) {
$PHP_SELF = $_SERVER['PHP_SELF'];
}
if (!ini_get("register_globals")) {
#import_request_variables('GPC');
}
$statecount = mysql_num_rows(mysql_query("SELECT * FROM gforum_Fitters WHERE fitter_valid = 1"));
$sql = "SELECT * FROM ".$prefix."FittersStates ORDER BY stateid";
$result = mysql_query($sql) OR die(mysql_error());
$state_list = array();
$state_tag_list = array();
while ($row = mysql_fetch_array($result)) {
$state_list[$row['stateid']] = $row['statelong'];
$state_tag_list[] = $row['statetag'];
}
function fist_equipped($fitter_id) {
global $db,$prefix;
$fist_equipped_bikes = array(10 => "guru", 13 => "retul", 12 => "purely", 2 => "exitcycling", 9 => "probikes");
$sql = "SELECT * FROM ".$prefix."Fitters WHERE fitter_id=$fitter_id LIMIT 1";
$sql_match = mysql_query($sql) or die(mysql_error());
$match_row = mysql_fetch_array($sql_match);
$match_row[fitter_certifications] = ltrim(rtrim($match_row[fitter_certifications], ", "), ", ");
$sql = ("SELECT * FROM gforum_FittersCertifications WHERE fitter_certification_id IN ($match_row[fitter_certifications]) ORDER BY fitter_certification_name ASC");
//echo $sql;
$fetch = mysql_query($sql) or die(mysql_error());
$fist_certified = false;
$fist_equipped = false;
$super_fist = false;
while ($list = mysql_fetch_array($fetch)) {
//echo ($list[fitter_certification_tag]);
$pos = strpos($list[fitter_certification_tag], "fist");
$sup = strpos($list[fitter_certification_tag], "super");
if ($pos !== false) {
//echo ("TRUE");
$fist_certified = true;
if ($sup !== false) {
//echo ("TRUE");
$fist_super_cert = true;
}
}
}
if ($fist_certified === true) {
$match_row[fitter_fitbikes] = ltrim(rtrim($match_row[fitter_fitbikes], ", "), ", ");
$sql = ("SELECT * FROM gforum_FittersFitbikes WHERE fitter_fitbike_id IN ($match_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)) {
//echo ($list[fitter_fitbike_tag]);
$key = array_search($list[fitter_fitbike_tag], $fist_equipped_bikes);
if ($key !== false){ $fist_equipped = true;}
}
}
if ($fist_equipped == true && $fist_super_cert == true) { $super_fist = true; }
if ($fist_equipped) { return("fist_equipped"); }
elseif ($super_fist) { return("super_fist"); }
else { return("none"); }
}
function curPageURL() {
$isHTTPS = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on");
$port = (isset($_SERVER["SERVER_PORT"]) && ((!$isHTTPS && $_SERVER["SERVER_PORT"] != "80") || ($isHTTPS && $_SERVER["SERVER_PORT"] != "443")));
$port = ($port) ? ':'.$_SERVER["SERVER_PORT"] : '';
$url = ($isHTTPS ? 'https://' : 'http://').$_SERVER["SERVER_NAME"].$port.$_SERVER["REQUEST_URI"];
return $url;
}
//Array of states for use in the form
/** $state_list = array('AL'=>"Alabama",
'AK'=>"Alaska",
'AB'=>'Alberta',
'AZ'=>"Arizona",
'AR'=>"Arkansas",
'BC'=>'British Columbia',
'CB'=>"Caribbean",
'CA'=>"California",
'CM'=>"Central America",
'CO'=>"Colorado",
'CT'=>"Connecticut",
'DE'=>"Delaware",
'DC'=>"District of Columbia",
'FL'=>"Florida",
'GA'=>"Georgia",
'HI'=>"Hawaii",
'ID'=>"Idaho",
'IL'=>"Illinois",
'IN'=>"Indiana",
'IA'=>"Iowa",
'KS'=>"Kansas",
'KY'=>"Kentucky",
'LA'=>"Louisiana",
'ME'=>"Maine",
'MB'=>'Manitoba',
'MD'=>"Maryland",
'MA'=>"Massachusetts",
'MX'=>"Mexico",
'MI'=>"Michigan",
'MN'=>"Minnesota",
'MS'=>"Mississippi",
'MO'=>"Missouri",
'MT'=>"Montana",
'NE'=>"Nebraska",
'NV'=>"Nevada",
'NB'=>'New Brunswick',
'NL'=>'Newfoundland',
'NH'=>"New Hampshire",
'NJ'=>"New Jersey",
'NM'=>"New Mexico",
'NY'=>"New York",
'NC'=>"North Carolina",
'ND'=>"North Dakota",
'NS'=>'Nova Scotia',
'OH'=>"Ohio",
'OK'=>"Oklahoma",
'ON'=>'Ontario',
'OR'=>"Oregon",
'PA'=>"Pennsylvania",
'PE'=>'Prince Edward Island',
'QC'=>'Quebec',
'RI'=>"Rhode Island",
'SK'=>'Saskatchewan',
'SC'=>"South Carolina",
'SD'=>"South Dakota",
'TN'=>"Tennessee",
'TX'=>"Texas",
'UT'=>"Utah",
'VT'=>"Vermont",
'VA'=>"Virginia",
'WA'=>"Washington",
'WV'=>"West Virginia",
'WI'=>"Wisconsin",
'WY'=>"Wyoming",
// New Foreign "States",
'UK'=>"United Kingdom",
'FR'=>"France",
'DE'=>"Germany",
'IT'=>"Italy",
'CH'=>"Switzerland",
'JP'=>"Japan",
'AU'=>"Australia",
'NZ'=>"New Zealand",
'PI'=>"Pacific Islands",
'HK'=>"Hong Kong");
*/
?>

116
site/fitters/csv_list.php Normal file
View File

@ -0,0 +1,116 @@
<?PHP
include("config.php");
if(is_logged_in($user)){
$username = base64_decode($_SESSION['user']);
if($username != "Slowman" && $username != "Rappstar") {
header('Location: '.$site_url);
exit();
}
} else {
header('Location: '.$site_url);
exit();
}
//$count_fitters = mysql_fetch_row(mysql_query("SELECT COUNT(fitter_id) FROM gforum_Fitters"));
//$num_fitters = $count_fitters[0];
//$fitter_idhere = $num_fitters
echo ("Name, Address, Address Two, City, State, Zip, Phone, Email, Website, Methodology, Certification(s), Fitbike(s), Motion Capture System(s)<br /><br />");
$results = mysql_query("SELECT * FROM ".$prefix."Fitters ORDER BY fitter_id ASC");
while ($row = mysql_fetch_array($results)){
echo stripslashes(stripslashes($row[fitter_name])) . ", ";
echo stripslashes(htmlspecialchars($row[fitter_address])) . ", ";
echo stripslashes(htmlspecialchars($row[fitter_address_two])) . ", ";
echo stripslashes(htmlspecialchars($row[fitter_city])) . ", ";
echo stripslashes(htmlspecialchars($row[fitter_state])) . ", ";
echo stripslashes(htmlspecialchars($row[fitter_zip])) . ", ";
echo stripslashes(htmlspecialchars($row[fitter_phone])) . ", ";
echo stripslashes(htmlspecialchars($row[fitter_email])) . ", ";
$substring = "http";
if (!is_int(strpos($row[fitter_website], $substring))) {
$row[fitter_website] = "http://".$row[fitter_website];
}
echo $row[fitter_website] . ", ";
$row[fitter_fitbikes] = ltrim(rtrim($row[fitter_fitbikes], ", "), ", ");
//methodology
$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 on fit methodology, ");
}
//certifications
$row[fitter_certifications] = ltrim(rtrim($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 "No certification(s), ";}
//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 "No fitbike(s), ";}
//motion captures
$row[fitter_motioncapture] = ltrim(rtrim($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 "No motion capture system(s)";}
echo "<br /> ";
}
?>

29
site/fitters/delete_X.php Normal file
View File

@ -0,0 +1,29 @@
<?PHP
include("config.php");
if (!$_POST){ header('Location: '.$site_url); }
$sql = "DELETE FROM gforum_Fitters WHERE fitter_id = '$_POST[fitter_id]'";
mysql_query($sql) or die(mysql_error());
$sql = "DELETE FROM gforum_FittersEdits WHERE fitter_id_fk = '$_POST[fitter_id]'";
mysql_query($sql) or die(mysql_error());
$sql = "DELETE FROM gforum_FittersEditors WHERE fitter_id_fk = '$_POST[fitter_id]'";
mysql_query($sql) or die(mysql_error());
$sql = "DELETE FROM gforum_FittersComment WHERE fitter_id_fk = '$_POST[fitter_id]'";
mysql_query($sql) or die(mysql_error());
$sql = "DELETE FROM gforum_FittersRating WHERE fitter_id_fk = '$_POST[fitter_id]'";
mysql_query($sql) or die(mysql_error());
header('Location: '.$site_url);
?>

View File

@ -0,0 +1,296 @@
<p>Please confirm your information. If everything is correct, click the submit button. Otherwise, you may click the edit button to change your information before submitting.</p>
<div class="dtable form">
<div class="drow">
<div class="dcell name">Store Name</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes($_POST[name]); ?>
<?
// check the db for similar matches
$name_tag = strtolower(str_replace(" ","", $_POST['name']));
$name_superstart = substr($name_tag, 0, 4);
$name_superend = substr($name_tag, -4, 4);
$name_supermid = substr($name_tag, ((strlen($name_tag))/2 - 2), 4);
//echo $name_supermid;
$match_sql = "SELECT fitter_id, fitter_name, fitter_name_tag, fitter_city, fitter_state FROM ".$prefix."Fitters WHERE fitter_valid = 1 AND (fitter_name_tag LIKE '%".$name_superstart."%' OR fitter_name_tag LIKE '%".$name_superend."%' OR fitter_name_tag LIKE '%".$name_supermid."%')";
//echo $match_sql;
$match_fetch = mysql_query($match_sql) OR die(mysql_error());
$i = false;
while ($match_row = mysql_fetch_array($match_fetch)) {
similar_text($match_row['fitter_name'], $_POST['name'], $percent);
if ($percent >= 50) {
if ($i == false) {
echo ("<span class=\"error\">Duplicate Alert:</span>");
}
echo ("<a href=\"".$site_url."/individual.php?fitter_id=".$match_row['fitter_id']."\">".$match_row['fitter_name']." (".$match_row['fitter_city'].", ".$match_row['fitter_state'].")</a> (Similarity: ".(round($percent, 0))."%)");
$i = true;
}
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Address </div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[address])); ?></div>
</div>
<div class="drow">
<div class="dcell name">Address 2</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[address_two])); ?></div>
</div>
<div class="drow">
<div class="dcell name">City</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[city])); ?></div>
</div>
<div class="drow">
<div class="dcell name">State</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[state])); ?></div>
</div>
<div class="drow">
<div class="dcell name">Zip</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[zip])); ?></div>
</div>
<div class="drow">
<div class="dcell name">Lat/Lng</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
if ($geocode_error == false) {
$latlng_string = "".$_POST[lat].", ".$_POST[lng]."";
echo (stripslashes(htmlspecialchars($latlng_string)));
} else {
echo ($geocode_message);
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Phone</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[phone])); ?></div>
</div>
<div class="drow">
<div class="dcell name">Fax</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[fax])); ?></div>
</div>
<div class="drow">
<div class="dcell name">E-mail</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[email])); ?></div>
</div>
<div class="drow">
<div class="dcell name">Website</div>
<div class="dcell divider"></div>
<div class="dcell value"><a href="<? echo $_POST[website]; ?>" target="_blank"><? echo $_POST[website]; ?></a></div>
</div>
<div class="drow">
<div class="dcell name">Portfolio</div>
<div class="dcell divider"></div>
<div class="dcell value"><a href="<? echo $_POST[portfolio]; ?>" target="_blank"><? echo $_POST[portfolio]; ?></a></div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
for ($i = 0; $i < 25; $i++) echo("*");
echo (" FIT INFO ");
for ($i = 0; $i < 25; $i++) echo("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Default Tri-Fit Methodology</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$sql = ("SELECT * FROM ".$prefix."FittersMethods WHERE fitter_method_id = ".$_POST[methods]." LIMIT 1");
$results = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($results) > 0) {
while ($row = mysql_fetch_array($results)) {
echo ("$row[fitter_method_name]");
}
} else {
echo ("Unanswered");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Certifications</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
if ($_POST[certifications]) {
$explosion = implode(",", $_POST[certifications]);
$sql = ("SELECT * FROM ".$prefix."FittersCertifications WHERE fitter_certification_id IN ($explosion) ORDER BY fitter_certification_name ASC");
//echo $sql;
$results = mysql_query($sql) or die(mysql_error());
$certification_list = "";
while ($row = mysql_fetch_array($results)) {
$certification_list = $certification_list."$row[fitter_certification_name], ";
}
$certification_list = rtrim($certification_list, ', ');
if ($certification_list == "") { echo "None"; } else { echo $certification_list; }
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Fit Bikes</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
if ($_POST[fitbikes]) {
$explosion = implode(",", $_POST[fitbikes]);
$sql = ("SELECT * FROM ".$prefix."FittersFitbikes WHERE fitter_fitbike_id IN ($explosion) ORDER BY fitter_fitbike_name ASC");
//echo $sql;
$results = mysql_query($sql) or die(mysql_error());
$fitbike_list = "";
while ($row = mysql_fetch_array($results)) {
$fitbike_list = $fitbike_list."$row[fitter_fitbike_name], ";
}
$fitbike_list = rtrim($fitbike_list, ', ');
if ($fitbike_list == "") { echo "None"; } else { echo $fitbike_list; }
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Motion-Capture Systems</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
if ($_POST[motioncapture]) {
$explosion = implode(",", $_POST[motioncapture]);
$sql = ("SELECT * FROM ".$prefix."FittersMotioncapture WHERE fitter_motioncapture_id IN ($explosion) ORDER BY fitter_motioncapture_name ASC");
$results = mysql_query($sql) or die(mysql_error());
$motioncapture_list = "";
while ($row = mysql_fetch_array($results)) {
$motioncapture_list = $motioncapture_list."$row[fitter_motioncapture_name], ";
}
$motioncapture_list = rtrim($motioncapture_list, ', ');
if ($motioncapture_list == "") { echo "None"; } else { echo $motioncapture_list; }
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Brand Friendly</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
if ($_POST[brandfriendly]) {
$explosion = implode(",", $_POST[brandfriendly]);
$sql = ("SELECT * FROM ".$prefix."FittersBrandFriendly WHERE fitter_brand_id IN ($explosion) ORDER BY fitter_brand_name ASC");
//echo $sql;
$fetch = mysql_query($sql) or die(mysql_error());
$brandfriendly_list = "";
while ($list = mysql_fetch_array($fetch)) {
$brandfriendly_list = $brandfriendly_list."$list[fitter_brand_name], ";
}
$brandfriendly_list = rtrim($brandfriendly_list, ', ');
echo $brandfriendly_list;
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Cost of Fit</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[cost])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">General Info</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[info])) ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Directions</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[directions])); ?>
</div>
</div>
<div class="drow actions">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<form action="add.php" method="post">
<input type="hidden" name="name" value="<? echo stripslashes(htmlspecialchars($_POST[name])); ?>">
<input type="hidden" name="address" value="<? echo stripslashes(htmlspecialchars($_POST[address])); ?>">
<input type="hidden" name="address_two" value="<? echo stripslashes(htmlspecialchars($_POST[address_two])); ?>">
<input type="hidden" name="city" value="<? echo stripslashes(htmlspecialchars($_POST[city])); ?>">
<input type="hidden" name="state" value="<? echo $_POST[state]; ?>">
<input type="hidden" name="zip" value="<? echo $_POST[zip]; ?>">
<input type="hidden" name="latlng_override" value="<? echo $_POST[latlng_override]; ?>">
<input type="hidden" name="lat" value="<? echo $_POST[lat]; ?>">
<input type="hidden" name="lng" value="<? echo $_POST[lng]; ?>">
<input type="hidden" name="phone" value="<? echo $_POST[phone]; ?>">
<input type="hidden" name="fax" value="<? echo $_POST[fax]; ?>">
<input type="hidden" name="email" value="<? echo $_POST[email]; ?>">
<input type="hidden" name="website" value="<? echo $_POST[website]; ?>">
<input type="hidden" name="portfolio" value="<? echo $_POST[portfolio]; ?>">
<input type="hidden" name="methods" value="<? echo $_POST[methods]; ?>">
<input type="hidden" name="certifications" value="<? echo(implode(',', $_POST[certifications])); ?>">
<input type="hidden" name="fitbikes" value="<? echo(implode(',', $_POST[fitbikes])); ?>">
<input type="hidden" name="motioncapture" value="<? echo(implode(',', $_POST[motioncapture])); ?>">
<input type="hidden" name="brandfriendly" value="<? echo(implode(',', $_POST[brandfriendly])); ?>">
<input type="hidden" name="cost" value="<? echo stripslashes(htmlspecialchars($_POST[cost])); ?>">
<input type="hidden" name="info" value="<? echo stripslashes(htmlspecialchars($_POST[info])); ?>">
<input type="hidden" name="directions" value="<? echo stripslashes(htmlspecialchars($_POST[directions])); ?>">
<input type="hidden" name="add_fitter" value="true">
<input type="hidden" name="insert_fitter" value="true">
<input type="hidden" name="submitted_by" value="<? echo $useruid; ?>" >
<input type="submit" name="submit" value="Submit Info" class="btn float-left" style="margin-right: 5px;"/>
</form>
<form action="add.php" method="post">
<input type="hidden" name="name" value="<? echo stripslashes(htmlspecialchars($_POST[name])); ?>">
<input type="hidden" name="address" value="<? echo stripslashes(htmlspecialchars($_POST[address])); ?>">
<input type="hidden" name="address_two" value="<? echo stripslashes(htmlspecialchars($_POST[address_two])); ?>">
<input type="hidden" name="city" value="<? echo stripslashes(htmlspecialchars($_POST[city])); ?>">
<input type="hidden" name="state" value="<? echo $_POST[state]; ?>">
<input type="hidden" name="zip" value="<? echo $_POST[zip]; ?>">
<input type="hidden" name="latlng_override" value="<? echo $_POST[latlng_override]; ?>">
<input type="hidden" name="lat" value="<? echo $_POST[lat]; ?>">
<input type="hidden" name="lng" value="<? echo $_POST[lng]; ?>">
<input type="hidden" name="phone" value="<? echo $_POST[phone]; ?>">
<input type="hidden" name="fax" value="<? echo $_POST[fax]; ?>">
<input type="hidden" name="email" value="<? echo $_POST[email]; ?>">
<input type="hidden" name="website" value="<? echo $_POST[website]; ?>">
<input type="hidden" name="portfolio" value="<? echo $_POST[portfolio]; ?>">
<input type="hidden" name="methods" value="<? echo $_POST[methods]; ?>">
<input type="hidden" name="certifications" value="<? echo(implode(',', $_POST[certifications])); ?>">
<input type="hidden" name="fitbikes" value="<? echo(implode(',', $_POST[fitbikes])); ?>">
<input type="hidden" name="motioncapture" value="<? echo(implode(',', $_POST[motioncapture])); ?>">
<input type="hidden" name="brandfriendly" value="<? echo(implode(',', $_POST[brandfriendly])); ?>">
<input type="hidden" name="cost" value="<? echo stripslashes(htmlspecialchars($_POST[cost])); ?>">
<input type="hidden" name="info" value="<? echo stripslashes(htmlspecialchars($_POST[info])); ?>">
<input type="hidden" name="directions" value="<? echo stripslashes(htmlspecialchars($_POST[directions])); ?>">
<input type="hidden" name="confirm_fitter" value="0">
<input type="submit" name="submit" value="Edit Information" class="btn float-left" />
</form>
</div>
</div>
</div>

View File

@ -0,0 +1,12 @@
<div class="breadcrumb">
<a href="<? echo $main_site_url ?>">Home</a> &gt;
<a href="<? echo $main_site_url . "/local/" ?>">Local Listings</a> &gt;
<? if ( $regionname or $statename or $row[fitter_name] ) { ?>
<a href="<? echo $site_url ?>">Fitters Database</a>
<? } else { ?>
<span class="lasttitle">Fitters Database</span>
<? } ?>
<? if ( $regionname ) { echo "&gt; " . $regionname; } ?>
<? if ( $statename ) { echo "&gt; " . $statename . " State"; } ?>
<? if ($row[fitter_name]) { echo "&gt; " . $row[fitter_name]; } ?>
</div>

View File

@ -0,0 +1,107 @@
<?PHP
if(is_logged_in($user)){
$tagtext = "I got fit here";
$actionlink = "individual.php?fitter_id=$row[fitter_id]&".get_sid();
}else{
$tagtext = "Log in to tag this fitter";
$actionlink = "$forum_url/forum/?do=login&from=fitters";
$tagstatus = "no";
}
if(is_logged_in($user)){
//Get user's uid
//$testresults = mysql_query("SELECT user_id FROM ".$prefix."User WHERE user_username=\"$username\"") or die(mysql_error());
//$testrow = mysql_fetch_array($testresults);
//$useruid = $testrow[user_id];
$useruid = base64_decode($_SESSION['user_id']);
// is the current user the owner of the fitter?
$fitter_submitted_by = FALSE;
if($useruid == $row[fitter_submitted_by]){
$fitter_submitted_by = TRUE;
}
$tagresults = mysql_query("SELECT fitter_user_tags FROM ".$prefix."Fitters WHERE fitter_id=$row[fitter_id]");
$tagrow = mysql_fetch_array($tagresults);
$tags = explode(",", $tagrow[fitter_user_tags]);
$profileresults = mysql_query("SELECT user_fittertags FROM ".$prefix."User WHERE user_id='$useruid'") or die(mysql_error());
$profilerow = mysql_fetch_array($profileresults);
$profiletags = explode(",", $profilerow[user_fittertags]);
if($_POST[status] == "tag"){
//tag the fitter
if(array_search($useruid, $tags) == FALSE){
array_push($tags, $useruid);
}
$tags = implode(",", $tags);
mysql_query("UPDATE ".$prefix."Fitters SET fitter_user_tags='$tags' WHERE fitter_id=$row[fitter_id]") or die(mysql_error());
$tags = explode(",", $tags);
if(array_search($row[fitter_id], $profiletags) == FALSE){
array_push($profiletags, $row[fitter_id]);
}
$profiletags = implode(",", $profiletags);
mysql_query("UPDATE ".$prefix."User SET user_fittertags='$profiletags' WHERE user_id='$useruid'") or die(mysql_error());
}else if($_POST[status] == "untag"){
//untag the fitter
$key = array_search($useruid, $tags);
unset($tags[$key]);
$tags = implode(",", $tags);
mysql_query("UPDATE ".$prefix."Fitters SET fitter_user_tags='$tags' WHERE fitter_id=$row[fitter_id]") or die(mysql_error());
$tags = explode(",", $tags);
$key = array_search($row[fitter_id], $profiletags);
unset($profiletags[$key]);
$profiletags = implode(",", $profiletags);
mysql_query("UPDATE ".$prefix."User SET user_fittertags='$profiletags' WHERE user_id=$useruid");
}
//Is the fitter tagged already?
if(array_search($useruid, $tags) !== FALSE){ $wasfit = TRUE; }else{ $wasfit = FALSE; }
if($wasfit){ $tagstatus = "untag"; $tagtext = "Untag this fitter";}else{ $tagstatus = "tag"; $tagtext = "I was fit";}
}
?>
<form action="<? echo $actionlink; ?>" method="post" style="display: inline;">
<input type="hidden" value="<? echo $tagstatus; ?>" name="status" />
<? if (is_logged_in($user)) { ?>
<input type="submit" value="<? echo $tagtext; ?>" class="btn" />
<? } else { ?>
<a href="<? echo $actionlink ?>" class="btn"><? echo $tagtext; ?></a>
<? } ?>
</form>
<form method="post" action="<? echo "individual.php?fitter_id=$row[fitter_id]#wasfit"; ?>" style="display: inline;">
<input type="submit" value="Who was fit?" class="btn" />
</form>
<? if(is_logged_in($user)){ ?>
<form method="post" action="<? echo "individual.php?fitter_id=$row[fitter_id]#comment"; ?>" style="display: inline;">
<input type="submit" value="Comment on this fitter" class="btn" />
</form>
<form method="post" action="<? echo "wiki_edit.php?fitter_id=$row[fitter_id]"; ?>" style="display: inline;">
<input type="submit" value="Edit this fitter (wiki)" class="btn" />
</form>
<?
if(is_admin($user)) {
?>
<form method="post" action="delete_X.php" style="display: inline;">
<input type="hidden" name="fitter_id" value="<? echo($row[fitter_id]); ?>" />
<input type="submit" value="Delete this fitter" class="btn" onclick="return confirm('Are you sure you want to DELETE this fitter?');" />
</form>
<?
//Get user's username
$testresults = mysql_query("SELECT user_username FROM ".$prefix."User WHERE user_id='$row[fitter_submitted_by]'") or die(mysql_error());
$testrow = mysql_fetch_array($testresults);
$username = $testrow[user_username];
echo("<br /><br /><strong>Entered By: </strong> <a href='http://forum.slowtwitch.com/gforum.cgi?username=$username;'>$username</a>");
}
}
?>

View File

@ -0,0 +1,40 @@
<body id="home" <? if (eregi("index.php", $_SERVER['SCRIPT_NAME'])) { echo ("onload='initializeFitterMap()'"); } ?>>
<? include("/var/home/slowtwitch/slowtwitch.com/www/db_templates/fb_sdk.html"); ?>
<div id="accessibility"><a href="#content">Skip to Content</a></div>
<hr class="hide" />
<div id="wrapper">
<div id="header">
<div id="ad_728x90"><!-- BEGIN ADVERTPRO CODE BLOCK -->
<? include "/var/home/slowtwitch/slowtwitch.com/www/db_templates/ad_728x90.html"; ?>
<!-- END ADVERTPRO CODE BLOCK --></div>
<div id="logo"><h1><a href="http://www.slowtwitch.com">&lt;:: Welcome to Slowtwitch.com ::&gt;</a></h1></div>
</div>
<? include "/var/home/slowtwitch/slowtwitch.com/www/db_templates/common_nav.html"; ?>
<hr class="hide" />
<div id="ocwrapper" class="clear">
<div id="icwrapper" class="clear">
<div id="leftsidebar">
<?
include("include_status.php");
?>
<?
include("include_navigation.php");
?>
</div>
<div id="contentwrapper" class="shadowleft">
<div class="shadowtop"><div class="shadowtopleft"></div><div class="shadowtopright"></div></div>
<div class="shadowright">
<div id="content">
<div class="clear"></div>

View File

@ -0,0 +1 @@
<? include("/var/home/slowtwitch/slowtwitch.com/www/db_templates/include_common_footer.php"); ?>

View File

@ -0,0 +1,24 @@
<?
if (eregi("include_common_head.php", $_SERVER['SCRIPT_NAME'])) {
Header("Location: index.php"); die();
}
?>
<!DOCTYPE html >
<html lang="en">
<head>
<base href="<? echo $site_url ?>/" />
<title>Slowtwitch.com Fitter Database: <? echo $pagetitle; ?></title>
<? include($common_path . "/templates/include_global_head.php"); ?>
<? include($common_path . "/templates/google_analytics.html"); ?>
<? include($common_path . "/templates/fb_sdk.html"); ?>
<!-- begin script to create random number for ads -->
<script language="Javascript">
<!--
sgi_ord=Math.random()*10000000000000000;
//-->
</script>
<!-- End random number script -->
</head>

View File

@ -0,0 +1,306 @@
<p>Please confirm your information. If everything is correct, click the submit button. Otherwise, you may click the edit button to change your information before submitting.</p>
<div class="dtable form">
<div class="drow">
<div class="dcell name">Store Name</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes($_POST[fitter_name]); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Address </div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[fitter_address])); ?></div>
</div>
<div class="drow">
<div class="dcell name">Address 2</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[fitter_address_two])); ?></div>
</div>
<div class="drow">
<div class="dcell name">City</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[fitter_city])); ?></div>
</div>
<div class="drow">
<div class="dcell name">State</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[fitter_state])); ?></div>
</div>
<div class="drow">
<div class="dcell name">Zip</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[fitter_zip])); ?></div>
</div>
<div class="drow">
<div class="dcell name">Lat/Lng</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
if ($geocode_error == false) {
$latlng_string = "".$_POST[fitter_lat].", ".$_POST[fitter_lng]."";
echo (stripslashes(htmlspecialchars($latlng_string)));
} else {
echo ($geocode_message);
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Phone</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[fitter_phone])); ?></div>
</div>
<div class="drow">
<div class="dcell name">Fax</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[fitter_fax])); ?></div>
</div>
<div class="drow">
<div class="dcell name">E-mail</div>
<div class="dcell divider"></div>
<div class="dcell value"><? echo stripslashes(htmlspecialchars($_POST[fitter_email])); ?></div>
</div>
<div class="drow">
<div class="dcell name">Website</div>
<div class="dcell divider"></div>
<div class="dcell value"><a href="<? echo $_POST[fitter_website]; ?>" target="_blank"><? echo $_POST[fitter_website]; ?></a></div>
</div>
<div class="drow">
<div class="dcell name">Portfolio</div>
<div class="dcell divider"></div>
<div class="dcell value"><a href="<? echo $_POST[fitter_portfolio]; ?>" target="_blank"><? echo $_POST[fitter_portfolio]; ?></a></div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
for ($i = 0; $i < 25; $i++) echo("*");
echo (" FIT INFO ");
for ($i = 0; $i < 25; $i++) echo("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Default Tri-Fit Methodology</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$sql = ("SELECT * FROM ".$prefix."FittersMethods WHERE fitter_method_id = ".$_POST[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");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Certifications</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
if ($_POST[fitter_certifications]) {
$explosion = implode(",", $_POST[fitter_certifications]);
$sql = ("SELECT * FROM ".$prefix."FittersCertifications WHERE fitter_certification_id IN ($explosion) 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, ', ');
echo $certification_list;
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Fit Bikes</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
if ($_POST[fitter_fitbikes]) {
$explosion = implode(",", $_POST[fitter_fitbikes]);
$sql = ("SELECT * FROM ".$prefix."FittersFitbikes WHERE fitter_fitbike_id IN ($explosion) 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, ', ');
echo $fitbike_list;
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Motion-Capture Systems</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
if ($_POST[fitter_motioncapture]) {
$explosion = implode(",", $_POST[fitter_motioncapture]);
$sql = ("SELECT * FROM ".$prefix."FittersMotioncapture WHERE fitter_motioncapture_id IN ($explosion) 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, ', ');
echo $motioncapture_list;
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Brand Friendly</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
if ($_POST[fitter_brandfriendly]) {
$explosion = implode(",", $_POST[fitter_brandfriendly]);
$sql = ("SELECT * FROM ".$prefix."FittersBrandFriendly WHERE fitter_brand_id IN ($explosion) ORDER BY fitter_brand_name ASC");
//echo $sql;
$fetch = mysql_query($sql) or die(mysql_error());
$brandfriendly_list = "";
while ($list = mysql_fetch_array($fetch)) {
$brandfriendly_list = $brandfriendly_list."$list[fitter_brand_name], ";
}
$brandfriendly_list = rtrim($brandfriendly_list, ', ');
echo $brandfriendly_list;
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Cost of Fit</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[fitter_cost])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">General Info</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[fitter_info])) ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Directions</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[fitter_directions])); ?>
</div>
</div>
<div class="drow actions">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<form action="wiki_edit.php" method="post">
<input type="hidden" name="fitter_name" value="<? echo stripslashes(htmlspecialchars($_POST[fitter_name])); ?>">
<input type="hidden" name="fitter_address" value="<? echo stripslashes(htmlspecialchars($_POST[fitter_address])); ?>">
<input type="hidden" name="fitter_address_two" value="<? echo stripslashes(htmlspecialchars($_POST[fitter_address_two])); ?>">
<input type="hidden" name="fitter_city" value="<? echo stripslashes(htmlspecialchars($_POST[fitter_city])); ?>">
<input type="hidden" name="fitter_state" value="<? echo $_POST[fitter_state]; ?>">
<input type="hidden" name="fitter_zip" value="<? echo $_POST[fitter_zip]; ?>">
<input type="hidden" name="latlng_override" value="<? echo $_POST[latlng_override]; ?>">
<input type="hidden" name="fitter_lat" value="<? echo $_POST[fitter_lat]; ?>">
<input type="hidden" name="fitter_lng" value="<? echo $_POST[fitter_lng]; ?>">
<input type="hidden" name="fitter_phone" value="<? echo $_POST[fitter_phone]; ?>">
<input type="hidden" name="fitter_fax" value="<? echo $_POST[fitter_fax]; ?>">
<input type="hidden" name="fitter_email" value="<? echo $_POST[fitter_email]; ?>">
<input type="hidden" name="fitter_website" value="<? echo $_POST[fitter_website]; ?>">
<input type="hidden" name="fitter_portfolio" value="<? echo $_POST[fitter_portfolio]; ?>">
<input type="hidden" name="fitter_method" value="<? echo $_POST[fitter_method]; ?>">
<input type="hidden" name="fitter_certifications" value="<? echo(implode(',', $_POST[fitter_certifications])); ?>">
<input type="hidden" name="fitter_fitbikes" value="<? echo(implode(',', $_POST[fitter_fitbikes])); ?>">
<input type="hidden" name="fitter_motioncapture" value="<? echo(implode(',', $_POST[fitter_motioncapture])); ?>">
<input type="hidden" name="fitter_brandfriendly" value="<? echo(implode(',', $_POST[fitter_brandfriendly])); ?>">
<input type="hidden" name="fitter_cost" value="<? echo stripslashes(htmlspecialchars($_POST[fitter_cost])); ?>">
<input type="hidden" name="fitter_info" value="<? echo stripslashes(htmlspecialchars($_POST[fitter_info])); ?>">
<input type="hidden" name="fitter_directions" value="<? echo stripslashes(htmlspecialchars($_POST[fitter_directions])); ?>">
<? // need to temporary set the field as being valid ?>
<input type="hidden" name="fitter_valid" value="1">
<input type="hidden" name="edit_fitter" value="true">
<input type="hidden" name="insert_fitter" value="true">
<input type="hidden" name="fitter_submitted_by" value="<? echo $useruid; ?>" >
<? if(isset($_POST[new_fitter])){ ?>
This data will be saved as a NEW FITTER.
<input type="hidden" name="new_fitter" value="1" />
<input type="hidden" name="fitter_submitted_by" value="<? echo($_POST[edited_by]); ?>" />
<? } else { ?>
This data will be saved as a modification to the EXISTING FITTER.
<input type="hidden" name="save_changes" value="1" />
<input type="hidden" name="edited_by" value="<? echo($_POST[edited_by]); ?>">
<input type="hidden" name="fitter_submitted_by" value="<? echo($_POST[fitter_submitted_by]); ?>" />
<input type="hidden" name="fitter_id" value="<? echo($_POST[fitter_id]); ?>" />
<? } ?>
<input type="submit" name="fitter_submit" value="Submit Info" class="btn float-left" style="margin-right: 5px" />
</form>
<form action="wiki_edit.php" method="post">
<input type="hidden" name="fitter_name" value="<? echo stripslashes(htmlspecialchars($_POST[fitter_name])); ?>">
<input type="hidden" name="fitter_address" value="<? echo stripslashes(htmlspecialchars($_POST[fitter_address])); ?>">
<input type="hidden" name="fitter_address_two" value="<? echo stripslashes(htmlspecialchars($_POST[fitter_address_two])); ?>">
<input type="hidden" name="fitter_city" value="<? echo stripslashes(htmlspecialchars($_POST[fitter_city])); ?>">
<input type="hidden" name="fitter_state" value="<? echo $_POST[fitter_state]; ?>">
<input type="hidden" name="fitter_zip" value="<? echo $_POST[fitter_zip]; ?>">
<input type="hidden" name="latlng_override" value="<? echo $_POST[latlng_override]; ?>">
<input type="hidden" name="fitter_lat" value="<? echo $_POST[fitter_lat]; ?>">
<input type="hidden" name="fitter_lng" value="<? echo $_POST[fitter_lng]; ?>">
<input type="hidden" name="fitter_phone" value="<? echo $_POST[fitter_phone]; ?>">
<input type="hidden" name="fitter_fax" value="<? echo $_POST[fitter_fax]; ?>">
<input type="hidden" name="fitter_email" value="<? echo $_POST[fitter_email]; ?>">
<input type="hidden" name="fitter_website" value="<? echo $_POST[fitter_website]; ?>">
<input type="hidden" name="fitter_portfolio" value="<? echo $_POST[fitter_portfolio]; ?>">
<input type="hidden" name="fitter_method" value="<? echo $_POST[fitter_method]; ?>">
<input type="hidden" name="fitter_certifications" value="<? echo(implode(',', $_POST[fitter_certifications])); ?>">
<input type="hidden" name="fitter_fitbikes" value="<? echo(implode(',', $_POST[fitter_fitbikes])); ?>">
<input type="hidden" name="fitter_motioncapture" value="<? echo(implode(',', $_POST[fitter_motioncapture])); ?>">
<input type="hidden" name="fitter_brandfriendly" value="<? echo(implode(',', $_POST[fitter_brandfriendly])); ?>">
<input type="hidden" name="fitter_cost" value="<? echo stripslashes(htmlspecialchars($_POST[fitter_cost])); ?>">
<input type="hidden" name="fitter_info" value="<? echo stripslashes(htmlspecialchars($_POST[fitter_info])); ?>">
<input type="hidden" name="fitter_directions" value="<? echo stripslashes(htmlspecialchars($_POST[fitter_directions])); ?>">
<input type="hidden" name="confirm_fitter" value="0">
<input type="hidden" name="edit_return" value="true">
<? // need to temporary set the field as being valid ?>
<input type="hidden" name="fitter_valid" value="1">
<input type="hidden" name="fitter_id" value="<? echo($_POST[fitter_id]); ?>" />
<input type="hidden" name="fitter_submitted_by" value="<? echo $submitted_by; ?>">
<input type="submit" name="submit" value="Edit Information" class="btn" />
</form>
</div>
</div>
</div>

View File

@ -0,0 +1,73 @@
<?PHP
$outsideflag = "Africa";
$sqlregionlist = "SELECT gtr.regionlong AS regionlong, gtr.regionid AS regionid, gtr.regionname AS regionname, gts.statetag AS statetag, gts.statelong AS statelong, COUNT(gf.fitter_id) AS numclubs
FROM ".$prefix."FittersStates AS gts
LEFT JOIN ".$prefix."Fitters AS gf
ON gts.statetag = gf.fitter_state_tag AND gf.fitter_valid = 1
LEFT JOIN ".$prefix."FittersRegions AS gtr
ON gts.regionid = gtr.regionid
GROUP BY gtr.regionlong, gts.statetag ORDER BY gtr.regionoutsideusa ASC, regionlong ASC";
//echo $sqlregionlist;
$resultregionlist = mysql_query($sqlregionlist);
?>
<div class="widget">
<h2>Browse Fitters</h2>
<div class="region-list">
<?
$currentregion = '';
$regioncount = '';
$tempstring = '';
$currenttag = '';
$showhide = '';
$region_dropdown = '';
$state_string = '';
while($rowregionlist = mysql_fetch_array($resultregionlist)){
$selected_region = '';
$selected_state = '';
if ($currentregion != $rowregionlist[regionlong]) {
if ($selected_item == $currentrid) {
$selected_region = ' selected="seleted"';
}
if ($currentregion != '') {
if ($currentregion == $outsideflag) { echo ("<br /><strong>Outside N. America</strong><br />"); }
$region_dropdown .= "<option value=\"$site_url/regionlist.php?region=$currentrid\"$selected_region>$currentregion ($regioncount)</option>$state_string";
echo ("<div class='list-item'><a href='$site_url/regionlist.php?region=$currentrid'>" . $currentregion . " (" . $regioncount . ")</a><span>+</span><div class='sublist' id='". $currenttag . "'>");
echo $tempstring;
echo ("</div></div>\n");
}
$currentregion = $rowregionlist[regionlong];
$currentrid = $rowregionlist[regionid];
$currenttag = $rowregionlist[regionname];
$regioncount = 0;
$tempstring = '';
$state_string = '';
}
if ($selected_item == $rowregionlist[statetag]) {
$selected_state = ' selected="selected"';
}
$state_string .= "<option value=\"$site_url/statelist.php?state=$rowregionlist[statetag]\"$selected_state>&nbsp;&nbsp;&nbsp;$rowregionlist[statelong] ($rowregionlist[numclubs])</option>";
$tempstring = $tempstring. "<a href='$site_url/statelist.php?state=$rowregionlist[statetag]".get_sid()."' class='lhdr' title='$rowregionlist[statelong]'>$rowregionlist[statelong] ($rowregionlist[numclubs])</a>\n";
$regioncount += $rowregionlist[numclubs];
}
echo ("<div class='list-item'><a href='$site_url/regionlist.php?region=$currentrid'>".$currentregion." (".$regioncount.")</a><span>+</span><div class='sublist' id='".$currenttag."'>");
echo $tempstring;
echo ('</div></div>');
if ( $selected_item == 'top') { $selected_region = ' selected="selected"'; }
$region_dropdown .= "<option value=\"" . $site_url . '/top.php' . "\"$selected_region>Top Ranked</option>";
?>
<div class="advsearch">
<a href="<? echo $site_url . '/search.php' ?>">Search Fitters</a> <span class="sprite-magnify">&nbsp;</span>
</div>
</div>
</div>

View File

@ -0,0 +1,17 @@
<div class="social-networks">
<a href="http://twitter.com/share" class="twitter-share-button" data-text="<? echo($pagetitle); ?>" data-count="vertical" data-via="slowtwitch">Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<div class="fb-like" data-href="<? echo(curPageURL()); ?>" data-send="false" data-layout="button_count" data-show-faces="false" data-font="verdana" data-action="like" data-share="false"></div>
<!-- Place this tag where you want the +1 button to render -->
<g:plusone></g:plusone>
<!-- Place this render call where appropriate -->
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
</div>

View File

@ -0,0 +1,14 @@
<?
$selected_local = 'fitters';
include($common_path . "/templates/include_local_listing.php");
?>
<div class="widget-divider"></div>
<? include("include_status.php"); ?>
<? include("include_navigation.php"); ?>
<div class="widget-divider"></div>
<div class="advert hide-on-mobile">
<? include($common_path . "/ads/ad_300x600.html"); ?>
</div>

View File

@ -0,0 +1,13 @@
<?PHP ?>
<?
if(is_admin()){
echo("<br /><br /><strong style=\"text-decoration: underline;\">Admin:</strong>");
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table." WHERE ".$field_lead."valid = 0"));
echo("<br /><a href='validate.php'><strong>Validate Entries (".$unvalid_count.")</strong></a>");
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table."Edits"));
echo("<br /><a href='wiki_validate.php'><strong>Validate Edits (".$unvalid_count.")</strong></a>");
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table."Comment WHERE comment_valid = 0"));
echo("<br /><a href='comments_validate.php'><strong>Validate Comments (".$unvalid_count.")</strong></a>");
}
?>

View File

@ -0,0 +1,23 @@
<div class="list-block grid">
<div class="col-1-1 clearfix">
<h3 class="float-left"><a href="<? echo "individual.php?fitter_id=$row[fitter_id]"; ?>"><? echo $row[fitter_name]; ?></a></h3>
</div>
<? if ($rating_text) { ?>
<p>(Avg. rating <? echo($row[score]); ?> based on <? echo(int_to_words($row[respondents])); if($row[respondents] == 1) { echo(" respondent"); } else { echo(" respondents"); } ?>)</p>
<? } ?>
<div class="col-1-2">
<?
echo ("$row[fitter_address]");
if ($row[fitter_address_two]) { echo ("<br />$row[fitter_address_two]"); }
echo("<br />$row[fitter_city], $row[fitter_state] $row[fitter_zip]");
?>
<br />Phone: <? echo $row[fitter_phone] ?>
<br />Fax: <? echo $row[fitter_fax] ?>
</div>
<div class="col-1-2">
Email: <? echo "<a href='mailto:$row[fitter_email]'>$row[fitter_email]</a>"; ?><br/>
Website: <? echo "<a href='$row[fitter_website]' target='_blank'>$row[fitter_website]</a>"; ?><br/>
<? if ($row[fitter_cart] == 1) { echo ("**eCommerce Shopping Cart**<br />"); } ?>
<a href="<? echo "individual.php?fitter_id=$row[fitter_id]"; ?>">More info &gt;</a>
</div>
</div>

136
site/fitters/index.php Normal file
View File

@ -0,0 +1,136 @@
<?PHP include("config.php");
// set the page title
$pagetitle = "Bike Fitters";
// set meta tags
$meta_keywords = "triathlon, trifind, duathlon";
$meta_description = "Are you trying to find bike fitters in near your area? You can browse all bike fitters organized by states, to find which ones you want to use.";
?>
<? 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">
<h1 class="float-left">Fitters</h1>
<? if (is_logged_in($user)) { ?>
<a href="<? echo $site_url . '/add.php' ?>" class="btn btn-white float-right">Add Fitter</a>
<? } ?>
<hr class="line" />
<? include("../runshops/include_region_list.php"); ?>
<div class="map-container">
<div id="map" class="map" data-name="fitter" data-json="<? echo $main_site_url ?>/googlemaps/json/fitter.json"></div><!--xml relative path from js folder -->
</div>
<?
$num = mysql_num_rows(mysql_query("SELECT fitter_id FROM ".$prefix."Fitters WHERE fitter_valid=1"));
?>
<h3>Welcome to Slowtwitch.com's North American Bike Fitter Database</h3>
<p><? echo($num) ?> fitters and counting. This collection of fitters is the most complete and comprehensive
selection of bike fitters in North America.</p>
<h3>F.I.S.T. equipped fitters</h3>
<p class="detail_text article">
<img src='http://www.slowtwitch.com/fitters/images/fist_equipped.gif' />Fitters who have attended a F.I.S.T. tribike fit workshop <strong>*AND*</strong> who have what we consider to be a F.I.S.T.-compatible fitbike (Purely Custom, EXIT Cycling, Retul, Rob King, or Guru DFU) have a special icon to designate what we consider to be a particularly important confluence of skills and tools. You will see this icon prominently displayed on the regional, state, and top fitter lists, on your advanced search results, and also on the fitter's individual page. Look for this icon if you want someone who has both the equipment and the training to execute a textbook F.I.S.T. fit.
</p>
<h3>Searching the database</h3>
<p>
Our Advanced Search is very potent, and will help you drill down to that set
of fitters conforming to a specific purpose you have in mind.
</p>
<h3>Browsing the database</h3>
<p>
You do not need to log in to do this. You'll find a list of fitters in
your region by clicking the regional links on the left. Click the (+) sign
and the region will expand to expose the individual states. Click on the
state to show that list of fitters in it. If you want to see fitters in
multiple states, but not those states we've aggregated into the regions you
see at left, you may do this via our Advanced Search.
</p>
<h3>Showing solidarity with your fitter</h3>
<p>
When you see your local fitter listed here, you may click the "I WAS FIT HERE" button. Your User Name will be added to the fitters's list of clients,
just like your User Name appends to those races you choose when you build
your Slowtwitch Personal Race Calendar. Likewise, your Forum User Profile
will show that this is your fitter of choice.
</p>
<div class="advert float-left">
<? include($common_path . "/ads/ad_300x250_roadblocks.html"); ?>
</div>
<h3>How to enter a fitter</h3>
<p>
You must be a registered user to add a fitter to the database. There is
one common type of registration on Slowtwitch, and if you are registered to
post on our Reader Forum you are one of
<?
$num_users = mysql_num_rows(mysql_query("SELECT user_id FROM ".$prefix."User WHERE 1=1"));
echo number_format($num_users);
?>
who have made a registration,
and this means you're able to add fitters to our database.
<br /><br />
If you're not registered, the login prompt is to the left of the page, near
the top. The registration process is straightforward, easy, and free. It
will require you to receive an email and click on a link to complete your
registration. All this should take you only a minute or two. Then...
<br /><br />
1. Click the ADD A FITTER button to begin adding to the database.
<br /><br />
2. Once you SUBMIT your fitter, you'll also need to CONFIRM your submission
via a link at the bottom of the page.
<br /><br />
3. Once you successfully add your fitter, it will not immediately be visible
to you. We must validate the addition on our end before anyone can see it.
We do this so that spammers won't use the fitter registration as a way to spam
our database.
</p>
<h3>How to edit published information about a fitter</h3>
<p>
Any registered user may edit information for a listing. We will review the full contents of each update before confirming any changes that are made. A list of all editors who have made changes is visible at the bottom of each listing. If an entry has been updated, but those changes have not yet been confirmed, this is evident via a note on the individual page for that particular entry. This is to prevent conflicting updates from occuring simultaneously. If you wish to update an entry with pending changes, please wait until we have had a chance to review those changes first. Someone may have already changed the information you were going to change yourself.
</p>
<h3>How to comment on a fitter</h3>
<p>
Any registered user may make a comment on a fitter listing. These comments are subject to validation by an administrator before being published.
</p>
<h3>Global fitter map</h3>
<p>
The map below shows the location of all registered Slowtwitch fitters around the globe. You can drag the map, zoom-in, zoom-out, and use any other of the standard Google Maps features. Anywhere you see a red icon, you can click to see the name of that fitter and a street address.
</p>
</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>

288
site/fitters/individual.php Normal file
View File

@ -0,0 +1,288 @@
<?PHP
include("config.php");
require_once("class/rating/classes/include.all.php");
$fitter_idhere = intval(mysql_escape_string($_GET[fitter_id]));
$results = mysql_query("SELECT * FROM ".$prefix."Fitters WHERE fitter_id='".$fitter_idhere."' LIMIT 1");
$row = mysql_fetch_array($results);
if (!$row){header('Location: '.$site_url.'/?error=invalid_id');}
if($row[fitter_valid] == 0) {
if(!is_admin($user)){
header('Location: '.$site_url);
exit();
}
}
// set the page title
$pagetitle = $row[fitter_name];
// set meta tags
$meta_keywords = "triathlon, ".$row[fitter_name].", ".$row[fitter_state]." bike fit";
$meta_description = "Considering getting fit by ".$row[fitter_name]."? Here is all of the information about this bike 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">
<? $selected_item = strtolower($row[fitter_state]); ?>
<? include("include_sidebar.php"); ?>
</div>
<div class="content content-has-widgets">
<div class="grid">
<div class="clearfix">
<h1 class="float-left">Fitters</h1>
<? if ($user) { ?>
<form method="post" action="wiki_edit.php?fitter_id=<? echo $row[fitter_id] ?>">
<input type="submit" value="Edit (wiki)" class="nobutton btn btn-white float-right">
</form>
<? } ?>
<a href="" class="btn btn-white float-right">Back</a>
<hr class="line" />
<? include("../runshops/include_region_list.php"); ?>
<div class="details grid">
<div class="col-9-12">
<h2><? echo stripslashes(stripslashes($row[fitter_name])) ; echo " "; ?></h2>
</div>
<div class="col-3-12 right">
<? if(is_logged_in($user)) { ?><a href="#comment">Comment</a><? }?>
</div>
<div class="clearfix"></div>
<div class="col-6-12 address">
<? echo stripslashes(htmlspecialchars($row[fitter_address])); ?><br />
<? if ( $row[fitter_address_two] ) { echo stripslashes(htmlspecialchars($row[fitter_address_two]) . "<br />"); } ?>
<? echo stripslashes(htmlspecialchars($row[fitter_city])); ?>, <? echo stripslashes(htmlspecialchars($row[fitter_state])); ?> <? echo stripslashes(htmlspecialchars($row[fitter_zip])); ?><br />
Phone: <? echo stripslashes(htmlspecialchars($row[fitter_phone])); ?><br />
Fax: <? echo stripslashes(htmlspecialchars($row[fitter_fax])); ?>
</div>
<div class="col-6-12 contact">
Email: <a href="mailto:<? echo $row[fitter_email]; ?>"><? echo stripslashes(htmlspecialchars($row[fitter_email])); ?></a><br />
<span class="briefy-b">Website: <a href="<? echo $row[fitter_website]; ?>" target="_blank"><? echo stripslashes(htmlspecialchars($row[fitter_website])); ?></a></span><br />
<span class="briefy-b">Portfolio: <a href="<? echo $row[fitter_portfolio]; ?>" target="_blank"><? echo stripslashes(htmlspecialchars($row[fitter_portfolio])); ?></a></span>
</div>
<div class="clearfix"></div>
<? if($_GET[review_add] == 'ok') { ?>
<p class="error"><strong>Commenter:</strong> your comments have been submitted and will be validated within 24 hours.</p>
<? } ?>
<? if($_GET[wiki_change] == 'success') { ?>
<p class="error"><strong>Editor:</strong> your changes have been submitted and will be validated within 24 hours.</p>
<? } ?>
<?
$wikiFetchSQL = "SELECT edit_id FROM ".$prefix."FittersEdits WHERE fitter_id_fk = '".intval(mysql_escape_string($_GET[fitter_id]))."'";
$boolEdits = mysql_num_rows(mysql_query($wikiFetchSQL));
if($boolEdits !== 0 && $_GET[wiki_change] != 'success') {
?>
<p class="error"><strong>Group Edits:</strong> there are group edits waiting to be validated.</p>
<? } ?>
<div class="col-1-1">
<? include("include_buttons.php"); ?>
<? include('include_share.php'); ?>
</div>
<div class="col-1-1 detail-block">
<h3>Fit Information</h3>
<div class="highlight-block">
<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>Brand-Friendly:</strong>
<?
$row[fitter_brandfriendly] = ltrim(rtrim($row[fitter_brandfriendly], ", "), ", ");
if ($row[fitter_brandfriendly]) {
$sql = ("SELECT * FROM gforum_FittersBrandFriendly WHERE fitter_brand_id IN ($row[fitter_brandfriendly]) ORDER BY fitter_brand_name ASC");
//echo $sql;
$fetch = mysql_query($sql) or die(mysql_error());
$brandfriendly_list = "";
while ($list = mysql_fetch_array($fetch)) {
$brandfriendly_list = $brandfriendly_list."$list[fitter_brand_name], ";
}
$brandfriendly_list = rtrim($brandfriendly_list, ', ');
}
if ($brandfriendly_list) {echo "This fitter has *verified* specific expertise in these brands - " . $brandfriendly_list;} else {echo "None";}
?><br />
<strong>Cost of Fit:</strong> <? echo stripslashes(htmlspecialchars($row[fitter_cost])); ?>
</div>
</div>
<div class="col-1-1 detail-block">
<h3>General Information</h3>
<div class="highlight-block">
<strong>General Information:</strong> <? echo stripslashes(stripslashes($row[fitter_info])) ?><br />
<strong>Directions:</strong> <? echo stripslashes(stripslashes($row[fitter_directions])) ?>
</div>
</div>
<div class="col-1-1">
<div id="map" class="map map-single" data-name="single" data-category="fitter" data-lat="<? echo $row[fitter_lat] ?>" data-lng="<? echo $row[fitter_lng] ?>">
</div>
<div class="map-description">
<small>
Map location is based off of a geocode of the addressed entered using Google's Google Maps API. If your address does not geocode properly, you can either update the address (we will attempt to re-geocode after any updates to your entry) <strong>or</strong> you can use Google's geocoding tool found here: <a href="http://gmaps-samples.googlecode.com/svn/trunk/geocoder/singlegeocode.html">http://gmaps-samples.googlecode.com/svn/trunk/geocoder/singlegeocode.html</a> to obtain a lat/long for your location and enter that. To use the utility, type in an address that is close to your location and then drag-and-drop the marker to obtain the desired lat/long. If you choose to enter a lat/long, you <strong>must</strong> check the box on the edit page that says, "override geocode with entered lat/long."
</small>
</div>
</div>
<div class="col-1-1 detail-block">
<h3>Who was fit?</h3>
<div class="highlight-block">
<a name="wasfit"></a>
<?
$testresults = mysql_query("SELECT fitter_user_tags FROM ".$prefix."Fitters WHERE fitter_id=$row[fitter_id]");
$testrow = mysql_fetch_array($testresults);
$tags = explode(",", $testrow[fitter_user_tags]);
$numcount = count($tags) - 1;
if($numcount == 0){ $phrase = "No users have tagged this fitter yet."; }
else if($numcount == 1){ $phrase = "There is 1 user who has tagged this fitter:"; }
else{ $phrase = "There are $numcount users who have tagged this fitter: "; }
?>
<? echo $phrase; ?>
<?
//List users
$i = 0;
foreach($tags as $value){
if($i > 0){
$tempresults = mysql_query("SELECT user_username FROM ".$prefix."User WHERE user_id='$value'") or die (mysql_error());
$temprow = mysql_fetch_array($tempresults);
if($i > 1){ echo ", "; }
// TODO: SLOWTWITCH EDIT
//echo "<a href=\"profiles/$temprow[user_username].html\">$temprow[user_username]</a>";
// replace the link above with the link below for integration into gforum
echo "<a href=\"http://forum.slowtwitch.com/gforum.cgi?username=$temprow[user_username]&session=".$_SESSION['session_id']."&from=fitters\">$temprow[user_username]</a>";
// TODO: SLOWTWITCH EDIT END
}
$i++;
}
?>
</div>
</div>
<div class="col-1-1 detail-block">
<a name="editors"></a>
<?
$testresults = mysql_query("SELECT * FROM ".$prefix."FittersEditors WHERE fitter_id_fk=$row[fitter_id] ORDER BY edit_timestamp DESC");
$numcount = mysql_num_rows($testresults);
if($numcount == 0){ $phrase = "No updates have been made this fitter yet."; }
else if($numcount == 1){ $phrase = "There has been 1 update to this fitter:"; }
else{ $phrase = "There have been $numcount updates to this fitter: "; }
?>
<h3><? echo $phrase; ?></h3>
<div class="highlight-block">
<?
$i = 0;
while($row=mysql_fetch_array($testresults)){
if($i >= 0){
$tempresults = mysql_query("SELECT user_username FROM ".$prefix."User WHERE user_id='$row[user_id_fk]'") or die (mysql_error());
$temprow = mysql_fetch_array($tempresults);
if($i >= 1){ echo "<br />"; }
// TODO: SLOWTWITCH EDIT
//echo "<a href=\"profiles/$temprow[user_username].html\">$temprow[user_username]</a>";
// replace the link above with the link below for integration into gforum
echo "<a href=\"http://forum.slowtwitch.com/gforum.cgi?username=$temprow[user_username]&session=".$_SESSION['session_id']."&from=fitter\">$temprow[user_username]</a> at ".date("F j, Y g:i A", $row[edit_timestamp]);
// TODO: SLOWTWITCH EDIT END
}
$i++;
}
if($numcount <= 0){ echo "No users"; }
?>
</div>
</div>
</div>
<div class="content-divider-bottom"></div>
<? include ('comments_show.php'); ?>
</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>

7
site/fitters/logout.php Normal file
View File

@ -0,0 +1,7 @@
<?PHP
include("config.php");
session_unset();
session_destroy();
$_SESSION = array();
header("Location: http://forum.slowtwitch.com/gforum.cgi?do=logout&from=fitters");
?>

View File

@ -0,0 +1,86 @@
<?php
require("config.php");
// Opens a connection to a MySQL server
/**$connection = mysql_connect($dbhost, $dbuser, $dbpass);
if (!$connection) {
die("Not connected : " . mysql_error());
}
// Set the active MySQL database
$db_selected = mysql_select_db($dbname, $connection);
if (!$db_selected) {
die("Can\'t use db : " . mysql_error());
}**/
// Select all the rows in the markers table
$query = "SELECT * FROM gforum_Fitters WHERE fitter_lat != 0 AND fitter_lat IS NOT NULL";
$result = mysql_query($query);
if (!$result) {
die("Invalid query: " . mysql_error());
}
// Initialize delay in geocode speed
$delay = 0;
$base_url = "https://" . MAPS_HOST . "/maps/geo?output=xml&key=" . KEY;
// Iterate through the rows, geocoding each address
while ($row = @mysql_fetch_assoc($result)) {
$geocode_pending = true;
while ($geocode_pending) {
$address = "".$row['fitter_address'].", ".$row['fitter_address_two'].", ".$row['fitter_city'].", ".$row['fitter_state']." ".$row['fitter_zip']."";
$id = $row["fitter_id"];
$request_url = $base_url . "&q=" . urlencode($address);
//echo ($request_url);
//$csv = file_get_contents($request_url) or die("csv url not loading");
// Create cUrl object to grab XML content using $request_url
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $request_url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$csv = trim(curl_exec($c));
curl_close($c);
$csvSplit = split(",", $csv);
$status = $csvSplit[0];
$accuracy = $csvSplit[1];
$lat = $csvSplit[2];
$lng = $csvSplit[3];
if (strcmp($status, "200") == 0 && $accuracy >= 5) {
// successful geocode
$geocode_pending = false;
$lat = $csvSplit[2];
$lng = $csvSplit[3];
$query = sprintf("UPDATE gforum_Fitters " .
" SET fitter_lat = '%s', fitter_lng = '%s' " .
" WHERE fitter_id = %s LIMIT 1;",
mysql_real_escape_string($lat),
mysql_real_escape_string($lng),
mysql_real_escape_string($id));
$update_result = mysql_query($query);
if (!$update_result) {
die("Invalid query: " . mysql_error());
}
} else if (strcmp($status, "620") == 0) {
// sent geocodes too fast
$delay += 100000;
} else if ($accuracy < 5) {
// failure to geocode
$geocode_pending = false;
echo $request_url . "\n";
echo "Address " . $address . " did not geocode to great enough accuracy to be useful. ";
echo "Accuracy match: " . $accuracy . "
\n";
} else {
// failure to geocode
$geocode_pending = false;
echo "Address " . $address . " failed to geocode. ";
echo "Received status " . $status . "
\n";
}
usleep($delay);
}
}
?>

View File

@ -0,0 +1,19 @@
<?php
require_once("classes/include.all.php");
// Check that the data was sent
if (sizeof($_POST) == 0
|| $_POST['parent'] == null
|| strlen(trim($_POST['parent'])) == 0
|| $_POST['item'] == null
|| strlen(trim($_POST['item'])) == 0
|| $_POST['rating'] == null
|| strlen(trim($_POST['rating'])) == 0
|| $_POST['classes'] == null
|| strlen(trim($_POST['classes'])) == 0)
{
die("You shouldn't be attempting to access this file in this manner.");
}
echo Rating::RateItem($_POST['parent'], $_POST['item'], $_POST['rating'], $_POST['classes']);
?>

Some files were not shown because too many files have changed in this diff Show More