Fifth pass at adding key files

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

333
site/triclubs/add.php Normal file
View File

@ -0,0 +1,333 @@
<?PHP include("config.php");
if(!is_logged_in($user)){
header('Location: '.$site_url);
exit();
}
$username = base64_decode($_SESSION['user']);
$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];
// set the page title
$pagetitle = "Add a Triathlon Club";
// set meta tags
$meta_keywords = "add triclub";
$meta_description = "Do you want to include your triathlon club in our online multisport club database? Then use this form to send us your information, and we will add it to our website.";
?>
<?
if($_POST[addclub] == 1){
include("add_X.php");
}
//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");
?>
<? 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( $_GET[confirmed] == "yes" ) { ?>
<h1>Thank you</h1>
<? echo "<p>Thank you. Your club should be added within 24 hours. You will now be redirected back to the add page.</p>";
echo "<META HTTP-EQUIV=Refresh CONTENT=\"4; URL=index.php\">";
} else if($confirm == 1) { ?>
<h1>Add a Triathlon Club: Step 2 of 2</h1>
<? } else if( ($confirm !=1) && ($_POST[confirm1] != 1)){ ?>
<h1>Add a Triathlon Club: Step 1 of 2</h1>
<? } else if( ($_POST[addclub] == 1) && (!$errmsg) && ($_POST[confirm1] == 1)){ ?>
<h1>Thank you</h1>
<? }
if(($confirm != 1) && ($_POST[confirm1] != 1) && $_GET[confirmed] != "yes") { ?>
<p>If you would like to add your triathlon club to our website, simply fill out the form below. Be sure to fill out every field. After filling out each field, click submit. <font color="red">You will then be prompted to confirm your information before the information is sent to us.</font> <!--Pictures are optional, and you can upload a maximum of 3 photos. The maximum file size for each picture is 600k.--></p>
<? } ?>
<? include("../runshops/include_region_list.php"); ?>
<? if( $_GET[confirmed] != "yes" && (($_POST[addclub] != 1) || ($errmsg) || (($confirm != 1) && ($_POST[confirm1] != 1))) ){ ?>
<form enctype="multipart/form-data" action="add.php" method="post">
<p><font color="red"><? echo $errmsg; ?></font></p>
<div class="dtable form">
<div class="drow">
<div class="dcell name">Club 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">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"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
for ($i = 0; $i < 25; $i++) echo("*");
echo (" MEMBERSHIP ");
for ($i = 0; $i < 25; $i++) echo("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">President</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($_POST[president])); ?>" type="text" name="president" class="txt lngtext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Board Members(s)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="radio" name="board" value="0" <? if ($_POST[board] == 0){ echo 'checked'; } ?>>None
<input type="radio" name="board" value="1" <? if ($_POST[board] == 1){ echo 'checked'; } ?>>Yes, Their Names:
<input value="<? echo stripslashes($_POST[board_names]); ?>" type="text" name="board_names" class="txt midtext">
</div>
</div>
<div class="drow">
<div class="dcell name">Total Membership</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($_POST[membership])); ?>" type="text" name="membership" class="txt smltext" /> (number of members only)
</div>
</div>
<div class="drow">
<div class="dcell name">Dues</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($_POST[dues])); ?>" type="text" name="dues" class="txt smltext" />
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
for ($i = 0; $i < 63; $i++) echo("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Club Info</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="info" class="txt lngtext" placeholder="Please write some information about your club."><? if($_POST[info]){ echo strip_tags(stripslashes($_POST[info])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Sponsors</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="sponsors" class="txt lngtext" placeholder="Please write some information about your club sponsors."><? if($_POST[sponsors]) { echo strip_tags(stripslashes($_POST[sponsors])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Discounts</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="discounts" class="txt lngtext" placeholder="Please write some information about any discounts offered to club members."><? if($_POST[discounts]){ echo strip_tags(stripslashes($_POST[discounts])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Directions to Workouts &amp; Meeting Location(s)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="directions" class="txt lngtext" placeholder="Please describe how to get to your club's meetings and workouts from your surrounding area."><? if($_POST[directions]){ echo strip_tags(stripslashes($_POST[directions])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Workout</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="workouts" class="txt lngtext" placeholder="Please list the schedule of your organized group workouts."><? if($_POST[workouts]){ echo strip_tags(stripslashes($_POST[workouts])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Meetings</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="meetings" class="txt lngtext" placeholder="Please list the schedule of any organized club meetings."><? if($_POST[meetings]){ echo strip_tags(stripslashes($_POST[meetings])); } ?></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="addclub" value="1" />
</div>
</div>
</div>
</form>
<? } else {
if(($_POST[addclub] == 1) && (!$errmsg) && ($_POST[confirm1] == 1)){
echo "<p class=\"cont\">Thank you. Your club should be added within 24 hours. You will now be redirected back to the add page.</p>";
echo "<META HTTP-EQUIV=Refresh CONTENT=\"4; URL=add.php\">";
}
if($confirm == 1){
$confirm = 0;
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>

124
site/triclubs/add_X.php Normal file
View File

@ -0,0 +1,124 @@
<?PHP
if (!$_POST){ header('Location: '.$site_url); }
/*
FIELD NAMES:
triclub_id
triclub_name
triclub_name_tag
triclub_address
triclub_address_two
triclub_city
triclub_state
triclub_state_tag
triclub_zip
triclub_email
triclub_website
triclub_president
triclub_board
triclub_board_names
triclub_membership
triclub_dues
triclub_info
triclub_sponsors
triclub_discounts
triclub_directions
triclub_workouts
triclub_meetings
triclub_submitted_by
triclub_valid
triclub_member_tags
*/
/* Need to ltrim and rtrim commas before insertion */
//Insert into database
//$pass = 'abc123';
$errmsg = NULL;
//if(strcmp($_POST[password], $pass) == 0){ //Password is good
//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[email]) $errmsg = $errmsg."Email, ";
if (!$_POST[website]) $errmsg = $errmsg."Website, ";
if (!$_POST[president]) $errmsg = $errmsg."President, ";
if (!$_POST[dues]) $errmsg = $errmsg."Dues, ";
if (!$_POST[membership]) $errmsg = $errmsg."Membership, ";
if ($_POST[contact] == 1 && !$_POST[contact_names]) $errmsg = $errmsg."Board names, ";
if (strlen($_POST[info]) < 4) $errmsg = $errmsg."Club info, ";
if (strlen($_POST[sponsors]) < 4) $errmsg = $errmsg."Club sponsors, ";
if (strlen($_POST[discounts]) < 4) $errmsg = $errmsg."Club discounts, ";
if (strlen($_POST[directions]) < 4) $errmsg = $errmsg."Directions, ";
if (strlen($_POST[workouts]) < 4) $errmsg = $errmsg."Club workouts, ";
if (strlen($_POST[meetings]) < 4) $errmsg = $errmsg."Club meetings, ";
if (isset($errmsg)) {
$errmsg = "The following fields cannot be left blank: ".$errmsg."<br />";
$errmsg = rtrim($errmsg, ", ");
}
if (!is_numeric($_POST[membership])) $errmsg = $errmsg."Membership must be a number ONLY<br />";
$start_url = "(http(s)?\:\/\/)?"; // start url
$dots = "([\w_-]{2,}\.)+"; // one or more parts containing a '.' at the end
$last_part = "([\w_-]{2,})"; // last part doesn't contain a dot
$user = "((\/)(\~)[\w_=-]+)?((\/)[\w_=-]+)*"; // maybe subdirectories - possibly with user ~
$end = "((\/)|(\/)[\w_-]+\.[\w]{2,})?"; // maybe a slash at the end or slash+file+extension
$qstring1 = "((\?[\w_-]+\=([^\#]+)){0,1}"; // querystring - first argument (?a=b)
$qstring2 = "(\&[\w_-]+\=([^\#]+))*)?"; // querystring - following arguments (&c=d)
$bkmrk = "(#[\w_-]+)?"; // bookmark
$exp = "/^".$start_url.$dots.$last_part.$user.$end.$qstring1.$qstring2.$bkmrk."$/i";
if( !preg_match($exp, $_POST[website]) ) {
// Contains invalid characters.
$errmsg = $errmsg."Invalid Web Address<br />";
}
if( preg_match('/[^a-zA-Z0-9\. ]/', $_POST[name]) ) {
// Contains invalid characters.
$errmsg = $errmsg."Please use only letters and numbers in the name<br />";
}
if(!$errmsg){
$name = trim($_POST[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[address]));
if (isset($_POST['address_two'])) { $address_two = mysql_escape_string(trim($_POST[address_two])); } else { $address_two = NULL; }
$city = mysql_escape_string(trim($_POST[city]));
$state = $_POST[state];
$state_tag = strtolower(str_replace(" ","", $state));
$zip = mysql_escape_string(trim($_POST[zip]));
$email = mysql_escape_string(trim($_POST[email]));
$website = mysql_escape_string(trim($_POST[website]));
$president = mysql_escape_string(trim($_POST[president]));
$dues = mysql_escape_string(trim($_POST[dues]));
$membership = mysql_escape_string(trim($_POST[membership]));
$board = $_POST[board];
if ( $board == 0 ){ $board_names = NULL; }else{ $board_names = mysql_escape_string(trim($_POST[board_names])); }
$info = mysql_escape_string(nl2br(substr(trim($_POST[info]), 0, 4096)));
$sponsors = mysql_escape_string(nl2br(substr(trim($_POST[sponsors]), 0, 4096)));
$discounts = mysql_escape_string(nl2br(substr(trim($_POST[discounts]), 0, 4096)));
$directions = mysql_escape_string(nl2br(substr(trim($_POST[directions]), 0, 4096)));
$workouts = mysql_escape_string(nl2br(substr(trim($_POST[workouts]), 0, 4096)));
$meetings = mysql_escape_string(nl2br(substr(trim($_POST[meetings]), 0, 4096)));
$submitted_by = $_POST[submitted_by];
if($_POST[confirm1] == 1){
$sql = "INSERT INTO ".$prefix."Triclubs (triclub_name, triclub_name_tag, triclub_address, triclub_address_two, triclub_city, triclub_state, triclub_state_tag, triclub_zip, triclub_email, triclub_website, triclub_president, triclub_board, triclub_board_names, triclub_membership, triclub_dues, triclub_info, triclub_sponsors, triclub_discounts, triclub_directions, triclub_workouts, triclub_meetings, triclub_submitted_by, triclub_valid) VALUES ('$name', '$name_tag', '$address', '$address_two', '$city', '$state', '$state_tag', '$zip', '$email', '$website', '$president', $board, '$board_names', '$membership', '$dues', '$info', '$sponsors', '$discounts', '$directions', '$workouts', '$meetings', '$submitted_by', 0)";
//echo("shop entered!");
//echo($sql);
mysql_query($sql) OR die(mysql_error());
//exit();
}else{
//echo("shop NOT entered.");
$confirm = 1;
}
}
//}else{
// $errmsg = 'Incorrect key.';
//}
?>

View File

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

View File

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

View File

@ -0,0 +1,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']);
?>

View File

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

View File

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

View File

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

View File

@ -0,0 +1,279 @@
<?php
class Rating
{
## PRIVATE VARIABLES
## END PRIVATE VARIABLES
## PUBLIC METHODS
// Output the Rating information
// Returns a string of HTML
public static function OutputRating($varParent, $varItem)
{
// Verify $varItem was provided
if ($varItem != null && strlen(trim($varItem)) != 0 && $varParent != null && strlen(trim($varParent)) != 0)
{
// Check if Magic QUotes is ON
if (!get_magic_quotes_gpc())
{
$varItem = addslashes($varItem);
$varParent = addslashes($varParent);
}
// Information for the Output
$averageStars = Rating::CalculateAverageRating($varParent, $varItem);
// Check to see that the user has not already rated this item
if (Rating::CheckRatingsByIp($varParent, $varItem) == 0)
{
$classes = "rating " . Rating::ShowStars($averageStars);
$cat_info = Rating::FetchCategoryInfo($varItem);
// Write Output HTML for the Rating Data
$output = "\r\n";
$output .= "<div class=\"rating-table\"><div><strong>{$cat_info['rating_cat_name']}</strong></div>\r\n";
$output .= "<div>{$cat_info['rating_cat_min']}</div><div><div class=\"rated\"><ul class=\"{$classes}\" style='margin: 0px 0px 10px 0px;' id=\"{$varParent}_{$varItem}\">\r\n";
$output .= " <li class=\"one\"><a href=\"javascript:RateItem('{$varParent}','{$varItem}', 1);\" title=\"1 Star\">1</a></li>\r\n";
$output .= " <li class=\"two\"><a href=\"javascript:RateItem('{$varParent}','{$varItem}', 2);\" title=\"2 Stars\">2</a></li>\r\n";
$output .= " <li class=\"three\"><a href=\"javascript:RateItem('{$varParent}','{$varItem}', 3);\" title=\"3 Stars\">3</a></li>\r\n";
$output .= " <li class=\"four\"><a href=\"javascript:RateItem('{$varParent}','{$varItem}', 4);\" title=\"4 Stars\">4</a></li>\r\n";
$output .= " <li class=\"five\"><a href=\"javascript:RateItem('{$varParent}','{$varItem}', 5);\" title=\"5 Stars\">5</a></li>\r\n";
$output .= "</ul></div></div><div> {$cat_info['rating_cat_max']}</div></div>\r\n";
}
else
{
$classes = "rated " . Rating::ShowStars($averageStars);
$cat_info = Rating::FetchCategoryInfo($varItem);
// Write Output HTML for the Rating Data
$output = "\r\n";
$output .= "<div class=\"rating-table\"><div><strong>{$cat_info['rating_cat_name']}</strong></div>\r\n";
$output .= "<div>{$cat_info['rating_cat_min']}</div><div><div class=\"rated\"><ul class=\"{$classes}\" style='margin: 0px 0px 10px 0px;' id=\"{$varParent}_{$varItem}\">\r\n";
$output .= " <li class=\"one\">1</li>\r\n";
$output .= " <li class=\"two\">2</li>\r\n";
$output .= " <li class=\"three\">3</li>\r\n";
$output .= " <li class=\"four\">4</li>\r\n";
$output .= " <li class=\"five\">5</li>\r\n";
$output .= "</ul></div></div><div> {$cat_info['rating_cat_max']}</div></div>\r\n";
}
}
else
{
$output = "";
// This is a major issue. NO information can be retrieve if an item name is not passed.
Error::LogError("Variable Missing", "You must provide the item name for this function to find the average.");
}
return $output;
}
public static function OutputParentRating($varParent)
{
// Verify $varParent was provided
if ($varParent != null && strlen(trim($varParent)) != 0)
{
// Check if Magic QUotes is ON
if (!get_magic_quotes_gpc())
{
$varParent = addslashes($varParent);
}
// Information for the Output
$averageStars = Rating::CalculateAverageParentRating($varParent);
$classes = "rated " . Rating::ShowStars($averageStars);
//$parent_info = Rating::FetchParentInfo($varParent);
// Write Output HTML for the Rating Data
$output = "\r\n";
//$output .= "<div style='clear:both;'>Overall Rating</div>";
$output .= "<div style='height: 16px; width: 80px; position: relative;'><ul class=\"{$classes}\" id=\"{$varParent}\" style='margin: 0px 0px 10px 0px;'>\r\n";
$output .= " <li class=\"one\">1</li>\r\n";
$output .= " <li class=\"two\">2</li>\r\n";
$output .= " <li class=\"three\">3</li>\r\n";
$output .= " <li class=\"four\">4</li>\r\n";
$output .= " <li class=\"five\">5</li>\r\n";
$output .= "</ul></div>\r\n";
}
else
{
$output = "";
// This is a major issue. NO information can be retrieve if an item name is not passed.
Error::LogError("Variable Missing", "You must provide the parent name for this function to find the average.");
}
return $output;
}
// Rate an Item
// Returns the name/value pair of new class names and the item name
public static function RateItem($varParent, $varItem, $varRating, $varClasses)
{
$newClassNames = $varClasses;
// Verify $varName was provided
if ($varParent != null && strlen(trim($varParent)) != 0
&& $varItem != null && strlen(trim($varItem)) != 0
&& $varRating != null && strlen(trim($varRating)) != 0 && is_numeric($varRating)
&& $varClasses != null && strlen(trim($varClasses)) != 0)
{
// Check if Magic Quotes is ON
if (!get_magic_quotes_gpc())
{
$varItem = addslashes($varItem);
$varParent = addslashes($varParent);
}
// Check to see that the user has not already rated this item
if (Rating::CheckRatingsByIp($varParent, $varItem) == 0)
{
$ipAddress = $_SERVER['REMOTE_ADDR'];
$tempTime = time();
Database::ExecuteQuery("INSERT INTO `gforum_TriclubsRating` (`triclub_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_TriclubsRatingCategory` 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_TriclubsRating` WHERE `category_id_fk`='{$varItem}' AND `triclub_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_TriclubsRating` WHERE `triclub_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_TriclubsRating` WHERE `category_id_fk`='{$varItem}' AND `triclub_id_fk`='{$varParent}' AND `rating_ip`='{$ipAddress}'", "AlreadyRated");
$results = Database::FetchResults("AlreadyRated");
Database::FreeResults("AlreadyRated");
Database::RemoveSavedResults("AlreadyRated");
// Check to see that the user has not already rated this item
if ($results != null && $results[0]['totalRatings'] != null)
{
return $results[0]['totalRatings'];
}
return 0;
}
## END PRIVATE METHODS
}
?>

View File

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

View File

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

View File

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

View File

@ -0,0 +1,33 @@
<?PHP
// do I need to do additional security checks to make sure the script is being called appropriately?
include("config.php");
if (!$_POST){ header('Location: '.$site_url); }
// error checking
if (isset($_POST[Review_Subject]) && isset($_POST[Review_Contents])) {
if ($_SERVER['HTTP_X_FORWARD_FOR']) {
$ip = $_SERVER['HTTP_X_FORWARD_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$tsNow = time();
$triclub_id = $_POST[triclub_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."TriclubsComment (triclub_id_fk, comment_time, user_id_fk, comment_subject, comment_message, comment_ip, comment_valid) VALUES ($triclub_id, '$tsNow', '$editor_id', '$subject', '$message', '$ip', 0)";
//echo $sql;
mysql_query($sql) or die(mysql_error());
}
header('Location: '.$site_url.'/individual.php?triclub_id='.$triclub_id.'&review_add=ok');
exit();
?>

View File

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

View File

@ -0,0 +1,88 @@
<?PHP include("config.php");
if(is_logged_in($user)){
$username = base64_decode($_SESSION['user']);
if($username != "Slowman" && $username != "Rappstar" && $username != "Herbert") {
header('Location: '.$site_url);
exit();
}
} else {
header('Location: '.$site_url);
exit();
}
// Query to fetch non-validated races:
$results = mysql_query("SELECT * FROM ".$prefix."TriclubsComment 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 triclub_name FROM ".$prefix."Triclubs WHERE triclub_id = ".$arrComments[triclub_id_fk]." LIMIT 1"));
$commenter_user_username = $arrCommenters[user_username];
$triclub_name = $arrClubs[triclub_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?triclub_id=".$arrComments[triclub_id_fk]."\">".$triclub_name."</a>";?></div><div class="indent" style="background-color: #eeeef9; border: 1px solid black; margin-top: 2px; margin-right: 5px; margin-bottom: 5px; padding: 5px; ">
<? echo stripslashes(stripslashes($arrComments[comment_message])); ?>
</div><div class="indent"><input type="checkbox" value="<? echo($arrComments[comment_id]); ?>" name="validate[]"> Validate this comment. <input type="checkbox" value="<? echo($arrComments[comment_id]); ?>" name="delete[]"> Delete this comment.<br /></div></td></tr>
<?
}
?>
</table>
<br />
<input type="submit" value="Process Selected Comments">
</div>
</form>
<!-- End content col -->
</div>
<!-- End BODY -->
</div>
<!-- End Outer -->
<? include("include_common_footer.php"); ?>

View File

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

79
site/triclubs/config.php Normal file
View File

@ -0,0 +1,79 @@
<?
###########################################
#-----------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 \\
\\
===========================================\
------------------------------------------*/
//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 = "Triclubs";
$field_lead = "triclub";
$site_url = "/triclubs";
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_Triclubs WHERE triclub_valid = 1"));
function curPageURL() {
$isHTTPS = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on");
$port = (isset($_SERVER["SERVER_PORT"]) && ((!$isHTTPS && $_SERVER["SERVER_PORT"] != "80") || ($isHTTPS && $_SERVER["SERVER_PORT"] != "443")));
$port = ($port) ? ':'.$_SERVER["SERVER_PORT"] : '';
$url = ($isHTTPS ? 'https://' : 'http://').$_SERVER["SERVER_NAME"].$port.$_SERVER["REQUEST_URI"];
return $url;
}
?>

View File

@ -0,0 +1,29 @@
<?PHP
include("config.php");
if (!$_POST){ header('Location: '.$site_url); }
$sql = "DELETE FROM gforum_Triclubs WHERE triclub_id = '$_POST[triclub_id]'";
mysql_query($sql) or die(mysql_error());
$sql = "DELETE FROM gforum_TriclubsEdits WHERE triclub_id_fk = '$_POST[triclub_id]'";
mysql_query($sql) or die(mysql_error());
$sql = "DELETE FROM gforum_TriclubsEditors WHERE triclub_id_fk = '$_POST[triclub_id]'";
mysql_query($sql) or die(mysql_error());
$sql = "DELETE FROM gforum_TriclubsComment WHERE triclub_id_fk = '$_POST[triclub_id]'";
mysql_query($sql) or die(mysql_error());
$sql = "DELETE FROM gforum_TriclubsRating WHERE triclub_id_fk = '$_POST[triclub_id]'";
mysql_query($sql) or die(mysql_error());
header('Location: '.$site_url);
?>

View File

@ -0,0 +1,206 @@
<p>Please confirm your club information. If everything is correct, click the submit button. Otherwise, you may click the edit button to change your club information before submitting.</p>
<div class="dtable form">
<div class="drow">
<div class="dcell name">Club Name</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes($_POST[name]); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Street Address</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[address])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Street Address Two</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[address_two])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">City</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[city])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">State</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[state])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Zip/Postal Code</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[zip])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">E-mail</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[email])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Website</div>
<div class="dcell divider"></div>
<div class="dcell value">
<a href="<? echo $_POST[website]; ?>" target="_blank"><? echo $_POST[website]; ?></a>
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
for ($i = 0; $i < 25; $i++) echo("*");
echo (" MEMBERSHIP ");
for ($i = 0; $i < 25; $i++) echo("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">President</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[president])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Board Member(s)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? if ($_POST[board] == 0) { echo "None"; } else { echo "Yes, Their Names - "; echo stripslashes($_POST[board_names]); } ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Membership</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[membership])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Dues</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[dues])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
for ($i = 0; $i < 62; $i++) echo("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Club 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">Sponsors</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[sponsors])) ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Discounts</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[discounts])) ?>
</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">
<div class="dcell name">Workouts</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[workouts])) ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Meetings</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[meetings])) ?>
</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="email" value="<? echo $_POST[email]; ?>">
<input type="hidden" name="website" value="<? echo $_POST[website]; ?>">
<input type="hidden" name="president" value="<? echo $_POST[president]; ?>">
<input type="hidden" name="board" value="<? echo $_POST[board]; ?>">
<input type="hidden" name="board_names" value="<? echo stripslashes(htmlspecialchars($_POST[board_names])); ?>">
<input type="hidden" name="membership" value="<? echo $_POST[membership]; ?>">
<input type="hidden" name="dues" value="<? echo $_POST[dues]; ?>">
<input type="hidden" name="info" value="<? echo stripslashes(htmlspecialchars($_POST[info])); ?>">
<input type="hidden" name="sponsors" value="<? echo stripslashes(htmlspecialchars($_POST[sponsors])); ?>">
<input type="hidden" name="discounts" value="<? echo stripslashes(htmlspecialchars($_POST[discounts])); ?>">
<input type="hidden" name="directions" value="<? echo stripslashes(htmlspecialchars($_POST[directions])); ?>">
<input type="hidden" name="workouts" value="<? echo stripslashes(htmlspecialchars($_POST[workouts])); ?>">
<input type="hidden" name="meetings" value="<? echo stripslashes(htmlspecialchars($_POST[meetings])); ?>">
<input type="hidden" name="addclub" value="1">
<input type="hidden" name="confirm1" value="1">
<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="email" value="<? echo $_POST[email]; ?>">
<input type="hidden" name="website" value="<? echo $_POST[website]; ?>">
<input type="hidden" name="president" value="<? echo $_POST[president]; ?>">
<input type="hidden" name="board" value="<? echo $_POST[board]; ?>">
<input type="hidden" name="board_names" value="<? echo stripslashes(htmlspecialchars($_POST[board_names])); ?>">
<input type="hidden" name="membership" value="<? echo $_POST[membership]; ?>">
<input type="hidden" name="dues" value="<? echo $_POST[dues]; ?>">
<input type="hidden" name="info" value="<? echo stripslashes(htmlspecialchars($_POST[info])); ?>">
<input type="hidden" name="sponsors" value="<? echo stripslashes(htmlspecialchars($_POST[sponsors])); ?>">
<input type="hidden" name="discounts" value="<? echo stripslashes(htmlspecialchars($_POST[discounts])); ?>">
<input type="hidden" name="directions" value="<? echo stripslashes(htmlspecialchars($_POST[directions])); ?>">
<input type="hidden" name="workouts" value="<? echo stripslashes(htmlspecialchars($_POST[workouts])); ?>">
<input type="hidden" name="meetings" value="<? echo stripslashes(htmlspecialchars($_POST[meetings])); ?>">
<input type="submit" name="submit" value="Edit Information" class="btn float-left" />
</form>
</div>
</div>
</div>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,221 @@
<p>Please confirm your club information. If everything is correct, click the submit button. Otherwise, you may click the edit button to change your club information before submitting.</p>
<div class="dtable form">
<div class="drow">
<div class="dcell name">Club Name</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes($_POST[triclub_name]); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Street Address</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[triclub_address])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Street Address Two</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[triclub_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[triclub_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[triclub_state])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Zip/Postal Code</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[triclub_zip])); ?>
</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[triclub_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[triclub_website]; ?>" target="_blank"><? echo $_POST[triclub_website]; ?></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 (" MEMBERSHIP ");
for ($i = 0; $i < 25; $i++) echo("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">President</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[triclub_president])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Board Member(s)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? if ($_POST[triclub_board] == 0) { echo "None"; } else { echo "Yes, Their Names - "; echo stripslashes($_POST[triclub_board_names]); } ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Membership</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[triclub_membership])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Dues</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo stripslashes(htmlspecialchars($_POST[triclub_dues])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
for ($i = 0; $i < 62; $i++) echo("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Club Info</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[triclub_info])) ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Sponsors</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[triclub_sponsors])) ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Discounts</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[triclub_discounts])) ?>
</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[triclub_directions])); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Workouts</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[triclub_workouts])) ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Meetings</div>
<div class="dcell divider"></div>
<div class="dcell value">
<? echo strip_tags(stripslashes($_POST[triclub_meetings])) ?>
</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="triclub_name" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_name])); ?>">
<input type="hidden" name="triclub_address" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_address])); ?>">
<input type="hidden" name="triclub_address_two" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_address_two])); ?>">
<input type="hidden" name="triclub_city" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_city])); ?>">
<input type="hidden" name="triclub_state" value="<? echo $_POST[triclub_state]; ?>">
<input type="hidden" name="triclub_zip" value="<? echo $_POST[triclub_zip]; ?>">
<input type="hidden" name="triclub_email" value="<? echo $_POST[triclub_email]; ?>">
<input type="hidden" name="triclub_website" value="<? echo $_POST[triclub_website]; ?>">
<input type="hidden" name="triclub_president" value="<? echo $_POST[triclub_president]; ?>">
<input type="hidden" name="triclub_board" value="<? echo $_POST[triclub_board]; ?>">
<input type="hidden" name="triclub_board_names" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_board_names])); ?>">
<input type="hidden" name="triclub_membership" value="<? echo $_POST[triclub_membership]; ?>">
<input type="hidden" name="triclub_dues" value="<? echo $_POST[triclub_dues]; ?>">
<input type="hidden" name="triclub_info" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_info])); ?>">
<input type="hidden" name="triclub_sponsors" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_sponsors])); ?>">
<input type="hidden" name="triclub_discounts" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_discounts])); ?>">
<input type="hidden" name="triclub_directions" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_directions])); ?>">
<input type="hidden" name="triclub_workouts" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_workouts])); ?>">
<input type="hidden" name="triclub_meetings" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_meetings])); ?>">
<? // need to temporary set the field as being valid ?>
<input type="hidden" name="triclub_valid" value="1">
<input type="hidden" name="edit_club" value="1">
<input type="hidden" name="confirm_entry" value="1">
<? if(isset($_POST[new_club])){ ?>
This data will be saved as a NEW CLUB.
<input type="hidden" name="new_club" value="1" />
<input type="hidden" name="triclub_submitted_by" value="<? echo($_POST[edited_by]); ?>" />
<? } else { ?>
This data will be saved as a modification to the EXISTING CLUB.
<input type="hidden" name="save_changes" value="1" />
<input type="hidden" name="edited_by" value="<? echo($_POST[edited_by]); ?>">
<input type="hidden" name="triclub_submitted_by" value="<? echo($_POST[triclub_submitted_by]); ?>" />
<input type="hidden" name="triclub_id" value="<? echo($_POST[triclub_id]); ?>" />
<? } ?>
<input type="submit" name="submit" value="Submit Info" class="btn float-left" style="margin-right: 5px" />
</form>
<form action="wiki_edit.php" method="post">
<input type="hidden" name="triclub_name" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_name])); ?>">
<input type="hidden" name="triclub_address" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_address])); ?>">
<input type="hidden" name="triclub_address_two" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_address_two])); ?>">
<input type="hidden" name="triclub_city" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_city])); ?>">
<input type="hidden" name="triclub_state" value="<? echo $_POST[triclub_state]; ?>">
<input type="hidden" name="triclub_zip" value="<? echo $_POST[triclub_zip]; ?>">
<input type="hidden" name="triclub_email" value="<? echo $_POST[triclub_email]; ?>">
<input type="hidden" name="triclub_website" value="<? echo $_POST[triclub_website]; ?>">
<input type="hidden" name="triclub_president" value="<? echo $_POST[triclub_president]; ?>">
<input type="hidden" name="triclub_board" value="<? echo $_POST[triclub_board]; ?>">
<input type="hidden" name="triclub_board_names" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_board_names])); ?>">
<input type="hidden" name="triclub_membership" value="<? echo $_POST[triclub_membership]; ?>">
<input type="hidden" name="triclub_dues" value="<? echo $_POST[triclub_dues]; ?>">
<input type="hidden" name="triclub_info" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_info])); ?>">
<input type="hidden" name="triclub_sponsors" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_sponsors])); ?>">
<input type="hidden" name="triclub_discounts" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_discounts])); ?>">
<input type="hidden" name="triclub_directions" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_directions])); ?>">
<input type="hidden" name="triclub_workouts" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_workouts])); ?>">
<input type="hidden" name="triclub_meetings" value="<? echo stripslashes(htmlspecialchars($_POST[triclub_meetings])); ?>">
<input type="hidden" name="edit_return" value="1">
<? // need to temporary set the field as being valid ?>
<input type="hidden" name="triclub_valid" value="1">
<input type="hidden" name="triclub_id" value="<? echo ($_POST[triclub_id]); ?>">
<input type="hidden" name="triclub_submitted_by" value="<? echo ($_POST[triclub_submitted_by]); ?>">
<input type="submit" name="submit" value="Edit Information" class="btn float-left" />
</form>
</div>
</div>
</div>

