Initial commit

This commit is contained in:
Ben Ramey
2017-03-02 20:30:40 -06:00
commit ab3c6fc8d5
10773 changed files with 515124 additions and 0 deletions

35
_old/products_adddownloads.php Executable file
View File

@@ -0,0 +1,35 @@
<?php
$event_name = 'USNationalChampionship2007';
$dir = opendir("/home/users/web/b2373/pow.fti/htdocs/bobsleighphotos/images/bobsleighphotos/$event_name");
while (false !== ($filename = readdir($dir)))
{
if($filename != '.' and $filename != '..')
{ $files[] = $filename; }
}
sort($files);
mysql_connect("mysql09.powweb.com",'fti','friend3');
mysql_select_db("bobsleighphotos");
$res = mysql_query("SELECT pa.products_attributes_id,p.products_image
FROM zc_products_attributes pa, zc_products p
WHERE p.products_id > 1307
AND p.products_id = pa.products_id;");
while($prod = mysql_fetch_assoc($res))
{
$image = str_replace('bobsleighphotos/','',$prod['products_image']);
mysql_query("INSERT INTO zc_products_attributes_download
(products_attributes_id,products_attributes_filename,
products_attributes_maxdays,products_attributes_maxcount)
VALUES({$prod['products_attributes_id']},'$image',7,2);");
if(mysql_error()) { print ": ".mysql_error()."<br />"; }
}
print "Done!";
?>

209
_old/products_enmasse.php Executable file
View File

@@ -0,0 +1,209 @@
<?php
$event_name = 'USNationalChampionship2007';
$event_readable_name = 'National Championship 2007';
$dir = opendir("/home/users/web/b2373/pow.fti/htdocs/bobsleighphotos/images/bobsleighphotos/$event_name");
$countries = array(
'AUS' => 'Australia',
'AUT' => 'Austria',
'Awa' => 'Awards Ceremonies',
'awa' => 'Awards Ceremonies',
'BER' => 'Bermuda',
'BIG' => 'Bosnia',
'BUL' => 'Bulgaria',
'BRA' => 'Brazil',
'CAN' => 'Canada',
'CZE' => 'Czech Republic',
'FRA' => 'France',
'GER' => 'Germany',
'GBR' => 'Great Britain',
'GRE' => 'Greece',
'HUN' => 'Hungary',
'IRE' => 'Ireland',
'ITA' => 'Italy',
'JPN' => 'Japan',
'LAT' => 'Latvia',
'MIS' => 'Miscellaneous',
'MON' => 'Monaco',
'NED' => 'Netherlands',
'NZL' => 'New Zealand',
'NOR' => 'Norway',
'POL' => 'Poland',
'ROM' => 'Romania',
'RUS' => 'Russia',
'SRB' => 'Serbia',
'SVK' => 'Slovakia',
'SWE' => 'Sweden',
'SUI' => 'Switzerland',
'ISV' => 'US Virgin Islands',
'USA' => 'USA',
);
while (false !== ($filename = readdir($dir)))
{
if($filename != '.' and $filename != '..')
{ $files[] = $filename; }
}
sort($files);
mysql_connect("mysql09.powweb.com",'fti','friend3');
mysql_select_db("bobsleighphotos");
if(!isset($_POST['doadding']))
{
$cats = array();
$res = mysql_query("SELECT cd.categories_name, cd.categories_id,c.parent_id
FROM zc_categories c, zc_categories_description cd
WHERE cd.categories_id = c.categories_id
ORDER BY cd.categories_name;");
# gather all categories
while($row = mysql_fetch_assoc($res))
{ $cats[] = $row; }
# retrieve all the categories hierarchically
$options = '';
for($idx = 0; $idx < count($cats); $idx++)
{
if($cats[$idx]['parent_id'] != 0)
{
for($c = 0; $c < count($cats); $c++)
{
if($cats[$c]['categories_id'] == $cats[$idx]['parent_id'])
{
$cats[$c]['subcategories'][] = $cats[$idx];
break;
}
}
}
}
print "<form action='products_enmasse.php' method='post'><input type='hidden' name='doadding' value='1' />\n";
foreach($files as $file)
{
$team = explode('.',$file);
$team = explode('-',$team[0]);
// EXTRA PARSING THAT I DON'T ALWAYS NEED
// $number = '';
//
// foreach($parts as $part)
// {
// if(preg_match("/([IV]+)$/",$part,$matches))
// {
// $team[0] = str_replace($matches[1],'',$part);
// $team[1] = "Team {$matches[1]},";
// }
// else if($part == 'W')
// { $team[3] = 'Womens,'; }
// else if(preg_match("/^\d+$/",$part))
// { $number = $part; }
// else if($team[0] !== $part)
// { $team[2] = $part.','; }
// }
$country_code = substr($team[0],0,3);
$country_name = $countries[$country_code];
$team[] = $event_readable_name;
// if(!empty($number))
// { $team[] = "($number)"; }
$title = implode(' ',$team);
list($width,$height) = getimagesize("/home/users/web/b2373/pow.fti/htdocs/bobsleighphotos/download/$event_name/$file");
print "Title: <input type='text' name='title_$file' size='50' value='$title' /> ($file)\n";
print "<input type='hidden' name='width_$file' value='$width' />";
print "<input type='hidden' name='height_$file' value='$height' />";
print "Category: <select name='cat_$file'>\n";
# create options for dropdown list
for($idx = 0; $idx < count($cats); $idx++)
{
$right_country = 0;
if($cats[$idx]['parent_id'] == 0)
{
print "<optgroup label='{$cats[$idx]['categories_name']}'>\n";
if($country_name === $cats[$idx]['categories_name'])
{ $right_country = 1; }
if(isset($cats[$idx]['subcategories']))
{
for($c = 0; $c < count($cats[$idx]['subcategories']); $c++)
{
$found_cat = 0;
$selected = '';
if($event_readable_name === $cats[$idx]['subcategories'][$c]['categories_name']
&& $right_country)
{
$selected = "selected='selected'";
$found_cat = 1;
}
print "<option value='{$cats[$idx]['subcategories'][$c]['categories_id']}' $selected>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$cats[$idx]['subcategories'][$c]['categories_name']}</option>\n";
}
}
print "</optgroup>\n";
}
}
print "</select>";
if(!$found_cat)
{ print "COULD NOT FIND CATEGORY!!"; }
print "<br /> <br />\n";
}
print "<input type='submit' /></form>";
}
else
{
foreach($files as $file)
{
$name = str_replace('.','_',$file);
$name = str_replace(' ','_',$name);
$width = $_POST['width_'.$name];
$height = $_POST['height_'.$name];
$title = $_POST['title_'.$name];
$cat = $_POST['cat_'.$name];
$desc = "Width: {$width}px<br />\n";
$desc .= "Height: {$height}px<br />\n";
$desc .= "Format: JPEG<br />\n";
$sql = "INSERT INTO zc_products
(products_type,products_quantity,products_image,products_price,
products_virtual,products_date_added,products_weight,products_status,
manufacturers_id,products_ordered,products_quantity_order_min,
products_quantity_order_units,products_priced_by_attribute,product_is_free,product_is_call,
products_quantity_mixed,product_is_always_free_shipping,products_qty_box_status,
products_quantity_order_max,products_sort_order,products_discount_type,products_discount_type_from,
products_price_sorter,master_categories_id,products_tax_class_id)
VALUES(1,10000,'bobsleighphotos/{$event_name}/$file',10.00,
1,NOW(),0,1,
0,0,1,
1,0,0,0,
1,0,1,
0,0,0,0,
10.00,$cat,1);";
mysql_query($sql);
$new_id = mysql_insert_id();
if(mysql_error()) { print "Product $file: ".mysql_error()."<br />"; continue; }
$sql = "INSERT INTO zc_products_description
(products_name,products_description)
VALUES('$title','$desc');";
mysql_query($sql);
if(mysql_error()) { print "Desc $file: ".mysql_error()."<br />"; continue; }
$sql = "INSERT INTO zc_products_to_categories
(products_id,categories_id)
VALUES($new_id,$cat);";
mysql_query($sql);
if(mysql_error()) { print "ProdtoCat $file: ".mysql_error()."<br />"; continue; }
}
print 'Done!';
}
?>

577
_old/version_1/admin/index.php Executable file
View File

@@ -0,0 +1,577 @@
<?php
$admin_digest = $_COOKIE['bobsleddigest'];
$digest = "b8939260fa537f7c975aaad60c951aaf5bbb7a9f";
$phrase = file_get_contents('../../../data/bobsledphrase.txt');
if( $admin_digest == "" or ($_POST['user'] and $_POST['password']) )
{
$admin_digest = sha1("{$_POST['user']}^{$_POST['password']}^$phrase");
setcookie('bobsleddigest',$admin_digest,time() + (30*60),'/bobsled/admin','.rameydesign.net');
}
include "../header.php";
if( $admin_digest == $digest )
{
if( $_POST['cmd'] == 'add_picture' )
{ print "<div class='alert'>" . AddPicture() . "</div>"; }
else if( $_POST['cmd'] == 'add_event' )
{ print "<div class='alert'>" . AddEvent() . "</div>"; }
else if( $_POST['cmd'] == 'add_team' )
{ print "<div class='alert'>" . AddTeam() . "</div>"; }
else if( $_POST['cmd'] == 'delete_team' )
{ print "<div class='alert'>" . DeleteTeam() . "</div>"; }
else if( $_POST['cmd'] == 'delete_event' )
{ print "<div class='alert'>" . DeleteEvent() . "</div>"; }
else if( $_POST['cmd'] == 'delete_picture' )
{ print "<div class='alert'>" . DeletePicture() . "</div>"; }
PrintAdminIndex();
}
else { PrintLoginPage(); }
?>
</div>
</div>
</div>
</body>
</html>
<?php
function AddTeam()
{
$team = str_replace(".","_",$_POST['teamname']);
$team = str_replace("/","_",$team);
$team = str_replace(" ","_",$team);
$team = escapeshellcmd($team);
print `mkdir "../pictures/$team/"`;
$newfolder = opendir("../pictures/$team/");
if( $newfolder )
{ $message = "Team $team successfully added."; closedir($newfolder); }
else
{ $message = "Team $team could not be added, please try again."; }
return $message;
}
function AddEvent()
{
$team = str_replace(".","_",$_POST['teamname']);
$team = str_replace("/","_",$team);
$team = str_replace(" ","_",$team);
$team = escapeshellcmd($team);
$event = str_replace(".","_",$_POST['eventname']);
$event = str_replace("/","_",$event);
$event = str_replace(" ","_",$event);
$event = escapeshellcmd($event);
print `mkdir "../pictures/$team/$event/"`;
$newfolder = opendir("../pictures/$team/$event/");
if( $newfolder )
{ $message = "Event $event for $team successfully added."; closedir($newfolder); }
else
{ $message = "Event $event for $team could not be added, please try again."; }
return $message;
}
function AddPicture()
{
$team = str_replace(".","_",$_POST['teamname']);
$team = str_replace("/","_",$team);
$team = str_replace(" ","_",$team);
$team = escapeshellcmd($team);
$event = str_replace(".","_",$_POST['eventname']);
$event = str_replace("/","_",$event);
$event = str_replace(" ","_",$event);
$event = escapeshellcmd($event);
$name = $_FILES['picture']['name'];
$description = addslashes($_POST['description']);
$price = addslashes($_POST['price']);
if( move_uploaded_file($_FILES['picture']['tmp_name'],"../pictures/$team/$event/$name") )
{
if( file_put_contents("../pictures/$team/$event/$name.txt","$price\n$description") )
{ $message = "Picture $name successfully added to team $team for $event."; }
}
else { $message = "Picture $name could not be added to team $team for $event, please try again."; }
return $message;
}
function DeleteTeam()
{
$team = str_replace(".","_",$_POST['teamname']);
$team = str_replace("/","_",$team);
$team = str_replace(" ","_",$team);
$team = escapeshellcmd($team);
$team_folder = scandir("../pictures/$team");
foreach($team_folder as $file)
{
$event_folder = scandir("../pictures/$team/$file");
foreach($event_folder as $file2)
{ print `rm "../pictures/$team/$file/$file2"`; }
print `rmdir "../pictures/$team/$file"`;
}
print `rmdir "../pictures/$team"`;
if( file_exists("../pictures/$team") )
{ $message = "Could not delete team."; }
else { $message = "Team deleted successfully."; }
return $message;
}
function DeleteEvent()
{
$team = str_replace(".","_",$_POST['teamname']);
$team = str_replace("/","_",$team);
$team = str_replace(" ","_",$team);
$team = escapeshellcmd($team);
$event = str_replace(".","_",$_POST['eventname']);
$event = str_replace("/","_",$event);
$event = str_replace(" ","_",$event);
$event = escapeshellcmd($event);
$event_folder = scandir("../pictures/$team/$event");
foreach($event_folder as $file)
{ print `rm "../pictures/$team/$event/$file"`; }
print `rmdir "../pictures/$team/$event"`;
if( file_exists("../pictures/$team/$event") )
{ $message = "Could not delete event."; }
else { $message = "Event deleted successfully."; }
return $message;
}
function DeletePicture()
{
$team = str_replace(".","_",$_POST['teamname']);
$team = str_replace("/","_",$team);
$team = str_replace(" ","_",$team);
$team = escapeshellcmd($team);
$event = str_replace(".","_",$_POST['eventname']);
$event = str_replace("/","_",$event);
$event = str_replace(" ","_",$event);
$event = escapeshellcmd($event);
$picture = str_replace("/","_",$_POST['picturename']);
$picture = str_replace(" ","_",$picture);
$picture = escapeshellcmd($picture);
print `rm "../pictures/$team/$event/$picture"`;
print `rm "../pictures/$team/$event/$picture.txt"`;
if( file_exists("../pictures/$team/$event/$picture") )
{ $message = "Could not delete picture."; }
else { $message = "Picture deleted successfully."; }
if( file_exists("../pictures/$team/$event/$picture.txt") )
{ $message .= " Could not delete picture details file."; }
else { $message .= " Picture details file delete successfully."; }
return $message;
}
function PrintAdminIndex()
{
$teams = scandir('../pictures');
$teams_html = "";
$events_js = "";
$pictures_js = "";
if($teams)
{
foreach($teams as $file)
{
if( $file != '.' and $file != "..")
{
$teams_html .= "<option value='$file'>$file</option>\n";
$var_name = str_replace(" ","_",$file);
$events_counter = 0;
$events_js .= "\nvar $var_name = new Array();";
$events = scandir("../pictures/$file");
if($events)
{
foreach($events as $file2)
{
if($file2 != '.' and $file2 != "..")
{
$file_name = addslashes($file2);
$events_js .= "\n $var_name" . "[$events_counter] = '$file2';";
$events_counter++;
$var_name2 = str_replace(" ","_",$file2);
$pictures_counter = 0;
$pictures_js .= "\nvar $var_name$var_name2 = new Array();";
$pictures = scandir("../pictures/$file/$file2");
if($pictures)
{
$counter2 = 0;
foreach($pictures as $file3)
{
if($file3 != '.' and $file3 != '..' and !(true == strpos($file3,".txt")))
{
$file_name2 = addslashes($file3);
$pictures_js .= "\n $var_name$var_name2" . "[$pictures_counter] = '$file_name2';";
$pictures_counter++;
}
}
}
}
}
}
}
}
}
?>
<strong>Admin Panel</strong>
<br /> <br />
<!--ADD TEAM-->
<form action='index.php' method='post'>
<input type='hidden' name='cmd' value='add_team' />
<div class='admin_section'>Add a new bobsled team</div>
<div class='indented_para'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Team name:</td>
<td><input type='text' size='30' name='teamname' /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='Add Team' /></td>
</tr>
</table>
</div>
</form>
<br /> <br />
<!--ADD EVENT-->
<form action='index.php' method='post'>
<input type='hidden' name='cmd' value='add_event' />
<div class='admin_section'>Add a new event to an existing team</div>
<div class='indented_para'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Select Team:</td>
<td>
<select name='teamname'>
<option>Select a Team</option>
<?php print $teams_html;
?>
</select>
</td>
</tr>
<tr>
<td align='right'>Event name:</td>
<td><input type='text' size='30' name='eventname' /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='Add Event' /></td>
</tr>
</table>
</div>
</form>
<br /> <br />
<!--ADD PICTURE-->
<form action='index.php' method='post' enctype="multipart/form-data">
<input type='hidden' name='cmd' value='add_picture' />
<div class='admin_section'>Add a new picture to an existing team's event</div>
<div class='indented_para'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Select Team:</td>
<td>
<select name='teamname' id='add_teams_select' onchange="SetEventsHTML('add')">
<option>Select a Team</option>
<?php print $teams_html;
?>
</select>
</td>
</tr>
<tr>
<td align='right'>Select Event:</td>
<td>
<select id='add_events_select' style='visibility:hidden'>
<option>Select an Event</option>
</select>
</td>
</tr>
<tr>
<td align='right'>Browse for picture:</td>
<td><input type='file' name='picture' /></td>
</tr>
<tr>
<td align='right'>Picture description:</td>
<td><input type='text' size='50' name='description' /></td>
</tr>
<tr>
<td align='right'>Picture price:</td>
<td><input type='text' size='5' name='price' /> (no dollar sign)</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='Add Picture' /></td>
</tr>
</table>
</div>
</form>
<script type='text/javascript' language='javascript'>
<!--
<?php print $events_js . "\n\n" . $pictures_js;
?>
function SetEventsHTML(id_prefix)
{
var events_id = id_prefix + "_events_select";
var teams_id = id_prefix + "_teams_select";
//grab the HTML elements
var events_select = document.getElementById(events_id);
var team_selected = document.getElementById(teams_id).value;
//replace all spaces with an underscore
while( team_selected.indexOf(" ") > 0 )
{ team_selected = team_selected.replace(" ","_"); }
var events_array = eval(team_selected);
var array_length = events_array.length;
if( team_selected != 'Select a Team' )
{
if(id_prefix == "delete2")
{
var picture_options = document.getElementById(id_prefix + "_pictures_select").options.length - 1;
for(var c=picture_options;c>0;c--)
{ document.getElementById(id_prefix + "_pictures_select").remove(c); }
}
var num_options = events_select.options.length - 1;
for(var c=num_options;c>0;c--)
{ events_select.remove(c); }
for(var i=0;i < array_length;i++)
{
var new_option = document.createElement("OPTION");
new_option.text = events_array[i];
new_option.value = events_array[i];
events_select.style.visibility = "visible";
events_select.options.add(new_option);
}
}
}
function SetPicturesHTML()
{
//grab the HTML elements
var pictures_select = document.getElementById('delete2_pictures_select');
var event_selected = document.getElementById('delete2_events_select').value;
var team_selected = document.getElementById('delete2_teams_select').value;
//replace all spaces with an underscore
while( event_selected.indexOf(" ") > 0 )
{ event_selected = event_selected.replace(" ","_"); }
//replace all spaces with an underscore
while( team_selected.indexOf(" ") > 0 )
{ team_selected = team_selected.replace(" ","_"); }
var pictures_array = eval(team_selected + event_selected);
var array_length = pictures_array.length;
if( event_selected != 'Select an Event' )
{
var num_options = pictures_select.options.length - 1;
for(var c=num_options;c>0;c--)
{ pictures_select.remove(c); }
for(var i=0;i < array_length;i++)
{
var new_option = document.createElement("OPTION");
new_option.text = pictures_array[i];
new_option.value = pictures_array[i];
pictures_select.style.visibility = "visible";
pictures_select.options.add(new_option);
}
}
}
function ReallyDeleteTeam()
{
if( confirm("Do you really want to delete this team?") )
{ return true; }
else { return false; }
}
function ReallyDeleteEvent()
{
if( confirm("Do you really want to delete this event?") )
{ return true; }
else { return false; }
}
function ReallyDeletePicture()
{
if( confirm("Do you really want to delete this picture?") )
{ return true; }
else { return false; }
}
//-->
</script>
<br /> <hr />
<!--DELETION CAPABILITIES--->
<!--DELETE TEAM-->
<form action='index.php' method='post'>
<input type='hidden' name='cmd' value='delete_team' />
<div class='admin_section'>Delete an entire, existing team</div>
<div class='indented_para'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Select a team:</td>
<td>
<select name='teamname'>
<option>Select a Team</option>
<?php print $teams_html;
?>
</select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='Delete Team' /></td>
</tr>
</table>
</div>
</form>
<br /> <br />
<!--DELETE EVENT-->
<form action='index.php' method='post'>
<input type='hidden' name='cmd' value='delete_event' />
<div class='admin_section'>Delete an entire, existing event of an existing team</div>
<div class='indented_para'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Select Team:</td>
<td>
<select name='teamname' id='delete_teams_select' onchange="SetEventsHTML('delete')">
<option>Select a Team</option>
<?php print $teams_html;
?>
</select>
</td>
</tr>
<tr>
<td align='right'>Select an event:</td>
<td>
<select id='delete_events_select' style='visibility:hidden'>
<option>Select an Event</option>
</select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='Delete Event' onsubmit='ReallyDeleteEvent()' /></td>
</tr>
</table>
</div>
</form>
<br /> <br />
<!--DELETE PICTURE-->
<form action='index.php' method='post'>
<input type='hidden' name='cmd' value='delete_picture' />
<div class='admin_section'>Delete a picture from an existing team's event</div>
<div class='indented_para'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Select Team:</td>
<td>
<select name='teamname' id='delete2_teams_select' onchange="SetEventsHTML('delete2')">
<option>Select a Team</option>
<?php print $teams_html;
?>
</select>
</td>
</tr>
<tr>
<td align='right'>Select Event:</td>
<td>
<select id="delete2_events_select" onchange="SetPicturesHTML()" style='visibility:hidden'>
<option>Select an Event</option>
</select>
</td>
</tr>
<tr>
<td align='right'>Select Picture:</td>
<td>
<select id="delete2_pictures_select" style='visibility:hidden'>
<option>Select a Picture</option>
</select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='Delete Picture' /></td>
</tr>
</table>
</div>
</form>
<?php
}
function PrintLoginPage()
{
?>
<form action='index.php' method='post'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Username:</td>
<td><input type='text' size='20' name='user' /></td>
</tr>
<tr>
<td align='right'>Password:</td>
<td><input type='password' size='20' name='password' /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='login' /></td>
</table>
</form>
<?php
}
?>

84
_old/version_1/bobsled.css Executable file
View File

@@ -0,0 +1,84 @@
/* CSS for John Nielsen's Bobsled Photos Website*/
a:link {
color: #336699;
}
a:visited {
color: #336699;
}
a:hover {
color: #999999;
}
/*************************
Main Div Tag Styles
***********************/
#main_div {
font-family: Arial;
}
#header {
width: 700px;
}
#linkbar {
width: 700px;
padding: 5px 20px 5px 20px;
font-weight: bold;
text-align: left;
border-width: 4px 0px 0px 0px;
border-color: #336699;
border-style: solid;
}
#body {
width: 700px;
padding: 20px;
border-width: 4px 0px 0px 0px;
border-color: #336699;
border-style: solid;
}
#teamindexheader {
width: 680px;
padding: 10px;
margin-top: 30px;
border-width: 4px;
border-color: #000000;
border-style: solid;
text-align: left;
font-size: 18px;
font-weight: bold;
}
#teamindex {
font-size: 14px;
font-weight: normal;
text-align: center;
height: 155px;
width: 680px;
overflow: auto;
}
#picture {
width: 550px;
padding: 5px;
border-width: 3px;
border-color: #000000;
border-style: solid;
}
.indented_para {
padding-left: 20px;
}
.admin_section {
margin-bottom: 5px;
text-decoration: underline;
}
.alert {
padding: 5px;
margin-bottom: 20px;
border-width: 2px;
border-color: red;
border-style: solid;
}
.description {
margin-top: 10px;
}
.team {
font-size: 18px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

16
_old/version_1/header.php Executable file
View File

@@ -0,0 +1,16 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>john nielsen's bobsled photos</title>
<link href='/bobsled/bobsled.css' rel='stylesheet' type='text/css' />
</head>
<body>
<div id="main_div" align='center'>
<div id="header">
<img src='/bobsled/graphics/header.jpg' />
</div>
<div id="linkbar">
<a href='/bobsled/index.php'>Home</a> :: <a href='/bobsled/index.php?page=about'>About John Nielsen</a>
</div>
<div id="body" align='left'>

221
_old/version_1/index.php Executable file
View File

@@ -0,0 +1,221 @@
<?php
$page = $_GET['page'];
$team = $_GET['team'];
$event = $_GET['event'];
$picture = $_GET['picture'];
include "header.php";
if( ($page == "" or $page == 'home') and ($team == '') )
{ PrintHome(); }
else if( $page == 'about' and $team == '' )
{ PrintAbout(); }
if( $team != '' and $event == '' )
{ DisplayTeam($team); }
if( $event != '' and $picture =="" )
{ DisplayTeamEvent($team,$event); }
if( $picture != '' )
{ DisplayTeamEventPicture($team,$event,$picture); }
?>
</div>
<div id="teamindexheader">Teams List
<div id="teamindex">
<?php
$teams_folder = scandir('./pictures');
if( $teams_folder )
{
print "
<table cellpadding='0' cellspacing='20' border='0'>
<tr>
";
foreach($teams_folder as $file)
{
if( $file != '.' and $file != '..' )
{
print "
<td align='center'>
<a href='index.php?team=$file'><img src='graphics/folder.gif' border='0' /></a>
<br />
<a href='index.php?team=$file'>$file</a>
</td>";
}
}
print "
</tr>
</table>
";
}
?>
</div>
</div>
</div>
</body>
</html>
<?php
//=================================================
// PAGE FUNCTIONS
//=================================================
//=======================================
// Displays the home page
//=======================================
function PrintHome()
{
?>
<strong>Welcome to John Nielsen's Bobsled Photos Home page!</strong>
<br /> <br />
The pictures here are organized according to team. Once you click on a team, you can
see pictures of that team organized according to event.
<br /> <br />
All pictures are for sale through PayPal. Please e-mail me at
<a href="mailto:bobsledphotos@friendshiptours.org">bobsledphotos@friendshiptours.org</a>
if you have any questions.
<?php
}
//=======================================
// Displays the about page
//=======================================
function PrintAbout()
{
?>
<strong>About John Nielsen</strong>
<br /> <br />
Stuff about John Nielsen.
<br /> <br />
More stuff about John Nielsen.
<?php
}
//=======================================
// Displays all events of a
// specific team
//=======================================
function DisplayTeam($team)
{
print "
<strong class='team'>$team</strong>
<br /> <br />";
$team_folder = scandir("./pictures/$team");
if( $team_folder )
{
$event_counter = 0;
print "
<table cellpadding='0' cellspacing='20' border='0'>
<tr>
";
foreach($team_folder as $file)
{
if( $file == '.' or $file == '..' )
{ continue; }
print "
<td align='center'>
<a href='index.php?team=$team&event=$file'><img src='graphics/folder.gif' border='0' /></a>
<br />
<a href='index.php?team=$team&event=$file'>$file</a>
</td>";
$event_counter++;
if( $event_counter == 4 )
{ print "</tr><tr>\n"; $event_counter = 0; }
}
print "
</tr>
</table>
";
}
}
//=======================================
// Displays a specific event of a
// specific team
//=======================================
function DisplayTeamEvent($team,$event)
{
print "
<strong class='team'><a href='index.php?team=$team'>$team</a> :: $event</strong>
<br /> <br />";
$event_folder = scandir("./pictures/$team/$event");
if( $event_folder )
{
$picture_counter = 0;
print "
<table cellpadding='0' cellspacing='20' border='0'>
<tr>
";
foreach($event_folder as $file)
{
if( $file == '.' or $file == '..' or (true == strpos($file,".txt")) )
{ continue; }
print "
<td align='center'>
<a href='index.php?team=$team&event=$event&picture=$file'><img src='./pictures/$team/$event/$file' border='0' width='80' /></a>
<br />
$file
</td>";
$picture_counter++;
if( $picture_counter == 5 )
{ print "</tr><tr>\n"; $picture_counter = 0; }
}
print "
</tr>
</table>
";
}
}
//=======================================
// Displays a specific picture of a
// specific event of a specific team
//=======================================
function DisplayTeamEventPicture($team,$event,$picture)
{
$picture_details = file_get_contents("./pictures/$team/$event/$picture.txt");
$details = explode("\n",$picture_details);
$details[1] = stripslashes($details[1]);
print "
<strong class='team'><a href='index.php?team=$team'>$team</a> ::
<a href='index.php?team=$team&event=$event'>$event</a> ::
$picture</strong>
<br /> <br />
<div align='center'>
<div id='picture' align='center'>
<img src='./pictures/$team/$event/$picture' width='550' />
<br />
<div align='left' class='description'>
<strong>Description:</strong> {$details[1]}
<br /> <br />
<form name='_xclick' action='https://www.paypal.com/cgi-bin/webscr' method='post'>
<strong>Price:</strong> \${$details[0]}
<input type='hidden' name='cmd' value='_xclick'>
<input type='hidden' name='business' value='ebay@rameydesign.net'>
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='item_name' value='$team/$event/$picture'>
<input type='hidden' name='amount' value='{$details[0]}'>
<input type='image' src='http://www.paypal.com/en_US/i/btn/x-click-but23.gif' border='0' name='submit' align='middle' alt='Make payments with PayPal - it's fast, free and secure!'>
</form>
</div>
</div>
</div>
";
}
?>

View File

@@ -0,0 +1,5 @@
<?php
$digest = sha1('fti^friend^this is the PHRAse FOR thE boBSLeD WEbsite');
print $digest;
?>

963
_old/version_2/_admin/index.php Executable file
View File

@@ -0,0 +1,963 @@
<?php
$admin_digest = $_COOKIE['bobsleddigest'];
$digest = "b8939260fa537f7c975aaad60c951aaf5bbb7a9f";
$phrase = file_get_contents('../../../data/bobsledphrase.txt');
if( $admin_digest == "" or ($_POST['user'] and $_POST['password']) )
{
$admin_digest = sha1("{$_POST['user']}^{$_POST['password']}^$phrase");
setcookie('bobsleddigest',$admin_digest,time() + (30*60),'/bobsled/admin','192.168.0.105');
}
include "../header.php";
if( $admin_digest == $digest )
{
if( $_POST['cmd'] == 'add_picture' )
{ print "<div class='alert'>" . AddPicture() . "</div>"; }
else if( $_POST['cmd'] == 'add_disc' )
{ print "<div class='alert'>" . AddDisc() . "</div>"; }
else if( $_POST['cmd'] == 'add_event' )
{ print "<div class='alert'>" . AddEvent() . "</div>"; }
else if( $_POST['cmd'] == 'add_team' )
{ print "<div class='alert'>" . AddTeam() . "</div>"; }
else if( $_POST['cmd'] == 'delete_team' )
{ print "<div class='alert'>" . DeleteTeam() . "</div>"; }
else if( $_POST['cmd'] == 'delete_disc' )
{ print "<div class='alert'>" . DeleteDisc() . "</div>"; }
else if( $_POST['cmd'] == 'delete_event' )
{ print "<div class='alert'>" . DeleteEvent() . "</div>"; }
else if( $_POST['cmd'] == 'delete_picture' )
{ print "<div class='alert'>" . DeletePicture() . "</div>"; }
PrintAdminIndex();
}
else { PrintLoginPage(); }
include "../footer.php";
//=================================================
// PAGE FUNCTIONS
//=================================================
//=======================================
// Adds a team folder
//=======================================
function AddTeam()
{
$team = str_replace(".","_",$_POST['teamname']);
$team = str_replace("/","_",$team);
$team = str_replace(" ","_",$team);
$team = escapeshellcmd($team);
if( file_exists("../pictures/$team/") ) //make sure this team doesn't already exist
{
$message = "&gt; $team already exists!";
print `rm "../pictures/$team/icon.jpg"`; //remove old icon, replace with new one
if( move_uploaded_file($_FILES['icon']['tmp_name'],"../pictures/$team/icon.jpg") )
{ $message .= "<br />&gt; Updated image for $team."; }
else { $message .= "<br />&gt; Could not update image for $team, please try again."; }
}
else //if the team does not already exist
{
print `mkdir "../pictures/$team/"`;
if( file_exists("../pictures/$team") )
{
$message = "&gt; Team $team successfully added.";
if( move_uploaded_file($_FILES['icon']['tmp_name'],"../pictures/$team/icon.jpg") )
{ $message .= "<br />&gt; Image successfully set for $team."; }
else { $message .= "<br />&gt; Could not set image for $team."; }
}
else
{ $message = "&gt; $team could not be added, please try again."; }
}
return $message;
}
//=======================================
// Adds a discipline to an existing team
//=======================================
function AddDisc()
{
$team = str_replace(".","_",$_POST['teamname']);
$team = str_replace("/","_",$team);
$team = str_replace(" ","_",$team);
$team = escapeshellcmd($team);
$disc = str_replace(".","_",$_POST['discname']);
$disc = str_replace("/","_",$disc);
$disc = str_replace(" ","_",$disc);
$disc = escapeshellcmd($disc);
if( file_exists("../pictures/$team/$disc/") ) //make sure this discipline doesn't already exist
{
$message = "&gt; $disc for $team already exists!";
print `rm "../pictures/$team/$disc/icon.jpg"`; //remove old icon, replace with new one
if( move_uploaded_file($_FILES['icon']['tmp_name'],"../pictures/$team/$disc/icon.jpg") )
{ $message .= "<br />&gt; Updated image for $disc."; }
else { $message .= "<br />&gt; Could not update image for $disc, please try again."; }
}
else //if the discipline does not already exist
{
print `mkdir "../pictures/$team/$disc/"`;
if( file_exists("../pictures/$team/$disc") )
{
$message = "&gt; $disc for $team successfully added.";
if( move_uploaded_file($_FILES['icon']['tmp_name'],"../pictures/$team/$disc/icon.jpg") )
{ $message .= "<br />&gt; Image successfully set for $disc."; }
else { $message .= "<br />&gt; Could not set image for $disc."; }
}
else
{ $message = "&gt; $disc for $team could not be added, please try again."; }
}
return $message;
}
//=======================================
// Adds an event to an existing team
//=======================================
function AddEvent()
{
$team = str_replace(".","_",$_POST['teamname']);
$team = str_replace("/","_",$team);
$team = str_replace(" ","_",$team);
$team = escapeshellcmd($team);
$disc = str_replace(".","_",$_POST['discname']);
$disc = str_replace("/","_",$disc);
$disc = str_replace(" ","_",$disc);
$disc = escapeshellcmd($disc);
$event = str_replace(".","_",$_POST['eventname']);
$event = str_replace("/","_",$event);
$event = str_replace(" ","_",$event);
$event = escapeshellcmd($event);
if( file_exists("../pictures/$team/$disc/$event/") ) //make sure this event doesn't already exist
{
$message = "&gt; $event for $team already exists!";
print `rm "../pictures/$team/$disc/$event/icon.jpg"`; //remove old icon, replace with new one
if( move_uploaded_file($_FILES['icon']['tmp_name'],"../pictures/$team/$disc/$event/icon.jpg") )
{ $message .= "<br />&gt; Updated image for $event."; }
else { $message .= "<br />&gt; Could not update image for $event, please try again."; }
}
else //if the event does not already exist
{
print `mkdir "../pictures/$team/$disc/$event/"`;
if( file_exists("../pictures/$team/$disc/$event") )
{
$message = "&gt; $event for $team successfully added.";
if( move_uploaded_file($_FILES['icon']['tmp_name'],"../pictures/$team/$disc/$event/icon.jpg") )
{ $message .= "<br />&gt; Image successfully set for $event."; }
else { $message .= "<br />&gt; Could not set image for $event."; }
}
else
{ $message = "&gt; $event for $team could not be added, please try again."; }
}
return $message;
}
//=======================================
// Adds a picture to an existing
// event of an existing team
//=======================================
function AddPicture()
{
$team = str_replace(".","_",$_POST['teamname']);
$team = str_replace("/","_",$team);
$team = str_replace(" ","_",$team);
$team = escapeshellcmd($team);
$disc = str_replace(".","_",$_POST['discname']);
$disc = str_replace("/","_",$disc);
$disc = str_replace(" ","_",$disc);
$disc = escapeshellcmd($disc);
$event = str_replace(".","_",$_POST['eventname']);
$event = str_replace("/","_",$event);
$event = str_replace(" ","_",$event);
$event = escapeshellcmd($event);
$name = $_FILES['picture']['name'];
$description = addslashes($_POST['description']);
$price = addslashes($_POST['price']);
if( move_uploaded_file($_FILES['picture']['tmp_name'],"../pictures/$team/$disc/$event/$name") )
{
if( file_put_contents("../pictures/$team/$disc/$event/$name.txt","$price\n$description") )
{ $message = "Picture $name successfully added to team $team for $event."; }
}
else { $message = "Picture $name could not be added to $disc for team $team for $event, please try again."; }
return $message;
}
//=======================================
// Deletes a team's entire folder
//=======================================
function DeleteTeam()
{
$team = str_replace(".","_",$_POST['teamname']);
$team = str_replace("/","_",$team);
$team = str_replace(" ","_",$team);
$team = escapeshellcmd($team);
$team_folder = scandir("../pictures/$team");
foreach($team_folder as $file)
{
if( $file != '.' and $file != '..' )
{
$disc_folder = scandir("../pictures/$team/$file");
foreach($disc_folder as $file2)
{
if( $file2 != '.' and $file2 != '..' )
{
$event_folder = scandir("../pictures/$team/$file/$file2");
foreach($event_folder as $file3)
{
if( $file3 != '.' and $file3 != '..' )
{
if( is_dir("../pictures/$team/$file/$file2/$file3") )
{ print `rmdir "../pictures/$team/$file/$file2/$file3/"`; }
else
{ print `rm "../pictures/$team/$file/$file2/$file3"`; }
}
}
if( is_dir("../pictures/$team/$file/$file2") )
{ print `rmdir "../pictures/$team/$file/$file2"`; }
else
{ print `rm "../pictures/$team/$file/$file2"`; }
}
}
if( is_dir("../pictures/$team/$file") )
{ print `rmdir "../pictures/$team/$file"`; }
else
{ print `rm "../pictures/$team/$file"`; }
}
}
print `rmdir "../pictures/$team"`;
if( file_exists("../pictures/$team") )
{ $message = "&gt; Could not delete team."; }
else { $message = "&gt; Team deleted successfully."; }
return $message;
}
//=======================================
// Deletes a team's entire discipline folder
//=======================================
function DeleteDisc()
{
$team = str_replace(".","_",$_POST['teamname']);
$team = str_replace("/","_",$team);
$team = str_replace(" ","_",$team);
$team = escapeshellcmd($team);
$disc = str_replace(".","_",$_POST['discname']);
$disc = str_replace("/","_",$disc);
$disc = str_replace(" ","_",$disc);
$disc = escapeshellcmd($disc);
$disc_folder = scandir("../pictures/$team/$disc/");
foreach($disc_folder as $file)
{
if( $file != '.' and $file != '..' )
{
$event_folder = scandir("../pictures/$team/$disc/$file");
foreach($event_folder as $file2)
{
if( $file2 != '.' and $file2 != '..' )
{
if( is_dir("../pictures/$team/$disc/$file/$file2") )
{ print `rmdir "../pictures/$team/$disc/$file/$file2/"`; }
else
{ print `rm "../pictures/$team/$disc/$file/$file2"`; }
}
}
if( is_dir("../pictures/$team/$disc/$file") )
{ print `rmdir "../pictures/$team/$disc/$file/"`; }
else
{ print `rm "../pictures/$team/$disc/$file"`; }
}
}
print `rmdir "../pictures/$team/$disc"`;
if( file_exists("../pictures/$team/$disc") )
{ $message = "&gt; Could not delete discipline."; }
else { $message = "&gt; Discipline deleted successfully."; }
return $message;
}
//=======================================
// Deletes a team's entire event folder
//=======================================
function DeleteEvent()
{
$team = str_replace(".","_",$_POST['teamname']);
$team = str_replace("/","_",$team);
$team = str_replace(" ","_",$team);
$team = escapeshellcmd($team);
$disc = str_replace(".","_",$_POST['discname']);
$disc = str_replace("/","_",$disc);
$disc = str_replace(" ","_",$disc);
$disc = escapeshellcmd($disc);
$event = str_replace(".","_",$_POST['eventname']);
$event = str_replace("/","_",$event);
$event = str_replace(" ","_",$event);
$event = escapeshellcmd($event);
$event_folder = scandir("../pictures/$team/$disc/$event/");
foreach($event_folder as $file)
{
if( $file != '.' and $file != '..' )
{ print `rm "../pictures/$team/$disc/$event/$file"`; }
}
print `rmdir "../pictures/$team/$disc/$event/"`;
if( file_exists("../pictures/$team/$disc/$event") )
{ $message = "&gt; Could not delete event."; }
else { $message = "&gt; Event deleted successfully."; }
return $message;
}
//=======================================
// Deletes a picture from an event of a team
//=======================================
function DeletePicture()
{
$team = str_replace(".","_",$_POST['teamname']);
$team = str_replace("/","_",$team);
$team = str_replace(" ","_",$team);
$team = escapeshellcmd($team);
$disc = str_replace(".","_",$_POST['discname']);
$disc = str_replace("/","_",$disc);
$disc = str_replace(" ","_",$disc);
$disc = escapeshellcmd($disc);
$event = str_replace(".","_",$_POST['eventname']);
$event = str_replace("/","_",$event);
$event = str_replace(" ","_",$event);
$event = escapeshellcmd($event);
$picture = str_replace("/","_",$_POST['picturename']);
$picture = str_replace(" ","_",$picture);
$picture = escapeshellcmd($picture);
print `rm "../pictures/$team/$disc/$event/$picture"`;
print `rm "../pictures/$team/$disc/$event/$picture.txt"`;
if( file_exists("../pictures/$team/$disc/$event/$picture") )
{ $message = "&gt; Could not delete picture."; }
else { $message = "&gt; Picture deleted successfully."; }
if( file_exists("../pictures/$team/$disc/$event/$picture.txt") )
{ $message .= "<br />&gt; Could not delete picture details file."; }
else { $message .= "<br />&gt; Picture details file deleted successfully."; }
return $message;
}
//=======================================
// Prints the admin index
//=======================================
function PrintAdminIndex()
{
$teams = scandir('../pictures');
$teams_html = "";
$events_js = "";
$pictures_js = "";
if($teams)
{
foreach($teams as $file) //traverse each team's folder
{
if( $file != '.' and $file != ".." and $file != 'icon.jpg') //ignore certain files/folders
{
$teams_html .= "<option value='$file'>$file</option>\n"; //create the html for each teams select menu
$var_name = str_replace(" ","_",$file); //all spaces are to be replaced with underscores
$discs_counter = 0;
$discs_js .= "\nvar $var_name = new Array();"; //create a javascript array for this team's discipline
$discs = scandir("../pictures/$file");
if($discs)
{
foreach($discs as $file2) //traverse each discipline folder for this team
{
if($file2 != '.' and $file2 != ".." and $file2 != 'icon.jpg') //ignore certain files/folders
{
$file_name = addslashes($file2);
$discs_js .= "\n $var_name" . "[$discs_counter] = '$file2';";
$discs_counter++;
$var_name2 = str_replace(" ","_",$file2);
$events_counter = 0;
$events_js .= "\nvar $var_name$var_name2 = new Array();";
$events = scandir("../pictures/$file/$file2");
if($events)
{
foreach($events as $file3) //traverse events folder for team's disciplines
{
if($file3 != '.' and $file3 != '..' and $file3 != 'icon.jpg')
{
$file_name2 = addslashes($file3);
$events_js .= "\n $var_name$var_name2" . "[$events_counter] = '$file_name2';";
$events_counter++;
$var_name3 = str_replace(" ","_",$file3);
$pictures_counter = 0;
$pictures_js .= "\nvar $var_name$var_name2$var_name3 = new Array();";
$pictures = scandir("../pictures/$file/$file2/$file3");
if($pictures)
{
foreach($pictures as $file4) //scan the pictures for each event of each team's disciplines
{
if($file4 != '.' and $file4 != '..' and $file4 != 'icon.jpg' and !(true == strpos($file4,".txt")))
{
$file_name3 = addslashes($file4);
$pictures_js .= "\n $var_name$var_name2$var_name3" . "[$pictures_counter] = '$file_name3';";
$pictures_counter++;
}
}
}
}
}
}
}
}
}
}
}
}
?>
<strong>Admin Panel</strong>
<br /> <hr />
<!--ADD TEAM-->
<form action='index.php' method='post' enctype="multipart/form-data">
<input type='hidden' name='cmd' value='add_team' />
<div class='admin_section'>Add a new bobsled team</div>
<div class='indented_para'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Team name:</td>
<td><input type='text' size='30' name='teamname' /></td>
</tr>
<tr>
<td align='right'>Icon for this team:</td>
<td><input type='file' name='icon' /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='Add Team' /></td>
</tr>
</table>
</div>
</form>
<hr />
<!--ADD Discipline-->
<form action='index.php' method='post' enctype="multipart/form-data">
<input type='hidden' name='cmd' value='add_disc' />
<div class='admin_section'>Add a new discipline to an existing team</div>
<div class='indented_para'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Select Team:</td>
<td>
<select name='teamname'>
<option>Select a Team</option>
<?php print $teams_html;
?>
</select>
</td>
</tr>
<tr>
<td align='right'>Discipline name:</td>
<td><input type='text' size='30' name='discname' /></td>
</tr>
<tr>
<td align='right'>Icon for this discipline:</td>
<td><input type='file' name='icon' /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='Add Discipline' /></td>
</tr>
</table>
</div>
</form>
<hr />
<!--ADD EVENT-->
<form action='index.php' method='post' enctype="multipart/form-data">
<input type='hidden' name='cmd' value='add_event' />
<div class='admin_section'>Add a new event to an existing team's discipline</div>
<div class='indented_para'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Select Team:</td>
<td>
<select name='teamname' id='add_teams_select' onchange="SetDiscsHTML('add')">
<option>Select a Team</option>
<?php print $teams_html;
?>
</select>
</td>
</tr>
<tr>
<td align='right'>Select Discipline:</td>
<td>
<select name='discname' id='add_discs_select' style='visibility:hidden'>
<option>Select a Discipline</option>
</select>
</td>
</tr>
<tr>
<td align='right'>Event name:</td>
<td><input type='text' size='30' name='eventname' /></td>
</tr>
<tr>
<td align='right'>Icon for this event:</td>
<td><input type='file' name='icon' /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='Add Event' /></td>
</tr>
</table>
</div>
</form>
<hr />
<!--ADD PICTURE-->
<form action='index.php' method='post' enctype="multipart/form-data">
<input type='hidden' name='cmd' value='add_picture' />
<div class='admin_section'>Add a new picture to an existing team's event</div>
<div class='indented_para'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Select Team:</td>
<td>
<select name='teamname' id='add2_teams_select' onchange="SetDiscsHTML('add2')">
<option>Select a Team</option>
<?php print $teams_html;
?>
</select>
</td>
</tr>
<tr>
<td align='right'>Select Discipline:</td>
<td>
<select name='discname' id='add2_discs_select' style='visibility:hidden' onchange="SetEventsHTML('add2')">
<option>Select a Discipline</option>
</select>
</td>
</tr>
<tr>
<td align='right'>Select Event:</td>
<td>
<select name='eventname' id='add2_events_select' style='visibility:hidden'>
<option>Select an Event</option>
</select>
</td>
</tr>
<tr>
<td align='right'>Browse for picture:</td>
<td><input type='file' name='picture' /></td>
</tr>
<tr>
<td align='right'>Picture description:</td>
<td><input type='text' size='50' name='description' /></td>
</tr>
<tr>
<td align='right'>Picture price:</td>
<td><input type='text' size='5' name='price' /> (no dollar sign)</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='Add Picture' /></td>
</tr>
</table>
</div>
</form>
<script type='text/javascript' language='javascript'>
<!--
<?php print $discs_js . "\n\n" . $events_js . "\n\n" . $pictures_js;
?>
function SetDiscsHTML(id_prefix)
{
var discs_id = id_prefix + "_discs_select";
var teams_id = id_prefix + "_teams_select";
//grab the HTML elements
var discs_select = document.getElementById(discs_id);
var team_selected = document.getElementById(teams_id).value;
//replace all spaces with an underscore
while( team_selected.indexOf(" ") > 0 )
{ team_selected = team_selected.replace(" ","_"); }
var discs_array = eval(team_selected);
var array_length = discs_array.length;
if( team_selected != 'Select a Team' )
{
if(id_prefix == "delete3")
{
var picture_options = document.getElementById(id_prefix + "_pictures_select").options.length - 1;
for(var c=picture_options;c>0;c--)
{ document.getElementById(id_prefix + "_pictures_select").remove(c); }
}
if((id_prefix == "delete2") || (id_prefix == "delete3") || (id_prefix == "add2"))
{
var event_options = document.getElementById(id_prefix + "_events_select").options.length - 1;
for(var c=event_options;c>0;c--)
{ document.getElementById(id_prefix + "_events_select").remove(c); }
}
var num_options = discs_select.options.length - 1;
for(var c=num_options;c>0;c--)
{ discs_select.remove(c); }
for(var i=0;i < array_length;i++)
{
var new_option = document.createElement("OPTION");
new_option.text = discs_array[i];
new_option.value = discs_array[i];
discs_select.style.visibility = "visible";
discs_select.options.add(new_option);
}
}
}
function SetEventsHTML(id_prefix)
{
var events_id = id_prefix + "_events_select";
var discs_id = id_prefix + "_discs_select";
var teams_id = id_prefix + "_teams_select";
//grab the HTML elements
var events_select = document.getElementById(events_id);
var disc_selected = document.getElementById(discs_id).value;
var team_selected = document.getElementById(teams_id).value;
//replace all spaces with an underscore
while( disc_selected.indexOf(" ") > 0 )
{ disc_selected = disc_selected.replace(" ","_"); }
while( team_selected.indexOf(" ") > 0 )
{ team_selected = team_selected.replace(" ","_"); }
var events_array = eval(team_selected + disc_selected);
var array_length = events_array.length;
if( disc_selected != 'Select a Discipline' )
{
if(id_prefix == "delete3")
{
var picture_options = document.getElementById(id_prefix + "_pictures_select").options.length - 1;
for(var c=picture_options;c>0;c--)
{ document.getElementById(id_prefix + "_pictures_select").remove(c); }
}
var num_options = events_select.options.length - 1;
for(var c=num_options;c>0;c--)
{ events_select.remove(c); }
for(var i=0;i < array_length;i++)
{
var new_option = document.createElement("OPTION");
new_option.text = events_array[i];
new_option.value = events_array[i];
events_select.style.visibility = "visible";
events_select.options.add(new_option);
}
}
}
function SetPicturesHTML()
{
//grab the HTML elements
var pictures_select = document.getElementById('delete3_pictures_select');
var event_selected = document.getElementById('delete3_events_select').value;
var disc_selected = document.getElementById('delete3_discs_select').value;
var team_selected = document.getElementById('delete3_teams_select').value;
//replace all spaces with an underscore
while( event_selected.indexOf(" ") > 0 )
{ event_selected = event_selected.replace(" ","_"); }
while( disc_selected.indexOf(" ") > 0 )
{ disc_selected = disc_selected.replace(" ","_"); }
while( team_selected.indexOf(" ") > 0 )
{ team_selected = team_selected.replace(" ","_"); }
var pictures_array = eval(team_selected + disc_selected + event_selected);
var array_length = pictures_array.length;
if( event_selected != 'Select an Event' )
{
var num_options = pictures_select.options.length - 1;
for(var c=num_options;c>0;c--)
{ pictures_select.remove(c); }
for(var i=0;i < array_length;i++)
{
var new_option = document.createElement("OPTION");
new_option.text = pictures_array[i];
new_option.value = pictures_array[i];
pictures_select.style.visibility = "visible";
pictures_select.options.add(new_option);
}
}
}
function ReallyDeleteTeam()
{
if( confirm("Do you really want to delete this team?") )
{ return true; }
else { return false; }
}
function ReallyDeleteDisc()
{
if( confirm("Do you really want to delete this discipline?") )
{ return true; }
else { return false; }
}
function ReallyDeleteEvent()
{
if( confirm("Do you really want to delete this event?") )
{ return true; }
else { return false; }
}
function ReallyDeletePicture()
{
if( confirm("Do you really want to delete this picture?") )
{ return true; }
else { return false; }
}
//-->
</script>
<hr /> <hr />
<!--DELETION CAPABILITIES--->
<!--DELETE TEAM-->
<form action='index.php' method='post'>
<input type='hidden' name='cmd' value='delete_team' />
<div class='admin_section'>Delete an entire, existing team</div>
<div class='indented_para'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Select a team:</td>
<td>
<select name='teamname'>
<option>Select a Team</option>
<?php print $teams_html;
?>
</select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='Delete Team' /></td>
</tr>
</table>
</div>
</form>
<hr />
<!--DELETE DISCIPLINE-->
<form action='index.php' method='post'>
<input type='hidden' name='cmd' value='delete_disc' />
<div class='admin_section'>Delete an entire, existing discipline of an existing team</div>
<div class='indented_para'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Select Team:</td>
<td>
<select name='teamname' id='delete_teams_select' onchange="SetDiscsHTML('delete')">
<option>Select a Team</option>
<?php print $teams_html;
?>
</select>
</td>
</tr>
<tr>
<td align='right'>Select a Discipline:</td>
<td>
<select name='discname' id='delete_discs_select' style='visibility:hidden'>
<option>Select a Discipline</option>
</select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='Delete Discipline' onsubmit='ReallyDeleteDisc()' /></td>
</tr>
</table>
</div>
</form>
<hr />
<!--DELETE EVENT-->
<form action='index.php' method='post'>
<input type='hidden' name='cmd' value='delete_event' />
<div class='admin_section'>Delete an entire, existing event of an existing team</div>
<div class='indented_para'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Select Team:</td>
<td>
<select name='teamname' id='delete2_teams_select' onchange="SetDiscsHTML('delete2')">
<option>Select a Team</option>
<?php print $teams_html;
?>
</select>
</td>
</tr>
<tr>
<td align='right'>Select a Discipline:</td>
<td>
<select name='discname' id='delete2_discs_select' style='visibility:hidden' onchange="SetEventsHTML('delete2')">
<option>Select a Discipline</option>
</select>
</td>
</tr>
<tr>
<td align='right'>Select an event:</td>
<td>
<select name='eventname' id='delete2_events_select' style='visibility:hidden'>
<option>Select an Event</option>
</select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='Delete Event' onsubmit='ReallyDeleteEvent()' /></td>
</tr>
</table>
</div>
</form>
<hr />
<!--DELETE PICTURE-->
<form action='index.php' method='post'>
<input type='hidden' name='cmd' value='delete_picture' />
<div class='admin_section'>Delete a picture from an existing team's event</div>
<div class='indented_para'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Select Team:</td>
<td>
<select name='teamname' id='delete3_teams_select' onchange="SetDiscsHTML('delete3')">
<option>Select a Team</option>
<?php print $teams_html;
?>
</select>
</td>
</tr>
<tr>
<td align='right'>Select a Discipline:</td>
<td>
<select name='discname' id='delete3_discs_select' style='visibility:hidden' onchange="SetEventsHTML('delete3')">
<option>Select a Discipline</option>
</select>
</td>
</tr>
<tr>
<td align='right'>Select Event:</td>
<td>
<select name='eventname' id="delete3_events_select" onchange="SetPicturesHTML()" style='visibility:hidden'>
<option>Select an Event</option>
</select>
</td>
</tr>
<tr>
<td align='right'>Select Picture:</td>
<td>
<select name='picturename' id="delete3_pictures_select" style='visibility:hidden'>
<option>Select a Picture</option>
</select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='Delete Picture' /></td>
</tr>
</table>
</div>
</form>
<hr />
<?php
}
//=======================================
// Displays the admin login page
//=======================================
function PrintLoginPage()
{
?>
<form action='index.php' method='post'>
<table cellpadding='4' cellspacing='0' border='0'>
<tr>
<td align='right'>Username:</td>
<td><input type='text' size='20' name='user' /></td>
</tr>
<tr>
<td align='right'>Password:</td>
<td><input type='password' size='20' name='password' /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' value='login' /></td>
</table>
</form>
<?php
}
?>

26
_old/version_2/about.php Executable file
View File

@@ -0,0 +1,26 @@
<?php
#####################################################
# #
# written by benjamin ramey #
# ben.ramey@gmail.com #
# #
# best viewed with: #
# resolution = 1280x960 #
# tab = 4 spaces #
# indent = 8 spaces #
# #
# This file contains: #
# about page for bobsleighphotos.com #
# #
#####################################################################################################################
# CODE # COMMENTS #
#####################################################################################################################
include 'html/html_header.php';
$page = xml_parse_file($_DOC_ROOT.'/data/pages/about.xml');
html_print_xml_page($page['page']);
include 'html/html_footer.php';
?>

205
_old/version_2/bobsleigh.css Executable file
View File

@@ -0,0 +1,205 @@
/* CSS for John Nielsen's Bobsled Photos Website*/
body {
background-color: #000000;
}
p {
margin: 10px 0px 0px 0px;
}
a:link {
color: #FFFFFF;
}
a:visited {
color: #FFFFFF;
}
a:hover {
color: #CCCCCC;
}
.img_border {
border-style: solid;
border-color: #000000;
border-width: 1px;
}
/*************************
Main Table ID Styles
***********************/
#top_left {
background-image: url(graphics/bg_corner_TL.png);
background-repeat: no-repeat;
background-position: top left;
}
#top_left-blue {
background-image: url(graphics/bg_corner_TL-blue.png);
background-repeat: no-repeat;
background-position: top left;
}
#top {
background-image: url(graphics/bg_line_top.png);
background-repeat: repeat-x;
height: 30px;
background-position: top;
}
#top_right {
background-image: url(graphics/bg_corner_TR.png);
background-repeat: no-repeat;
background-position: top right;
}
#top_right-blue {
background-image: url(graphics/bg_corner_TR-blue.png);
background-repeat: no-repeat;
background-position: top right;
}
#left {
background-image: url(graphics/bg_line_left.png);
background-repeat: repeat-y;
background-position: left;
width: 30px;
}
#right {
background-image: url(graphics/bg_line_right.png);
background-repeat: repeat-y;
background-position: right;
width: 30px;
}
#bottom_left {
background-image: url(graphics/bg_corner_BL.png);
background-repeat: no-repeat;
background-position: bottom left;
}
#bottom_left-blue {
background-image: url(graphics/bg_corner_BL-blue.png);
background-repeat: no-repeat;
background-position: bottom left;
}
#bottom {
background-image: url(graphics/bg_line_bottom.png);
background-repeat: repeat-x;
height: 30px;
background-position: bottom;
}
#bottom_right {
background-image: url(graphics/bg_corner_BR.png);
background-repeat: no-repeat;
background-position: top right;
}
#bottom_right-blue {
background-image: url(graphics/bg_corner_BR-blue.png);
background-repeat: no-repeat;
background-position: top right;
}
/*************************
Main Div Tag Styles
***********************/
#blueline {
position: relative;
top: 100px;
z-index: 0;
height: 204px;
background-color: #333333;
border-width: 4px 0px 4px 0px;
border-color: #666666;
border-style: ridge;
background-image: url(./graphics/negative_strip.jpg);
background-repeat: repeat-x;
background-position: center;
}
#main_div {
font-family: Arial;
color: #FFFFFF;
}
#header {
margin: 0px 0px 5px 0px;
}
#linkbar {
margin: 0px 0px 10px 0px;
padding: 0px;
font-weight: bold;
text-align: left;
}
#body {
position: relative;
z-index: 1;
top: -190px;
width: 700px;
padding: 0px;
background-color: #336699;
}
#content {
padding: 0px;
}
#teamindexheader {
padding: 10px;
margin-top: 30px;
text-align: left;
text-transform: uppercase;
font-size: 18px;
font-weight: bold;
}
#teamindex {
font-size: 14px;
font-weight: normal;
text-align: center;
height: 155px;
overflow: auto;
}
#picture {
width: 550px;
padding: 5px;
border-width: 3px;
border-color: #000000;
border-style: solid;
background-color: #CCCCCC;
color: #000000;
}
.indented_para {
padding-left: 20px;
}
.admin_section {
margin-bottom: 5px;
font-weight: bold;
}
.alert {
padding: 5px;
margin-bottom: 20px;
border-width: 2px;
border-color: red;
border-style: solid;
}
.description {
margin-top: 10px;
}
.team {
font-size: 18px;
}
.teams_list {
height:200px;
overflow:auto;
}
/*************************
Text Styles
***********************/
.page_title {
margin-bottom: 10px;
font-size: 18pt;
font-weight: bold;
font-variant: small-caps;
}
.page_content {
margin: 0px;
}
.text_div {
margin: 15px 0px 0px 0px;
}
.text_header {
margin: 0px;
text-decoration: underline;
}
.text {
padding: 0px 0px 0px 15px;
margin: 0px;
}

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<page>
<name>About BobsleighPhotos.com</name>
<content>
<section>
<name>About John Nielsen</name>
<text>
<para>Stuff about John Nielsen.</para>
</text>
</section>
<section>
<name>How Buying a Photo Works</name>
<text>
<para>
<paracontent>Finding the picture that you want is simply a matter of browsing through the pictures on the site to find something you like. All the pictures are organized in the following order:</paracontent>
<list type='ordered'>
<listitem>Team</listitem>
<listitem>Discipline (skeleton, 4-man, 2-man, etc)</listitem>
<listitem>Event (Calgary 2005, Berchtesgaden 2004, etc)</listitem>
</list>
</para>
<para>Once you find a picture you would like to buy, you must click on the appropriate "Buy Now" button that can be found directly under each picture. You will notice that the pictures each have two "Buy Now" buttons, one labeled "Order a Print" and the other labeled "Order a Digital Copy". If you would like a copy of the picture in digital format, choose "Order a Digital Copy". If you would like a physical 8x10 inch print of the picture, choose "Order a Print".</para>
<para>Once you choose which format best suites you and you click on the corresponding "Buy Now" button, you will be directed to the PayPal site to send the money for the picture to us. When we receive your order, the full size picture will then be e-mailed to you in digital format, or a physical print of the picture will be sent to you via regular mail--whichever option you have chosen.</para>
</text>
</section>
</content>
</page>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<page>
<name>Welcome to BobsleighPhotos.com!</name>
<content>
<para> welcome message </para>
</content>
</page>

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

