Fifth pass at adding key files
This commit is contained in:
337
site/fitters/add.php
Normal file
337
site/fitters/add.php
Normal 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
152
site/fitters/add_X.php
Normal 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
|
||||
?>
|
19
site/fitters/ajax.rate.item.php
Normal file
19
site/fitters/ajax.rate.item.php
Normal 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']);
|
||||
?>
|
339
site/fitters/class/mysql.class.php
Normal file
339
site/fitters/class/mysql.class.php
Normal 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
|
||||
|
||||
?>
|
406
site/fitters/class/rating/classes/database.class.php
Normal file
406
site/fitters/class/rating/classes/database.class.php
Normal 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
|
||||
}
|
||||
?>
|
258
site/fitters/class/rating/classes/error.class.php
Normal file
258
site/fitters/class/rating/classes/error.class.php
Normal 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
|
||||
}
|
||||
?>
|
7
site/fitters/class/rating/classes/include.all.php
Normal file
7
site/fitters/class/rating/classes/include.all.php
Normal 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);
|
||||
?>
|
279
site/fitters/class/rating/classes/rating.class.php
Normal file
279
site/fitters/class/rating/classes/rating.class.php
Normal 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
|
||||
}
|
||||
?>
|
55
site/fitters/class/rating/int.to.words.php
Normal file
55
site/fitters/class/rating/int.to.words.php
Normal 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;
|
||||
}
|
||||
|
||||
?>
|
71
site/fitters/class/rating/rating-example.php
Normal file
71
site/fitters/class/rating/rating-example.php
Normal 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();
|
||||
?>
|
35
site/fitters/comments_add.php
Normal file
35
site/fitters/comments_add.php
Normal 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>
|
33
site/fitters/comments_add_X.php
Normal file
33
site/fitters/comments_add_X.php
Normal 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();
|
||||
|
||||
?>
|
19
site/fitters/comments_show.php
Normal file
19
site/fitters/comments_show.php
Normal 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>
|
88
site/fitters/comments_validate.php
Normal file
88
site/fitters/comments_validate.php
Normal 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"); ?>
|
37
site/fitters/comments_validate_X.php
Normal file
37
site/fitters/comments_validate_X.php
Normal 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
226
site/fitters/config.php
Normal 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
116
site/fitters/csv_list.php
Normal 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
29
site/fitters/delete_X.php
Normal 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);
|
||||
|
||||
?>
|
296
site/fitters/include_add_confirm.php
Normal file
296
site/fitters/include_add_confirm.php
Normal 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>
|
||||
|
12
site/fitters/include_breadcrumb.php
Normal file
12
site/fitters/include_breadcrumb.php
Normal file
@ -0,0 +1,12 @@
|
||||
<div class="breadcrumb">
|
||||
<a href="<? echo $main_site_url ?>">Home</a> >
|
||||
<a href="<? echo $main_site_url . "/local/" ?>">Local Listings</a> >
|
||||
<? 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 "> " . $regionname; } ?>
|
||||
<? if ( $statename ) { echo "> " . $statename . " State"; } ?>
|
||||
<? if ($row[fitter_name]) { echo "> " . $row[fitter_name]; } ?>
|
||||
</div>
|
107
site/fitters/include_buttons.php
Normal file
107
site/fitters/include_buttons.php
Normal 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>");
|
||||
}
|
||||
}
|
||||
?>
|
40
site/fitters/include_common_content.php
Normal file
40
site/fitters/include_common_content.php
Normal 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"><:: Welcome to Slowtwitch.com ::></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>
|
1
site/fitters/include_common_footer.php
Normal file
1
site/fitters/include_common_footer.php
Normal file
@ -0,0 +1 @@
|
||||
<? include("/var/home/slowtwitch/slowtwitch.com/www/db_templates/include_common_footer.php"); ?>
|
24
site/fitters/include_common_head.php
Normal file
24
site/fitters/include_common_head.php
Normal 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>
|
306
site/fitters/include_edit_confirm.php
Normal file
306
site/fitters/include_edit_confirm.php
Normal 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>
|
73
site/fitters/include_navigation.php
Normal file
73
site/fitters/include_navigation.php
Normal 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> $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"> </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
17
site/fitters/include_share.php
Normal file
17
site/fitters/include_share.php
Normal 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>
|
14
site/fitters/include_sidebar.php
Normal file
14
site/fitters/include_sidebar.php
Normal 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>
|
13
site/fitters/include_status.php
Normal file
13
site/fitters/include_status.php
Normal 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>");
|
||||
}
|
||||
?>
|
23
site/fitters/include_store.php
Normal file
23
site/fitters/include_store.php
Normal 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 ></a>
|
||||
</div>
|
||||
</div>
|
136
site/fitters/index.php
Normal file
136
site/fitters/index.php
Normal 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
288
site/fitters/individual.php
Normal 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
7
site/fitters/logout.php
Normal 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");
|
||||
?>
|
86
site/fitters/phpsqlgeocode_csv.php
Normal file
86
site/fitters/phpsqlgeocode_csv.php
Normal 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);
|
||||
}
|
||||
}
|
||||
?>
|
19
site/fitters/rating/ajax.rate.item.php
Normal file
19
site/fitters/rating/ajax.rate.item.php
Normal 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']);
|
||||
?>
|
406
site/fitters/rating/classes/database.class.php
Normal file
406
site/fitters/rating/classes/database.class.php
Normal 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
|
||||
}
|
||||
?>
|
258
site/fitters/rating/classes/error.class.php
Normal file
258
site/fitters/rating/classes/error.class.php
Normal 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
|
||||
}
|
||||
?>
|
8
site/fitters/rating/classes/include.all.php
Normal file
8
site/fitters/rating/classes/include.all.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
require_once("error.class.php");
|
||||
require_once("database.class.php");
|
||||
require_once("rating.class.php");
|
||||
|
||||
#Database::Initialize("mysql", "192.168.1.10", "3306", "slowtwitch", "slowtwitch", "k9volqlAcpq");
|
||||
Database::Initialize("mysql", "localhost", "3306", "dev_slowtwitch_com", "slowtwitch", "slowtwitchdev");
|
||||
?>
|
279
site/fitters/rating/classes/rating.class.php
Normal file
279
site/fitters/rating/classes/rating.class.php
Normal 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 style='clear:both;'>{$cat_info['rating_cat_name']}<br></div>";
|
||||
$output .= "<div style='display: inline;'><div style='float: left;'>{$cat_info['rating_cat_min']} </div><div style='float: left;'><ul class=\"{$classes}\" id=\"{$varParent}_{$varItem}\" 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><div style='float:left;'> {$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`, `rating_category_id`, `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 `rating_category_id`='{$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 `rating_category_id`='{$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
|
||||
}
|
||||
?>
|
55
site/fitters/rating/int.to.words.php
Normal file
55
site/fitters/rating/int.to.words.php
Normal 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;
|
||||
}
|
||||
|
||||
?>
|
71
site/fitters/rating/rating-example.php
Normal file
71
site/fitters/rating/rating-example.php
Normal 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();
|
||||
?>
|
87
site/fitters/regionlist.php
Normal file
87
site/fitters/regionlist.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?PHP include("config.php");
|
||||
require_once("class/rating/classes/include.all.php");
|
||||
include("class/rating/int.to.words.php");
|
||||
|
||||
$results = mysql_query("SELECT regionlong FROM ".$prefix."FittersRegions WHERE regionid = ".intval(mysql_escape_string($_GET[region]))." LIMIT 1") OR die ( header('Location: '.$site_url.'?mysql_error'));
|
||||
|
||||
if (mysql_num_rows($results) == 0) {
|
||||
header('Location: '.$site_url.'?mysql_error');
|
||||
}
|
||||
|
||||
$row = mysql_fetch_array($results);
|
||||
$regionname = $row[regionlong];
|
||||
|
||||
$results = mysql_query("SELECT gf.fitter_id, gf.fitter_name, gf.fitter_address, gf.fitter_address_two, gf.fitter_city, gf.fitter_state, gf.fitter_zip, gf.fitter_phone, gf.fitter_fax, gf.fitter_email, gf.fitter_website, gf.fitter_certifications, gf.fitter_fitbikes
|
||||
FROM ".$prefix."Fitters AS gf
|
||||
RIGHT JOIN ".$prefix."FittersStates AS gts
|
||||
ON gts.regionid = '".intval(mysql_escape_string($_GET[region]))."' AND gf.fitter_state_tag = gts.statetag
|
||||
WHERE gf.fitter_valid = 1 ORDER BY gf.fitter_name ASC") OR die(mysql_error());
|
||||
|
||||
$none = FALSE;
|
||||
if (mysql_num_rows($results) == 0) {
|
||||
$none = TRUE;
|
||||
}
|
||||
|
||||
// set the page title
|
||||
$pagetitle = $regionname;
|
||||
$selected_item = mysql_escape_string($_GET[region]);
|
||||
|
||||
// set meta tags
|
||||
$meta_keywords = "bike fitters in ".$regionname;
|
||||
$meta_description = "Trying to find bike fitters in ".$regionname."? Here is a listing of all ".$regionname." bike fitters.";
|
||||
?>
|
||||
|
||||
<? 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">Bike Fitters</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 Fitter</a>
|
||||
<? } ?>
|
||||
<hr class="line" />
|
||||
<? include("../runshops/include_region_list.php"); ?>
|
||||
|
||||
<h2><? echo $regionname ?> Region</h2>
|
||||
<hr />
|
||||
|
||||
<?
|
||||
if($none == TRUE){
|
||||
echo "No bike fitters have been entered yet for $regionname.";
|
||||
}
|
||||
?>
|
||||
|
||||
<? 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>
|
282
site/fitters/search.php
Normal file
282
site/fitters/search.php
Normal file
@ -0,0 +1,282 @@
|
||||
<?PHP include("config.php");
|
||||
|
||||
// set the page title
|
||||
$pagetitle = "Search The Database";
|
||||
|
||||
// set meta tags
|
||||
$meta_keywords = "search fitters";
|
||||
$meta_description = "Do you want to search for fitters in our online bike fitter 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."FittersStates");
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<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="content-title"><strong>Search For A Fitter</strong></h1>
|
||||
|
||||
<p class="cont">If you would like to search for a fitter, please use the form below. None of the fields are mandatory. Checking no box in a field indicates you don't care if a fitter 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. All searches are "OR" based, so checking two boxes will find fitters that, for example, use either an EXIT fit bike OR a Serotta size-cycle. The one exception is for certifications, where checking both boxes will find fitters who have ALL of the checked certifications; you can use the "ANY" box to search for fitters who have any certification.</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>Bike Fit</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="drow">
|
||||
<div class="dcell name">Has Portfolio Link</div>
|
||||
<div class="dcell divider"></div>
|
||||
<div class="dcell value">
|
||||
<input type="checkbox" name="portfolio" value="1">Portfolio Link in Profile
|
||||
</div>
|
||||
</div>
|
||||
<div class="drow">
|
||||
<div class="dcell name">Default Tri-Fit Methodology</div>
|
||||
<div class="dcell divider"></div>
|
||||
<div class="dcell value">
|
||||
<table width="100%" cellpadding="2" cellspacing="2"><?
|
||||
|
||||
$results = mysql_query("SELECT * FROM gforum_FittersMethods ORDER BY fitter_method_name ASC");
|
||||
|
||||
$i = 0;
|
||||
echo("<tr>");
|
||||
while ($row = mysql_fetch_array($results)) {
|
||||
if(!($i%4)) echo "</tr><tr>";
|
||||
echo("<td width=\"25%\"><input type=\"checkbox\" name=\"methods[]\" value=\"$row[fitter_method_id]\" >$row[fitter_method_name]</td>\n");
|
||||
$i++;
|
||||
}
|
||||
echo("<td width=\"25%\"><input type=\"checkbox\" name=\"methods[]\" value=\"999\" ><strong>ANY</strong></td>\n");
|
||||
$i++;
|
||||
while($i<4) {
|
||||
echo("<td width=\"25%\"> </td>");
|
||||
$i++;
|
||||
}
|
||||
if(!($i%4)) echo "</tr><tr>";
|
||||
|
||||
echo("</tr>");
|
||||
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="drow">
|
||||
<div class="dcell name">Fit Certifications:</div>
|
||||
<div class="dcell divider"></div>
|
||||
<div class="dcell value">
|
||||
<table width="100%" cellpadding="2" cellspacing="2"><?
|
||||
|
||||
$results = mysql_query("SELECT * FROM gforum_FittersCertifications ORDER BY fitter_certification_name ASC");
|
||||
|
||||
$i = 0;
|
||||
echo("<tr>");
|
||||
while ($row = mysql_fetch_array($results)) {
|
||||
if(!($i%4)) echo "</tr><tr>";
|
||||
echo("<td width=\"25%\"><input type=\"checkbox\" name=\"certifications[]\" value=\"$row[fitter_certification_id]\" >$row[fitter_certification_name]</td>\n");
|
||||
$i++;
|
||||
}
|
||||
if(!($i%4)) echo "</tr><tr>";
|
||||
echo("<td width=\"25%\"><input type=\"checkbox\" name=\"certifications[]\" value=\"999\" ><strong>ANY</strong></td>\n");
|
||||
echo("</tr>");
|
||||
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="drow">
|
||||
<div class="dcell name">Fit-Bike Model(s) Used</div>
|
||||
<div class="dcell divider"></div>
|
||||
<div class="dcell value">
|
||||
<table width="100%" cellpadding="2" cellspacing="2"><?
|
||||
|
||||
$results = mysql_query("SELECT * FROM gforum_FittersFitbikes ORDER BY fitter_fitbike_name ASC");
|
||||
|
||||
$i = 0;
|
||||
echo("<tr>");
|
||||
//echo("<input type=\"hidden\" name=\"fitbikes[]\" value=\"0\" >");
|
||||
while ($row = mysql_fetch_array($results)) {
|
||||
if(!($i%4)) echo "</tr><tr>";
|
||||
echo("<td width=\"25%\"><input type=\"checkbox\" name=\"fitbikes[]\" value=\"$row[fitter_fitbike_id]\" >$row[fitter_fitbike_name]</td>\n");
|
||||
$i++;
|
||||
}
|
||||
if(!($i%4)) echo "</tr><tr>";
|
||||
echo("<td width=\"25%\"><input type=\"checkbox\" name=\"fitbikes[]\" value=\"999\" ><strong>ANY</strong></td>\n");
|
||||
echo("</tr>");
|
||||
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="drow">
|
||||
<div class="dcell name">Motion-Capture Systems</div>
|
||||
<div class="dcell divider"></div>
|
||||
<div class="dcell value">
|
||||
<table width="100%" cellpadding="2" cellspacing="2"><?
|
||||
|
||||
$results = mysql_query("SELECT * FROM gforum_FittersMotioncapture ORDER BY fitter_motioncapture_name ASC");
|
||||
|
||||
$i = 0;
|
||||
echo("<tr>");
|
||||
//echo("<input type=\"hidden\" name=\"motioncapture[]\" value=\"0\" >");
|
||||
while ($row = mysql_fetch_array($results)) {
|
||||
if(!($i%4)) echo "</tr><tr>";
|
||||
echo("<td width=\"25%\"><input type=\"checkbox\" name=\"motioncapture[]\" value=\"$row[fitter_motioncapture_id]\" >$row[fitter_motioncapture_name]</td>\n");
|
||||
$i++;
|
||||
}
|
||||
if(!($i%4)) echo "</tr><tr>";
|
||||
echo("<td width=\"25%\"><input type=\"checkbox\" name=\"motioncapture[]\" value=\"999\" ><strong>ANY</strong></td>\n");
|
||||
echo("</tr>");
|
||||
|
||||
?>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="drow">
|
||||
<div class="dcell name">Brand Friendly</div>
|
||||
<div class="dcell divider"></div>
|
||||
<div class="dcell value">
|
||||
<table width="100%" cellpadding="2" cellspacing="2"><?
|
||||
|
||||
$results = mysql_query("SELECT * FROM gforum_FittersBrandFriendly ORDER BY fitter_brand_name ASC");
|
||||
|
||||
$i = 0;
|
||||
echo("<tr>");
|
||||
//echo("<input type=\"hidden\" name=\"brandfriendly[]\" value=\"0\" >");
|
||||
while ($row = mysql_fetch_array($results)) {
|
||||
if(!($i%4)) echo "</tr><tr>";
|
||||
echo("<td width=\"25%\"><input type=\"checkbox\" name=\"brandfriendly[]\" value=\"$row[fitter_brand_id]\" >$row[fitter_brand_name]</td>\n");
|
||||
$i++;
|
||||
}
|
||||
if(!($i%4)) echo "</tr><tr>";
|
||||
echo("<td width=\"25%\"><input type=\"checkbox\" name=\"brandfriendly[]\" value=\"999\" ><strong>ANY</strong></td>\n");
|
||||
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."FittersStates AS gts
|
||||
LEFT JOIN ".$prefix."FittersRegions AS gtr
|
||||
ON gts.regionid = gtr.regionid
|
||||
ORDER BY gtr.regionlong";
|
||||
|
||||
$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="fitter">
|
||||
<input type="submit" value="Search" class="btn">
|
||||
</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>
|
269
site/fitters/search_X.php
Normal file
269
site/fitters/search_X.php
Normal file
@ -0,0 +1,269 @@
|
||||
<?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");
|
||||
|
||||
// string comparison match percent
|
||||
$comp_pct = 70;
|
||||
|
||||
if (!$_POST){ header('Location: '.$site_url); }
|
||||
|
||||
// build the SQL query
|
||||
$sql = "SELECT fitter_id, fitter_name, fitter_address, fitter_address_two, fitter_city, fitter_state, fitter_zip, fitter_phone, fitter_fax, fitter_email, fitter_website, fitter_certifications, fitter_fitbikes FROM ".$prefix."Fitters WHERE fitter_valid=1 ";
|
||||
|
||||
// add fitters
|
||||
|
||||
if (isset($_POST[portfolio])) {
|
||||
$sql = $sql." AND fitter_portfolio <> ''";
|
||||
}
|
||||
|
||||
if (isset($_POST[methods])) {
|
||||
if (in_array("999", $_POST[methods])) {
|
||||
$sql = $sql." AND fitter_method <> '0'";
|
||||
} else {
|
||||
$sql = $sql." AND (";
|
||||
$flag = 0;
|
||||
foreach ($_POST[methods] AS $value) {
|
||||
if ($flag == 1){
|
||||
$sql = $sql." OR ";
|
||||
}
|
||||
$sql = $sql."fitter_method = '$value'";
|
||||
$flag = 1;
|
||||
}
|
||||
$sql = $sql.")";
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST[certifications])) {
|
||||
if (in_array("999", $_POST[certifications])) {
|
||||
$sql = $sql." AND fitter_certifications <> ',0,'";
|
||||
} else {
|
||||
/**$sql = $sql."AND (";
|
||||
$flag = 0;
|
||||
foreach ($_POST[certifications] AS $value) {
|
||||
if ($flag == 1){
|
||||
$sql = $sql." OR ";
|
||||
}
|
||||
$sql = $sql."fitter_certifications LIKE '%,$value,%'";
|
||||
$flag = 1;
|
||||
}
|
||||
$sql = $sql.")";**/
|
||||
foreach ($_POST[certifications] AS $value) {
|
||||
$sql = $sql." AND fitter_certifications LIKE '%,$value,%'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST[fitbikes])) {
|
||||
if (in_array("999", $_POST[fitbikes])) {
|
||||
$sql = $sql." AND fitter_fitbikes <> ',0,'";
|
||||
} else {
|
||||
$sql = $sql."AND (";
|
||||
$flag = 0;
|
||||
foreach ($_POST[fitbikes] AS $value) {
|
||||
if ($flag == 1){
|
||||
$sql = $sql." OR ";
|
||||
}
|
||||
$sql = $sql."fitter_fitbikes LIKE '%,$value,%'";
|
||||
$flag = 1;
|
||||
}
|
||||
$sql = $sql.")";
|
||||
//foreach ($_POST[fitbikes] AS $value) {
|
||||
//$sql = $sql." OR fitter_fitbikes LIKE '%,$value,%'";
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST[motioncapture])) {
|
||||
if (in_array("999", $_POST[motioncapture])) {
|
||||
$sql = $sql." AND fitter_motioncapture <> ',0,'";
|
||||
} else {
|
||||
$sql = $sql."AND (";
|
||||
$flag = 0;
|
||||
foreach ($_POST[motioncapture] AS $value) {
|
||||
if ($flag == 1){
|
||||
$sql = $sql." OR ";
|
||||
}
|
||||
$sql = $sql."fitter_motioncapture LIKE '%,$value,%'";
|
||||
$flag = 1;
|
||||
}
|
||||
$sql = $sql.")";
|
||||
//foreach ($_POST[motioncapture] AS $value) {
|
||||
//$sql = $sql." AND fitter_motioncapture LIKE '%,$value,%'";
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST[brandfriendly])) {
|
||||
if (in_array("999", $_POST[brandfriendly])) {
|
||||
$sql = $sql." AND fitter_brandfriendly <> ',0,'";
|
||||
} else {
|
||||
$sql = $sql."AND (";
|
||||
$flag = 0;
|
||||
foreach ($_POST[brandfriendly] AS $value) {
|
||||
if ($flag == 1){
|
||||
$sql = $sql." OR ";
|
||||
}
|
||||
$sql = $sql."fitter_brandfriendly LIKE '%,$value,%'";
|
||||
$flag = 1;
|
||||
}
|
||||
$sql = $sql.")";
|
||||
//foreach ($_POST[motioncapture] AS $value) {
|
||||
//$sql = $sql." AND fitter_motioncapture 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 fitter_state_tag IN $statelist";
|
||||
}
|
||||
|
||||
|
||||
$sql = $sql." ORDER BY fitter_name ASC";
|
||||
|
||||
//echo $sql;
|
||||
|
||||
$results = mysql_query($sql) OR die(mysql_error());
|
||||
|
||||
$none = FALSE;
|
||||
if (mysql_num_rows($results) == 0) {
|
||||
$none = TRUE;
|
||||
}
|
||||
$match_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_fitteres = mysql_fetch_array($results)) {
|
||||
// build an array that we can loop through.
|
||||
$arr_fitteres[$i] = $row_fitteres;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$arr_Matches = array();
|
||||
foreach ($arr_fitteres AS $fitter) {
|
||||
if (stripos($fitter['fitter_name'], $_POST['keyword']) !== false) {
|
||||
// push this onto the array of matches
|
||||
$fitter['percent'] = 100;
|
||||
array_push($arr_Matches, $fitter);
|
||||
} else {
|
||||
$name_nospace = str_replace(" ", "", $fitter['fitter_name']);
|
||||
$keyword_nospace = str_replace(" ", "", $_POST['keyword']);
|
||||
if (stripos($name_nospace, $keyword_nospace) !== false) {
|
||||
// push this onto the array of matches
|
||||
$fitter['percent'] = 90;
|
||||
array_push($arr_Matches, $fitter);
|
||||
} else {
|
||||
// trim redundant keywords
|
||||
$fitter_name = $fitter['fitter_name'];
|
||||
foreach ($trim_words AS $word) {
|
||||
$fitter_name = str_ireplace($word, " ", $fitter_name);
|
||||
}
|
||||
//$fitter_name = str_ireplace(" ", "", $fitter_name);
|
||||
$fitter_name = strtolower($fitter_name);
|
||||
$arr_fitter_name = explode(" ", $fitter_name);
|
||||
$_POST['keyword'] = strtolower($_POST['keyword']);
|
||||
$_POST['keyword'] = str_replace(" ", "", $_POST['keyword']);
|
||||
foreach ($arr_fitter_name AS $test_word) {
|
||||
similar_text($test_word, $_POST['keyword'], $percent);
|
||||
if ($percent >= $comp_pct) {
|
||||
// push this onto the array of matches
|
||||
$fitter['percent'] = round($percent, 0);
|
||||
//$fitter['trimmed'] = $fitter_name;
|
||||
array_push($arr_Matches, $fitter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($arr_Matches) == 0) {
|
||||
$none = TRUE;
|
||||
}
|
||||
$match_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, fitters, triathlon, results";
|
||||
$meta_description = "Bike fitters matching a user's search query. A list of matching fitters.";
|
||||
?>
|
||||
|
||||
<? 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><strong><? echo $match_count; ?> Fitters Match Your Search Criteria</strong></p>
|
||||
<?
|
||||
|
||||
if ($bool_Keywords == true) {
|
||||
foreach($arr_Matches AS $row){
|
||||
include("include_store.php");
|
||||
} // end foreach arr_Matches
|
||||
} else { //if bool_Keywords
|
||||
while ($row = mysql_fetch_array($results)) {
|
||||
include("include_store.php");
|
||||
} // end foreach mysql_fetch_array ?>
|
||||
<? } // end else ?>
|
||||
</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>
|
85
site/fitters/statelist.php
Normal file
85
site/fitters/statelist.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?PHP include("config.php");
|
||||
require_once("class/rating/classes/include.all.php");
|
||||
include("class/rating/int.to.words.php");
|
||||
|
||||
if (!isset($_GET['state']) || !in_array($_GET['state'], $state_tag_list)) {
|
||||
header('Location: '.$site_url.'/?error=no_state');
|
||||
}
|
||||
|
||||
$results = mysql_query("SELECT statelong FROM ".$prefix."FittersStates WHERE statetag = '".substr(mysql_escape_string($_GET[state]),0,20)."' LIMIT 1") OR die(mysql_error());
|
||||
|
||||
if (mysql_num_rows($results) == 0) {
|
||||
header('Location: '.$site_url.'?mysql_error');
|
||||
}
|
||||
|
||||
$row = mysql_fetch_array($results);
|
||||
$statename = $row[statelong];
|
||||
|
||||
$results = mysql_query("SELECT fitter_id, fitter_name, fitter_address, fitter_address_two, fitter_city, fitter_state, fitter_zip, fitter_phone, fitter_fax, fitter_email, fitter_website, fitter_certifications, fitter_fitbikes FROM ".$prefix."Fitters WHERE fitter_state_tag='".substr(mysql_escape_string($_GET[state]),0,20)."' AND fitter_valid=1 ORDER BY fitter_name ASC");
|
||||
|
||||
$none = FALSE;
|
||||
if (mysql_num_rows($results) == 0) {
|
||||
$none = TRUE;
|
||||
}
|
||||
|
||||
// set the page title
|
||||
$pagetitle = $statename;
|
||||
$selected_item = mysql_escape_string($_GET[state]);
|
||||
|
||||
// set meta tags
|
||||
$meta_keywords = "bike fitters in ".$statename;
|
||||
$meta_description = "Trying to find bike fitters in ".$statename."? Here is a listing of all ".$statename." bike fitters. Users can even rate and comment on these fitters.";
|
||||
?>
|
||||
|
||||
<? 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>
|
||||
<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 Fitter</a>
|
||||
<? } ?>
|
||||
<hr class="line" />
|
||||
<? include("../runshops/include_region_list.php"); ?>
|
||||
|
||||
<h2><? echo $statename ?> State</h2>
|
||||
<?
|
||||
if($none == TRUE){
|
||||
echo "<p>No bike fitters have been entered yet for $statename.</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>
|
72
site/fitters/top.php
Normal file
72
site/fitters/top.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?PHP include("config.php");
|
||||
require_once("class/rating/classes/include.all.php");
|
||||
include("class/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.fitter_id, gf.fitter_name, gf.fitter_address, gf.fitter_address_two, gf.fitter_city, gf.fitter_state, gf.fitter_zip, gf.fitter_phone, gf.fitter_fax, gf.fitter_email, gf.fitter_website, gf.fitter_certifications, gf.fitter_fitbikes FROM ".$prefix."FittersRating AS gfr RIGHT JOIN ".$prefix."Fitters AS gf ON gf.fitter_id = gfr.fitter_id_fk GROUP BY gfr.fitter_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 Bike Fitters";
|
||||
|
||||
// set meta tags
|
||||
$meta_keywords = "top ranked bike fitters";
|
||||
$meta_description = "Top ranked bike fitters 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 Bike Fitters</h1>
|
||||
<hr class="line" />
|
||||
<? include("../runshops/include_region_list.php"); ?>
|
||||
|
||||
<?
|
||||
if($none == TRUE){
|
||||
echo "No bike fitters 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>
|
||||
|
90
site/fitters/validate.php
Normal file
90
site/fitters/validate.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?PHP
|
||||
|
||||
include("config.php");
|
||||
|
||||
if(!is_admin($user)){
|
||||
header('Location:'.$site_url.'/');
|
||||
}
|
||||
|
||||
// Query to fetch non-validated races:
|
||||
$results = mysql_query("SELECT fitter_id, fitter_name, fitter_address, fitter_address_two, fitter_city, fitter_state, fitter_phone, fitter_fax, fitter_zip, fitter_email, fitter_website FROM ".$prefix."Fitters WHERE fitter_valid=0 ORDER BY fitter_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: Fitter Validation";
|
||||
|
||||
// set meta tags
|
||||
$meta_keywords = "";
|
||||
$meta_description = "";
|
||||
?>
|
||||
|
||||
<? include("include_common_head.php"); ?>
|
||||
|
||||
<body class="listings">
|
||||
<? include($common_path . "/ads/ad_wallpaper.html"); ?>
|
||||
|
||||
<div class="container">
|
||||
<? include($common_path . "/templates/include_header.php"); ?>
|
||||
<div class="main">
|
||||
<div class="contentwrapper clearfix">
|
||||
<? include("include_breadcrumb.php"); ?>
|
||||
|
||||
<section class="section listings section-has-widgets">
|
||||
<div class="sidebar-b">
|
||||
<? include("include_sidebar.php"); ?>
|
||||
</div>
|
||||
|
||||
<div class="content content-has-widgets">
|
||||
<div class="grid">
|
||||
|
||||
<div class="clearfix">
|
||||
<h1 class="content-title"><strong>Unvalidated Fitters</strong></h1>
|
||||
<form method="post" action="validate_X.php" enctype="multipart/form-data">
|
||||
<?
|
||||
if($none == TRUE){
|
||||
echo "There are no fitters 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?fitter_id=$row[fitter_id]"; ?>"><? echo $row[fitter_name]; ?></a></div></div>
|
||||
<div class="drow"><div class="dcell">Address: <? echo ("$row[fitter_address]"); if($row[fitter_address_two]) { echo ("<br /><span class='indent'>$row[fitter_address_two]</span>"); } echo("<br /><span class='indent'>$row[fitter_city], $row[fitter_state] $row[fitter_zip]</span>"); ?></div></div>
|
||||
<div class="drow"><div class="dcell">
|
||||
<?
|
||||
|
||||
echo "Phone: $row[fitter_phone]<br /><strong class='indent'>Fax/Alt Phone: </strong> $row[fitter_fax]";
|
||||
|
||||
?>
|
||||
</div></div>
|
||||
<div class="drow"><div class="dcell">
|
||||
<strong>Email:</strong> <? echo "<a href='mailto:$row[fitter_email]'>$row[fitter_email]</a>"; ?><br />
|
||||
<strong>Website:</strong> <? echo "<a href='$row[fitter_website]' target='_blank'>$row[fitter_website]</a>"; ?>
|
||||
<br>
|
||||
<a class="nav" href="<? echo "individual.php?fitter_id=$row[fitter_id]"; ?>">More information</a>
|
||||
<br /><input type="checkbox" value="<? echo($row[fitter_id]); ?>" name="validate[]"> Validate this fitter. <input type="checkbox" value="<? echo($row[fitter_id]); ?>" name="delete[]"> Delete this fitter.<br />
|
||||
</div></div>
|
||||
<? } ?>
|
||||
</div>
|
||||
<input type="submit" value="Validate Selected Fitters" 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>
|
35
site/fitters/validate_X.php
Normal file
35
site/fitters/validate_X.php
Normal 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."Fitters WHERE fitter_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."Fitters
|
||||
SET fitter_valid = 1
|
||||
WHERE fitter_id IN $idlist;";
|
||||
|
||||
mysql_query($sql) or die(mysql_error());
|
||||
|
||||
}
|
||||
|
||||
header('Location: '.$site_url.'/validate.php');
|
||||
|
||||
?>
|
21
site/fitters/wiki_buttons.php
Normal file
21
site/fitters/wiki_buttons.php
Normal 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 fitter?');" />
|
||||
</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 fitter?');" />
|
||||
</form>
|
||||
|
||||
</div>
|
362
site/fitters/wiki_edit.php
Normal file
362
site/fitters/wiki_edit.php
Normal file
@ -0,0 +1,362 @@
|
||||
<?PHP
|
||||
|
||||
include("config.php");
|
||||
|
||||
if(!isset($_GET[fitter_id]) AND !$_POST AND !is_numeric($_GET[fitter_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_fitter'])) {
|
||||
$row = $_POST;
|
||||
} else {
|
||||
$fitter_idhere = intval(mysql_escape_string($_GET[fitter_id]));
|
||||
$results = mysql_query("SELECT * FROM ".$prefix."Fitters WHERE fitter_id='".$fitter_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[fitter_valid] != 1 ) {
|
||||
header('Location: '.$site_url.'/?error=fitter_not_valid');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
// set the page title
|
||||
$pagetitle = "Edit A Bike Fitter";
|
||||
|
||||
// set meta tags
|
||||
$meta_keywords = "edit a bike fitter";
|
||||
$meta_description = "edit screen for bike fitter information";
|
||||
|
||||
?>
|
||||
|
||||
<?
|
||||
|
||||
if($_POST[edit_fitter] == true){
|
||||
include("wiki_edit_X.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<? 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">
|
||||
|
||||
<? if( $confirm_fitter == true ) { ?>
|
||||
<h1>Edit a Fitter: Step 2 of 2</h1>
|
||||
<? } else if( ($confirm_fitter != true) || ($_POST[edit_fitter] != true) ){ ?>
|
||||
<h1>Edit a Fitter: Step 1 of 2</h1>
|
||||
<hr class="line" />
|
||||
<? include("../runshops/include_region_list.php"); ?>
|
||||
<? if (!$errmsg) { ?>
|
||||
<p>To edit a fitter, 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 fitter (for instance, if you have multiple chapters), hit the "SAVE AS A NEW FITTER" button. To save changes to the existing fitter entry, hit the "SAVE CHANGES TO YOUR FITTER" 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.</p>
|
||||
<? } else { ?>
|
||||
<p class="cont"><span style="color: red;"><? echo $errmsg; ?></span></p>
|
||||
<? } ?>
|
||||
<? }
|
||||
|
||||
// begin insert form
|
||||
if( ($_POST[edit_fitter] != true) || ($errmsg) || (($confirm_fitter != true) && ($_POST[insert_fitter] != true)) ) { ?>
|
||||
<form enctype="multipart/form-data" action="wiki_edit.php" method="post">
|
||||
<div class="dtable form">
|
||||
<div class="drow">
|
||||
<div class="dcell name">Store Name</div>
|
||||
<div class="dcell divider"></div>
|
||||
<div class="dcell value">
|
||||
<input type="text" name="fitter_name" value="<? echo stripslashes($row[fitter_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="fitter_address" value="<? echo stripslashes(htmlspecialchars($row[fitter_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="fitter_address_two" value="<? echo stripslashes(htmlspecialchars($row[fitter_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="fitter_city" value="<? echo stripslashes(htmlspecialchars($row[fitter_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="fitter_state">
|
||||
<option value="0">Choose a State/Province</option>
|
||||
<?
|
||||
foreach($state_list as $key=>$value) {
|
||||
if(strcmp($row[fitter_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="fitter_zip" value="<? echo stripslashes(htmlspecialchars($row[fitter_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="fitter_latlng_override" <? if ($row[fitter_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($row[fitter_lat])); ?>" type="text" name="fitter_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($row[fitter_lng])); ?>" type="text" name="fitter_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="fitter_phone" value="<? echo stripslashes(htmlspecialchars($row[fitter_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="fitter_fax" value="<? echo stripslashes(htmlspecialchars($row[fitter_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="fitter_email" value="<? echo stripslashes(htmlspecialchars($row[fitter_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="fitter_website" value="<? echo stripslashes(htmlspecialchars($row[fitter_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="fitter_portfolio" value="<? echo stripslashes(htmlspecialchars($row[fitter_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=\"fitter_method\" value=\"0\" >");
|
||||
while ($list = mysql_fetch_array($fetch)) {
|
||||
echo("<span class=\"col2\"><input type=\"radio\" name=\"fitter_method\" value=\"$list[fitter_method_id]\" ");
|
||||
if ($list['fitter_method_id'] == $row[fitter_method]){ 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($row[fitter_certifications])){ $explosion = explode(",", $row[fitter_certifications]); } else { $explosion = $row[fitter_certifications]; }
|
||||
|
||||
$fetch = mysql_query("SELECT * FROM ".$prefix."FittersCertifications ORDER BY fitter_certification_name ASC") OR die(mysql_error());
|
||||
|
||||
echo("<input type=\"hidden\" name=\"fitter_certifications[]\" value=\"0\" >");
|
||||
while ($list = mysql_fetch_array($fetch)) {
|
||||
echo("<span class=\"col\"><input type=\"checkbox\" name=\"fitter_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($row[fitter_fitbikes])){ $explosion = explode(",", $row[fitter_fitbikes]); } else { $explosion = $row[fitter_fitbikes]; }
|
||||
$results = mysql_query("SELECT * FROM ".$prefix."FittersFitbikes ORDER BY fitter_fitbike_name ASC");
|
||||
echo("<input type=\"hidden\" name=\"fitter_fitbikes[]\" value=\"0\" >");
|
||||
while ($fetch = mysql_fetch_array($results)) {
|
||||
echo("<span class=\"col\"><input type=\"checkbox\" name=\"fitter_fitbikes[]\" value=\"$fetch[fitter_fitbike_id]\" ");
|
||||
if (in_array($fetch[fitter_fitbike_id], $explosion)){ echo "checked "; }
|
||||
echo(">$fetch[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($row[fitter_motioncapture])){ $explosion = explode(",", $row[fitter_motioncapture]); } else { $explosion = $row[fitter_motioncapture]; }
|
||||
|
||||
$results = mysql_query("SELECT * FROM ".$prefix."FittersMotioncapture ORDER BY fitter_motioncapture_name ASC");
|
||||
|
||||
echo("<input type=\"hidden\" name=\"fitter_motioncapture[]\" value=\"0\" >");
|
||||
while ($fetch = mysql_fetch_array($results)) {
|
||||
echo("<span class=\"col\"><input type=\"checkbox\" name=\"fitter_motioncapture[]\" value=\"$fetch[fitter_motioncapture_id]\" ");
|
||||
if (in_array($fetch[fitter_motioncapture_id], $explosion)){ echo "checked "; }
|
||||
echo(">$fetch[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($row[fitter_brandfriendly])){ $explosion = explode(",", $row[fitter_brandfriendly]); } else { $explosion = $row[fitter_brandfriendly]; }
|
||||
|
||||
$results = mysql_query("SELECT * FROM ".$prefix."FittersBrandFriendly ORDER BY fitter_brand_name ASC");
|
||||
|
||||
echo("<input type=\"hidden\" name=\"fitter_brandfriendly[]\" value=\"0\" >");
|
||||
while ($fetch = mysql_fetch_array($results)) {
|
||||
echo("<span class=\"col\"><input type=\"checkbox\" name=\"fitter_brandfriendly[]\" value=\"$fetch[fitter_brand_id]\" ");
|
||||
if (in_array($fetch[fitter_brand_id], $explosion)){ echo "checked "; }
|
||||
echo(">$fetch[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($row[fitter_cost])); ?>" type="text" name="fitter_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="fitter_info" class="txt lngtext" placeholder="Please write some information about your fitting business.">
|
||||
<? if($row[fitter_info]){ echo strip_tags(stripslashes($row[fitter_info])); } ?>
|
||||
</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="drow">
|
||||
<div class="dcell name">Directions</div>
|
||||
<div class="dcell divider"></div>
|
||||
<div class="dcell value">
|
||||
<textarea name="fitter_directions" class="txt lngtext" placeholder="Please describe how to get to your shop from your surrounding area.">
|
||||
<? if($row[fitter_directions]) { echo strip_tags(stripslashes($row[fitter_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" name="save_changes" value="Save Your Fitter Info" class="btn" />
|
||||
<input type="submit" name="new_fitter" value="Save As A New Fitter" class="btn" />
|
||||
<input type="reset" value="Reset" class="btn" />
|
||||
<input type="hidden" name="edit_fitter" value="true" />
|
||||
<input type="hidden" name="fitter_id" value="<? echo($row[fitter_id]); ?>" />
|
||||
<? // need to temporary set the field as being valid ?>
|
||||
<input type="hidden" name="fitter_valid" value="1" />
|
||||
<input type="hidden" name="fitter_submitted_by" value="<? echo($row[fitter_submitted_by]); ?>" />
|
||||
<input type="hidden" name="edited_by" value="<? echo($useruid); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<? }
|
||||
if ($confirm_fitter == true){
|
||||
include("include_edit_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>
|
189
site/fitters/wiki_edit_X.php
Normal file
189
site/fitters/wiki_edit_X.php
Normal file
@ -0,0 +1,189 @@
|
||||
<?PHP
|
||||
|
||||
if (!$_POST){ header('Location: '.$site_url.'/?error=no_post'); }
|
||||
|
||||
/*
|
||||
|
||||
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
|
||||
$errmsg = NULL;
|
||||
//Check for blank fields
|
||||
if ((!$_POST[fitter_name])) $errmsg = $errmsg."Shop name, ";
|
||||
if (!$_POST[fitter_city]) $errmsg = $errmsg."City, ";
|
||||
if (!$_POST[fitter_state]) $errmsg = $errmsg."State, ";
|
||||
if (!$_POST[fitter_address]) $errmsg = $errmsg."Address, ";
|
||||
if ((!$_POST[fitter_lat] || !$_POST[fitter_lng]) && $_POST[latlng_override] == true) $errmsg = $errmsg."Lat/Lng cannot be left blank if you wish to override address, ";
|
||||
if (!$_POST[fitter_phone]) $errmsg = $errmsg."Phone, ";
|
||||
if (!$_POST[fitter_email]) $errmsg = $errmsg."Email, ";
|
||||
if (!$_POST[fitter_website]) $errmsg = $errmsg."Website, ";
|
||||
if (!$_POST[fitter_cost]) $errmsg = $errmsg."Cost, ";
|
||||
if (strlen($_POST[fitter_info]) < 4) $errmsg = $errmsg."General Info, ";
|
||||
if (strlen($_POST[fitter_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[fitter_website]) ) {
|
||||
// Contains invalid characters.
|
||||
$errmsg = $errmsg."Invalid Web Address<br />";
|
||||
}
|
||||
if($_POST[fitter_portfolio] != "" && !preg_match($exp, $_POST[fitter_portfolio]) ) {
|
||||
// Contains invalid characters.
|
||||
$errmsg = $errmsg."Invalid Portfolio Address<br />";
|
||||
}
|
||||
if( preg_match('/[^a-zA-Z0-9\. ]/', $_POST[fitter_name]) ) {
|
||||
// Contains invalid characters.
|
||||
$errmsg = $errmsg."Please use only letters and numbers in the name<br />";
|
||||
}
|
||||
|
||||
if(!$errmsg){
|
||||
|
||||
$name = trim($_POST[fitter_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[fitter_address]));
|
||||
$full_address = $address;
|
||||
if (isset($_POST['fitter_address_two'])) { $address_two = mysql_escape_string(trim($_POST[fitter_address_two])); } else { $address_two = NULL; $full_address = $full_address.", ".$address_two; }
|
||||
$city = mysql_escape_string(trim($_POST[fitter_city]));
|
||||
$full_address = $full_address.", ".$city;
|
||||
$state = $_POST[fitter_state];
|
||||
$full_address = $full_address.", ".$state;
|
||||
$state_tag = strtolower(str_replace(" ","", $state));
|
||||
$zip = mysql_escape_string(trim($_POST[fitter_zip]));
|
||||
$full_address = $full_address." ".$zip;
|
||||
$latlng_override = $_POST[latlng_override];
|
||||
if ($latlng_override == true) {
|
||||
$lat = $_POST[fitter_lat];
|
||||
$lng = $_POST[fitter_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[fitter_lat] = $lat;
|
||||
$lng = $geocode_status[1];
|
||||
$_POST[fitter_lng] = $lng;
|
||||
//echo ($lat.", ".$lng);
|
||||
} else {
|
||||
$geocode_error = true;
|
||||
$lat = 0;
|
||||
$_POST[fitter_lat] = $lat;
|
||||
$lng = 0;
|
||||
$_POST[fitter_lng] = $lng;
|
||||
$geocode_message = $geocode_status;
|
||||
}
|
||||
}
|
||||
$phone = trim($_POST[fitter_phone]);
|
||||
$fax = trim($_POST[fitter_fax]);
|
||||
$email = mysql_escape_string(trim($_POST[fitter_email]));
|
||||
$website = mysql_escape_string(trim($_POST[fitter_website]));
|
||||
$portfolio = mysql_escape_string(trim($_POST[fitter_portfolio]));
|
||||
$method = mysql_escape_string(trim($_POST[fitter_method]));
|
||||
$certifications = mysql_escape_string(trim($_POST[fitter_certifications]));
|
||||
$fitbikes = mysql_escape_string(trim($_POST[fitter_fitbikes]));
|
||||
$motioncapture = mysql_escape_string(trim($_POST[fitter_motioncapture]));
|
||||
$brandfriendly = mysql_escape_string(trim($_POST[fitter_brandfriendly]));
|
||||
$cost = mysql_escape_string(trim($_POST[fitter_cost]));
|
||||
$info = mysql_escape_string(nl2br(substr(trim($_POST[fitter_info]), 0, 4096)));
|
||||
$directions = mysql_escape_string(nl2br(substr(trim($_POST[fitter_directions]), 0, 4096)));
|
||||
$submitted_by = mysql_escape_string(trim($_POST[fitter_submitted_by]));
|
||||
$id = mysql_escape_string(trim($_POST[fitter_id]));
|
||||
$edited_by = mysql_escape_string(trim($_POST[edited_by]));
|
||||
$edit_timestamp = time();
|
||||
|
||||
// BEGIN CONFIRM ENTRY CHECK
|
||||
if($_POST[insert_fitter] == true){
|
||||
if(isset($_POST[new_fitter])){
|
||||
$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', '$method', ',$certifications,', ',$fitbikes,', ',$motioncapture,', ',$brandfriendly,', '$cost', '$info', '$directions', $submitted_by, 0, '$portfolio')";
|
||||
//echo("fitter entered!");
|
||||
//echo($sql);
|
||||
mysql_query($sql) OR die(mysql_error());
|
||||
header('Location: '.$site_url.'/add.php?confirmed=yes');
|
||||
} elseif(isset($_POST[save_changes]) && $submitted_by != $edited_by) {
|
||||
$sql = "INSERT INTO ".$prefix."FittersEdits (fitter_id_fk, editor_user_id_fk, edit_timestamp, 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 ('$id', '$edited_by', '$edit_timestamp', '$name', '$name_tag', '$address', '$address_two', '$city', '$state', '$state_tag', '$zip', '$lat', '$lng', '$phone', '$fax', '$email', '$website', '$method', ',$certifications,', ',$fitbikes,', ',$motioncapture,', ',$brandfriendly,', '$cost', '$info', '$directions', $submitted_by, 0, '$portfolio')";
|
||||
mysql_query($sql) OR die(mysql_error());
|
||||
header('Location: '.$site_url.'/individual.php?fitter_id='.$id.'&wiki_change=edit_success');
|
||||
} elseif(isset($_POST[save_changes]) && $submitted_by == $edited_by) {
|
||||
$sql = "UPDATE ".$prefix."Fitters
|
||||
SET fitter_name = '".$name."',
|
||||
fitter_name_tag = '".$name_tag."',
|
||||
fitter_address = '".$address."',
|
||||
fitter_address_two = '".$address_two."',
|
||||
fitter_city = '".$city."',
|
||||
fitter_state = '".$state."',
|
||||
fitter_state_tag = '".$state_tag."',
|
||||
fitter_phone = '".$phone."',
|
||||
fitter_fax = '".$fax."',
|
||||
fitter_zip = '".$zip."',
|
||||
fitter_lat = '".$lat."',
|
||||
fitter_lng = '".$lng."',
|
||||
fitter_email = '".$email."',
|
||||
fitter_website = '".$website."',
|
||||
fitter_method = '".$method."',
|
||||
fitter_certifications = ',".$certifications.",',
|
||||
fitter_fitbikes = ',".$fitbikes.",',
|
||||
fitter_motioncapture = ',".$motioncapture.",',
|
||||
fitter_brandfriendly = ',".$brandfriendly.",',
|
||||
fitter_cost = '".$cost."',
|
||||
fitter_info = '".$info."',
|
||||
fitter_directions = '".$directions."',
|
||||
fitter_portfolio = '".$portfolio."'
|
||||
WHERE fitter_id = $id";
|
||||
//echo $sql;
|
||||
//exit();
|
||||
mysql_query($sql) OR die(mysql_error());
|
||||
header('Location: '.$site_url.'/individual.php?fitter_id='.$id.'&wiki_change=update_success');
|
||||
} else {
|
||||
header('Location: '.$site_url.'/individual.php?fitter_id='.$id.'&changes=failure');
|
||||
}
|
||||
} else {
|
||||
//echo("fitter NOT entered.");
|
||||
$confirm_fitter = true;
|
||||
}
|
||||
// END CONFIRM ENTRY CHECK
|
||||
}
|
||||
// END ERROR MESSAGE CHECK
|
||||
?>
|
95
site/fitters/wiki_validate.php
Normal file
95
site/fitters/wiki_validate.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?PHP include("config.php");
|
||||
|
||||
if(!is_admin($user)){
|
||||
header('Location:'.$site_url.'/');
|
||||
}
|
||||
|
||||
// Query to fetch non-validated fitters:
|
||||
$results = mysql_query("SELECT edit_id, fitter_name, fitter_city, fitter_state, fitter_info, edit_timestamp, fitter_submitted_by, editor_user_id_fk FROM ".$prefix."FittersEdits 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: Fitter Edit Validation";
|
||||
|
||||
// set meta tags
|
||||
$meta_keywords = "";
|
||||
$meta_description = "";
|
||||
?>
|
||||
|
||||
<? include("include_common_head.php"); ?>
|
||||
|
||||
<body class="listings">
|
||||
<? include($common_path . "/ads/ad_wallpaper.html"); ?>
|
||||
|
||||
<div class="container">
|
||||
<? include($common_path . "/templates/include_header.php"); ?>
|
||||
<div class="main">
|
||||
<div class="contentwrapper clearfix">
|
||||
<? include("include_breadcrumb.php"); ?>
|
||||
|
||||
<section class="section listings section-has-widgets">
|
||||
<div class="sidebar-b">
|
||||
<? include("include_sidebar.php"); ?>
|
||||
</div>
|
||||
|
||||
<div class="content content-has-widgets">
|
||||
<div class="grid">
|
||||
|
||||
<div class="clearfix">
|
||||
<h1 class="content-title"><strong>Unvalidated Public Edits</strong></h1>
|
||||
<form method="post" action="wiki_validate_X.php" enctype="multipart/form-data">
|
||||
<?
|
||||
if($none == TRUE){
|
||||
echo "There are no edits waiting to be validated.";
|
||||
}
|
||||
?>
|
||||
<div class="dtable">
|
||||
<?
|
||||
while($row = mysql_fetch_array($results)){
|
||||
$arrEditors = mysql_fetch_array(mysql_query("SELECT user_username FROM ".$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[fitter_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[fitter_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 fitter submitter)"; } else { echo ""; } ?></div></div>
|
||||
<div class="drow"><div class="dcell"><strong>Info:</strong>
|
||||
<?
|
||||
if(strlen($row[fitter_info]) > 400){
|
||||
$phrase = "…"; }else{
|
||||
$phrase = ""; }
|
||||
|
||||
echo substr(htmlspecialchars(strip_tags(stripslashes($row[fitter_info]))), 0, 160);
|
||||
echo $phrase;
|
||||
?>
|
||||
</div></div>
|
||||
|
||||
<div class="drow"><div class="dcell">
|
||||
<strong>Location:</strong> <? echo "$row[fitter_city], $row[fitter_state]"; ?><br />
|
||||
<a class="nav" href="<? echo "wiki_view.php?edit_id=$row[edit_id]"; ?>">More information</a>
|
||||
<br /><input type="checkbox" value="<? echo($row[edit_id]); ?>" name="validate[]"> Validate this edit. <input type="checkbox" value="<? echo($row[edit_id]); ?>" name="delete[]"> Delete this edit.
|
||||
</div></div>
|
||||
<? } ?>
|
||||
</div>
|
||||
<input type="submit" value="Process Selected Fitters" 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>
|
100
site/fitters/wiki_validate_X.php
Normal file
100
site/fitters/wiki_validate_X.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?PHP
|
||||
|
||||
// do I need to do additional security checks to make sure the script is being called appropriately?
|
||||
|
||||
/*
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
|
||||
|
||||
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."FittersEdits 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."FittersEdits WHERE edit_id IN $validateList";
|
||||
|
||||
$results = mysql_query($sql) OR die(mysql_error());
|
||||
|
||||
// Loop through fitters shifting edits over
|
||||
while($row = mysql_fetch_array($results)) {
|
||||
$sql = "UPDATE ".$prefix."Fitters
|
||||
SET fitter_name = '".mysql_escape_string($row[fitter_name])."',
|
||||
fitter_name_tag = '".mysql_escape_string($row[fitter_name_tag])."',
|
||||
fitter_address = '".mysql_escape_string($row[fitter_address])."',
|
||||
fitter_address_two = '".mysql_escape_string($row[fitter_address_two])."',
|
||||
fitter_city = '".mysql_escape_string($row[fitter_city])."',
|
||||
fitter_state = '".mysql_escape_string($row[fitter_state])."',
|
||||
fitter_state_tag = '".mysql_escape_string($row[fitter_state_tag])."',
|
||||
fitter_phone = '".mysql_escape_string($row[fitter_phone])."',
|
||||
fitter_fax = '".mysql_escape_string($row[fitter_fax])."',
|
||||
fitter_zip = '".mysql_escape_string($row[fitter_zip])."',
|
||||
fitter_lat = '".mysql_escape_string($row[fitter_lat])."',
|
||||
fitter_lng = '".mysql_escape_string($row[fitter_lng])."',
|
||||
fitter_email = '".mysql_escape_string($row[fitter_email])."',
|
||||
fitter_website = '".mysql_escape_string($row[fitter_website])."',
|
||||
fitter_method = '".mysql_escape_string($row[fitter_method])."',
|
||||
fitter_certifications = '".mysql_escape_string($row[fitter_certifications])."',
|
||||
fitter_fitbikes = '".mysql_escape_string($row[fitter_fitbikes])."',
|
||||
fitter_motioncapture = '".mysql_escape_string($row[fitter_motioncapture])."',
|
||||
fitter_cost = '".mysql_escape_string($row[fitter_cost])."',
|
||||
fitter_info = '" . mysql_escape_string($row[fitter_info]) . "',
|
||||
fitter_directions = '" . mysql_escape_string($row[fitter_directions]) . "',
|
||||
fitter_portfolio = '".mysql_escape_string($row[fitter_portfolio])."'
|
||||
WHERE fitter_id = '$row[fitter_id_fk]'";
|
||||
//echo $sql;
|
||||
//exit();
|
||||
mysql_query($sql) OR die(mysql_error());
|
||||
|
||||
$sql = "INSERT INTO ".$prefix."FittersEditors (fitter_id_fk, user_id_fk, edit_timestamp) VALUES ('$row[fitter_id_fk]', '$row[editor_user_id_fk]', '$row[edit_timestamp]')";
|
||||
mysql_query($sql) OR die(mysql_error());
|
||||
|
||||
$sql = "DELETE FROM ".$prefix."FittersEdits WHERE edit_id = $row[edit_id]";
|
||||
mysql_query($sql) OR die(mysql_error());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
header('Location: '.$site_url.'/wiki_validate.php');
|
||||
|
||||
?>
|
227
site/fitters/wiki_view.php
Normal file
227
site/fitters/wiki_view.php
Normal file
@ -0,0 +1,227 @@
|
||||
<?PHP
|
||||
|
||||
if (!is_numeric($_GET[edit_id])) { header('Location:'.$site_url.'/?error=invalid_id'); }
|
||||
|
||||
include("config.php");
|
||||
|
||||
// only admins can validate
|
||||
if(!is_admin($user)){
|
||||
header('Location:'.$site_url.'/');
|
||||
exit();
|
||||
}
|
||||
|
||||
// get the info for the edit based on ID
|
||||
// if the ID isn't valid, punt the user
|
||||
$edit_id_here = intval(mysql_escape_string($_GET[edit_id]));
|
||||
$results = mysql_query("SELECT * FROM ".$prefix."FittersEdits WHERE edit_id = '".$edit_id_here."'");
|
||||
$row = mysql_fetch_array($results);
|
||||
if (!$row) { header('Location:'.$site_url.'/?error=no_entry'); }
|
||||
|
||||
// set the page title
|
||||
$pagetitle = $row[fitter_name];
|
||||
|
||||
// set meta tags
|
||||
$meta_keywords = "triathlon, ".$row[fitter_name].", ".$row[fitter_state]." triathlon fitter";
|
||||
$meta_description = "Considering getting fit by ".$row[fitter_name]."? Here is all of the information about this fitter.";
|
||||
|
||||
include("include_common_head.php");
|
||||
|
||||
?>
|
||||
|
||||
<body class="listings">
|
||||
<? include($common_path . "/ads/ad_wallpaper.html"); ?>
|
||||
|
||||
<div class="container">
|
||||
<? include($common_path . "/templates/include_header.php"); ?>
|
||||
<div class="main">
|
||||
<div class="contentwrapper clearfix">
|
||||
<? include("include_breadcrumb.php"); ?>
|
||||
|
||||
<section class="section listings section-has-widgets section-static remove-sidebar">
|
||||
<div class="sidebar-b">
|
||||
<? include("include_sidebar.php"); ?>
|
||||
</div>
|
||||
|
||||
<div class="content content-has-widgets">
|
||||
<div class="grid">
|
||||
|
||||
<div class="clearfix">
|
||||
|
||||
<h2 style="display: inline; height: 16px; margin-bottom: 20px;"><!-- class="content-title"--><? echo stripslashes($row[fitter_name]) ; echo " "; ?></h2>
|
||||
|
||||
<?
|
||||
|
||||
// wiki control buttons
|
||||
include("wiki_buttons.php")
|
||||
|
||||
?>
|
||||
|
||||
<div style="margin-top: 10px;">
|
||||
|
||||
|
||||
<?
|
||||
$sqlWikiFetch = "SELECT user_username FROM ".$prefix."User WHERE user_id = ".mysql_escape_string($row[editor_user_id_fk])." LIMIT 1";
|
||||
|
||||
$arrUser = mysql_fetch_array(mysql_query($sqlWikiFetch));
|
||||
|
||||
$strEditor = $arrUser[user_username];
|
||||
?>
|
||||
<strong>Editor:</strong> <? echo "<a href=\"http://forum.slowtwitch.com/gforum.cgi?username=".$strEditor.";\" target=\"_blank\">".$strEditor."</a>"; ?>
|
||||
<br />
|
||||
|
||||
<strong>Edit Date:</strong> <? echo date("F j, Y", $row[edit_timestamp]); ?>
|
||||
<br />
|
||||
|
||||
<strong>Street Address: </strong><? echo stripslashes(htmlspecialchars($row[fitter_address])); ?>
|
||||
<br />
|
||||
<strong>Street Address Two: </strong><? echo stripslashes(htmlspecialchars($row[fitter_address_two])); ?>
|
||||
<br />
|
||||
<strong>City: </strong><? echo stripslashes(htmlspecialchars($row[fitter_city])); ?>
|
||||
<br />
|
||||
<strong>State: </strong><? echo stripslashes(htmlspecialchars($row[fitter_state])); ?>
|
||||
<br />
|
||||
<strong>Zip/Postal Code: </strong><? echo stripslashes(htmlspecialchars($row[fitter_zip])); ?>
|
||||
<br />
|
||||
<strong>Phone: </strong><? echo stripslashes(htmlspecialchars($row[fitter_phone])); ?>
|
||||
<br />
|
||||
<strong>Fax/Alt Phone: </strong><? echo stripslashes(htmlspecialchars($row[fitter_fax])); ?>
|
||||
<br />
|
||||
<strong>E-mail: </strong><a href="mailto:<? echo $row[fitter_email]; ?>"><? echo stripslashes(htmlspecialchars($row[fitter_email])); ?></a>
|
||||
<br />
|
||||
<strong>Website: </strong><a href="<? echo $row[fitter_website]; ?>" target="_blank"><? echo $row[fitter_website]; ?></a>
|
||||
<br />
|
||||
<strong>Portfolio: </strong><a href="<? echo $row[fitter_portfolio]; ?>" target="_blank"><? echo $row[fitter_portfolio]; ?></a>
|
||||
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<div class="indentlarge">
|
||||
<?
|
||||
for ($i = 0; $i < 35; $i++) echo("*");
|
||||
echo (" FIT INFO ");
|
||||
for ($i = 0; $i < 35; $i++) echo("*");
|
||||
?>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<strong>Default Tri-Fit Methodology: </strong><?
|
||||
|
||||
$sql = ("SELECT * FROM ".$prefix."FittersMethods WHERE fitter_method_id = ".$row[fitter_method]." LIMIT 1");
|
||||
|
||||
//echo $sql;
|
||||
|
||||
$fetch = mysql_query($sql) or die(mysql_error());
|
||||
|
||||
if (mysql_num_rows($fetch) > 0) {
|
||||
while ($method_list = mysql_fetch_array($fetch)) {
|
||||
echo ("$method_list[fitter_method_name]");
|
||||
}
|
||||
} else {
|
||||
echo ("Unanswered");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<br />
|
||||
<strong>Certifications: </strong><?
|
||||
|
||||
$row[fitter_certifications] = ltrim(rtrim($row[fitter_certifications], ", "), ", ");
|
||||
if ($row[fitter_certifications]) {
|
||||
$sql = ("SELECT * FROM gforum_FittersCertifications WHERE fitter_certification_id IN ($row[fitter_certifications]) ORDER BY fitter_certification_name ASC");
|
||||
|
||||
//echo $sql;
|
||||
|
||||
$fetch = mysql_query($sql) or die(mysql_error());
|
||||
|
||||
$certification_list = "";
|
||||
while ($list = mysql_fetch_array($fetch)) {
|
||||
$certification_list = $certification_list."$list[fitter_certification_name], ";
|
||||
}
|
||||
$certification_list = rtrim($certification_list, ', ');
|
||||
}
|
||||
|
||||
if ($certification_list) {echo $certification_list;} else {echo "None";}
|
||||
|
||||
?>
|
||||
|
||||
<br />
|
||||
<strong>Fit Bikes: </strong><?
|
||||
|
||||
$row[fitter_fitbikes] = ltrim(rtrim($row[fitter_fitbikes], ", "), ", ");
|
||||
if ($row[fitter_fitbikes]) {
|
||||
$sql = ("SELECT * FROM gforum_FittersFitbikes WHERE fitter_fitbike_id IN ($row[fitter_fitbikes]) ORDER BY fitter_fitbike_name ASC");
|
||||
|
||||
//echo $sql;
|
||||
|
||||
$fetch = mysql_query($sql) or die(mysql_error());
|
||||
|
||||
$fitbike_list = "";
|
||||
while ($list = mysql_fetch_array($fetch)) {
|
||||
$fitbike_list = $fitbike_list."$list[fitter_fitbike_name], ";
|
||||
}
|
||||
$fitbike_list = rtrim($fitbike_list, ', ');
|
||||
}
|
||||
|
||||
if ($fitbike_list) {echo $fitbike_list;} else {echo "None";}
|
||||
|
||||
?>
|
||||
|
||||
<br />
|
||||
<strong>Motion-Capture Systems: </strong><?
|
||||
|
||||
$row[fitter_motioncapture] = ltrim(rtrim($row[fitter_motioncapture], ", "), ", ");
|
||||
|
||||
if ($row[fitter_motioncapture]) {
|
||||
|
||||
$sql = ("SELECT * FROM gforum_FittersMotioncapture WHERE fitter_motioncapture_id IN ($row[fitter_motioncapture]) ORDER BY fitter_motioncapture_name ASC");
|
||||
|
||||
//echo $sql;
|
||||
|
||||
$fetch = mysql_query($sql) or die(mysql_error());
|
||||
|
||||
$motioncapture_list = "";
|
||||
while ($list = mysql_fetch_array($fetch)) {
|
||||
$motioncapture_list = $motioncapture_list."$list[fitter_motioncapture_name], ";
|
||||
}
|
||||
$motioncapture_list = rtrim($motioncapture_list, ', ');
|
||||
}
|
||||
|
||||
if ($motioncapture_list) {echo $motioncapture_list;} else {echo "None";}
|
||||
|
||||
?>
|
||||
|
||||
<br />
|
||||
<strong>Cost of Fit: </strong><? echo stripslashes(htmlspecialchars($row[fitter_cost])); ?>
|
||||
|
||||
<br /><br />
|
||||
<div class="indentlarge">
|
||||
<?
|
||||
for ($i = 0; $i < 80; $i++) echo("*");
|
||||
?>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<strong>General Info: </strong><? echo stripslashes(stripslashes($row[fitter_info])) ?>
|
||||
<br /><br />
|
||||
<strong>Directions to Location(s): </strong><? echo stripslashes(stripslashes($row[fitter_directions])); ?>
|
||||
|
||||
<br />
|
||||
|
||||
</div>
|
||||
|
||||
</div><!-- end col-2/3 -->
|
||||
</div><!-- end grid -->
|
||||
</div><!-- end content -->
|
||||
</section>
|
||||
|
||||
|
||||
</div><!-- end contentwrapper -->
|
||||
</div> <!-- end main -->
|
||||
|
||||
<? include($common_path . "/templates/include_footer.php") ?>
|
||||
</div> <!-- container -->
|
||||
</body>
|
||||
<? include($common_path . "/templates/include_global_js.php") ?>
|
||||
</html>
|
Reference in New Issue
Block a user