View File

@ -0,0 +1,64 @@
<?PHP
$sqlregionlist = "SELECT gtr.regionlong AS regionlong, gtr.regionid AS regionid, gtr.regionname AS regionname, gts.statetag AS statetag, gts.statelong AS statelong, COUNT(gt.triclub_id) AS numclubs
FROM ".$prefix."TriathlonsStates AS gts
LEFT JOIN ".$prefix."Triclubs AS gt
ON gts.statetag = gt.triclub_state_tag AND gt.triclub_valid = 1
LEFT JOIN ".$prefix."TriathlonsRegions AS gtr
ON gts.regionid = gtr.regionid
GROUP BY gtr.regionlong, gts.statetag ORDER BY gtr.regionlong ASC";
//echo $sqlregionlist;
$resultregionlist = mysql_query($sqlregionlist);
?>
<div class="widget">
<h2>Browse TriClubs</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 != '') {
$region_dropdown .= "<option value=\"$site_url/regionlist.php?region=$currentrid\"$selected_region>$currentregion ($regioncount)</option>$state_string";
echo ("<div class='list-item'><a href='$site_url/regionlist.php?region=$currentrid'>" . $currentregion . " (" . $regioncount . ")</a><span>+</span><div class='sublist' id='". $currenttag . "'>");
echo $tempstring;
echo ("</div></div>\n");
}
$currentregion = $rowregionlist[regionlong];
$currentrid = $rowregionlist[regionid];
$currenttag = $rowregionlist[regionname];
$regioncount = 0;
$tempstring = '';
$state_string = '';
}
if ($selected_item == $rowregionlist[statetag]) {
$selected_state = ' selected="selected"';
}
$state_string .= "<option value=\"$site_url/statelist.php?state=$rowregionlist[statetag]\"$selected_state>&nbsp;&nbsp;&nbsp;$rowregionlist[statelong] ($rowregionlist[numclubs])</option>";
$tempstring = $tempstring. "<a href='$site_url/statelist.php?state=$rowregionlist[statetag]".get_sid()."' class='lhdr' title='$rowregionlist[statelong]'>$rowregionlist[statelong] ($rowregionlist[numclubs])</a>\n";
$regioncount += $rowregionlist[numclubs];
}
echo ("<div class='list-item'><a href='$site_url/regionlist.php?region=$currentrid'>".$currentregion." (".$regioncount.")</a><span>+</span><div class='sublist' id='".$currenttag."'>");
echo $tempstring;
echo ('</div></div>');
if ( $selected_item == 'top') { $selected_region = ' selected="selected"'; }
$region_dropdown .= "<option value=\"" . $site_url . '/top.php' . "\"$selected_region>Top Ranked</option>";
?>
</div>
</div>