View File

@@ -0,0 +1,2 @@
25.00
Corner number five on day two of the Calgary World Championship.

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

View File

@@ -0,0 +1,2 @@
10.00
The USA team gets off to a fast start on day four.

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 MiB

26
_old/version_2/home.php Executable file
View File

@@ -0,0 +1,26 @@
<?php
#####################################################
# #
# written by benjamin ramey #
# ben.ramey@gmail.com #
# #
# best viewed with: #
# resolution = 1280x960 #
# tab = 4 spaces #
# indent = 8 spaces #
# #
# This file contains: #
# about page for bobsleighphotos.com #
# #
#####################################################################################################################
# CODE # COMMENTS #
#####################################################################################################################
include 'html/html_header.php';
$page = xml_parse_file($_DOC_ROOT.'/data/pages/home.xml');
html_print_xml_page($page['page']);
include 'html/html_footer.php';
?>

View File

@@ -0,0 +1,14 @@
</td>
<td id='right'>&nbsp;</td>
</tr>
<tr>
<td id='bottom_left'>&nbsp;</td>
<td id='bottom'>&nbsp;</td>
<td id='bottom_right'>&nbsp;</td>
</tr>
</table>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,29 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>bobsleigh photos by john nielsen</title>
<link href='/bobsleigh.css' rel='stylesheet' type='text/css' />
</head>
<body>
<div id="blueline"></div>
<div id="main_div" align='center'>
<div id="body" align='left'>
<table cellpadding='0' cellspacing='0' border='0' width='100%'>
<tr>
<td id='top_left'>&nbsp;</td>
<td id='top'>&nbsp;</td>
<td id='top_right'>&nbsp;</td>
</tr>
<tr>
<td id='left'>&nbsp;</td>
<td>
<div id="header">
<img src='/graphics/header.jpg' border='0' />
</div>
<div id="linkbar">
&nbsp;
<a href='/index.php'><img src='/graphics/btn_home.png' border='0' /></a>
<a href='/index.php'><img src='/graphics/btn_teams.png' border='0' /></a>
<a href='/index.php/about/'><img src='/graphics/btn_about.png' border='0' /></a>
</div>

