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

556 lines
29 KiB
PHP

<?PHP
include("config.php");
if(!isset($_GET[retailer_id]) AND !$_POST AND !is_numeric($_GET[retailer_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_shop])) {
$row = $_POST;
} else {
$retailer_idhere = mysql_real_escape_string($_GET[retailer_id]);
$results = mysql_query("SELECT * FROM gforum_Retailers WHERE retailer_id=".$retailer_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[retailer_valid] != 1 ) {
header('Location: '.$site_url.'/?error=shop_not_valid');
exit();
}
// set the page title
$pagetitle = "Edit A Retailer";
// set meta tags
$meta_keywords = "edit retailer";
$meta_description = "edit screen for retailer information";
?>
<?
if($_POST[edit_shop] == 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>
<p class="cont">Thank you. Your shop should be added within 24 hours. You will now be redirected back to the homepage page.</p>
<meta HTTP-EQUIV="Refresh" CONTENT="4; URL=index.php" />
<? } else if ( $confirm == 1 ) { ?>
<h1><strong>Edit a Shop: Step 2 of 2</h1>
<? } else if ( ($confirm !=1) && ($_POST[confirm_entry] != 1)) { ?>
<h1>Edit a Shop: Step 1 of 2</h1>
<? } else if ( ($_POST[addshop] == 1) && (!$errmsg) && ($_POST[confirm_entry] == 1)) { ?>
<h1>Thank you</h1>
<? } ?>
<hr class="line" />
<? include("../runshops/include_region_list.php"); ?>
<? if (($confirm != 1) && ($_POST[confirm_entry] != 1) && $_GET[confirmed] != "yes") { ?>
<p class="cont">To edit a retailer, 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 retailer (for instance, if you have multiple locations), hit the "SAVE AS A NEW RETAILER" button. To save changes to the existing retailer entry, hit the "SAVE CHANGES TO YOUR SHOP" 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>
<? } ?>
<? if( $_GET[confirmed] != "yes" && (($_POST[edit_shop] != 1) || ($errmsg) || (($confirm != 1) && ($_POST[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">Shop Name</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="retailer_name" value="<? echo stripslashes($row[retailer_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="retailer_address" value="<? echo stripslashes(htmlspecialchars($row[retailer_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="retailer_address_two" value="<? echo stripslashes(htmlspecialchars($row[retailer_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="retailer_city" value="<? echo stripslashes(htmlspecialchars($row[retailer_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="retailer_state">
<option value="0">Choose a State/Province</option>
<?
foreach($state_list as $key=>$value){
if(strcmp($row[retailer_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="retailer_zip" value="<? echo stripslashes(htmlspecialchars($row[retailer_zip])); ?>" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Phone</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="retailer_phone" value="<? echo stripslashes(htmlspecialchars($row[retailer_phone])); ?>" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Fax</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="retailer_fax" value="<? echo stripslashes(htmlspecialchars($row[retailer_fax])); ?>" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">E-mail</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="retailer_email" value="<? echo stripslashes(htmlspecialchars($row[retailer_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="retailer_website" value="<? echo stripslashes(htmlspecialchars($row[retailer_website])); ?>" class="txt lngtext" placeholder="http://" />
</div>
</div>
<div class="drow">
<div class="dcell name">Online Shopping Cart</div>
<div class="dcell divider"></div>
<div class="dcell value">
<select name="retailer_cart">
<option value="0" <? if ($row[retailer_cart] == 0) { echo "selected='selected'"; } ?>>No</option>
<option value="1" <? if ($row[retailer_cart] == 1) { echo "selected='selected'"; } ?>>Yes</option>
</select> (Must be a fully functional ecommerce system)
</div>
</div>
<div class="dcell name">Spoke Alliance Member</div>
<div class="dcell divider"></div>
<div class="dcell value">
<select name="retailer_spoke">
<option value="0" <? if ($row[retailer_spoke] == 0) { echo "selected='selected'"; } ?>>No</option>
<option value="1" <? if ($row[retailer_spoke] == 1) { echo "selected='selected'"; } ?>>Yes</option>
</select>
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
for ($i = 0; $i < 15; $i++) echo("*");
echo (" PRODUCT DELIVERY CHANNELS ");
for ($i = 0; $i < 15; $i++) echo("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">We ship mail-order via</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="checkbox" name="retailer_mailorder_ecommerce" value="1" <? if ($row[retailer_mailorder_ecommerce] == 1){ echo 'checked'; } ?>>e-commerce site<br />
<input type="checkbox" name="retailer_mailorder_phone" value="1" <? if ($row[retailer_mailorder_phone] == 1){ echo 'checked'; } ?>>phone
</div>
</div>
<div class="drow">
<div class="dcell name">We offer local home/work delivery, transacting via</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="checkbox" name="retailer_local_ecommerce" value="1" <? if ($row[retailer_local_ecommerce] == 1){ echo 'checked'; } ?>>e-commerce site<br />
<input type="checkbox" name="retailer_local_phone" value="1" <? if ($row[retailer_local_phone] == 1){ echo 'checked'; } ?>>phone
</div>
</div>
<div class="drow">
<div class="dcell name">You may order in advance, and pick up, transacting via</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="checkbox" name="retailer_pickup_ecommerce" value="1" <? if ($row[retailer_pickup_ecommerce] == 1){ echo 'checked'; } ?>>e-commerce site<br>
<input type="checkbox" name="retailer_pickup_phone" value="1" <? if ($row[retailer_pickup_phone] == 1){ echo 'checked'; } ?>>phone
</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 (" BIKE FIT ");
for ($i = 0; $i < 25; $i++) echo("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Key Tri-Specific Contact(s)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="radio" name="retailer_contact" value="0" <? if ($row[retailer_contact] == 0){ echo 'checked'; } ?>>None<br />
<input type="radio" name="retailer_contact" value="1" <? if ($row[retailer_contact] == 1){ echo 'checked'; } ?>>Yes, Their Names:
<input value="<? echo stripslashes($row[retailer_contact_names]); ?>" type="text" name="retailer_contact_names" class="txt shotext"/>
</div>
</div>
<div class="drow">
<div class="dcell name">F.I.S.T. Tri Fitter(s)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="radio" name="retailer_fist" value="0" <? if ($row[retailer_fist] == 0){ echo 'checked'; } ?>>None<br />
<input type="radio" name="retailer_fist" value="1" <? if ($row[retailer_fist] == 1){ echo 'checked'; } ?>>Yes, Their Names:
<input value="<? echo stripslashes($row[retailer_fist_names]); ?>" type="text" name="retailer_fist_names" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">F.I.S.T. Road Fitter(s)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="radio" name="retailer_fist_road" value="0" <? if ($row[retailer_fist_road] == 0){ echo 'checked'; } ?>>None<br />
<input type="radio" name="retailer_fist_road" value="1" <? if ($row[retailer_fist_road] == 1){ echo 'checked'; } ?>>Yes, Their Names:
<input value="<? echo stripslashes($row[retailer_fist_road_names]); ?>" type="text" name="retailer_fist_road_names" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">F.I.S.T. Advanced Fitter(s)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="radio" name="retailer_fist_advanced" value="0" <? if ($row[retailer_fist_advanced] == 0){ echo 'checked'; } ?>>None<br />
<input type="radio" name="retailer_fist_advanced" value="1" <? if ($row[retailer_fist_advanced] == 1){ echo 'checked'; } ?>>Yes, Their Names:
<input value="<? echo stripslashes($row[retailer_fist_advanced_names]); ?>" type="text" name="retailer_fist_advanced_names" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">BFACT Score</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($row[retailer_bfact])); ?>" type="text" name="retailer_bfact" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">BikeFit, BodyGeometry, Retul, Serotta, or Trek Fitter(s)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="radio" name="retailer_serotta" value="0" <? if ($row[retailer_serotta] == 0){ echo 'checked'; } ?>>None<br />
<input type="radio" name="retailer_serotta" value="1" <? if ($row[retailer_serotta] == 1){ echo 'checked'; } ?>>Yes, Their Names:
<input value="<? echo stripslashes($row[retailer_serotta_names]); ?>" type="text" name="retailer_serotta_names" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Default Tri-Fit Methodology</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$fetch = mysql_query("SELECT * FROM ".$prefix."RetailersMethods ORDER BY retailer_method_name ASC") OR die(mysql_error());
echo("<input type=\"hidden\" name=\"retailer_method\" value=\"0\" >");
while ($list = mysql_fetch_array($fetch)) {
echo("<span class=\"cols\"><input type=\"radio\" name=\"retailer_method\" value=\"$list[retailer_method_id]\" ");
if ($list['retailer_method_id'] == $row[retailer_method]){ echo "checked "; }
echo(">$list[retailer_method_name]</span>\n");
$i++;
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Fit Bikes</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$explosion = array("");
if (!is_array($row[retailer_fitbikes])){ $explosion = explode(",", $row[retailer_fitbikes]); } else { $explosion = $row[retailer_fitbikes]; }
$list = mysql_query("SELECT * FROM gforum_RetailersFitbikes ORDER BY retailers_fitbike_name ASC");
echo("<input type=\"hidden\" name=\"retailer_fitbikes[]\" value=\"0\" >");
while ($fetch = mysql_fetch_array($list)) {
echo("<span class=\"col\"><input type=\"checkbox\" name=\"retailer_fitbikes[]\" value=\"$fetch[retailers_fitbike_id]\" ");
if (in_array($fetch[retailers_fitbike_id], $explosion)){ echo "checked "; }
echo(">$fetch[retailers_fitbike_name]</span>\n");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Motion-Capture Systems</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$explosion = array("");
if (!is_array($row[retailer_motioncapture])){ $explosion = explode(",", $row[retailer_motioncapture]); } else { $explosion = $row[retailer_motioncapture]; }
$list = mysql_query("SELECT * FROM gforum_RetailersMotioncapture ORDER BY retailers_motioncapture_name ASC");
echo("<input type=\"hidden\" name=\"retailer_motioncapture[]\" value=\"0\" >");
while ($fetch = mysql_fetch_array($list)) {
echo("<span class=\"col\"><input type=\"checkbox\" name=\"retailer_motioncapture[]\" value=\"$fetch[retailers_motioncapture_id]\" ");
if (in_array($fetch[retailers_motioncapture_id], $explosion)){ echo "checked "; }
echo(">$fetch[retailers_motioncapture_name]</span>\n");
}
?>
</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 (" BRANDS ");
for ($i = 0; $i < 25; $i++) echo("*");
?>
<p class="note">IMPORTANT: Tri and road bike brands of which you'll have six or more sitting on the floor during the season.</p>
</div>
</div>
<div class="drow">
<div class="dcell name">Wetsuits</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$explosion = array("");
if (!is_array($row[retailer_wetsuits])){ $explosion = explode(",", $row[retailer_wetsuits]); } else { $explosion = $row[retailer_wetsuits]; }
$list = mysql_query("SELECT * FROM gforum_RetailersWetsuits ORDER BY retailers_wetsuit_name ASC");
echo("<input type=\"hidden\" name=\"retailer_wetsuits[]\" value=\"0\" >");
while ($fetch = mysql_fetch_array($list)) {
echo("<span class=\"col\"><input type=\"checkbox\" name=\"retailer_wetsuits[]\" value=\"$fetch[retailers_wetsuit_id]\" ");
if (in_array($fetch[retailers_wetsuit_id], $explosion)){ echo "checked "; }
echo(">$fetch[retailers_wetsuit_name]</span>\n");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Bikes</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$explosion = array("");
if (!is_array($row[retailer_bikes])){ $explosion = explode(",", $row[retailer_bikes]); } else { $explosion = $row[retailer_bikes]; }
$list = mysql_query("SELECT * FROM gforum_RetailersBikes ORDER BY retailers_bike_name ASC");
echo("<input type=\"hidden\" name=\"retailer_bikes[]\" value=\"0\" >");
while ($fetch = mysql_fetch_array($list)) {
echo("<span class=\"col\"><input type=\"checkbox\" name=\"retailer_bikes[]\" value=\"$fetch[retailers_bike_id]\" ");
if (in_array($fetch[retailers_bike_id], $explosion)){ echo "checked "; }
echo(">$fetch[retailers_bike_name]</span>\n");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Custom Frames</div>
<div class="dcell divider"></div>
<div class="dcell value">
<p class="note">IMPORTANT: Custom brands of which you'll sell six or more in a 12 month period.</p>
<?
$explosion = array("");
if (!is_array($row[retailer_customs])){ $explosion = explode(",", $row[retailer_customs]); } else { $explosion = $row[retailer_customs]; }
$list = mysql_query("SELECT * FROM gforum_RetailersCustoms ORDER BY retailers_custom_name ASC");
echo("<input type=\"hidden\" name=\"retailer_customs[]\" value=\"0\" >");
while ($fetch = mysql_fetch_array($list)) {
echo("<span class=\"col\"><input type=\"checkbox\" name=\"retailer_customs[]\" value=\"$fetch[retailers_custom_id]\" ");
if (in_array($fetch[retailers_custom_id], $explosion)){ echo "checked "; }
echo(">$fetch[retailers_custom_name]</span>\n");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Shop Hours</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input value="<? echo stripslashes(htmlspecialchars($row[retailer_hours])); ?>" type="text" name="retailer_hours" class="txt lngtext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Barnett-Trained Mechanic(s)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="radio" name="retailer_barnett" value="0" <? if ($row[retailer_barnett] == 0){ echo 'checked'; } ?>>None<br />
<input type="radio" name="retailer_barnett" value="1" <? if ($row[retailer_barnett] == 1){ echo 'checked'; } ?>>Yes, Their Names:
<input value="<? echo stripslashes($row[retailer_barnett_names]); ?>" type="text" name="retailer_barnett_names" class="txt shotext">
</div>
</div>
<div class="drow">
<div class="dcell name">United Bicycle Institute-Trained Mechanic(s)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="radio" name="retailer_ubi" value="0" <? if ($row[retailer_ubi] == 0){ echo 'checked'; } ?>>None<br />
<input type="radio" name="retailer_ubi" value="1" <? if ($row[retailer_ubi] == 1){ echo 'checked'; } ?>>Yes, Their Names:
<input value="<? echo stripslashes($row[retailer_ubi_names]); ?>" type="text" name="retailer_ubi_names" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Shop Info</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="retailer_info" class="txt lngtext" placeholder="Please write some information about your shop.">
<? if($row[retailer_info]){ echo strip_tags(stripslashes($row[retailer_info])); } ?>
</textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Directions</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="retailer_directions" class="txt lngtext" placeholder="Please describe how to get to your shop from your surrounding area.">
<? if($row[retailer_directions]) { echo strip_tags(stripslashes($row[retailer_directions])); } ?>
</textarea>
</div>
</div>
<div class="drow actions">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="submit" name="save_changes" value="Save Shop Info" class="btn" />
<input type="submit" name="new_shop" value="Save As A New Retailer" class="btn" />
<input type="reset" value="Reset" class="btn" />
<input type="hidden" name="edit_shop" value="1">
<input type="hidden" name="retailer_id" value="<? echo($row[retailer_id]); ?>">
<? // need to temporary set the field as being valid ?>
<input type="hidden" name="retailer_valid" value="1">
<input type="hidden" name="retailer_submitted_by" value="<? echo($row[retailer_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>