View File

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

View File

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

View File

@ -0,0 +1,23 @@
<div class="list-block grid">
<div class="col-1-1 clearfix">
<h3 class="float-left"><a href="<? echo "individual.php?triclub_id=$row[triclub_id]"; ?>"><? echo $row[triclub_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[triclub_address]");
if ($row[triclub_address_two]) { echo ("<br />$row[triclub_address_two]"); }
echo("<br />$row[triclub_city], $row[triclub_state] $row[triclub_zip]");
?>
<br />Phone: <? echo $row[triclub_phone] ?>
<br />Fax: <? echo $row[triclub_fax] ?>
</div>
<div class="col-1-2">
Email: <? echo "<a href='mailto:$row[triclub_email]'>$row[triclub_email]</a>"; ?><br/>
Website: <? echo "<a href='$row[triclub_website]' target='_blank'>$row[triclub_website]</a>"; ?><br/>
<? if ($row[triclub_cart] == 1) { echo ("**eCommerce Shopping Cart**<br />"); } ?>
<a href="<? echo "individual.php?triclub_id=$row[triclub_id]"; ?>">More info &gt;</a>
</div>
</div>

118
site/triclubs/index.php Normal file
View File

@ -0,0 +1,118 @@
<?PHP include("config.php");
// set the page title
$pagetitle = "Triathlon & Multisport Clubs";
// set meta tags
$meta_keywords = "triathlon, trifind, duathlon";
$meta_description = "Are you trying to find triathlon clubs in near your area? You can browse all triathlon clubs organized by states, to find which ones you want to join.";
?>
<? include("include_common_head.php"); ?>
<body class="listings">
<? include($common_path . "/ads/ad_wallpaper.html"); ?>
<div class="container">
<? include($common_path . "/templates/include_header.php"); ?>
<div class="main">
<div class="contentwrapper clearfix">
<? include("include_breadcrumb.php"); ?>
<section class="section listings section-has-widgets section-static remove-sidebar">
<div class="sidebar-b">
<? include("include_sidebar.php"); ?>
</div>
<div class="content content-has-widgets">
<div class="grid">
<div class="clearfix">
<h1 class="float-left">Triathlon Clubs</h1>
<? if (is_logged_in($user)) { ?>
<a href="<? echo $site_url . '/add.php' ?>" class="btn btn-white float-right">Add TriClub</a>
<? } ?>
<hr class="line" />
<? include("../runshops/include_region_list.php"); ?>
<div class="map-container">
<div id="map" class="map" data-name="triclub" data-json="<? echo $main_site_url ?>/googlemaps/json/triclub.json"></div><!--xml relative path from js folder -->
</div>
<div class="content">
<?
$num = mysql_num_rows(mysql_query("SELECT triclub_id FROM gforum_Triclubs WHERE triclub_valid=1"));
?>
<h3>Welcome to Slowtwitch.com's North American Triathlon & Multisport Club Database</h3>
<p><? echo($num) ?> clubs and counting. This collection of triclubs is the most complete and comprehensive
selection of tri-specific clubs in North America.</p>
<h3>Browsing the database</h3>
<p>
You do not need to log in to do this. You'll find a list of clubs 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 clubs in it. If you want to see clubs 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 club</h3>
<p>
When you see your local club listed here, you may click the "I'M A MEMBER" button. Your User Name will be added to the clubs's list of members,
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 club of choice.
</p>
<div class="advert float-left">
<? include($common_path . "/ads/ad_300x250_roadblocks.html"); ?>
</div>
<h3>How to enter a club</h3>
<p>You must be a registered user to add a club 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 clubs 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 CLUB button to begin adding to the database.
<br /><br />
2. Once you SUBMIT your club, 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 club, 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 club registration as a way to spam
our database.
</p>
<h3>How to edit published information about a triclub</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 club</h3>
<p>Any registered user may make a comment on a club listing. These comments are subject to validation by an administrator before being published.</p>
<h3>Global tri club map</h3>
<p>The map below shows the location of all registered Slowtwitch triathlon clubs 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 triathlon club and a street address.</p>
</div><!-- end content -->
</div><!-- end col-2/3 -->
</div><!-- end grid -->
</div><!-- end content -->
</section>
</div><!-- end contentwrapper -->
</div> <!-- end main -->
<? include($common_path . "/templates/include_footer.php") ?>
</div> <!-- container -->
</body>
<? include($common_path . "/templates/include_global_js.php") ?>
</html>

View File

@ -0,0 +1,207 @@
<?PHP
include("config.php");
require_once("class/rating/classes/include.all.php");
$triclub_idhere = mysql_real_escape_string($_GET[triclub_id]);
$results = mysql_query("SELECT * FROM ".$prefix."Triclubs WHERE triclub_id=$triclub_idhere LIMIT 1");
$row = mysql_fetch_array($results);
if (!$row){header('Location: '.$site_url.'/?error=invalid_id');}
if($row[triclub_valid] == 0) {
if(!is_admin($user)){
header('Location: '.$site_url);
exit();
}
}
// set the page title
$pagetitle = $row[triclub_name];
// set meta tags
$meta_keywords = "triathlon, ".$row[triclub_name].", ".$row[triclub_state]." triathlon club";
$meta_description = "Considering joining ".$row[triclub_name]."? Here is all of the information about this triathlon club.";
?>
<? 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[triclub_state]); ?>
<? include("include_sidebar.php"); ?>
</div>
<div class="content content-has-widgets">
<div class="grid">
<div class="clearfix">
<? include("include_starfunc.php"); ?>
<h1 class="float-left">Triathlon Clubs</h1>
<? if ($user) { ?>
<form method="post" action="wiki_edit.php?retailer_id=<? echo $row[triclub_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[triclub_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[triclub_address])); ?><br />
<? if ( $row[triclub_address_two] ) { echo stripslashes(htmlspecialchars($row[triclub_address_two]) . "<br />"); } ?>
<? echo stripslashes(htmlspecialchars($row[triclub_city])); ?>, <? echo stripslashes(htmlspecialchars($row[triclub_state])); ?> <? echo stripslashes(htmlspecialchars($row[triclub_zip])); ?><br />
Phone: <? echo stripslashes(htmlspecialchars($row[triclub_phone])); ?><br />
Fax: <? echo stripslashes(htmlspecialchars($row[triclub_fax])); ?>
</div>
<div class="col-6-12 contact">
Email: <a href="mailto:<? echo $row[triclub_email]; ?>"><? echo stripslashes(htmlspecialchars($row[triclub_email])); ?></a><br />
<span class="briefy-b">Website: <a href="<? echo $row[triclub_website]; ?>" target="_blank"><? echo stripslashes(htmlspecialchars($row[triclub_website])); ?></a></span>
</div>
<div class="clearfix"></div>
<? if($_GET[review_add] == 'ok') { ?>
<p class="success"><strong>Commenter:</strong> your comments have been submitted and will be validated within 24 hours.</p>
<? } ?>
<? if($_GET[wiki_change] == 'success') { ?>
<p class="success"><strong>Editor:</strong> your changes have been submitted and will be validated within 24 hours.</p>
<? } ?>
<? $wikiFetchSQL = "SELECT edit_id FROM ".$prefix."TriclubsEdits WHERE triclub_id_fk = '".intval(mysql_escape_string($_GET[triclub_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"); ?>
</div>
<div class="col-1-1 detail-block">
<h3>Membership</h3>
<div class="highlight-block">
<strong>Club President: </strong><? echo stripslashes(htmlspecialchars($row[triclub_president])); ?><br />
<strong>Board Member(s): </strong><? if ($row[triclub_board] == 0) { echo "None"; } else { echo "Yes, Their Names - "; echo stripslashes($row[triclub_board_names]); } ?> <br />
<strong>Total Membership: </strong><? echo $row[triclub_membership]; ?><br />
<strong>Club Dues: </strong><? echo stripslashes(htmlspecialchars($row[triclub_dues])); ?>
</div>
</div>
<div class="col-1-1 detail-block">
<h3>General Information</h3>
<div class="highlight-block">
<strong>Club Info: </strong><? echo stripslashes(stripslashes($row[triclub_info])) ?>
<br />
<strong>Club Sponsors: </strong><? echo stripslashes(stripslashes($row[triclub_sponsors])) ?>
<br />
<strong>Club Discounts: </strong><? echo stripslashes(stripslashes($row[triclub_discounts])) ?>
<br />
<strong>Directions to Workouts &amp; Meeting Location(s): </strong><? echo stripslashes(stripslashes($row[triclub_directions])); ?>
<br />
<strong>Club Workout Schedule: </strong><? echo stripslashes(stripslashes($row[triclub_workouts])); ?>
<br />
<strong>Club Meetings &amp; Events Schedule: </strong><? echo stripslashes(stripslashes($row[triclub_meetings])); ?>
</div>
</div>
<div class="col-1-1">
<div id="map" class="map map-single" data-name="single" data-category="triclub" data-lat="<? echo $row[triclub_lat] ?>" data-lng="<? echo $row[triclub_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>Racers</h3>
<div class="highlight-block">
<a name="racers"></a>
<?
$testresults = mysql_query("SELECT triclub_member_tags FROM ".$prefix."Triclubs WHERE triclub_id=$row[triclub_id]");
$testrow = mysql_fetch_array($testresults);
$tags = explode(",", $testrow[triclub_member_tags]);
$numcount = count($tags) - 1;
if($numcount == 0){ $phrase = "No users have tagged this club yet."; }
else if($numcount == 1){ $phrase = "There is 1 user who has tagged this club:"; }
else{ $phrase = "There are $numcount users who have tagged this club: "; }
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 ", "; }
echo "<a href=\"http://forum.slowtwitch.com/gforum.cgi?username=$temprow[user_username]&session=".$_SESSION['session_id']."&from=triclubs\">$temprow[user_username]</a>";
}
$i++;
}
?>
</div>
</div>
<div class="col-1-1 detail-block">
<a name="editors"></a>
<?
$testresults = mysql_query("SELECT * FROM ".$prefix."TriclubsEditors WHERE triclub_id_fk=$row[triclub_id] ORDER BY edit_timestamp DESC");
$numcount = mysql_num_rows($testresults);
if($numcount == 0){ $phrase = "No updates have been made this club yet."; }
else if($numcount == 1){ $phrase = "There has been 1 update to this club:"; }
else{ $phrase = "There have been $numcount updates to this club: "; }
?>
<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=racecalendar\">$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/triclubs/logout.php Normal file
View File

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

View File

@ -0,0 +1,82 @@
<?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."TriathlonsRegions WHERE regionid = '".mysql_real_escape_string($_GET[region])."' LIMIT 1");
$row = mysql_fetch_array($results);
$regionname = $row[regionlong];
$selected_item = mysql_real_escape_string($_GET[region]);
$results = mysql_query("SELECT gt.triclub_id, gt.triclub_name, gt.triclub_address, gt.triclub_address_two, gt.triclub_city, gt.triclub_state, gt.triclub_zip, gt.triclub_email, gt.triclub_website
FROM ".$prefix."Triclubs AS gt
RIGHT JOIN ".$prefix."TriathlonsStates AS gts
ON gts.regionid = '".mysql_real_escape_string($_GET[region])."' AND gt.triclub_state_tag = gts.statetag
WHERE gt.triclub_valid = 1 ORDER BY gt.triclub_name ASC");
$none = FALSE;
if (mysql_num_rows($results) == 0) {
$none = TRUE;
}
// set the page title
$pagetitle = $regionname;
// set meta tags
$meta_keywords = "triathlon clubs in ".$regionname;
$meta_description = "Trying to find triathlon clubs in ".$regionname."? Here is a listing of all ".$regionname." triathlon clubs.";
?>
<? include("include_common_head.php"); ?>
<body class="listings">
<? include($common_path . "/ads/ad_wallpaper.html"); ?>
<div class="container">
<? include($common_path . "/templates/include_header.php"); ?>
<div class="main">
<div class="contentwrapper clearfix">
<? include("include_breadcrumb.php"); ?>
<section class="section listings section-has-widgets section-static remove-sidebar">
<div class="sidebar-b">
<? include("include_sidebar.php"); ?>
</div>
<div class="content content-has-widgets">
<div class="grid">
<div class="clearfix">
<h1 class="float-left">Triathlon Clubs</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 TriClub</a>
<? } ?>
<hr class="line" />
<? include("../runshops/include_region_list.php"); ?>
<h2><? echo $regionname ?> Region</h2>
<hr />
<?
if($none == TRUE){
echo "<p>No triathlon clubs have been entered yet for $regionname.</p>";
}
?>
<? while ($row = mysql_fetch_array($results)) {
include("include_store.php");
} ?>
</div><!-- end col-2/3 -->
</div><!-- end grid -->
</div><!-- end content -->
</section>
</div><!-- end contentwrapper -->
</div> <!-- end main -->
<? include($common_path . "/templates/include_footer.php") ?>
</div> <!-- container -->
</body>
<? include($common_path . "/templates/include_global_js.php") ?>
</html>