39
_old/version_2/index.php Executable file
View File

@@ -0,0 +1,39 @@
<?php
#####################################################
# #
# written by benjamin ramey #
# ben.ramey@gmail.com #
# #
# best viewed with: #
# resolution = 1280x960 #
# tab = 4 spaces #
# indent = 8 spaces #
# #
# This file contains: #
# index page of bobsleighphotos.com #
# #
#####################################################################################################################
# CODE # COMMENTS #
#####################################################################################################################
##################################################################### FILES TO INCLUDE
require 'php/func_ops.php'; # site operation functions
require 'php/func_html.php'; # functions to do HTML printing tasks
require 'php/func_xml.php'; # functions to handle xml
require 'php/inc_constants.php'; # php constants
require 'php/inc_globals.php'; # global variables
##################################################################### SWITCHING STATION
$page = array_pop($_CMDS); # the first element in the _CMDS array is always
# the page to display
if(empty($page)) { $page = 'home'; }
switch($page) {
default:
include $page.'.php';
break;
}
exit;
?>

170
_old/version_2/php/func_html.php Executable file
View File

@@ -0,0 +1,170 @@
<?php
#########################################################
# #
# Functions the print HTML #
# written by benjamin ramey #
# bsr@rameydesign.net #
# #
# best viewed with: #
# resolution = 1280x960 #
# tab = 4 spaces #
# indent = 8 spaces #
# #
#####################################################################################################################################################
# CODE # COMMENTS #
#####################################################################################################################################################
###################################################################################################### print a page from xml data array
# parameters: 1) array of data from xml file
# returns: the html for the select box for language selection
function html_print_xml_page($data)
{
$page_name = $data['name'];
$page_content = '';
$sections = 0;
$paras = 0;
isset($data['content']['section'])
? $sections = 1
: $paras = 1;
if($sections ) {
$contents = xml_force_array($data['content']['section']);
$page_content = html_print_sections($contents);
}
else if($paras) {
$contents = xml_force_array($data['content']['para']);
$page_content = html_print_paragraphs($contents);
}
print "<div class='page_title'>$page_name</div>\n";
print "<div class='page_content'>\n";
print $page_content;
print "</div>\n";
}
###################################################################################################### print sections of an xml page
# parameters: 1) array of sections to print
# returns: the html for the sections
function html_print_sections(&$sections)
{
$page_content = '';
foreach($sections as $sec) {
$page_content .= "<div class='text_div'>\n";
$page_content .= "<div class='text_header'>{$sec['name']}</div>\n";
$page_content .= "<div class='text'>\n";
$paras = xml_force_array($sec['text']['para']);
$page_content .= html_print_paragraphs($paras);
$page_content .= "</div>\n";
$page_content .= "</div>\n";
}
return $page_content;
}
###################################################################################################### print paragraphs of an xml page
# parameters: 1) array of paragraphs to print
# returns: the html for the paragraphs
function html_print_paragraphs(&$paragraphs)
{
$page_content = '';
foreach($paragraphs as $para) {
$page_content .= '<p>';
if(is_array($para)) {
foreach($para as $key => $value) {
switch($key) {
case 'line':
if(is_array($value)) {
foreach($value as $line) { $page_content .= '<br />'.$line; }
}
else { $page_content .= '<br />'.$value; }
break;
case 'paracontent':
$page_content .= "$value\n";
break;
case 'list':
if($para['list']['type'] == 'ordered') {
$page_content .= "<ol>\n";
}
else { $page_content .= "<ul>\n"; }
foreach($para['list']['listitem'] as $item) {
$page_content .= "<li>$item</li>\n";
}
if($para['list']['type'] == 'ordered') {
$page_content .= "</ol>\n";
}
else { $page_content .= "</ul>\n"; }
break;
case 'heading':
$page_content .= "<strong>$value</strong>\n";
break;
case 'link':
if(is_array($value)) {
$page_content .= " <a href='{$value['href']}'>{$value['linktext']}</a>\n";
}
else { $page_content .= " <a href='$value'>$value</a>\n"; }
break;
case 'image':
$images = xml_force_array($para['image']);
$page_content .= html_print_images($images);
break;
default:
break;
}
}
}
else { $page_content .= $para; }
$page_content .= "</p>\n";
}
return $page_content;
}
###################################################################################################### print images of an xml page
# parameters: 1) array of images to print
# returns: the html for the images
function html_print_images(&$images)
{
$page_content = '';
foreach($images as $image) {
if(is_array($image)) {
foreach($image as $key => $value) {
switch($key) {
case 'link':
$page_content .= "<a href='$value'><img src='/graphics/{$image['path']}' ";
$page_content .= "target='_blank' border='0' /></a>\n";
break;
default:
break;
}
}
}
else { $page_content .= "<img src='/graphics/{$image}' border='0' align='right' />\n"; }
}
return $page_content;
}
###################################################################################################### gets a random panorama image
# parameters: 1) path to pictures
# returns: the html for the select box for language selection
function html_get_random_img($path)
{
$pictures = scandir($path);
$pictures = filesys_remove_unwanted_children($pictures,$path,'folders');
$num_pics = count($pictures);
$rand_pic = $pictures[floor(rand(0,$num_pics - 1))];
return($rand_pic);
}
?>

