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

429 lines
22 KiB
PHP

<?PHP
include("config.php");
if(!isset($_GET[runshop_id]) AND !$_POST AND !is_numeric($_GET[runshop_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 {
$runshop_idhere = mysql_real_escape_string($_GET[runshop_id]);
$results = mysql_query("SELECT * FROM ".$prefix."Runshops WHERE runshop_id=".$runshop_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()) {
if ( $row[runshop_valid] != 1 ) {
header('Location: '.$site_url.'/?error=shop_not_valid');
exit();
}
}
// set the page title
$pagetitle = "Edit A Running Store";
// set meta tags
$meta_keywords = "edit running store";
$meta_description = "edit screen for running store information";
?>
<? include("include_common_head.php"); ?>
<?
if($_POST[edit_shop] == 1){
include("wiki_edit_X.php");
}
?>
<body class="listings">
<? include($common_path . "/ads/ad_wallpaper.html"); ?>
<div class="container">
<? include($common_path . "/templates/include_header.php"); ?>
<div class="main">
<div class="contentwrapper clearfix">
<? include("include_breadcrumb.php"); ?>
<section class="section listings section-has-widgets section-static remove-sidebar">
<div class="sidebar-b">
<? include("include_sidebar.php"); ?>
</div>
<div class="content content-has-widgets">
<div class="grid">
<div class="clearfix">
<?
if( $_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 home page.</p>
<META HTTP-EQUIV=Refresh CONTENT=\"4; URL=index.php\">
<? } else if($confirm == 1) { ?>
<h1>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[edit_shop] == 1) && (!$errmsg) && ($_POST[confirm_entry] == 1)) { ?>
<h1>Thank you</h1>
<? } ?>
<hr class="line" />
<? include("include_region_list.php"); ?>
<? if(($confirm != 1) && ($_POST[confirm_entry] != 1) && $_GET[confirmed] != "yes") { ?>
<p class="cont">To edit a running store, 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 running store (for instance, if you have multiple locations), hit the "SAVE AS A NEW RUNNING STORE" button. To save changes to the existing running store entry, hit the "SAVE CHANGES TO YOUR RUNNING STORE" button. You will have a chance to review the data before confirming.</font></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">Store Name</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="runshop_name" value="<? echo stripslashes($row[runshop_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="runshop_address" value="<? echo stripslashes(htmlspecialchars($row[runshop_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="runshop_address_two" value="<? echo stripslashes(htmlspecialchars($row[runshop_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="runshop_city" value="<? echo stripslashes(htmlspecialchars($row[runshop_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="runshop_state">
<option value="0">Choose a State/Province</option>
<?
foreach($state_list as $key=>$value) {
if(strcmp($row[runshop_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="runshop_zip" value="<? echo stripslashes(htmlspecialchars($row[runshop_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="runshop_phone" value="<? echo stripslashes(htmlspecialchars($row[runshop_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="runshop_fax" value="<? echo stripslashes(htmlspecialchars($row[runshop_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="runshop_email" value="<? echo stripslashes(htmlspecialchars($row[runshop_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="runshop_website" value="<? echo stripslashes(htmlspecialchars($row[runshop_website])); ?>" class="txt lngtext" placeholder="http://" />
</div>
</div>
<div class="drow">
<div class="dcell name">Online Shopping Cart: <br/> (Must be a fully functional ecommerce system)</div>
<div class="dcell divider"></div>
<div class="dcell value">
<select name="runshop_cart">
<option value="0" <? if ($row[runshop_cart] == 0) { echo "selected='selected'"; } ?>>No</option>
<option value="1" <? if ($row[runshop_cart] == 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 < 10; $i++) echo("*");
echo (" TECHNOLOGY, COMMUNITY &amp; EDUCATION ");
for ($i = 0; $i < 10; $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">
<select name="runshop_contact">
<option value="0" <? if ($row[runshop_contact] == 0) { echo "selected='selected'"; } ?>>None</option>
<option value="1" <? if ($row[runshop_contact] == 1) { echo "selected='selected'"; } ?>>Yes, Their Names</option>
</select>
<input type="text" name="runshop_contact_names" value="<? echo stripslashes($row[runshop_contact_names]); ?>" class="txt shotext" />
</div>
</div>
<div class="drow">
<div class="dcell name">Diagnostic Equipment</div>
<div class="dcell divider"></div>
<div class="dcell value">
<?
$explosion = array("");
if (!is_array($row[runshop_diagnostics])){ $explosion = explode(",", $row[runshop_diagnostics]); } else { $explosion = $row[runshop_diagnostics]; }
$list = mysql_query("SELECT * FROM ".$prefix."RunshopsDiagnostics ORDER BY diagnostic_name ASC");
echo("<input type=\"hidden\" name=\"runshop_diagnostics[]\" value=\"0\" >");
while ($fetch = mysql_fetch_array($list)) {
echo("<input type=\"checkbox\" name=\"runshop_diagnostics[]\" value=\"$fetch[diagnostic_id]\" ");
if (in_array($fetch[diagnostic_id], $explosion)){ echo "checked "; }
echo(">$fetch[diagnostic_name]");
}
?>
</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("*");
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Running Shoes</div>
<div class="dcell divider"></div>
<div class="dcell value">
<p class="note">IMPORTANT: Running shoe brands of which you'll have almost
full size runs in stock of most of the important run models at almost all
times.</p>
<?
$explosion = array("");
if (!is_array($row[runshop_shoes])){ $explosion = explode(",", $row[runshop_shoes]); } else { $explosion = $row[runshop_shoes]; }
$list = mysql_query("SELECT * FROM ".$prefix."RunshopsShoes ORDER BY shoe_name ASC");
echo("<input type=\"hidden\" name=\"runshop_shoes[]\" value=\"0\" >");
while ($fetch = mysql_fetch_array($list)) {
echo("<span class=\"col\"><input type=\"checkbox\" name=\"runshop_shoes[]\" value=\"$fetch[shoe_id]\" ");
if (in_array($fetch[shoe_id], $explosion)){ echo "checked "; }
echo(" />$fetch[shoe_name]</span>");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Socks</div>
<div class="dcell divider"></div>
<div class="dcell value">
<p class="note">IMPORTANT: Sock brands you'll keep in stock almost all the time.</p>
<?
$explosion = array("");
if (!is_array($row[runshop_socks])){ $explosion = explode(",", $row[runshop_socks]); } else { $explosion = $row[runshop_socks]; }
$list = mysql_query("SELECT * FROM ".$prefix."RunshopsSocks ORDER BY sock_name ASC");
echo("<input type=\"hidden\" name=\"runshop_socks[]\" value=\"0\" >");
while ($fetch = mysql_fetch_array($list)) {
echo("<span class=\"col\"><input type=\"checkbox\" name=\"runshop_socks[]\" value=\"$fetch[sock_id]\" ");
if (in_array($fetch[sock_id], $explosion)){ echo "checked "; }
echo(">$fetch[sock_name]</span>\n");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Run Focused Apparel</div>
<div class="dcell divider"></div>
<div class="dcell value">
<p class="note">IMPORTANT: Run focus apparel brands you'll keep in stock, full size runs, almost all the time, season-appropriate.</p>
<?
$explosion = array("");
if (!is_array($row[runshop_apparel_run])){ $explosion = explode(",", $row[runshop_apparel_run]); } else { $explosion = $row[runshop_apparel_run]; }
$list = mysql_query("SELECT * FROM ".$prefix."RunshopsApparelRun ORDER BY apparel_run_name ASC");
echo("<input type=\"hidden\" name=\"runshop_apparel_run[]\" value=\"0\" >");
while ($fetch = mysql_fetch_array($list)) {
echo("<span class=\"col\"><input type=\"checkbox\" name=\"runshop_apparel_run[]\" value=\"$fetch[apparel_run_id]\" ");
if (in_array($fetch[apparel_run_id], $explosion)){ echo "checked "; }
echo(">$fetch[apparel_run_name]</span>\n");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Tri Focused Apparel</div>
<div class="dcell divider"></div>
<div class="dcell value">
<p class="note">IMPORTANT: Run/tri apparel brands you'll keep in stock, full size runs, almost
all the time, season-appropriate.</p>
<?
$explosion = array("");
if (!is_array($row[runshop_apparel_tri])){ $explosion = explode(",", $row[runshop_apparel_tri]); } else { $explosion = $row[runshop_apparel_tri]; }
$list = mysql_query("SELECT * FROM ".$prefix."RunshopsApparelTri ORDER BY apparel_tri_name ASC");
echo("<input type=\"hidden\" name=\"runshop_apparel_tri[]\" value=\"0\" >");
while ($fetch = mysql_fetch_array($list)) {
echo("<span class=\"col\"><input type=\"checkbox\" name=\"runshop_apparel_tri[]\" value=\"$fetch[apparel_tri_id]\" ");
if (in_array($fetch[apparel_tri_id], $explosion)){ echo "checked "; }
echo(">$fetch[apparel_tri_name]</span>\n");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Swim Gear</div>
<div class="dcell divider"></div>
<div class="dcell value">
<p class="note">IMPORTANT: Swimwear/Goggles: Brands you carry wide and deep, with models that are
swim-specific.</p>
<?
$explosion = array("");
if (!is_array($row[runshop_swimgear])){ $explosion = explode(",", $row[runshop_swimgear]); } else { $explosion = $row[runshop_swimgear]; }
$list = mysql_query("SELECT * FROM ".$prefix."ResourceSwimgear ORDER BY swimgear_name ASC");
echo("<input type=\"hidden\" name=\"runshop_swimgear[]\" value=\"0\" >");
while ($fetch = mysql_fetch_array($list)) {
echo("<span class=\"col\"><input type=\"checkbox\" name=\"runshop_swimgear[]\" value=\"$fetch[swimgear_id]\" ");
if (in_array($fetch[swimgear_id], $explosion)){ echo "checked "; }
echo(">$fetch[swimgear_name]</span>\n");
}
?>
</div>
</div>
<div class="drow">
<div class="dcell name">Wetsuits</div>
<div class="dcell divider"></div>
<div class="dcell value">
<p class="note">IMPORTANT: Wetsuit brands of which you'll have 12 or more continually in stock during the season.</p>
<?
$explosion = array("");
if (!is_array($row[runshop_wetsuits])){ $explosion = explode(",", $row[runshop_wetsuits]); } else { $explosion = $row[runshop_wetsuits]; }
$list = mysql_query("SELECT * FROM ".$prefix."ResourceWetsuit ORDER BY wetsuit_name ASC");
echo("<input type=\"hidden\" name=\"runshop_wetsuits[]\" value=\"0\" >");
while ($fetch = mysql_fetch_array($list)) {
echo("<span class=\"col\"><input type=\"checkbox\" name=\"runshop_wetsuits[]\" value=\"$fetch[wetsuit_id]\" ");
if (in_array($fetch[wetsuit_id], $explosion)){ echo "checked "; }
echo(">$fetch[wetsuit_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 < 60; $i++) echo("*"); ?>
</div>
</div>
<div class="drow">
<div class="dcell name">Store Hours</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="runshop_hours" value="<? echo stripslashes(htmlspecialchars($row[runshop_hours])); ?>" class="txt lngtext" /></td>
</div>
</div>
<div class="drow">
<div class="dcell name">Runs &amp; Classes</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="runshop_classes" class="txt lngtext" placeholder="Place here times and days of regular runs emanating from the shop, with distances and pace (easy-moderate-fast); also whether you host running classes, when, and any cost associated.">
<? if($row[runshop_classes]){ echo strip_tags(stripslashes($row[runshop_classes])); } ?>
</textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Shop Info</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="runshop_info" class="txt lngtext" placeholder="Please write some information about your shop.">
<? if($row[runshop_info]){ echo strip_tags(stripslashes($row[runshop_info])); } ?>
</textarea>
</div>
</div>
<div class="drow">
<div class="dcell name">Directions</div>
<div class="dcell divider"></div>
<div class="dcell value">
<textarea name="runshop_directions" class="txt lngtext" placeholder="Please describe how to get to your shop from your surrounding area.">
<? if($row[runshop_directions]) { echo strip_tags(stripslashes($row[runshop_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 Changes" class="btn" />
<input type="submit" name="new_shop" value="Save As A New Store" class="btn" />
<input type="reset" value="Reset" class="btn">
<input type="hidden" name="edit_shop" value="1">
<input type="hidden" name="runshop_id" value="<? echo($row[runshop_id]); ?>">
<? // need to temporary set the field as being valid ?>
<input type="hidden" name="runshop_valid" value="1">
<input type="hidden" name="runshop_submitted_by" value="<? echo($row[runshop_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>