127
site/triclubs/statelist.php Normal file
View File

@ -0,0 +1,127 @@
<?PHP include("config.php");
require_once("class/rating/classes/include.all.php");
include("class/rating/int.to.words.php");
$results = mysql_query("SELECT triclub_state FROM ".$prefix."Triclubs WHERE triclub_state_tag='".mysql_real_escape_string($_GET[state])."' AND triclub_valid = 1 LIMIT 1");
$row = mysql_fetch_array($results);
$statename = $row[triclub_state];
$none = FALSE;
if(mysql_num_rows($results) < 1){
$statename = substr(mysql_real_escape_string($_GET[state]),0,20);
if($statename == "districtofcolumbia"){
$statename = "District of Columbia";
}
if($statename == "centralamerica"){
$statename = "Central America";
}
if(($statename == "newhampshire")){
$statename = "New Hampshire";
}
if($statename == "newjersey"){
$statename = "New Jersey";
}
if($statename == "newmexico"){
$statename = "New Mexico";
}
if($statename == "newyork"){
$statename = "New York";
}
if($statename == "northcarolina"){
$statename = "North Carolina";
}
if($statename == "northdakota"){
$statename = "North Dakota";
}
if($statename == "southcarolina"){
$statename = "South Carolina";
}
if($statename == "southdakota"){
$statename = "South Dakota";
}
if($statename == "westvirginia"){
$statename = "West Virginia";
}
if($statename == "britishcolumbia"){
$statename = "British Columbia";
}
if($statename == "newbrunswick"){
$statename = "New Brunswick";
}
if($statename == "novascotia"){
$statename = "Nova Scotia";
}
if($statename == "princeedwardisland"){
$statename = "Prince Edward Island";
}
$statename = ucfirst($statename);
$none = TRUE;
}
$results = mysql_query("SELECT triclub_id, triclub_name, triclub_address, triclub_address_two, triclub_city, triclub_state, triclub_zip, triclub_email, triclub_website FROM ".$prefix."Triclubs WHERE triclub_state_tag='".substr(mysql_real_escape_string($_GET[state]),0,20)."' AND triclub_valid=1 ORDER BY triclub_name ASC");
// set the page title
$pagetitle = $statename;
$selected_item = substr(mysql_real_escape_string($_GET[state]),0,20);
// set meta tags
$meta_keywords = "triathlon clubs in ".$statename;
$meta_description = "Trying to find triathlon clubs in ".$statename."? Here is a listing of all ".$statename." triathlon clubs. Users can even rate and comment on these clubs.";
?>
<? include("include_common_head.php"); ?>
<body class="listings">
<? include($common_path . "/ads/ad_wallpaper.html"); ?>
<div class="container">
<? include($common_path . "/templates/include_header.php"); ?>
<div class="main">
<div class="contentwrapper clearfix">
<? include("include_breadcrumb.php"); ?>
<section class="section listings section-has-widgets section-static remove-sidebar">
<div class="sidebar-b">
<? include("include_sidebar.php"); ?>
</div>
<div class="content content-has-widgets">
<div class="grid">
<div class="clearfix">
<h1 class="float-left">Triathlon Clubs</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 TriClub</a>
<? } ?>
<hr class="line" />
<? include("../runshops/include_region_list.php"); ?>
<h2><? echo $statename ?> State</h2>
<hr />
<?
if($none == TRUE){
echo "<p>No triathlon clubs 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>

71
site/triclubs/top.php Normal file
View File

@ -0,0 +1,71 @@
<?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(gtr.rating_ip)) AS respondents, ROUND(AVG(gtr.rating_vote), 2) AS score, COUNT(gtr.rating_vote) AS votes, gt.triclub_id, gt.triclub_name, gt.triclub_address, gt.triclub_address_two, gt.triclub_city, gt.triclub_state, gt.triclub_zip, gt.triclub_email, gt.triclub_website FROM ".$prefix."TriclubsRating AS gtr RIGHT JOIN ".$prefix."Triclubs AS gt ON gt.triclub_id = gtr.triclub_id_fk GROUP BY gtr.triclub_id_fk HAVING COUNT(gtr.rating_vote) > 10 ORDER BY score DESC, votes DESC LIMIT 10");
$none = FALSE;
if (mysql_num_rows($results) == 0) {
$none = TRUE;
}
// set the page title
$pagetitle = "Top Triathlon Clubs";
// set meta tags
$meta_keywords = "top ranked triclubs";
$meta_description = "Top ranked triathlon clubs based on rankings submitted by the user.";
?>
<? include("include_common_head.php"); ?>
<body class="listings">
<? include($common_path . "/ads/ad_wallpaper.html"); ?>
<div class="container">
<? include($common_path . "/templates/include_header.php"); ?>
<div class="main">
<div class="contentwrapper clearfix">
<? include("include_breadcrumb.php"); ?>
<section class="section listings section-has-widgets section-static remove-sidebar">
<div class="sidebar-b">
<? $selected_item = 'top'; ?>
<? include("include_sidebar.php"); ?>
</div>
<div class="content content-has-widgets">
<div class="grid">
<div class="clearfix">
<h1>Top Ranked Triathlon Clubs</h1>
<hr class="line" />
<? include("../runshops/include_region_list.php"); ?>
<?
if($none == TRUE){
echo "<p>No running stores have been entered yet for $regionname.</p>";
}
?>
<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>