41
_old/version_2/php/func_ops.php Executable file
View File

@@ -0,0 +1,41 @@
<?php
#####################################################
# #
# written by benjamin ramey #
# ben.ramey@gmail.com #
# #
# best viewed with: #
# resolution = 1280x960 #
# tab = 4 spaces #
# indent = 8 spaces #
# #
# This file contains: #
# Functions the govern various and sundry #
# site operations such as obtaining the #
# commands sent to the server like, for #
# example, what page to display #
# #
#####################################################################################################################
# CODE # COMMENTS #
#####################################################################################################################
##################################################################### FUNCTION: ops_get_cmds
function ops_get_cmds()
{
global $_QUERY,$_SCRIPT_NAME;
$separator = '/'; # query string will be split by this character
$cmds = array();
if(empty($_QUERY)) { return($cmds); } # if the query string is empty, no need to procede
# but we do want to still return an array (even an empty one)
$cmds = explode($separator,
str_replace($_SCRIPT_NAME,'',$_QUERY));
for($c = 0; $c < count($cmds); ) { # removes any empty array elements
if(empty($cmds[$c])) {
array_splice($cmds,$c,1); # remove the empty element
}
else { $c++; } # only advance the array index if we didn't splice something out
}
return($cmds);
}

136
_old/version_2/php/func_xml.php Executable file
View File

@@ -0,0 +1,136 @@
<?php
#########################################################
# #
# XML functions #
# written by benjamin ramey #
# bsr@rameydesign.net #
# #
# best viewed with: #
# resolution = 1280x960 #
# tab = 4 spaces #
# indent = 8 spaces #
# #
########################################################################################## xml_parse_file
# parameters: path to file to parse
# returns: associative array of xml file data
function xml_parse_file($xml_file)
{
$xml = '';
$data = array();
if(file_exists($xml_file)) {
$xml = file_get_contents($xml_file);
if(empty($xml)) {
return(NULL);
}
}
else { return(NULL); }
$patt = "/^<\?xml([^\?]*)\?>/";
preg_match($patt,$xml,$matches);
$xml_specs = explode(' ',$matches[1]);
foreach($xml_specs as $spec) {
if(empty($spec)) { continue; }
list($name,$value) = explode('=',$spec);
$value = str_replace("'",'',$value);
$value = str_replace('"','',$value);
$data[$name] = $value;
}
$xml = substr($xml,strlen($matches[0]));
$xml_left = array($xml); // init xml heap
$tmp_refs[] =& $data; // init refs heap
$patt = "/^<(\w+)([^>]*)>/"; // pattern to get element at beginning of xml_left
while(!empty($xml_left)) {
$to_process = array_pop($xml_left); // $xml_left is a heap
$to_process = trim($to_process); // trim fore and aft spaces
$last_index = count($tmp_refs) - 1;
if(preg_match($patt,$to_process,$matches)) {
$element = $matches[1];
$parameters = isset($matches[2]) ? $matches[2] : '';
if(isset($tmp_refs[$last_index][$element])) {
if(is_array($tmp_refs[$last_index][$element])) {
if(isset($tmp_refs[$last_index][$element][0])) { // case: [biography]=>[0],[1]...[x]; $element = biography
array_push($tmp_refs[$last_index][$element],''); // endsup: [biography]=>[0],[1]...[x+1]
$tmp_index = count($tmp_refs[$last_index][$element]) - 1;
$tmp_refs[] =& $tmp_refs[$last_index][$element][$tmp_index];
}
else { // case: [biography]=>[paragraph]; $element = biography
$tmp_ary = $tmp_refs[$last_index][$element]; // endsup: [biography]=>[0]=>[paragraph]
$tmp_refs[$last_index][$element] = array($tmp_ary,''); // [1]=>''
$tmp_refs[] =& $tmp_refs[$last_index][$element][1];
}
}
else { // case: [biography]=>"string"; $element = biography
$tmp_refs[$last_index][$element] = array($tmp_refs[$last_index][$element],'');
$tmp_refs[] =& $tmp_refs[$last_index][$element][1]; // endsup: [biography]=>[0]=>"string"
} // [1]=>''
}
else {
$tmp_refs[$last_index][$element] = ''; // case: [biography]=> NULL; $element = biography
$tmp_refs[] =& $tmp_refs[$last_index][$element]; // endsup: [biography]=>""
}
if(!empty($parameters)) { // if there are parameters, add them as if they were imbedded elements
$pairs = explode(' ',$parameters);
$last_index = count($tmp_refs) - 1;
$tmp_refs[$last_index] = array(); // we can do this, because we know the last element added
// is always fresh and new
foreach($pairs as $pair) {
if(empty($pair)) { continue; }
list($name,$value) = explode('=',$pair);
$value = str_replace("'",'',$value);
$value = str_replace('"','',$value);
$tmp_refs[$last_index][$name] = $value;
}
}
$end_tag = strpos($to_process,"</$element>");
if($end_tag === FALSE) {
return("ERROR IN XML DOCUMENT, NO END TAG: $element\n\nto process: $to_process");
}
$element_len = strlen($matches[0]);
$contents = substr($to_process,$element_len,$end_tag - $element_len);
if($extra = substr($to_process,$end_tag + strlen("</$element>"))) {
array_push($xml_left,$extra);
}
else {
array_push($xml_left,'!~~END~~!');
}
array_push($xml_left,$contents);
}
else if($to_process != '!~~END~~!') { // no pattern match, but it's not the end of an embedded element
$tmp_refs[$last_index] = $to_process; // so we must have content to assign, so assign it--genius!
array_pop($tmp_refs);
}
else { // we've reached the end of an embedded element, so jump back a level
$tmp = array_pop($tmp_refs);
}
}
return($data);
}
########################################################################################## xml_force_array
# parameters: path to file to parse
# returns: associative array of xml file data
function xml_force_array($element)
{
$array = array();
if(is_array($element)) {
if(isset($element[0])) { $array = $element; }
else { array_push($array,$element); }
}
else { array_push($array,$element); }
return($array);
}
?>

View File

@@ -0,0 +1,23 @@
<?php
#####################################################
# #
# written by benjamin ramey #
# ben.ramey@gmail.com #
# #
# This file contains: #
# constants #
# #
#####################################################################################################
# CODE # COMMENTS #
#####################################################################################################
# style: all caps, underscores
# prefix: k
##################################################### CONSTANTS
define('kDEBUG',false); # toggles debugging messages throughout code
define('kERROR_LEVEL','low'); # level of error reporting:
# none = no error reporting
# high = only high priority errors
# medium = medium and higher priority errors
# low = low and higher priority errors
?>

View File

@@ -0,0 +1,19 @@
<?php
#####################################################
# #
# written by benjamin ramey #
# ben.ramey@gmail.com #
# #
# This file contains: #
# globals #
# #
#####################################################################################################################
# CODE # COMMENTS #
#####################################################################################################################
# style: all caps, underscores
# prefix: _
##################################################################### GLOBALS
$_DOC_ROOT = $_SERVER['DOCUMENT_ROOT'];
$_SCRIPT_NAME = $_SERVER['SCRIPT_NAME'];
$_QUERY = $_SERVER['REQUEST_URI'];
$_CMDS = ops_get_cmds();

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 KiB