View File

@ -0,0 +1,83 @@
<?PHP
include("config.php");
if(!is_admin($user)){
header('Location:'.$site_url.'/');
}
// Query to fetch non-validated races:
$results = mysql_query("SELECT triclub_id, triclub_name, triclub_address, triclub_address_two, triclub_city, triclub_state, triclub_zip, triclub_email, triclub_website FROM ".$prefix."Triclubs WHERE triclub_valid=0 ORDER BY triclub_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: Triclub 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 Triclubs</strong></h1>
<form method="post" action="validate_X.php" enctype="multipart/form-data">
<?
if($none == TRUE){
echo "There are no triclubs 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?triclub_id=$row[triclub_id]"; ?>"><? echo $row[triclub_name]; ?></a></div></div>
<div class="drow"><div class="dcell"><strong class="indent">Address:</strong> <? echo ("$row[triclub_address]"); if($row[triclub_address_two]) { echo ("<br /><span class='indent'>$row[triclub_address_two]</span>"); } echo("<br /><span class='indent'>$row[triclub_city], $row[triclub_state] $row[triclub_zip]</span>"); ?></div></div>
<div class="drow"><div class="dcell">
<strong>Email:</strong> <? echo "<a href='mailto:$row[triclub_email]'>$row[triclub_email]</a>"; ?><br />
<strong>Website:</strong> <? echo "<a href='$row[triclub_website]' target='_blank'>$row[triclub_website]</a>"; ?>
<br>
<a class="nav" href="<? echo "individual.php?triclub_id=$row[triclub_id]"; ?>">More information</a>
<br /><input type="checkbox" value="<? echo($row[triclub_id]); ?>" name="validate[]"> Validate this triclub. <input type="checkbox" value="<? echo($row[triclub_id]); ?>" name="delete[]"> Delete this triclub.
</div></div>
<? } ?>
</div>
<input type="submit" value="Validate Selected Triclubs" class="btn">
</form>
</div><!-- end col-2/3 -->
</div><!-- end grid -->
</div><!-- end content -->
</section>
</div><!-- end contentwrapper -->
</div> <!-- end main -->
<? include($common_path . "/templates/include_footer.php") ?>
</div> <!-- container -->
</body>
<? include($common_path . "/templates/include_global_js.php") ?>
</html>

View File

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

View File

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

352
site/triclubs/wiki_edit.php Normal file
View File

@ -0,0 +1,352 @@
<?PHP
include("config.php");
if(!isset($_GET[triclub_id]) AND !$_POST AND !is_numeric($_GET[triclub_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_club])) {
$row = $_POST;
} else {
$triclub_idhere = mysql_real_escape_string($_GET[triclub_id]);
$results = mysql_query("SELECT * FROM ".$prefix."Triclubs WHERE triclub_id=".$triclub_idhere);
$row = mysql_fetch_array($results);
}
//Get user's session data information
$username = base64_decode($_SESSION['user']);
$useruid = base64_decode($_SESSION['user_id']);
if ( !is_admin() && $row[triclub_valid] != 1 ) {
//echo "row: ".$row[triclub_valid];
header('Location: '.$site_url.'/?error=club_not_valid');
exit();
}
// set the page title
$pagetitle = "Edit A Triathlon Club";
// set meta tags
$meta_keywords = "edit a triathlon club";
$meta_description = "edit screen for triathlon club information";
?>
<?
if($row[edit_club] == 1){
include("wiki_edit_X.php");
}
//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");
?>
<? 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( $_GET[confirmed] == "yes" ) { ?>
<h1>Thank you</h1>
<? echo "<p>Thank you. Your club should be added within 24 hours. You will now be redirected back to the add page.</p>";
echo "<META HTTP-EQUIV=Refresh CONTENT=\"4; URL=add.php\">";
} else if($confirm == 1){ ?>
<h1>Edit a Club: Step 2 of 2</h1>
<? } else if( ($confirm !=1) && ($row[confirm_entry] != 1)){ ?>
<h1>Edit a Club: Step 1 of 2</h1>
<? } else if( ($row[edit_club] == 1) && (!$errmsg) && ($row[confirm_entry] == 1)){ ?>
<h1>Thank you</h1>
<? }
if(($confirm != 1) && ($row[triclub_confirm_entry] != 1) && $_GET[confirmed] != "yes"){ ?>
<p>To edit a club, simply change the data you wish. If you make a mistake, just hit the reset button. <font color="red">To save the changes as a NEW club (for instance, if you have multiple chapters), hit the "SAVE AS A NEW CLUB" button. To save changes to the existing club entry, hit the "SAVE CHANGES TO YOUR CLUB" button. You will have a chance to review the data before confirming.</font> <!--Pictures are optional, and you can upload a maximum of 3 photos. The maximum file size for each picture is 600k.--></p>
<? } ?>
<? include("../runshops/include_region_list.php"); ?>
<? if( $_GET[confirmed] != "yes" && (($row[edit_club] != 1) || ($errmsg) || (($confirm != 1) && ($row[triclub_confirm_entry] != 1))) ) { ?>
<form enctype="multipart/form-data" action="wiki_edit.php" method="post">
<p class="cont"><font color="red"><? echo $errmsg; ?></font></p>
<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="triclub_name" value="<? echo stripslashes($row[triclub_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="triclub_address" value="<? echo stripslashes(htmlspecialchars($row[triclub_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="triclub_address_two" value="<? echo stripslashes(htmlspecialchars($row[triclub_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="triclub_city" value="<? echo stripslashes(htmlspecialchars($row[triclub_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="triclub_state">
<option value="0">Choose a State/Province</option>
<?
foreach($state_list as $key=>$value) {
if(strcmp($row[triclub_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="triclub_zip" value="<? echo stripslashes(htmlspecialchars($row[triclub_zip])); ?>" 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="triclub_email" value="<? echo stripslashes(htmlspecialchars($row[triclub_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="triclub_website" value="<? echo stripslashes(htmlspecialchars($row[triclub_website])); ?>" class="txt lngtext" placeholder="http://" />
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
for ($i = 0; $i < 25; $i++) echo("*");
echo (" MEMBERSHIP ");
for ($i = 0; $i < 25; $i++) echo("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">President</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($row[triclub_president])); ?>" type="text" name="triclub_president" class="txt lngtext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Board Members(s)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="radio" name="triclub_board" value="0" <? if ($row[triclub_board] == 0){ echo 'checked'; } ?>>None
<input type="radio" name="triclub_board" value="1" <? if ($row[triclub_board] == 1){ echo 'checked'; } ?>>Yes, Their Names:
<input value="<? echo stripslashes($row[triclub_board_names]); ?>" type="text" name="triclub_board_names" class="txt midtext">
</div>
</div>
<div class="drow">
<div class="dcell name">Total Membership</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($row[triclub_membership])); ?>" type="text" name="triclub_membership" class="txt smltext" /> (number of members only)
</div>
</div>
<div class="drow">
<div class="dcell name">Dues</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($row[triclub_dues])); ?>" type="text" name="triclub_dues" class="txt smltext" />
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
for ($i = 0; $i < 63; $i++) echo("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Club Info</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="triclub_info" class="txt lngtext" placeholder="Please write some information about your club."><? if($row[triclub_info]){ echo strip_tags(stripslashes($row[triclub_info])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Sponsors</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="triclub_sponsors" class="txt lngtext" placeholder="Please write some information about your club sponsors."><? if($row[triclub_sponsors]) { echo strip_tags(stripslashes($row[triclub_sponsors])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Discounts</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="triclub_discounts" class="txt lngtext" placeholder="Please write some information about any discounts offered to club members."><? if($row[triclub_discounts]){ echo strip_tags(stripslashes($row[triclub_discounts])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Directions to Workouts &amp; Meeting Location(s)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="triclub_directions" class="txt lngtext" placeholder="Please describe how to get to your club's meetings and workouts from your surrounding area."><? if($row[triclub_directions]){ echo strip_tags(stripslashes($row[triclub_directions])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Workout</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="triclub_workouts" class="txt lngtext" placeholder="Please list the schedule of your organized group workouts."><? if($row[triclub_workouts]){ echo strip_tags(stripslashes($row[triclub_workouts])); } ?></textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Meetings</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="triclub_meetings" class="txt lngtext" placeholder="Please list the schedule of any organized club meetings."><? if($row[triclub_meetings]){ echo strip_tags(stripslashes($row[triclub_meetings])); } ?></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 Club Info" class="btn" />
<input type="submit" name="new_club" value="Save As A New Club" class="btn" />
<input type="reset" value="Reset" class="btn" />
<input type="hidden" name="edit_club" value="1" />
<input type="hidden" name="triclub_id" value="<? echo($row[triclub_id]); ?>" />
<? // need to temporary set the field as being valid ?>
<input type="hidden" name="triclub_valid" value="1" />
<input type="hidden" name="triclub_submitted_by" value="<? echo($row[triclub_submitted_by]); ?>" />
<input type="hidden" name="edited_by" value="<? echo($useruid); ?>" />
</div>
</div>
</div>
</form>
<?
} else {
if ($confirm == 1){
$confirm = 0;
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>

View File

@ -0,0 +1,135 @@
<?PHP
if (!$_POST){ header('Location: '.$site_url.'/?error=no_post'); }
/*
FIELD NAMES:
triclub_id
triclub_name
triclub_name_tag
triclub_address
triclub_address_two
triclub_city
triclub_state
triclub_state_tag
triclub_zip
triclub_email
triclub_website
triclub_president
triclub_board
triclub_board_names
triclub_membership
triclub_dues
triclub_info
triclub_sponsors
triclub_discounts
triclub_directions
triclub_workouts
triclub_meetings
triclub_submitted_by
triclub_valid
triclub_member_tags
*/
/* Need to ltrim and rtrim commas before insertion */
//Insert into database
//$pass = 'abc123';
$errmsg = NULL;
//if(strcmp($_POST[password], $pass) == 0){ //Password is good
//Check for blank fields
if ((!$_POST[triclub_name])) $errmsg = $errmsg."Shop name, ";
if (!$_POST[triclub_city]) $errmsg = $errmsg."City, ";
if (!$_POST[triclub_state]) $errmsg = $errmsg."State, ";
if (!$_POST[triclub_address]) $errmsg = $errmsg."Address, ";
if (!$_POST[triclub_email]) $errmsg = $errmsg."Email, ";
if (!$_POST[triclub_website]) $errmsg = $errmsg."Website, ";
if (!$_POST[triclub_president]) $errmsg = $errmsg."President, ";
if (!$_POST[triclub_dues]) $errmsg = $errmsg."Dues, ";
if (!$_POST[triclub_membership]) $errmsg = $errmsg."Membership, ";
if ($_POST[triclub_contact] == 1 && !$_POST[triclub_contact_names]) $errmsg = $errmsg."Board names, ";
if (strlen($_POST[triclub_info]) < 4) $errmsg = $errmsg."Club info, ";
if (strlen($_POST[triclub_sponsors]) < 4) $errmsg = $errmsg."Club sponsors, ";
if (strlen($_POST[triclub_discounts]) < 4) $errmsg = $errmsg."Club discounts, ";
if (strlen($_POST[triclub_directions]) < 4) $errmsg = $errmsg."Directions, ";
if (strlen($_POST[triclub_workouts]) < 4) $errmsg = $errmsg."Club workouts, ";
if (strlen($_POST[triclub_meetings]) < 4) $errmsg = $errmsg."Club meetings, ";
if (isset($errmsg)) {
$errmsg = "The following fields cannot be left blank: ".$errmsg."<br />";
$errmsg = rtrim($errmsg, ", ");
}
if (!is_numeric($_POST[triclub_membership])) $errmsg = $errmsg."Membership must be a number ONLY<br />";
$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[triclub_website]) ) {
// Contains invalid characters.
$errmsg = $errmsg."Invalid Web Address<br />";
}
if( preg_match('/[^a-zA-Z0-9\. ]/', $_POST[triclub_name]) ) {
// Contains invalid characters.
$errmsg = $errmsg."Please use only letters and numbers in the name<br />";
}
if(!$errmsg){
$name = trim($_POST[triclub_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[triclub_address]));
if (isset($_POST['triclub_address_two'])) { $address_two = mysql_escape_string(trim($_POST[triclub_address_two])); } else { $triclub_address_two = NULL; }
$city = mysql_escape_string(trim($_POST[triclub_city]));
$state = $_POST[triclub_state];
$state_tag = strtolower(str_replace(" ","", $state));
$zip = mysql_escape_string(trim($_POST[triclub_zip]));
$email = mysql_escape_string(trim($_POST[triclub_email]));
$website = mysql_escape_string(trim($_POST[triclub_website]));
$president = mysql_escape_string(trim($_POST[triclub_president]));
$dues = mysql_escape_string(trim($_POST[triclub_dues]));
$membership = mysql_escape_string(trim($_POST[triclub_membership]));
$board = $_POST[triclub_board];
if ( $board == 0 ){ $board_names = NULL; }else{ $board_names = mysql_escape_string(trim($_POST[triclub_board_names])); }
$info = mysql_escape_string(nl2br(substr(trim($_POST[triclub_info]), 0, 4096)));
$sponsors = mysql_escape_string(nl2br(substr(trim($_POST[triclub_sponsors]), 0, 4096)));
$discounts = mysql_escape_string(nl2br(substr(trim($_POST[triclub_discounts]), 0, 4096)));
$directions = mysql_escape_string(nl2br(substr(trim($_POST[triclub_directions]), 0, 4096)));
$workouts = mysql_escape_string(nl2br(substr(trim($_POST[triclub_workouts]), 0, 4096)));
$meetings = mysql_escape_string(nl2br(substr(trim($_POST[triclub_meetings]), 0, 4096)));
$submitted_by = $_POST[triclub_submitted_by];
$id = $_POST[triclub_id];
$edited_by = $_POST[edited_by];
$edit_timestamp = time();
// BEGIN CONFIRM ENTRY CHECK
if($_POST[confirm_entry] == 1){
if(isset($_POST[new_club])){
$sql = "INSERT INTO ".$prefix."Triclubs (triclub_name, triclub_name_tag, triclub_address, triclub_address_two, triclub_city, triclub_state, triclub_state_tag, triclub_zip, triclub_email, triclub_website, triclub_president, triclub_board, triclub_board_names, triclub_membership, triclub_dues, triclub_info, triclub_sponsors, triclub_discounts, triclub_directions, triclub_workouts, triclub_meetings, triclub_submitted_by, triclub_valid) VALUES ('$name', '$name_tag', '$address', '$address_two', '$city', '$state', '$state_tag', '$zip', '$email', '$website', '$president', $board, '$board_names', '$membership', '$dues', '$info', '$sponsors', '$discounts', '$directions', '$workouts', '$meetings', '$submitted_by', 0)";
//echo("club entered!");
//echo($sql);
mysql_query($sql) OR die(mysql_error());
header('Location: '.$site_url.'/add.php?confirmed=yes');
} elseif(isset($_POST[save_changes])) {
$sql = "INSERT INTO ".$prefix."TriclubsEdits (triclub_id_fk, editor_user_id_fk, edit_timestamp, triclub_name, triclub_name_tag, triclub_address, triclub_address_two, triclub_city, triclub_state, triclub_state_tag, triclub_zip, triclub_email, triclub_website, triclub_president, triclub_board, triclub_board_names, triclub_membership, triclub_dues, triclub_info, triclub_sponsors, triclub_discounts, triclub_directions, triclub_workouts, triclub_meetings, triclub_submitted_by, triclub_valid) VALUES ('$id', '$edited_by', '$edit_timestamp', '$name', '$name_tag', '$address', '$address_two', '$city', '$state', '$state_tag', '$zip', '$email', '$website', '$president', $board, '$board_names', '$membership', '$dues', '$info', '$sponsors', '$discounts', '$directions', '$workouts', '$meetings', '$submitted_by', 0)";
mysql_query($sql) OR die(mysql_error());
header('Location: '.$site_url.'/individual.php?triclub_id='.$id.'&wiki_change=success');
} else {
header('Location: '.$site_url.'/individual.php?triclub_id='.$id.'&changes=failure');
}
} else {
//echo("club NOT entered.");
$confirm = 1;
}
// END CONFIRM ENTRY CHECK
}
// END ERROR MESSAGE CHECK
?>

View File

@ -0,0 +1,98 @@
<?PHP include("config.php");
if(!is_admin($user)){
header('Location:'.$site_url.'/');
}
// Query to fetch non-validated triclubs:
$results = mysql_query("SELECT edit_id, triclub_name, triclub_city, triclub_state, triclub_info, edit_timestamp, triclub_submitted_by, editor_user_id_fk FROM ".$prefix."TriclubsEdits 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: Triclub 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[triclub_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[triclub_name]; ?></a></div></div>
<div class="drow"><div class="dcell">Edited on: <? 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 triclub submitter)"; } else { echo ""; } ?></div></div>
<div class="drow"><div class="dcell"><strong>Info:</strong>
<?
if(strlen($row[triclub_info]) > 400){
$phrase = "&hellip;"; }else{
$phrase = ""; }
echo substr(htmlspecialchars(strip_tags(stripslashes($row[triclub_info]))), 0, 160);
echo $phrase;
?>
</div></div>
<div class="drow"><td class="dcell">
<strong>Location:</strong> <? echo "$row[triclub_city], $row[triclub_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 Triclubs" class="btn">
</form>
</div><!-- end col-2/3 -->
</div><!-- end grid -->
</div><!-- end content -->
</section>
</div><!-- end contentwrapper -->
</div> <!-- end main -->
<? include($common_path . "/templates/include_footer.php") ?>
</div> <!-- container -->
</body>
<? include($common_path . "/templates/include_global_js.php") ?>
</html>

View File

@ -0,0 +1,103 @@
<?PHP
// do I need to do additional security checks to make sure the script is being called appropriately?
/*
FIELD NAMES:
triclub_id
triclub_name
triclub_name_tag
triclub_address
triclub_address_two
triclub_city
triclub_state
triclub_state_tag
triclub_zip
triclub_email
triclub_website
triclub_president
triclub_board
triclub_board_names
triclub_membership
triclub_dues
triclub_info
triclub_sponsors
triclub_discounts
triclub_directions
triclub_workouts
triclub_meetings
triclub_submitted_by
triclub_valid
triclub_member_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."TriclubsEdits 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."TriclubsEdits WHERE edit_id IN $validateList";
$results = mysql_query($sql) OR die(mysql_error());
// Loop through triclubs shifting edits over
while($row = mysql_fetch_array($results)) {
$sql = "UPDATE ".$prefix."Triclubs
SET triclub_name = '".mysql_escape_string($row[triclub_name])."',
triclub_name_tag = '".mysql_escape_string($row[triclub_name_tag])."',
triclub_address = '".mysql_escape_string($row[triclub_address])."',
triclub_address_two = '".mysql_escape_string($row[triclub_address_two])."',
triclub_city = '".mysql_escape_string($row[triclub_city])."',
triclub_state = '".mysql_escape_string($row[triclub_state])."',
triclub_state_tag = '".mysql_escape_string($row[triclub_state_tag])."',
triclub_zip = '".mysql_escape_string($row[triclub_zip])."',
triclub_email = '".mysql_escape_string($row[triclub_email])."',
triclub_website = '".mysql_escape_string($row[triclub_website])."',
triclub_president = '".mysql_escape_string($row[triclub_president])."',
triclub_board = '".mysql_escape_string($row[triclub_board])."',
triclub_board_names = '".mysql_escape_string($row[triclub_board_names])."',
triclub_membership = '".mysql_escape_string($row[triclub_membership])."',
triclub_dues = '".mysql_escape_string($row[triclub_dues])."',
triclub_info = '".mysql_escape_string($row[triclub_info])."',
triclub_sponsors = '".mysql_escape_string($row[triclub_sponsors])."',
triclub_discounts = '".mysql_escape_string($row[triclub_discounts])."',
triclub_directions = '".mysql_escape_string($row[triclub_directions])."',
triclub_workouts = '".mysql_escape_string($row[triclub_workouts])."',
triclub_meetings = '".mysql_escape_string($row[triclub_meetings])."'
WHERE triclub_id = '$row[triclub_id_fk]'";
//echo $sql;
//exit();
mysql_query($sql) OR die(mysql_error());
$sql = "INSERT INTO ".$prefix."TriclubsEditors (triclub_id_fk, user_id_fk, edit_timestamp) VALUES ('$row[triclub_id_fk]', '$row[editor_user_id_fk]', '$row[edit_timestamp]')";
mysql_query($sql) OR die(mysql_error());
$sql = "DELETE FROM ".$prefix."TriclubsEdits WHERE edit_id = $row[edit_id]";
mysql_query($sql) OR die(mysql_error());
}
}
header('Location: '.$site_url.'/wiki_validate.php');
?>

148
site/triclubs/wiki_view.php Normal file
View File

@ -0,0 +1,148 @@
<?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."TriclubsEdits 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[triclub_name];
// set meta tags
$meta_keywords = "triathlon, ".$row[triclub_name].", ".$row[triclub_state]." triathlon triclub";
$meta_description = "Considering joining ".$row[triclub_name]."? Here is all of the information about this triclub.";
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">
<h2 style="display: inline; height: 16px; margin-bottom: 20px;"><!-- class="content-title"--><? echo stripslashes($row[triclub_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[triclub_address])); ?>
<br />
<strong>Street Address Two: </strong><? echo stripslashes(htmlspecialchars($row[triclub_address_two])); ?>
<br />
<strong>City: </strong><? echo stripslashes(htmlspecialchars($row[triclub_city])); ?>
<br />
<strong>State: </strong><? echo stripslashes(htmlspecialchars($row[triclub_state])); ?>
<br />
<strong>Zip/Postal Code: </strong><? echo stripslashes(htmlspecialchars($row[triclub_zip])); ?>
<br />
<strong>E-mail: </strong><a href="mailto:<? echo $row[triclub_email]; ?>"><? echo stripslashes(htmlspecialchars($row[triclub_email])); ?></a>
<br />
<strong>Website: </strong><a href="<? echo $row[triclub_website]; ?>" target="_blank"><? echo $row[triclub_website]; ?></a>
<br />
<br />
<div class="indentlarge">
<?
for ($i = 0; $i < 33; $i++) echo("*");
echo (" MEMBERSHIP ");
for ($i = 0; $i < 33; $i++) echo("*");
?>
</div>
<br />
<strong>Club President: </strong><? echo stripslashes(htmlspecialchars($row[triclub_president])); ?>
<br />
<strong>Board Member(s): </strong><? if ($row[triclub_board] == 0) { echo "None"; } else { echo "Yes, Their Names - "; echo stripslashes($row[triclub_board_names]); } ?>
<br />
<strong>Total Membership: </strong><? echo $row[triclub_membership]; ?>
<br />
<strong>Club Dues: </strong><? echo stripslashes(htmlspecialchars($row[triclub_dues])); ?>
<br /><br />
<div class="indentlarge">
<?
for ($i = 0; $i < 80; $i++) echo("*");
?>
</div>
<br />
<strong>Club Info: </strong><? echo stripslashes(stripslashes($row[triclub_info])) ?>
<br /><br />
<strong>Club Sponsors: </strong><? echo stripslashes(stripslashes($row[triclub_sponsors])) ?>
<br /><br />
<strong>Club Discounts: </strong><? echo stripslashes(stripslashes($row[triclub_discounts])) ?>
<br /><br />
<strong>Directions to Meeting Location(s): </strong><? echo stripslashes(stripslashes($row[triclub_directions])); ?>
<br /><br />
<strong>Club Workout Schedule: </strong><? echo stripslashes(stripslashes($row[triclub_workouts])); ?>
<br /><br />
<strong>Club Meetings &amp; Events Schedule: </strong><? echo stripslashes(stripslashes($row[triclub_meetings])); ?>
<br /><br />
<strong>Directions to Workouts &amp; Meeting Location(s): </strong><? echo stripslashes(stripslashes($row[triclub_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>