Fourth pass at adding key files

This commit is contained in:
dsainty
2024-06-17 22:30:36 +10:00
parent 08eb7b7da2
commit 67ccdbcc34
132 changed files with 11416 additions and 0 deletions

View File

@ -0,0 +1,34 @@
<?require ("global.php");?>
<?php
$ID = 0;
if (isset($_POST['ID'])) { $ID = $_POST['ID']; }
$stageID = 0;
if (isset($_POST['stageID'])) { $stageID = $_POST['stageID']; }
if ($ID != 0)
{
$query = "UPDATE maps SET "
. "zoom = '" . $_POST['zoom'] . "', "
. "map_type = '" . $_POST['map_type'] . "', "
. "center_lat = '" . $_POST['center_lat'] . "', "
. "center_lon = '" . $_POST['center_lon'] . "' "
. "WHERE ID = '$ID'";
$result = mysql_query($query, $db);
}
else
{
$query = "INSERT INTO maps (stageID, zoom, map_type, center_lat, center_lon) VALUES ("
. "'" . $stageID . "',"
. "'" . $_POST['zoom'] . "',"
. "'" . $_POST['map_type'] . "',"
. "'" . $_POST['center_lat'] . "',"
. "'" . $_POST['center_lon'] . "')";
$result = mysql_query($query, $db);
}
staticify($stageID);
header("Location: /tick/stages.php");
?>

View File

@ -0,0 +1,33 @@
function banner(which)
{
var LIMIT = 9;
var sections = new Array(LIMIT);
for (var i=0; i < sections.length; i++)
{
sections[i] = 'bannerthere';
}
if (which >= 0 && which <= LIMIT)
sections[which] = 'bannerhere';
document.writeln('<table cellpadding=2 cellspacing=2 border=0 width=700"><tr>');
document.writeln('<td align=center width="20%"><img src="/images/omr_logo_on_black_120w.jpg" border=0></td>');
document.writeln('<td align=center><a class=' + sections[1] + ' href="events.php">Events</a></td>');
document.writeln('<td align=center><a class=' + sections[2] + ' href="stages.php">Stages</a></td>');
document.writeln('<td align=center><a class=' + sections[3] + ' href="ticks.php">Ticks</a></td>');
document.writeln('<td align=center><a class=' + sections[5] + ' href="standings.php">Standings</a></td>');
document.writeln('<td align=center><a class=' + sections[6] + ' href="maps_appearance.php">Maps</a></td>');
document.writeln('<td align=center><a class=' + sections[4] + ' href="pics.php">Pics</a></td>');
document.writeln('<td align=center><a class=' + sections[7] + ' href="videos.php">Videos</a></td>');
//document.writeln('<td align=center><a class=' + sections[8] + ' href="popup.php">Popup</a></td>');
document.writeln('</tr></table>');
}
function popup(url, word)
{
var msg = "Are you sure you want to permanently remove this " + word + "?";
if (confirm(msg))
{
location.replace(url);
}
}

View File

@ -0,0 +1,32 @@
<?php
$img = '';
if (isset($_GET['img'])) { $img = $_GET['img']; }
?>
<html>
<head>
<title>:: click on the picture to close window ::</title>
</head>
<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4>
<div align=center>
<table cellpadding=3 cellspacing=3 border=0 width="100">
<tr>
<td bgcolor="#eeeeee">
<a href="javascript:window.close();">
<img border=0 src="<?php echo $img ?>">
</a>
</td>
</tr>
</table>
</div>
</body>
</html>

View File

@ -0,0 +1,65 @@
<?require ("global.php");?>
<?php
$stageID = 0;
if (isset($_POST['stageID'])) { $stageID = $_POST['stageID']; }
$segmentID = 0;
if (isset($_POST['segmentID'])) { $segmentID = $_POST['segmentID']; }
if ($stageID != 0)
{
$query = "DELETE FROM maps_coords WHERE stageID = " . $stageID;
$result = mysql_query($query, $db);
$query = "SELECT * FROM segments WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$segment = "segment" . $r['ID'];
if (isset($_POST[$segment]) && $_POST[$segment] != "")
{
$coords = split(":", $_POST[$segment]);
for ($i=0; $i < count($coords) - 1; $i++)
{
list($lat, $lon) = split(",", $coords[$i]);
$query2 = "INSERT INTO maps_coords (stageID, segmentID, sequence, latitude, longitude) VALUES ("
. "'" . $stageID . "',"
. "'" . $r['ID'] . "',"
. "'" . $i . "',"
. "'" . $lat . "',"
. "'" . $lon . "')";
$result2 = mysql_query($query2, $db) or mysql_error($result2);
}
}
$distance_mi = "distance_mi" . $r['ID'];
$distance_km = "distance_km" . $r['ID'];
if (isset($_POST[$distance_mi]) && $_POST[$distance_mi] != "")
{
$query2 = "UPDATE segments SET "
. "distance_mi = '" . $_POST[$distance_mi] . "', "
. "distance_km = '" . $_POST[$distance_km] . "' "
. "WHERE ID = " . $r['ID'];
$result2 = mysql_query($query2, $db) or mysql_error($result2);
}
}
mysql_free_result($result);
}
if ($segmentID == 0)
{
$query = "INSERT INTO segments (stageID, color, name) VALUES ("
. "'" . $stageID . "', "
. "'" . $_POST['color'] . "', "
. "'" . myaddslashes($_POST['name']) . "')";
$result = mysql_query($query, $db) or mysql_error($result);
}
}
header("Location: /tick/maps_courses.php");
?>

View File

@ -0,0 +1,58 @@
<?require ("global.php");?>
<?php
$stageID = 0;
if (isset($_POST['stageID'])) { $stageID = $_POST['stageID']; }
$newStageID = 0;
if (isset($_POST['newStageID'])) { $newStageID = $_POST['newStageID']; }
if ($newStageID != 0)
{
$query = "DELETE FROM segments WHERE stageID = $stageID";
$result = mysql_query($query, $db);
$query = "SELECT * from segments WHERE stageID = $newStageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$query2 = "INSERT INTO segments (stageID, name, color, distance_mi, distance_km) VALUES ("
. "'" . $stageID . "',"
. "'" . $r['name'] . "',"
. "'" . $r['color'] . "',"
. "'" . $r['distance_mi'] . "',"
. "'" . $r['distance_km'] . "')";
$result2 = mysql_query($query2, $db);
$ID = mysql_insert_id();
$segments[$r['ID']] = $ID;
}
mysql_free_result($result);
}
$query = "DELETE FROM maps_coords WHERE stageID = $stageID";
$result = mysql_query($query, $db);
$query = "SELECT * from maps_coords WHERE stageID = $newStageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$query2 = "INSERT INTO maps_coords (stageID, segmentID, sequence, latitude, longitude) VALUES ("
. "'" . $stageID . "',"
. "'" . $segments[$r['segmentID']] . "',"
. "'" . $r['sequence'] . "',"
. "'" . $r['latitude'] . "',"
. "'" . $r['longitude'] . "')";
$result2 = mysql_query($query2, $db);
}
mysql_free_result($result);
}
}
header("Location: /tick/maps_appearance.php");
?>

View File

@ -0,0 +1,17 @@
<?require ("global.php");?>
<?php
if (isset($_GET['ID']))
{
$ID = $_GET["ID"];
$query = "DELETE FROM maps_coords WHERE segmentID = $ID";
$result = mysql_query($query, $db);
$query = "DELETE FROM segments WHERE ID = $ID LIMIT 1";
$result = mysql_query($query, $db);
}
header("Location: /tick/maps_courses.php");
?>

View File

@ -0,0 +1,272 @@
<?require ("global.php");?>
<?php
$userID = 0;
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
else { header("Location: /tick/login.html"); }
$ID = "0";
$tag = "0";
$date_start = ''; $year_start = 0; $month_start = 0; $day_start = 0;
$date_end = ''; $year_end = 0; $month_end = 0; $day_end = 0;
$name = '';
$header_html = ''; $footer_html = ''; $banner_html = ''; $tower_html = '';
$map_key = ""; $title = "";
$status = 'inactive';
$notes = '';
if (isset($_GET['tag']))
{
$tag = $_GET["tag"];
$query = "SELECT * FROM events WHERE tag = '$tag'";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$ID = $r['ID'];
$name = $r['name'];
$date_start = $r['date_start'];
list($year_start, $month_start, $day_start) = split("-", $date_start);
$date_end = $r['date_end'];
list($year_end, $month_end, $day_end) = split("-", $date_end);
$header_html = $r['header_html'];
$footer_html = $r['footer_html'];
$banner_html = $r['banner_html'];
$tower_html = $r['tower_html'];
$status = $r['status'];
$map_key = $r['map_key'];
$title = $r['title'];
$notes = $r['notes'];
}
}
}
?>
<html>
<head>
<title>OneTicker :: Events</title>
<link rel=stylesheet type="text/css" href="tick.css">
<script src="banner.js" type="text/javascript"></script>
</head>
<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4>
<script type="text/javascript">banner(1);</script>
<form name="events" action="events_add.php" method="post">
<input type="hidden" name="tag" value="<? echo $tag ?>">
<input type="hidden" name="userID" value="<? echo $userID ?>">
<input type="hidden" name="status" value="active">
<table border=0 cellspacing=1 cellpadding=1 width="680">
<tr>
<td><div class=text><b>Name:</b></div></td>
<td><input class=blacktext type=text name="name" value="<? echo $name; ?>" size=50 maxlength=175></td>
</tr>
<tr>
<td><div class=text><b>Map key:</b></div></td>
<td><input class=blacktext type=text name="map_key" value="<? echo $map_key; ?>" size=50 maxlength=254></td>
</tr>
<tr>
<td><div class=text><b>Window title:</b></div></td>
<td><input class=blacktext type=text name="title" value="<? echo $title; ?>" size=50 maxlength=254></td>
</tr>
<!--
<tr>
<td><div class=text><b>Status:</b></div></td>
<td><div class=text>
<select name=status class=blacktext>
<option value="inactive"<? if ($status == 'inactive') { echo " selected"; } ?>>inactive</option>
<option value="active"<? if ($status == 'active') { echo " selected"; } ?>>active</option>
<option value="neither"<? if ($status == 'neither') { echo " selected"; } ?>>neither</option>
</select>
</div></td>
</tr>
-->
<tr>
<td><div class=text><b>Start date:</b></div></td>
<td><div class=text>
<select class=blacktext name=month_start>
<?
while(list($key, $value) = each($month_names))
{
$selected = "";
$month_index = $key + 1;
if ($month_index == $month_start) { $selected = " selected"; }
echo "<option value=\"${month_index}\"$selected>${value}</option>";
}
?>
</select>&nbsp;
<select class=blacktext name=day_start>
<?
for ($i=1; $i<32;$i++)
{
$selected = "";
if ($i == $day_start) { $selected = " selected"; }
echo "<option value=\"$i\"$selected>$i</option>";
}
?>
</select>&nbsp;
<select class=blacktext name=year_start>
<?
for ($i=2006; $i<2015;$i++)
{
$selected = "";
if ($i == $year_start) { $selected = " selected"; }
echo "<option value=\"$i\"$selected>$i</option>";
}
?>
</select>
</div></td>
</tr>
<tr>
<td><div class=text><b>End date:</b></div></td>
<td><div class=text>
<select class=blacktext name=month_end>
<?
reset($month_names);
while(list($key, $value) = each($month_names))
{
$selected = "";
$month_index = $key + 1;
if ($month_index == $month_end) { $selected = " selected"; }
echo "<option value=\"${month_index}\"$selected>${value}</option>";
}
?>
</select>&nbsp;
<select class=blacktext name=day_end>
<?
for ($i=1; $i<32;$i++)
{
$selected = "";
if ($i == $day_end) { $selected = " selected"; }
echo "<option value=\"$i\"$selected>$i</option>";
}
?>
</select>&nbsp;
<select class=blacktext name=year_end>
<?
for ($i=2006; $i<2015;$i++)
{
$selected = "";
if ($i == $year_end) { $selected = " selected"; }
echo "<option value=\"$i\"$selected>$i</option>";
}
?>
</select>
</div></td>
</tr>
<tr valign=top>
<td><div class=text><b>Header:</b><br>&nbsp;(HTML)</div></td>
<td><div class=blacktext>
<textarea class=blacktext name="header_html" cols=80 rows=5 wrap="virtual"><? echo "$header_html"; ?></textarea>
</div></td>
</tr>
<tr valign=top>
<td><div class=text><b>Footer:</b><br>&nbsp;(HTML)</div></td>
<td><div class=blacktext>
<textarea class=blacktext name="footer_html" cols=80 rows=5 wrap="virtual"><? echo "$footer_html"; ?></textarea>
</div></td>
</tr>
<tr valign=top>
<td><div class=text><b>Banner:</b><br>&nbsp;(HTML)</div></td>
<td><div class=blacktext>
<textarea class=blacktext name="banner_html" cols=80 rows=5 wrap="virtual"><? echo $banner_html; ?></textarea>
</div></td>
</tr>
<tr valign=top>
<td><div class=text><b>Tower:</b><br>&nbsp;(HTML)</div></td>
<td><div class=blacktext>
<textarea class=blacktext name="tower_html" cols=80 rows=5 wrap="virtual"><? echo $tower_html; ?></textarea>
</div></td>
</tr>
<tr valign=top>
<td><div class=text><b>Notes:</b></div></td>
<td><div class=blacktext>
<textarea class=blacktext name="notes" cols=80 rows=3 wrap="virtual"><? echo $notes; ?></textarea>
</div></td>
</tr>
<tr>
<td colspan="2" align=center>
<input class=boldtext type="submit" name="submit" value="add/update event"></td>
</tr>
</table>
</form>
<p><table border=0 cellpadding=0 cellspacing=0 bgcolor="#000000" width="700">
<tr><td>
<table border=0 cellpadding=3 cellspacing=1 bgcolor="#000000" width=100%>
<tr valign=top>
<td bgcolor=#cccccc align=center width="15%"><div class=blacktext><b>START</b></div></td>
<td bgcolor=#cccccc align=center width="15%"><div class=blacktext><b>FINISH</b></div></td>
<td bgcolor=#cccccc align=center><div class=blacktext><b>NAME</b></div></td>
<td bgcolor=#cccccc align=center width="10%"><div class=blacktext>&nbsp;</div></td>
</tr>
<?php
$query = "SELECT *, DATE_FORMAT(events.date_start, '%b %e, %Y') AS datef_start, DATE_FORMAT(events.date_end, '%b %e, %Y') AS datef_end FROM events WHERE userID = $userID ORDER BY date_start DESC";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$eventID = $r['ID'];
$tag = $r['tag'];
$status = $r['status'];
$name = $r['name'];
$date_start = $r['datef_start'];
$date_end = $r['datef_end'];
$default_flag = $r['default_flag'];
if ($eventID == $ID) { echo "<tr bgcolor=#ffaaaa>"; }
else { echo "<tr bgcolor=#ffffff>"; }
echo "<td><div class=blacktext>&nbsp;<a href=\"events.php?tag=${tag}\">$date_start</a></div></td>";
echo "<td><div class=blacktext>&nbsp;$date_end</div></td>";
echo "<td><div class=blacktext>$name</div></td>";
echo "<td>";
//echo "<a href=\"javascript:popup('events_remove.php?tag=${tag}', 'event');\"><img src=\"images/x.gif\" border=0></a>&nbsp;";
if ($default_flag == "yes")
{
echo "<img src=\"images/checkmark.gif\" border=0>";
}
else
{
echo "<a href=\"events_set_default.php?tag=${tag}\"><img src=\"images/checkmark_black.gif\" border=0 alt=\"make active\"></a>";
}
echo "</td>";
echo "</tr>";
}
}
?>
<tr valign=top>
<td bgcolor=#aaaaaa colspan=4><div class=blacktext>&nbsp;
</div></td>
</tr>
</table></td></tr>
</table>
</body>
</html>

View File

@ -0,0 +1,49 @@
<?require ("global.php");?>
<?php
$tag = 0;
if (isset($_POST['tag'])) { $tag = $_POST['tag']; }
if ($tag != 0)
{
$query = "UPDATE events SET name = '" . myaddslashes($_POST['name'])
. "', date_start = '" . $_POST['year_start'] . "-"
. $_POST['month_start'] . "-" . $_POST['day_start']
. "', date_end = '" . $_POST['year_end'] . "-"
. $_POST['month_end'] . "-" . $_POST['day_end']
. "', status = '" . $_POST['status']
. "', header_html = '" . myaddslashes($_POST['header_html'])
. "', footer_html = '" . myaddslashes($_POST['footer_html'])
. "', banner_html = '" . myaddslashes($_POST['banner_html'])
. "', tower_html = '" . myaddslashes($_POST['tower_html'])
. "', map_key= '" . myaddslashes($_POST['map_key'])
. "', title= '" . myaddslashes($_POST['title'])
. "', notes = '" . myaddslashes($_POST['notes'])
. "' WHERE tag = '$tag'";
$result = mysql_query($query, $db);
}
else
{
$tag = date("Ymdhis") . rand();
$query = "INSERT INTO events (tag, userID, name, status, date_start, date_end, header_html, footer_html, banner_html, tower_html, map_key, title, notes) VALUES ('"
. $tag . "','"
. $_POST['userID'] . "','"
. myaddslashes($_POST['name']) . "','"
. $_POST['status'] . "','"
. $_POST['year_start'] . "-" . $_POST['month_start'] . "-"
. $_POST['day_start'] . "','"
. $_POST['year_end'] . "-" . $_POST['month_end'] . "-"
. $_POST['day_end'] . "','"
. myaddslashes($_POST['header_html']) . "','"
. myaddslashes($_POST['footer_html']) . "','"
. myaddslashes($_POST['banner_html']) . "','"
. myaddslashes($_POST['tower_html']) . "','"
. myaddslashes($_POST['map_key']) . "','"
. myaddslashes($_POST['title']) . "','"
. myaddslashes($_POST['notes']) . "')";
$result = mysql_query($query, $db);
}
header("Location: /tick/events.php");
?>

View File

@ -0,0 +1,13 @@
<?require ("global.php");?>
<?php
if (isset($_GET['tag']))
{
$tag = $_GET["tag"];
$query = "DELETE FROM events WHERE tag = '${tag}' LIMIT 1";
$result = mysql_query($query, $db);
}
header("Location: /tick/events.php");
?>

View File

@ -0,0 +1,16 @@
<?require ("global.php");?>
<?php
if (isset($_GET['tag']))
{
$tag = $_GET["tag"];
$query = "UPDATE events SET default_flag = 'no' WHERE default_flag = 'yes'";
$result = mysql_query($query, $db);
$query = "UPDATE events SET default_flag = 'yes' WHERE tag = '$tag'";
$result = mysql_query($query, $db);
}
header("Location: /tick/events.php");
?>

View File

@ -0,0 +1,114 @@
<?php
$DOCUMENT_ROOT = '/var/home/slowtwitch/slowtwitch.com/www';
$default_font = 'font face="Verdana, Arial, Helvetica, sans-serif"';
$month_names = array('January','February','March','April','May','June','July',
'August','September','October','November','December');
$static_base = "http://www.slowtwitch.com/live/";
$db = mysql_connect("192.168.1.10", "slowtwitch", "k9volqlAcpq");
mysql_select_db("ticker",$db);
umask('002');
function myaddslashes($string)
{
if (get_magic_quotes_gpc() == 1) { return ($string); }
else { return (addslashes($string)); }
}
function staticify($stageID)
{
$db = mysql_connect("192.168.1.10", "slowtwitch", "k9volqlAcpq");
mysql_select_db("ticker",$db);
$err = NULL;
$url = "http://www.slowtwitch.com";
$sourcepage = "$url/tick/viewer.php?ID=$stageID";
$query = "SELECT static_url FROM stages WHERE ID = " . $stageID;
$result = mysql_query($query, $db);
if ($result)
{
$r = mysql_fetch_array($result);
$static_URL = $r['static_url'];
}
$tempfilename = "/tmp/temp_viewer.html";
$targetfilename = "/var/home/slowtwitch/slowtwitch.com/www/live/".$static_URL.".html";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $sourcepage);
curl_setopt ($ch, CURLOPT_HEADER, 0);
ob_start();
curl_exec ($ch);
curl_close ($ch);
$htmldata = ob_get_contents();
ob_end_clean();
/**$dynamic_source = fopen($sourcepage, 'r');
if (!$dynamic_source) {
echo "<strong>Unable to load $sourcepage - Static page! Update Failed!</strong>";
exit();
}
$htmldata = fread($dynamic_source, 1024*1024);
fclose($dynamic_source); **/
$tempfile = fopen($tempfilename, 'w');
if (!$tempfile) {
$err = "write_error";
}
fwrite($tempfile, $htmldata);
fclose($tempfile);
copy($tempfilename, $targetfilename);
unlink($tempfilename);
}
function staticify_all($eventID)
{
$db = mysql_connect("192.168.1.10", "slowtwitch", "k9volqlAcpq");
mysql_select_db("ticker",$db);
$query = "SELECT ID FROM stages WHERE eventID = ${eventID} AND status != 'complete'";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$stageID = $r['ID'];
staticify($stageID);
}
}
}
function staticify_old($stageID)
{
//$s = "/usr/bin/wget -O /var/www/html/one/tick/html/stage${stageID}.html 'http://www.onemillionrevolutions.org/tick/viewer.php?ID=${stageID}&link=static'";
//exec("$s 2>&1", $updw);
//$s = "/usr/bin/wget -O /var/www/html/one/tick/html/stage${stageID}_mobile.html 'http://www.onemillionrevolutions.org/tick/viewer_mobile.php?ID=${stageID}&link=static'";
//exec("$s 2>&1", $updw);
}
function staticify_all_old($eventID)
{
//$db = mysql_connect("localhost", "web", "jalapeno");
//mysql_select_db("ticker",$db);
//$query = "SELECT ID FROM stages WHERE eventID = ${eventID}";
//$result = mysql_query($query, $db);
//if ($result)
//{
//while ($r = mysql_fetch_array($result))
//{
//$stageID = $r['ID'];
//staticify($stageID);
//}
//}
}
?>

View File

@ -0,0 +1,23 @@
<?require ("global.php");?>
<?php
if (isset($_POST['username']) && isset($_POST['password']))
{
$query = "SELECT ID FROM users WHERE username = '"
. $_POST['username'] . "' AND password = password('"
. $_POST['password'] . "') LIMIT 1";
$result = mysql_query($query, $db);
if ($result)
{
if ($r = mysql_fetch_array($result))
{
setcookie("userID", $r['ID']);
header("Location: /tick/events.php");
}
else { header("Location: /tick/login.html"); }
}
else { header("Location: /tick/login.html"); }
}
else { header("Location: /tick/login.html"); }
?>

View File

@ -0,0 +1,268 @@
<?require ("global.php");?>
<?
$userID = 0;
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
else { header("Location: /tick/login.html"); }
$ID = 0;
$zoom = "4";
$map_type = "G_NORMAL_MAP";
$center_lat = "39.2";
$center_lon = "-96.1419";
$current_lat = "";
$current_lon = "";
$route = "";
$stageID = 0;
if (isset($_COOKIE['stageID'])) { $stageID = $_COOKIE['stageID']; }
else { header("Location: /tick/stages.php"); }
$query = "SELECT events.name as event_name, stages.* FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID AND events.userID = $userID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$event_name = $r['event_name'];
$name = $r['name'];
}
}
mysql_free_result($result);
$query = "SELECT * FROM maps WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$ID = $r['ID'];
$zoom = $r['zoom'];
$center_lat = $r['center_lat'];
$center_lon = $r['center_lon'];
$current_lat = $r['current_lat'];
$current_lon = $r['current_lon'];
$map_type = $r['map_type'];
}
}
mysql_free_result($result);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>OneTicker :: Maps</title>
<link rel=stylesheet type="text/css" href="tick.css">
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<script src="banner.js" type="text/javascript"></script>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAeMrkW1kxL_t7AGsTQzv_9xTiDdLVRVFb_6ZTq65OUOi0peX-hhSUkw5QRZCCxeeji7sl84l_PgpHCw" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map;
var markers = new Array();
var points = new Array();
var whichRadio = 0;
var original_zoom = <? echo "$zoom"; ?>;
var original_center_lat = "<? echo "$center_lat"; ?>";
var original_center_lon = "<? echo "$center_lon"; ?>";
var original_current_lat = "<? echo "$current_lat"; ?>";
var original_current_lon = "<? echo "$current_lon"; ?>";
var currentMarker = new GMarker(new GLatLng(original_current_lat, original_current_lon));
function loadCoords()
{
var point;
<?
$query = "SELECT * FROM maps_coords WHERE stageID = $stageID ORDER BY sequence";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$latitude = $r['latitude'];
$longitude = $r['longitude'];
echo "point = new GLatLng(\"${latitude}\",\"${longitude}\");";
echo "markers.push(new GMarker(point));";
echo "points.push(point);";
}
}
echo "document.maps.route.value = makeString();";
mysql_free_result($result);
?>
}
function makeString()
{
var result = "";
for (var i=0; i < points.length; i++)
{
result = result + points[i].lat() + "," + points[i].lng() + ":";
}
return result;
}
function showRoute(showMarkers)
{
map.clearOverlays();
if ((showMarkers == "yes") && (markers.length) > 0)
{
map.addOverlay(markers[0]);
if (markers.length > 1) { map.addOverlay(markers[markers.length-1]); }
}
if (points.length > 0) { map.addOverlay(new GPolyline(points)); }
}
function removeLastPoint()
{
if (whichRadio == 1)
{
if (markers.length > 0) { markers.pop(); }
if (points.length > 0) { points.pop(); }
showRoute("yes");
document.maps.route.value = makeString();
}
}
function clearRoute()
{
if (whichRadio == 1)
{
markers = new Array();
points = new Array();
map.clearOverlays();
document.maps.route.value = "";
}
}
function onLoad()
{
map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(original_center_lat, original_center_lon), original_zoom, <? echo "$map_type"; ?>);
loadCoords();
showRoute("no");
map.addOverlay(currentMarker);
GEvent.addListener(map, 'click', function(marker, point)
{
if (marker) // someone clicked a marker
{
if (whichRadio == 0) // in "current" mode
{
map.removeOverlay(marker);
document.maps.current_lat.value = "0.0";
document.maps.current_lon.value = "0.0";
}
}
else // someone clicked the map
{
if (whichRadio == 0) // in "current" mode
{
map.removeOverlay(currentMarker);
currentMarker = new GMarker(point);
map.addOverlay(currentMarker);
document.maps.current_lat.value = point.lat();
document.maps.current_lon.value = point.lng();
}
else // in "route" mode
{
markers.push(new GMarker(point));
points.push(point);
showRoute("yes");
document.maps.route.value = makeString();
}
}
});
}
//]]>
</script>
</head>
<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4 onload="onLoad()" onunload="GUnload()">
<script type="text/javascript">banner(6);</script>
<form name="maps" action="maps_update.php" method="post">
<input type="hidden" name="ID" value="<? echo "$ID"; ?>">
<input type="hidden" name="stageID" value="<? echo "$stageID"; ?>">
<input type="hidden" name="route" value="0">
<input type="hidden" name="current_lat" value="0">
<input type="hidden" name="current_lon" value="0">
<table border=0 cellspacing=1 cellpadding=1 width="650">
<tr><td colspan=3>
<div id="map" style="width: 730px; height: 450px; border: 2px solid #aaaaaa"></div>
</td></tr>
<tr>
<td><div class=text align=right><b>Zoom:</b>&nbsp;</div></td>
<td><div class=text><input class=blacktext type=text name="zoom" value="<? echo "$zoom"; ?>" size=5 maxlength=5>
[<a onclick="document.maps.zoom.value = map.getZoom();" href="javascript:void(0);">set</a>]
</div></td>
<td><div class=text>
<input class=blacktext type=radio name="choose" value="current" onclick="if (whichRadio == 1) { showRoute('no'); map.addOverlay(currentMarker); } whichRadio=0;" checked>&nbsp;<b>Mark current position</b>
</div></td>
</tr>
<tr>
<td><div class=text align=right><b>Center latitude:</b>&nbsp;</div></td>
<td><div class=text>
<input class=blacktext type=text name="center_lat" value="<? echo "$center_lat"; ?>" size=20 maxlength=20>
[<a onclick="document.maps.center_lat.value = map.getCenter().lat();" href="javascript:void(0);">set</a>]
</div></td>
<td rowspan=3><div class=text><input class=blacktext type=radio name="choose" value="route" onclick="if (whichRadio == 0) { showRoute('yes'); } whichRadio=1;">&nbsp;<b>Edit route</b>
<br><ul>
<li><a onclick="removeLastPoint();" href="javascript:void(0);">remove last point</a></li>
<li><a onclick="clearRoute();" href="javascript:void(0);">clear route</a></li>
</ul>
</div></td>
</tr>
<tr>
<td><div class=text align=right><b>Center longitude:</b>&nbsp;</div></td>
<td><div class=text>
<input class=blacktext type=text name="center_lon" value="<? echo "$center_lon"; ?>" size=20 maxlength=20>
[<a onclick="document.maps.center_lon.value = map.getCenter().lng();" href="javascript:void(0);">set</a>]
</div></td>
</tr>
<tr>
<td><div class=text align=right><b>Initial map type:</b>&nbsp;</div></td>
<td><select class=blacktext name="map_type">
<option value="G_NORMAL_MAP"<? if ($map_type == 'G_NORMAL_MAP') { echo " selected"; } ?>>normal</option>
<option value="G_SATELLITE_MAP"<? if ($map_type == 'G_SATELLITE_MAP') { echo " selected"; } ?>>satellite</option>
<option value="G_HYBRID_MAP"<? if ($map_type == 'G_HYBRID_MAP') { echo " selected"; } ?>>hybrid</option>
</select></td>
</tr>
<tr>
<td colspan=2 align=center><div class=text>
[<a onclick="document.maps.zoom.value = original_zoom; document.maps.center_lat.value = original_center_lat; document.maps.center_lon.value = original_center_lon; map.setCenter(new GLatLng(original_center_lat, original_center_lon), original_zoom);" href="javascript:void(0);">reset map to saved</a>]
</div></td>
<td><div class=text>&nbsp;</div></td>
</tr>
<tr><td colspan=3><div class=text>&nbsp;</div></td></tr>
<tr>
<td colspan=3 align=center>
<input class=boldtext type="submit" name="submit" value="update map for <? echo "$event_name $name"; ?>"></td>
</tr>
</table>
</form>
</body>
</html>

View File

@ -0,0 +1,233 @@
<?require ("global.php");?>
<?
$userID = 0;
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
else { header("Location: /tick/login.html"); }
$ID = 0;
$zoom = "4";
$map_type = "G_NORMAL_MAP";
$center_lat = "39.2";
$center_lon = "-96.1419";
$current_lat = "";
$current_lon = "";
$route = "";
$stageID = 0;
if (isset($_COOKIE['stageID'])) { $stageID = $_COOKIE['stageID']; }
else { header("Location: /tick/stages.php"); }
$query = "SELECT events.name as event_name, stages.* FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID AND events.userID = $userID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$event_name = $r['event_name'];
$name = $r['name'];
}
}
mysql_free_result($result);
$query = "SELECT * FROM maps WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$ID = $r['ID'];
$zoom = $r['zoom'];
$center_lat = $r['center_lat'];
$center_lon = $r['center_lon'];
$current_lat = $r['current_lat'];
$current_lon = $r['current_lon'];
$map_type = $r['map_type'];
}
}
mysql_free_result($result);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>OneTicker :: Maps</title>
<link rel=stylesheet type="text/css" href="tick.css">
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<script src="banner.js" type="text/javascript"></script>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAeMrkW1kxL_t7AGsTQzv_9xRenuji4aHjAULXgP93zutp7Hv6ShRbebgpZJZpLLF2bt806Iyi896c8g" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map;
var zoom = <? echo "$zoom"; ?>;
var center_lat = "<? echo "$center_lat"; ?>";
var center_lon = "<? echo "$center_lon"; ?>";
var base = new GIcon();
base.image = "/maps/images/pin_red.png";
base.shadow = "/images/balloons/shadow.png";
base.iconSize = new GSize(12, 20);
base.shadowSize = new GSize(22, 20);
base.iconAnchor = new GPoint(6, 20);
base.infoWindowAnchor = new GPoint(5, 1);
function onLoad()
{
var routes, marker;
map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(<? echo "$center_lat"; ?>, <? echo "$center_lon"; ?>), <? echo "$zoom"; ?>, <? echo "$map_type"; ?>);
GEvent.addListener(map, 'maptypechanged', function()
{
var name = map.getCurrentMapType().getName();
if (name == "Map") { document.appearance.map_type.value = "G_NORMAL_MAP"; }
if (name == "Satellite") { document.appearance.map_type.value = "G_SATELLITE_MAP"; }
if (name == "Hybrid") { document.appearance.map_type.value = "G_HYBRID_MAP"; }
});
GEvent.addListener(map, 'moveend', function()
{
var center = map.getCenter();
document.appearance.center_lat.value = center.lat();
document.appearance.center_lon.value = center.lng();
});
GEvent.addListener(map, 'zoomend', function(oldLevel, newLevel)
{
document.appearance.zoom.value = newLevel;
});
<?
$query = "SELECT * FROM segments WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
echo "routes = new Array();";
$query2 = "SELECT * FROM maps_coords WHERE segmentID = " . $r['ID'] . " ORDER BY sequence";
$result2 = mysql_query($query2, $db);
if ($result2)
{
while ($r2 = mysql_fetch_array($result2))
{
$lat = $r2['latitude'];
$lon = $r2['longitude'];
echo "point = new GLatLng(" . $lat . ", " . $lon . ");";
echo "routes.push(point);";
}
mysql_free_result($result2);
}
echo "if (routes.length > 0) { map.addOverlay(new GPolyline(routes, '" . $r['color'] . "', 5)); }";
}
mysql_free_result($result);
}
?>
<?
$query = "SELECT * FROM markers WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
echo "base.image = \"/maps/images/" . $r['icon'] . "\";";
echo "marker = createMarker(base, new GLatLng(" . $r['latitude'] . ", " . $r['longitude'] . "), '" . $r['ID'] . "', '" . addslashes($r['title']) . "', '" . addslashes($r['text']) . "', '" . $r['image'] . "');";
echo "map.addOverlay(marker);";
}
mysql_free_result($result);
}
?>
}
function createMarker(icon, point, markerID, title, text, image)
{
var marker = new GMarker(point, {icon: icon});
var html = '<table cellpadding=1 cellspacing=1 border=0 width=200>';
if (image != "")
{
html = html + '<tr><td align=center><a target=_blank href="/tick/html/black.php?img=/tick/images/gallery/' + image + '"><img height="130" src="/tick/images/gallery/t_' + image + '" border=0></a><br></td></tr>';
}
html = html + '<tr><td><div class=blacktext><b>' + title + '</b></td></tr>';
html = html + '<tr><td><div class=blacktext>' + text + '</div></td></tr>';
html = html + '</table>';
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
//]]>
</script>
</head>
<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4 onload="onLoad()" onunload="GUnload()">
<script type="text/javascript">banner(6);</script>
<form name="appearance" action="appearance_update.php" method="post">
<input type="hidden" name="ID" value="<? echo "$ID"; ?>">
<input type="hidden" name="stageID" value="<? echo "$stageID"; ?>">
<input type="hidden" name="center_lat" value="<? echo "$center_lat"; ?>">
<input type="hidden" name="center_lon" value="<? echo "$center_lon"; ?>">
<input type="hidden" name="zoom" value="<? echo "$zoom"; ?>">
<input type="hidden" name="map_type" value="<? echo $map_type ?>">
<table border=1 cellspacing=1 cellpadding=1 width="600">
<tr valign=top>
<td>
<div id="map" style="width: 330px; height: 467px; border: 2px solid #aaaaaa"></div>
</td>
<td><table cellpadding=2 cellspacing=2 border=0 width=270>
<tr>
<td colspan=2><div class=text>
The map to the left is the same size as the map on the race viewer. It also shows the view that will appear when the viewer initially loads.
<p>To change what the viewer will initially show, adjust the map and zoom to the view you desire and click the button below.
</div></td>
</tr>
<tr>
<td align=center>
[<a onclick="document.appearance.zoom.value = <? echo "$zoom"; ?>; document.appearance.center_lat.value = <? echo "$center_lat"; ?>; document.appearance.center_lon.value = <? echo "$center_lon"; ?>; map.setCenter(new GLatLng(<? echo "$center_lat"; ?>, <? echo "$center_lon"; ?>), <? echo "$zoom"; ?>, <? echo "$map_type"; ?>);" href="javascript:void(0);">reset map</a>]
</div></td>
<td align=center>
<input class=boldtext type="submit" name="submit" value="save map">
</td>
</tr>
<tr>
<td colspan=2><div class=text>
<p>&nbsp;<p>
To create courses or add markers to the map, use these links:
<p><ul>
<li><a href="/tick/maps_courses.php">create/edit courses</a></li>
<li><a href="/tick/markers.php">create markers</a></li>
<li><a href="/tick/maps_copy.php">copy an existing course</a></li>
</ul></div></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>

View File

@ -0,0 +1,168 @@
<?require ("global.php");?>
<?
$userID = 0;
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
else { header("Location: /tick/login.html"); }
$stageID = 0;
if (isset($_COOKIE['stageID'])) { $stageID = $_COOKIE['stageID']; }
else { header("Location: /tick/stages.php"); }
$query = "SELECT events.name as event_name, stages.* FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID AND events.userID = $userID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$event_name = $r['event_name'];
$name = $r['name'];
}
mysql_free_result($result);
}
$query = "SELECT * FROM maps WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$ID = $r['ID'];
$zoom = $r['zoom'];
$center_lat = $r['center_lat'];
$center_lon = $r['center_lon'];
$map_type = $r['map_type'];
}
mysql_free_result($result);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>OneTicker :: Maps :: Copy</title>
<link rel=stylesheet type="text/css" href="tick.css">
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<script src="banner.js" type="text/javascript"></script>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAeMrkW1kxL_t7AGsTQzv_9xRenuji4aHjAULXgP93zutp7Hv6ShRbebgpZJZpLLF2bt806Iyi896c8g" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map;
var zoom = <? echo "$zoom"; ?>;
var center_lat = "<? echo "$center_lat"; ?>";
var center_lon = "<? echo "$center_lon"; ?>";
function onLoad()
{
var routes;
map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(<? echo "$center_lat"; ?>, <? echo "$center_lon"; ?>), <? echo "$zoom"; ?>, <? echo "$map_type"; ?>);
<?
$query = "SELECT * FROM segments WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
echo "routes = new Array();";
$query2 = "SELECT * FROM maps_coords WHERE segmentID = " . $r['ID'] . " ORDER BY sequence";
$result2 = mysql_query($query2, $db);
if ($result2)
{
while ($r2 = mysql_fetch_array($result2))
{
$lat = $r2['latitude'];
$lon = $r2['longitude'];
echo "point = new GLatLng(" . $lat . ", " . $lon . ");";
echo "routes.push(point);";
}
mysql_free_result($result2);
}
echo "if (routes.length > 0) { map.addOverlay(new GPolyline(routes, '" . $r['color'] . "', 5)); }";
}
mysql_free_result($result);
}
?>
}
//]]>
</script>
</head>
<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4 onload="onLoad()" onunload="GUnload()">
<script type="text/javascript">banner(6);</script>
<form name="copy" action="courses_copy.php" method="post">
<input type="hidden" name="stageID" value="<? echo "$stageID"; ?>">
<table border=1 cellspacing=1 cellpadding=1 width="600">
<tr valign=top>
<td>
<div id="map" style="width: 330px; height: 467px; border: 2px solid #aaaaaa"></div>
</td>
<td><table cellpadding=2 cellspacing=2 border=0 width=270>
<tr>
<td colspan=2><div class=text>
Begin by selecting a course from the pulldown menu below.
<p>If you would like to copy this course map to this stage, click the button. <b>Make sure you want to do this, as it will erase any courses currently stored for this stage!</b>
</div></td>
</tr>
<tr>
<td align=center><div class=blacktext>
<select name=newStageID class=blacktext>
<?
$query = "SELECT events.name AS ename, stages.name AS sname, stages.ID FROM events, stages WHERE events.ID = stages.eventID and events.userID = $userID ORDER BY stages.date DESC";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
if ($r['ID'] != $stageID)
{
echo '<option value="' . $r['ID'] . '">' . $r['ename'] . ' :: ' . $r['sname'] . '</option>';
}
}
mysql_free_result($result);
}
?>
</select>
</div></td>
</tr>
<tr>
<td align=center>
<p><input class=boldtext type="submit" name="submit" value="copy course">
</td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>

View File

@ -0,0 +1,318 @@
<?require ("global.php");?>
<?php
$userID = 0;
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
else { header("Location: /tick/login.html"); }
$ID = 0;
$zoom = "4";
$map_type = "G_NORMAL_MAP";
$center_lat = "39.2";
$center_lon = "-96.1419";
$stageID = 0;
if (isset($_COOKIE['stageID'])) { $stageID = $_COOKIE['stageID']; }
else { header("Location: /tick/stages.php"); }
$query = "SELECT events.name as event_name, stages.* FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID AND events.userID = $userID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$event_name = $r['event_name'];
$name = $r['name'];
}
}
mysql_free_result($result);
$query = "SELECT * FROM maps WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$ID = $r['ID'];
$zoom = $r['zoom'];
$center_lat = $r['center_lat'];
$center_lon = $r['center_lon'];
$current_lat = $r['current_lat'];
$current_lon = $r['current_lon'];
$map_type = $r['map_type'];
}
}
mysql_free_result($result);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<title>OneTicker :: Maps :: Courses</title>
<link rel=stylesheet type="text/css" href="/tick/tick.css">
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<script src="banner.js" type="text/javascript"></script>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAeMrkW1kxL_t7AGsTQzv_9xRenuji4aHjAULXgP93zutp7Hv6ShRbebgpZJZpLLF2bt806Iyi896c8g" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map;
var routes = new Array();
var activeSegmentID = 0;
var original_zoom = <? echo "$zoom"; ?>;
var original_center_lat = "<? echo "$center_lat"; ?>";
var original_center_lon = "<? echo "$center_lon"; ?>";
function onLoad()
{
var point;
map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(original_center_lat, original_center_lon), original_zoom, <? echo "$map_type"; ?>);
GEvent.addListener(map, 'click', function(marker, point)
{
if (marker) // someone clicked a marker
{
}
else // someone clicked the map
{
if (activeSegmentID != 0)
{
map.panTo(point);
routes[activeSegmentID]['course'].push(point);
showRoute(activeSegmentID);
makeString();
}
}
});
<?
$query = "SELECT * FROM segments WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$segmentID = $r['ID'];
echo "activeSegmentID = " . $segmentID . ";";
echo "routes[" . $segmentID . "] = new Array();";
echo "routes[" . $segmentID . "]['color'] = '". $r['color'] . "';";
echo "routes[" . $segmentID . "]['course'] = new Array();";
$query2 = "SELECT * FROM maps_coords WHERE segmentID = " . $segmentID . " ORDER BY sequence";
$result2 = mysql_query($query2, $db);
if ($result2)
{
while ($r2 = mysql_fetch_array($result2))
{
$lat = $r2['latitude'];
$lon = $r2['longitude'];
echo "point = new GLatLng(" . $lat . ", " . $lon . ");";
echo "routes[" . $segmentID . "]['course'].push(point);";
}
mysql_free_result($result2);
}
echo "makeString();";
}
mysql_free_result($result);
}
?>
if (typeof document.courses.segmentID != "undefined")
{
document.courses.segmentID[0].click();
}
}
function makeString()
{
var result = "";
var points = routes[activeSegmentID]['course'];
for (var i=0; i < points.length; i++)
{
result = result + points[i].lat() + "," + points[i].lng() + ":";
}
eval("document.courses.segment" + activeSegmentID + ".value = result");
calculate_distance();
}
function showRoute(segmentID)
{
activeSegmentID = segmentID;
map.clearOverlays();
if (segmentID > 0)
{
var num_points = routes[segmentID]['course'].length;
if (num_points > 0)
{
map.addOverlay(new GPolyline(routes[segmentID]['course'], routes[segmentID]['color'], 5));
map.addOverlay(new GMarker(routes[segmentID]['course'][0]));
map.addOverlay(new GMarker(routes[segmentID]['course'][num_points-1]));
}
}
}
function removeLastPoint()
{
if (routes[activeSegmentID]['course'].length > 0)
{
routes[activeSegmentID]['course'].pop();
}
showRoute(activeSegmentID);
makeString();
}
function clearRoute()
{
routes[activeSegmentID]['course'] = new Array();
showRoute(activeSegmentID);
makeString();
}
function calculate_distance()
{
var miles = 0.0, kilometers = 0.0;
var points = routes[activeSegmentID]['course'];
if (points.length < 2)
{
eval("document.courses.distance_mi" + activeSegmentID + ".value = '0.0'");
eval("document.courses.distance_km" + activeSegmentID + ".value = '0.0'");
return;
}
for (var i=0; i < points.length - 1; i++)
{
kilometers += points[i].distanceFrom(points[i+1]) / 1000;
}
miles = Math.round(kilometers * 0.621371192 * 100) / 100;
kilometers = Math.round(kilometers * 100) / 100;
eval("document.courses.distance_mi" + activeSegmentID + ".value = miles");
eval("document.courses.distance_km" + activeSegmentID + ".value = kilometers");
}
//]]>
</script>
</head>
<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4 onload="onLoad()" onunload="GUnload()">
<script type="text/javascript">banner(6);</script>
<form name="courses" action="/tick/courses_add.php" method="post">
<input type="hidden" name="stageID" value="<? echo $stageID ?>">
<table border=1 cellspacing=2 cellpadding=2>
<tr valign=top>
<td bgcolor="#444444"><table cellpadding=2 cellspacing=2 border=0 width=200>
<tr>
<?
$i = 0;
$query = "SELECT * FROM segments WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
if ($i == 0) { echo '<td><div class=text><b>Choose a course:</b><br>'; }
$file = "dot_red.png";
if ($r['color'] == '#ff0202') { $file = "dot_red.png"; }
if ($r['color'] == '#fe6702') { $file = "dot_orange.png"; }
if ($r['color'] == '#fefe35') { $file = "dot_yellow.png"; }
if ($r['color'] == '#02fe35') { $file = "dot_green.png"; }
if ($r['color'] == '#3567fe') { $file = "dot_blue.png"; }
if ($r['color'] == '#cc00ff') { $file = "dot_purple.png"; }
if ($r['color'] == '#ff6699') { $file = "dot_pink.png"; }
if ($r['color'] == '#999999') { $file = "dot_grey.png"; }
echo '<input type=hidden name=segment' . $r['ID'] . ' value=""';
echo "<br><input class=blacktext type=radio name=segmentID onclick=\"javascript:showRoute(" . $r['ID'] . ");\" value=\"" . $r['ID'] . "\"><img height=5 width=40 src=\"/maps/images/" . $file . "\" border=0>&nbsp;" . $r['name'];
echo "&nbsp;<a href=\"javascript:popup('courses_remove.php?ID=" . $r['ID'] . "', 'segment');\"><img src=\"/images/x.gif\" border=0></a>";
echo '<br><input type=text class=smtext size=7 maxlength=10 name="distance_mi' . $r['ID'] . '" value="' . $r['distance_mi'] . '" readonly> mi';
echo '&nbsp;&nbsp;&nbsp;<input type=text class=smtext size=7 maxlength=10 name="distance_km' . $r['ID'] . '" value="' . $r['distance_km'] . '" readonly> km<br>';
$i++;
}
mysql_free_result($result);
if ($i > 0)
{
echo '<p>&nbsp;<br><input class=blacktext type=radio name=segmentID value=0 onclick="javascript:showRoute(0);">...or create a new course:';
}
else
{
echo '<td><div class=text><b>Create a new course:</b><br>';
}
}
?>
</div></td>
</tr>
<tr>
<td><div class=text><b>Label: </b>
<input class=blacktext type=text name=name size=20 maxlength=40>
</div></td>
</tr>
<tr>
<td><div class=text><b>Color: </b>
<select name=color class=blacktext>
<option value="#ff0202">red</option>
<option value="#fe6702">orange</option>
<option value="#fefe35">yellow</option>
<option value="#02fe35">green</option>
<option value="#3567fe">blue</option>
<option value="#cc00ff">purple</option>
<option value="#ff6699">pink</option>
<option value="#999999">grey</option>
</select>
</div></td>
</tr>
<tr>
<td align=center><div class=smtext>
<p><input class=blackboldtext type=submit value="save course">
</div></td>
</tr>
<tr>
<td><div class=text>
<p><ul>
<li><a onclick="removeLastPoint();" href="javascript:void(0);">remove last point</a></li>
<li><a onclick="clearRoute();" href="javascript:void(0);">clear segment</a></li>
</ul>
</div></td>
</tr>
</table>
</td>
<td><table cellpadding=0 cellspacing=0 border=0>
<tr valign=top>
<td align=center>
<div id="map" style="width: 600px; height: 400px; border: 2px solid #aaaaaa"></div>
</td>
</tr>
</table></td></tr>
</table>
</form>
</body>
</html>

View File

@ -0,0 +1,55 @@
<?require ("global.php");?>
<?php
$ID = 0;
$stageID = 0;
if (isset($_POST['ID'])) { $ID = $_POST['ID']; }
if (isset($_POST['stageID'])) { $stageID = $_POST['stageID']; }
if ($ID != 0)
{
$query = "UPDATE maps SET "
. "zoom = '" . $_POST['zoom'] . "', "
. "map_type = '" . $_POST['map_type'] . "', "
. "current_lat = '" . $_POST['current_lat'] . "', "
. "current_lon = '" . $_POST['current_lon'] . "', "
. "center_lat = '" . $_POST['center_lat'] . "', "
. "center_lon = '" . $_POST['center_lon'] . "' "
. "WHERE ID = '$ID'";
$result = mysql_query($query, $db);
}
else
{
$query = "INSERT INTO maps (stageID, zoom, map_type, current_lat, current_lon, center_lat, center_lon) VALUES ("
. "'" . $stageID . "',"
. "'" . $_POST['zoom'] . "',"
. "'" . $_POST['map_type'] . "',"
. "'" . $_POST['current_lat'] . "',"
. "'" . $_POST['current_lon'] . "',"
. "'" . $_POST['center_lat'] . "',"
. "'" . $_POST['center_lon'] . "')";
$result = mysql_query($query, $db);
}
if (isset($_POST['route']) && $_POST['route'] != "")
{
$query = "DELETE FROM maps_coords WHERE stageID = $stageID";
$result = mysql_query($query, $db);
$coords = split(":", $_POST['route']);
for ($i=0; $i < count($coords) - 1; $i++)
{
list($lat, $lon) = split(",", $coords[$i]);
$query = "INSERT INTO maps_coords (stageID, sequence, latitude, longitude) VALUES ("
. "'" . $stageID . "',"
. "'" . $i . "',"
. "'" . $lat . "',"
. "'" . $lon . "')";
$result = mysql_query($query, $db);
}
}
staticify($stageID);
header("Location: /tick/stages.php");
?>

View File

@ -0,0 +1,313 @@
<?require ("global.php");?>
<?php
$userID = 0;
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
else { header("Location: /tick/login.html"); }
$ID = 0;
$zoom = "4";
$map_type = "G_NORMAL_MAP";
$center_lat = "39.2";
$center_lon = "-96.1419";
$stageID = 0;
if (isset($_COOKIE['stageID'])) { $stageID = $_COOKIE['stageID']; }
else { header("Location: /tick/stages.php"); }
$query = "SELECT events.name as event_name, stages.* FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID AND events.userID = $userID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$event_name = $r['event_name'];
$name = $r['name'];
}
}
mysql_free_result($result);
$query = "SELECT * FROM maps WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$ID = $r['ID'];
$zoom = $r['zoom'];
$center_lat = $r['center_lat'];
$center_lon = $r['center_lon'];
$current_lat = $r['current_lat'];
$current_lon = $r['current_lon'];
$map_type = $r['map_type'];
}
}
mysql_free_result($result);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<title>OneTicker :: Maps :: Markers</title>
<link rel=stylesheet type="text/css" href="tick.css">
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<script src="banner.js" type="text/javascript"></script>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAeMrkW1kxL_t7AGsTQzv_9xRenuji4aHjAULXgP93zutp7Hv6ShRbebgpZJZpLLF2bt806Iyi896c8g" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map, currentMarker;
var geocoder = new GClientGeocoder();
var zoom = <? echo "$zoom"; ?>;
var center_lat = "<? echo "$center_lat"; ?>";
var center_lon = "<? echo "$center_lon"; ?>";
var pins = new Array();
pins[0] = 'pin_red.png';
pins[1] = 'pin_orange.png';
pins[2] = 'pin_yellow.png';
pins[3] = 'pin_green.png';
pins[4] = 'pin_blue.png';
pins[5] = 'pin_purple.png';
pins[6] = 'pin_pink.png';
pins[7] = 'pin_grey.png';
var base = new GIcon();
base.image = "/maps/images/" + pins[0];
base.shadow = "/images/balloons/shadow.png";
base.iconSize = new GSize(12, 20);
base.shadowSize = new GSize(22, 20);
base.iconAnchor = new GPoint(6, 20);
base.infoWindowAnchor = new GPoint(5, 1);
function onLoad()
{
var marker, routes;
map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(center_lat, center_lon), zoom, <? echo "$map_type"; ?>);
currentMarker = new GMarker(new GLatLng(0.0, 0.0), {icon: base});
map.addOverlay(currentMarker);
GEvent.addListener(map, 'click', function(marker, point)
{
if (marker) // someone clicked a marker
{
}
else // someone clicked the map
{
currentMarker.setPoint(point);
document.markers.latitude.value = point.lat();
document.markers.longitude.value = point.lng();
}
});
<?
$query = "SELECT * FROM segments WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
echo "routes = new Array();";
$query2 = "SELECT * FROM maps_coords WHERE segmentID = " . $r['ID'] . " ORDER BY sequence";
$result2 = mysql_query($query2, $db);
if ($result2)
{
while ($r2 = mysql_fetch_array($result2))
{
$lat = $r2['latitude'];
$lon = $r2['longitude'];
echo "point = new GLatLng(" . $lat . ", " . $lon . ");";
echo "routes.push(point);";
}
mysql_free_result($result2);
}
echo "if (routes.length > 0) { map.addOverlay(new GPolyline(routes, '" . $r['color'] . "', 5)); }";
}
mysql_free_result($result);
}
?>
<?
$query = "SELECT * FROM markers WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
echo "base.image = \"/maps/images/" . $r['icon'] . "\";";
echo "marker = createMarker(base, new GLatLng(" . $r['latitude'] . ", " . $r['longitude'] . "), '" . $r['ID'] . "', '" . addslashes($r['title']) . "', '" . addslashes($r['text']) . "', '" . $r['image'] . "');";
echo "map.addOverlay(marker);";
}
mysql_free_result($result);
}
?>
document.markers.latitude.value = "<? echo "$center_lat"; ?>";
document.markers.longitude.value = "<? echo "$center_lon"; ?>";
document.markers.icon[0].click();
}
function showAddress(address)
{
geocoder.getLatLng(address, function(point)
{
if (!point) { alert("Sorry! I couldn't find that address."); }
else
{
map.panTo(point);
currentMarker.setPoint(point);
document.markers.latitude.value = point.lat();
document.markers.longitude.value = point.lng();
}
}
);
}
function changePin(which)
{
currentMarker.getIcon().image = "/maps/images/" + pins[which];
map.removeOverlay(currentMarker);
map.addOverlay(currentMarker);
}
function whichNewPin()
{
for (var i=0; i < document.markers.icon.length; i++)
{
if (document.markers.icon[i].checked == true)
return i;
}
return 0;
}
function createMarker(icon, point, markerID, title, text, image)
{
var marker = new GMarker(point, {icon: icon});
var html = '<table cellpadding=1 cellspacing=1 border=0 width=200>';
if (image != "")
{
html = html + '<tr><td align=center><a target=_blank href="/tick/html/black.php?img=/tick/images/gallery/' + image + '"><img height="130" src="/tick/images/gallery/t_' + image + '" border=0></a><br></td></tr>';
}
html = html + '<tr><td><div class=blacktext><b>' + title + '</b></td></tr>';
html = html + '<tr><td><div class=blacktext>' + text + '</div></td></tr>';
html = html + "<tr><td><div class=blacktext><a href=\"javascript:popup('markers_remove.php?ID=" + markerID + "', 'marker');\"><img src=\"/images/x.gif\" border=0></a>remove this marker</div></td></tr>";
html = html + '</table>';
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
//]]>
</script>
</head>
<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4 onload="onLoad()" onunload="GUnload()">
<script type="text/javascript">banner(6);</script>
<form name="markers" enctype="multipart/form-data" action="markers_add.php" method="post">
<input type="hidden" name="stageID" value="<? echo $stageID ?>">
<table border=1 cellspacing=1 cellpadding=1>
<tr valign=top>
<td bgcolor="#444444"><table cellpadding=2 cellspacing=2 border=0 width="180">
<tr>
<td colspan=2><div class=smtext>
<b>Title</b>
<br><input class=blacktext type=text size=35 maxlength=120 name=title value="<? echo "$title"; ?>">
</div></td>
</tr>
<tr>
<td colspan=2><div class=smtext>
<b>Image</b>
<br><input class=blacktext type=file name="pic" size=30>
<p><ul class=text>
<li>image will be resized automatically</li>
<li>uploaded filesize limit is 800K</li>
</ul>
</div></td>
</tr>
<tr>
<td colspan=2><div class=smtext>
<b>Text</b>
<br><textarea class=blacktext name="text" cols=35 rows=4 wrap="virtual"><? echo "$text"; ?></textarea>
</div></td>
</tr>
<tr>
<td><div class=smtext>
<b>Latitude</b>
<br><input class=blacktext type=text size=16 maxlength=20 name=latitude value="<? echo "$latitude"; ?>" readonly>
</div></td>
<td><div class=smtext>
<b>Longitude</b>
<br><input class=blacktext type=text size=16 maxlength=20 name=longitude value="<? echo "$longitude"; ?>" readonly>
</div></td>
</tr>
<tr>
<td colspan=2><table cellpadding=2 cellspacing=2 border=0 width="100%">
<tr>
<td><input type=radio name=icon value="pin_red.png" checked onclick="javascript:changePin(0);"><img src="/maps/images/pin_red.png" border=0></td>
<td><input type=radio name=icon value="pin_orange.png" onclick="javascript:changePin(1);"><img src="/maps/images/pin_orange.png" border=0></td>
<td><input type=radio name=icon value="pin_yellow.png" onclick="javascript:changePin(2);"><img src="/maps/images/pin_yellow.png" border=0></td>
<td><input type=radio name=icon value="pin_green.png" onclick="javascript:changePin(3);"><img src="/maps/images/pin_green.png" border=0></td>
</tr>
<tr>
<td><input type=radio name=icon value="pin_blue.png" onclick="javascript:changePin(4);"><img src="/maps/images/pin_blue.png" border=0></td>
<td><input type=radio name=icon value="pin_purple.png" onclick="javascript:changePin(5);"><img src="/maps/images/pin_purple.png" border=0></td>
<td><input type=radio name=icon value="pin_pink.png" onclick="javascript:changePin(6);"><img src="/maps/images/pin_pink.png" border=0></td>
<td><input type=radio name=icon value="pin_grey.png" onclick="javascript:changePin(7);"><img src="/maps/images/pin_grey.png" border=0></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan=2 align=center><div class=smtext>
<p><input class=blackboldtext type=submit value="add marker">
</div></td>
</tr>
</table>
</td>
<td><table cellpadding=1 cellspacing=0 border=0 width="100%">
<tr valign=top>
<td align=center>
<div id="map" style="width: 600px; height: 400px; border: 2px solid #aaaaaa"></div>
</td>
</tr>
<tr>
<td align=center><div class=text>
<b>Move marker to address:</b>&nbsp;
<input class=blacktext type=text name=address size=30 maxlength=150>
&nbsp;<a href="javascript:void(0);" onclick="javascript:showAddress(document.markers.address.value); return false">GO</a>
</div></td>
</tr>
</table></td></tr>
</table>
</form>
</body>
</html>

View File

@ -0,0 +1,55 @@
<?require ("global.php");?>
<?php
$stamp = date("Ymdhis");
$filename = "";
$path = "";
$complete = "";
if (isset($_FILES['pic']['name']) && $_FILES['pic']['name'] != "")
{
$path = "$DOCUMENT_ROOT/tick/images/gallery/";
$filename = $stamp . preg_replace('/\s+/', '', basename($_FILES['pic']['name']));
$complete = $path . $filename;
move_uploaded_file($_FILES['pic']['tmp_name'], $complete);
chmod($complete, 0755);
$s = "/var/www/html/one/tick/scripts/pics.pl $filename --- 640";
exec("$s 2>&1", $updw);
$s = "/var/www/html/one/tick/scripts/pics.pl $filename t_ 130";
exec("$s 2>&1", $updw);
}
$stageID = 0;
if (isset($_POST['stageID'])) { $stageID = $_POST['stageID']; }
if ($stageID != 0)
{
$query = "INSERT INTO markers (stageID, icon, title, text, image, latitude, longitude) VALUES ("
. "'" . $stageID . "', "
. "'" . $_POST['icon'] . "', "
. "'" . myaddslashes($_POST['title']) . "', "
. "'" . myaddslashes($_POST['text']) . "', "
. "'" . $filename . "', "
. "'" . $_POST['latitude'] . "', "
. "'" . $_POST['longitude'] . "')";
$result = mysql_query($query, $db) or mysql_error($result);
}
if ($filename != "")
{
$big = "http://www.onemillionrevolutions.org/tick/images/gallery/${filename}\n";
$small = "http://www.onemillionrevolutions.org/tick/images/gallery/t_${filename}\n";
$file = "/var/www/html/one/tick/images/gallery/pic${ID}.txt";
if (!$file_handle = fopen($file,"a")) { echo "Cannot open file"; }
if (!fwrite($file_handle, $big)) { echo "Cannot write to file"; }
if (!fwrite($file_handle, $small)) { echo "Cannot write to file"; }
fclose($file_handle);
}
staticify($_POST['stageID']);
header("Location: /tick/markers.php");
?>

View File

@ -0,0 +1,30 @@
<?require ("global.php");?>
<?php
if (isset($_GET['ID']))
{
$ID = $_GET["ID"];
$query = "SELECT image FROM markers WHERE ID = $ID LIMIT 1";
$result = mysql_query($query, $db);
if ($result)
{
if ($r = mysql_fetch_array($result))
{
$image = $r['image'];
if ($image != '')
{
unlink("$DOCUMENT_ROOT/tick/images/gallery/${image}");
unlink("$DOCUMENT_ROOT/tick/images/gallery/t_${image}");
}
}
mysql_free_result($result);
}
$query = "DELETE FROM markers WHERE ID = $ID LIMIT 1";
$result = mysql_query($query, $db);
}
header("Location: /tick/markers.php");
?>

View File

@ -0,0 +1,152 @@
<?require ("global.php");?>
<?php
$userID = 0;
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
else { header("Location: /tick/login.html"); }
$stageID = 0;
if (isset($_COOKIE['stageID'])) { $stageID = $_COOKIE['stageID']; }
else { header("Location: /tick/stages.php"); }
$query = "SELECT events.name as event_name, stages.*, DATE_FORMAT(stages.date, '%b %e, %Y') AS datef FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID AND events.userID = $userID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$event_name = $r['event_name'];
$stage_string = "[${r['datef']}] ${event_name} ${r['name']}";
}
}
mysql_free_result($result);
$ID = 0;
$filename = '';
$caption = '';
$courtesy_of = '';
$default_flag = '';
if (isset($_GET['ID']))
{
$ID = $_GET["ID"];
$query = "SELECT * FROM pics WHERE ID = $ID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$filename = $r['filename'];
$caption = $r['caption'];
$courtesy_of = $r['courtesy_of'];
$default_flag = $r['default_flag'];
}
}
}
?>
<html>
<head>
<title>OneTicker :: Pics</title>
<link rel=stylesheet type="text/css" href="tick.css">
<script src="banner.js" type="text/javascript"></script>
</head>
<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4>
<script type="text/javascript">banner(4);</script>
<form name="pics" enctype="multipart/form-data" action="pics_add.php" method="post">
<input type="hidden" name="ID" value="<? echo $ID ?>">
<input type="hidden" name="stageID" value="<? echo $stageID ?>">
<table border=0 cellspacing=1 cellpadding=1 width="480">
<tr>
<td><div class=text><b>Stage:</b></div></td>
<td><div class=text><? echo "$stage_string"; ?></div></td>
</tr>
<tr valign=top>
<td><div class=text><b>Picture:</b></div></td>
<td><div class=text>
<input class=blacktext type=file name="pic" size=40>
<ul>
<li>image will be resized appropriately</li>
<li>leave blank to keep existing image</li>
<li>DO NOT put non-alphanumeric characters in image filenames</li>
<li>don't forget to activate images you want visible</li>
</ul>
</div></td>
</tr>
<tr>
<td><div class=text><b>Caption:</b></div></td>
<td><input class=blacktext type=text name="caption" value="<? echo "$caption"; ?>" size=50 maxlength=175></td>
</tr>
<tr>
<td><div class=text><b>Credit:</b></div></td>
<td><input class=blacktext type=text name="courtesy_of" value="<? echo "$courtesy_of"; ?>" size=50 maxlength=175></td>
</tr>
<tr>
<td colspan="2" align=center>
<input class=boldtext type="submit" name="submit" value="add/update picture"></td>
</tr>
</table>
</form>
<p><table border=0 cellpadding=3 cellspacing=3 bgcolor="#000000" width="640">
<tr valign=top>
<?php
$count = 1;
$query = "SELECT * FROM pics WHERE stageID = $stageID ORDER BY default_flag";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$picID = $r['ID'];
$caption = $r['caption'];
$courtesy_of = $r['courtesy_of'];
$fullname = $r['fullname'];
$default_flag = $r['default_flag'];
$bgcolor = "#888888";
if ($default_flag == "yes" ) { $bgcolor = "#ffffff"; }
if ($picID == $ID) { $bgcolor = "#ff6666"; }
echo '<td align=center width="33%"><div class=text>';
echo "<table cellpadding=2 cellspacing=0 border=0 bgcolor=${bgcolor}>";
echo "<tr><td align=center>";
echo "<a target=_blank href=\"/tick/html/black.php?img=/tick/images/gallery/${fullname}\"><img src=\"/tick/images/gallery/t_${fullname}\" border=0></a></td></tr></table>";
if ($caption != "") { echo "<br>$caption"; }
if ($courtesy_of != "") { echo "<br><i>by $courtesy_of</i>"; }
echo "<br><a href=\"javascript:popup('pics_remove.php?ID=${picID}', 'picture');\"><img src=\"images/x.gif\" border=0></a>&nbsp;";
echo "[<a href=\"pics.php?ID=${picID}\">edit</a>]&nbsp;";
if ($default_flag == "yes")
{
echo "[<a href=\"pics_set_default.php?stageID=${stageID}&become=no&ID=${picID}\">deactivate</a>]";
}
else
{
echo "[<a href=\"pics_set_default.php?stageID=${stageID}&become=yes&ID=${picID}\">activate</a>]";
}
echo "</div></td>";
if ($count % 3 == 0) { echo "</tr><tr valign=top>"; }
$count++;
}
}
?>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,57 @@
<?require ("global.php");?>
<?php
$ID = 0;
list($msec, $sec) = explode(" ", microtime());
$stamp = date("Ymdhis") . substr($msec, 4);
$filename = "";
$path = "";
$complete = "";
$url = "";
$sql = "";
if (isset($_POST['ID'])) { $ID = $_POST['ID']; }
if (isset($_FILES['pic']['name']) && $_FILES['pic']['name'] != "")
{
$path = "$DOCUMENT_ROOT/tick/images/gallery/";
$pieces = preg_split('/\./', basename($_FILES['pic']['name']));
$filename = $stamp . "." . $pieces[1];
$complete = $path . $filename;
move_uploaded_file($_FILES['pic']['tmp_name'], $complete);
chmod($complete, 0755);
$s = "/var/home/slowtwitch/slowtwitch.com/www/tick/scripts/pics.pl $filename --- 640";
exec("$s 2>&1", $updw);
$s = "/var/home/slowtwitch/slowtwitch.com/www/tick/scripts/pics.pl $filename t_ 130";
exec("$s 2>&1", $updw);
$url = "/tick/images/gallery/";
$sql = "fullname = '" . $filename . "', fullurl = '" . $url . "', ";
}
if ($ID != 0)
{
$query = "UPDATE pics SET "
. $sql
. "caption = '" . myaddslashes($_POST['caption']) . "',"
. "courtesy_of = '" . myaddslashes($_POST['courtesy_of']) . "' "
. "WHERE ID = '$ID'";
$result = mysql_query($query, $db);
}
else
{
$query = "INSERT INTO pics (stageID,fullname,fullurl,caption,courtesy_of,default_flag) VALUES ('"
. $_POST['stageID'] . "','"
. $filename . "','"
. $url . "','"
. myaddslashes($_POST['caption']) . "','"
. myaddslashes($_POST['courtesy_of']) . "','"
. "no')";
$result = mysql_query($query, $db);
}
header("Location: /tick/pics.php");
?>

View File

@ -0,0 +1,28 @@
<?require ("global.php");?>
<?php
if (isset($_GET['ID']))
{
$ID = $_GET["ID"];
$query = "SELECT fullname, stageID FROM pics WHERE ID = $ID LIMIT 1";
$result = mysql_query($query, $db);
if ($result)
{
if ($r = mysql_fetch_array($result))
{
$fullname = $r['fullname'];
$stageID = $r['stageID'];
unlink("$DOCUMENT_ROOT/tick/images/gallery/${fullname}");
unlink("$DOCUMENT_ROOT/tick/images/gallery/t_${fullname}");
}
}
$query = "DELETE FROM pics WHERE ID = $ID LIMIT 1";
$result = mysql_query($query, $db);
staticify($stageID);
}
header("Location: /tick/pics.php");
?>

View File

@ -0,0 +1,16 @@
<?require ("global.php");?>
<?php
if (isset($_GET['ID']) && isset($_GET['become']))
{
$ID = $_GET["ID"];
$become = $_GET["become"];
$query = "UPDATE pics SET default_flag = '${become}' WHERE ID = $ID";
$result = mysql_query($query, $db);
staticify($_GET['stageID']);
}
header("Location: /tick/pics.php");
?>

View File

@ -0,0 +1,79 @@
<?require ("global.php");?>
<?
$userID = 0;
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
else { header("Location: /tick/login.html"); }
$stageID = 0;
if (isset($_COOKIE['stageID'])) { $stageID = $_COOKIE['stageID']; }
else { header("Location: /tick/stages.php"); }
$query = "SELECT events.name as event_name, stages.* FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID AND events.userID = $userID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$event_name = $r['event_name'];
$name = $r['name'];
$popup_link = $r['popup_link'];
$popup_text = $r['popup_text'];
$popup_position = $r['popup_position'];
}
}
mysql_free_result($result);
?>
<html>
<head>
<title>OneTicker :: Popup</title>
<link rel=stylesheet type="text/css" href="tick.css">
<script src="banner.js" type="text/javascript"></script>
</head>
<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4>
<script type="text/javascript">banner(8);</script>
<form name="popup" action="popup_update.php" method="post">
<input type="hidden" name="stageID" value="<? echo $stageID ?>">
<table border=0 cellspacing=2 cellpadding=2 width=640>
<tr><td><div class=text>&nbsp;</div></td></tr>
<tr>
<td><div class=text><span class=smtext>link name</span>
<br><input class=blacktext type=text name="popup_link" value="<? echo $popup_link; ?>" size=50 maxlength=300></td>
</tr>
<tr>
<td ><div class=blacktext><span class=smtext>popup window contents (HTML)</span>
<br><textarea class=blacktext name="popup_text" cols=66 rows=12 wrap="virtual"><? echo $popup_text; ?></textarea>
</div></td>
</tr>
<tr>
<td><div class=text><span class=smtext>position</span>
<br><select name="popup_position" class=blacktext>
<option value="notes"<? if ($popup_position == 'notes') { echo " selected"; } ?>>end of notes</option>
<option value="stages"<? if ($popup_position == 'stages') { echo " selected"; } ?>>stages section</option>
</select>
</div></td>
</tr>
<tr><td colspan=2><div class=text>&nbsp;</div></td></tr>
<tr>
<td colspan="2" align=center>
<input class=boldtext type="submit" name="submit" value="update popup for <? echo "$event_name $name"; ?>"></td>
</tr>
</table>
</form>
</body>
</html>

View File

@ -0,0 +1,23 @@
<?require ("global.php");?>
<?php
$stageID = 0;
if (isset($_POST['stageID']))
{
$stageID = $_POST['stageID'];
$query = "UPDATE stages SET "
. "popup_link = '" . myaddslashes($_POST['popup_link']) . "', "
. "popup_text = '" . myaddslashes($_POST['popup_text']) . "', "
. "popup_position = '" . myaddslashes($_POST['popup_position']) . "' "
. "WHERE ID = $stageID";
$result = mysql_query($query, $db);
$s = "/usr/bin/wget -O /var/www/html/one/tick/html/popwindow${stageID}.html 'http://www.onemillionrevolutions.org/tick/popwindow.php?ID=${stageID}'";
exec("$s 2>&1", $updw);
staticify($_POST['stageID']);
}
header("Location: /tick/ticks.php");
?>

View File

@ -0,0 +1,60 @@
<?require ("global.php");?>
<?php
$stageID = 0;
$popup_link = "";
$popup_text = "";
if (isset($_GET['ID']))
{
$stageID = $_GET['ID'];
$query = "SELECT popup_link, popup_text FROM stages WHERE ID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$popup_link = $r['popup_link'];
$popup_text = $r['popup_text'];
}
mysql_free_result($result);
}
}
?>
<html>
<head>
<title>OneTicker :: <? echo "$popup_link"; ?></title>
<style type="text/css">
<!--
.text
{
font-family : Verdana, Arial, Geneva, Helvetica;
font-size : 11px;
color : #000000;
line-height : 120%;
}
-->
</style>
</head>
<body marginheight=4 marginwidth=15 leftmargin=15 topmargin=4>
<table cellpadding=1 cellspacing=1 border=0 width="280" align=center>
<tr>
<td><div class=text>
<? echo "$popup_text"; ?>
</div></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,30 @@
#!/usr/bin/perl
use Image::Magick;
my ($image);
my $filename = shift || exit(0);
my $append = shift || "";
my $max_height = shift || 200;
if ($append eq "---") { $append = ""; }
my $base = '/var/home/slowtwitch/slowtwitch.com/www/tick/images/gallery';
my $new_filename = "${base}/${append}${filename}";
$image = Image::Magick->new;
$image->Read("${base}/${filename}");
$width = $image->Get('columns');
$height = $image->Get('rows');
if (($width > 900) || ($height > $max_height))
{
$image->Resize(geometry=>"${width}x${max_height}");
# $image->Scale(geometry=>"${longest_side}x${longest_side}");
# $image->Border(geometry=>'5x5');
$image->Write(filename=>"${new_filename}", quality=>'75');
}
undef $image;
exit(0);

View File

@ -0,0 +1,30 @@
#!/usr/bin/perl
use Image::Magick;
my ($image);
my $filename = shift || exit(0);
my $append = shift || "";
my $max_height = shift || 200;
if ($append eq "---") { $append = ""; }
my $base = '/var/www/html/one/tick/images/gallery';
my $new_filename = "${base}/${append}${filename}";
$image = Image::Magick->new;
$image->Read("${base}/${filename}");
$width = $image->Get('columns');
$height = $image->Get('rows');
if (($width > 900) || ($height > $max_height))
{
$image->Resize(geometry=>"${width}x${max_height}");
# $image->Scale(geometry=>"${longest_side}x${longest_side}");
# $image->Border(geometry=>'5x5');
$image->Write(filename=>"${new_filename}", quality=>'75');
}
undef $image;
exit(0);

View File

@ -0,0 +1,35 @@
#!/usr/bin/perl
use Image::Magick;
sub get_files
{
my @allFiles;
opendir DIR, "/var/www/html/one/tick/images/gallery";
@allFiles = grep !/^\./, readdir DIR;
closedir DIR;
foreach $file (@allFiles)
{
if ($file =~ m/^f\_.*?/)
{
print "$file\n";
$image = Image::Magick->new;
$image->Read("/var/www/html/one/tick/images/gallery/${file}");
$width = $image->Get('columns');
$height = $image->Get('rows');
if (($width > 700) || ($height > 170))
{
$image->Resize(geometry=>"1500x170");
$image->Write(filename=>"/var/www/html/one/tick/images/gallery/t_${file}", quality=>'80');
}
undef $image;
}
}
}
&get_files();

View File

@ -0,0 +1,25 @@
#!/usr/bin/perl
# resize to 160 on the long edge and add black border
use Image::Magick;
$source_dir = shift || ".";
my @allFiles;
opendir DIR, $source_dir;
@allFiles = grep !/^\./, readdir DIR;
closedir DIR;
foreach $file (@allFiles)
{
if ($file =~ m/^b.*?\.jpg/g)
{
print "$file\n";
$image = Image::Magick->new;
$image->Read("$source_dir/${file}");
$image->Resize(geometry=>"160x160");
$image->Border(geometry=>"2x2", fill=>"black");
$image->Write(filename=>"$source_dir/t_${file}", quality=>'75');
undef $image;
}
}

View File

@ -0,0 +1,328 @@
<?require ("global.php");?>
<?php
$userID = 0;
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
else { header("Location: /tick/login.html"); }
$default_stageID = 0;
if (isset($_COOKIE['stageID'])) { $default_stageID = $_COOKIE['stageID']; }
$ID = 0;
$date = ''; $year = 0; $month = 0; $day = 0;
$name = ''; $status = 'new'; $refresh_type = 'meta';
$inc_pics = 'yes'; $inc_video = 'no'; $inc_map = 'yes';
$start_location = ''; $end_location = ''; $distance = '';
$refresh = ''; $extra_html = '';
$tick_sequence = ''; $time_offset = ''; $mobile_notes = ''; $notes = '';
if (isset($_GET['ID']))
{
$ID = $_GET["ID"];
$query = "SELECT * FROM stages WHERE ID = $ID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$status = $r['status'];
$inc_pics = $r['inc_pics'];
$inc_video = $r['inc_video'];
$inc_map = $r['inc_map'];
$date = $r['date'];
list($year, $month, $day) = split("-", $date);
$name = $r['name'];
$start_location = $r['start_location'];
$end_location = $r['end_location'];
$distance = $r['distance'];
$refresh = $r['refresh'];
$tick_sequence = $r['tick_sequence'];
$refresh_type = $r['refresh_type'];
$time_offset = $r['time_offset'];
$mobile_notes = $r['mobile_notes'];
$extra_html = $r['extra_html'];
$notes = $r['notes'];
$static_url = $r['static_url'];
}
}
}
$query = "SELECT *, DATE_FORMAT(events.date_start, '%b %e, %Y') AS datef FROM events WHERE default_flag = 'yes' AND userID = $userID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$eventID = $r['ID'];
$event_name = $r['name'];
$event_date = $r['datef'];
}
}
mysql_free_result($result);
?>
<html>
<head>
<title>OneTicker :: Stages</title>
<link rel=stylesheet type="text/css" href="tick.css">
<script src="banner.js" type="text/javascript"></script>
</head>
<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4>
<script type="text/javascript">banner(2);</script>
<form name="stages" enctype="multipart/form-data" action="stages_add.php" method="post">
<input type="hidden" name="eventID" value="<? echo $eventID ?>">
<input type="hidden" name="ID" value="<? echo $ID ?>">
<input type="hidden" name="tick_sequence" value="">
<?
if ($default_stageID == 0)
{
echo "<div class=redtext><img src=\"/tick/images/clear.gif\" border=0 height=2 width=140><b>Please select an active stage.</b><p></div>";
}
?>
<table border=0 cellspacing=1 cellpadding=1 width="640">
<tr>
<td colspan=2><div class=text><span class=smtext>name</span>
<br><input class=blacktext type=text name="name" value="<? echo $name; ?>" size=50 maxlength=175></td>
<td><div class=text><span class=smtext>distance</span>
<br><input class=blacktext type=text name="distance" value="<? echo "$distance"; ?>" size=28 maxlength=100></td>
<td><div class=text><span class=smtext>status</span>
<br><select name=status class=blacktext>
<option value="new"<? if ($status == 'new') { echo " selected"; } ?>>new</option>
<option value="ongoing"<? if ($status == 'ongoing') { echo " selected"; } ?>>ongoing</option>
<option value="complete"<? if ($status == 'complete') { echo " selected"; } ?>>complete</option>
<option value="irrelevant"<? if ($status == 'irrelevant') { echo " selected"; } ?>>irrelevant</option>
</select>
</div></td>
</tr>
<tr>
<td><div class=text><span class=smtext>start location</span>
<br><input class=blacktext type=text name="start_location" value="<? echo $start_location; ?>" size=23 maxlength=150></td>
<td><div class=text><span class=smtext>end location</span>
<br><input class=blacktext type=text name="end_location" value="<? echo $end_location; ?>" size=23 maxlength=150></td>
<td><div class=text><span class=smtext>page refresh</span>
<br><select name=refresh class=blacktext>
<option value="0"<? if ($refresh == 0) { echo " selected"; } ?>>never</option>
<option value="60"<? if ($refresh == 60) { echo " selected"; } ?>>every minute</option>
<option value="120"<? if ($refresh == 120) { echo " selected"; } ?>>every 2 minutes</option>
<option value="180"<? if ($refresh == 180) { echo " selected"; } ?>>every 3 minutes</option>
<option value="240"<? if ($refresh == 240) { echo " selected"; } ?>>every 4 minutes</option>
<option value="300"<? if ($refresh == 300) { echo " selected"; } ?>>every 5 minutes</option>
<option value="480"<? if ($refresh == 480) { echo " selected"; } ?>>every 8 minutes</option>
<option value="600"<? if ($refresh == 600) { echo " selected"; } ?>>every 10 minutes</option>
<option value="1200"<? if ($refresh == 1200) { echo " selected"; } ?>>every 20 minutes</option>
<option value="1800"<? if ($refresh == 1800) { echo " selected"; } ?>>every 30 minutes</option>
<option value="3600"<? if ($refresh == 3600) { echo " selected"; } ?>>every hour</option>
</select>
</div></td>
<td><div class=text><span class=smtext>refresh method</span>
<br><select name="refresh_type" class=blacktext>
<option value="meta"<? if ($refresh_type == 'meta') { echo " selected"; } ?>>not controllable</option>
<option value="javascript"<? if ($refresh_type == 'javascript') { echo " selected"; } ?>>user controlled</option>
</select>
</div></td>
<!--
<td><div class=text><span class=smtext>tick sequence</span>
<br><select name=tick_sequence class=blacktext>
<option value=""<? if ($tick_sequence == '') { echo " selected"; } ?>>most recent last</option>
<option value=" DESC"<? if ($tick_sequence == ' DESC') { echo " selected"; } ?>>most recent first</option>
</select>
</div></td>
-->
</tr>
<tr valign=top>
<td colspan=2><table cellpadding=0 cellspacing=0 border=0 width="100%">
<tr valign=top>
<td><div class=text><span class=smtext>date</span>
<br><select class=blacktext name=month>
<?
while(list($key, $value) = each($month_names))
{
$selected = "";
$month_index = $key + 1;
if ($month_index == $month) { $selected = " selected"; }
echo "<option value=\"${month_index}\"$selected>${value}</option>";
}
?>
</select>&nbsp;
<select class=blacktext name=day>
<?
for ($i=1; $i<32;$i++)
{
$selected = "";
if ($i == $day) { $selected = " selected"; }
echo "<option value=\"$i\"$selected>$i</option>";
}
?>
</select>&nbsp;
<select class=blacktext name=year>
<?
for ($i=2009; $i<2015;$i++)
{
$selected = "";
if ($i == $year) { $selected = " selected"; }
echo "<option value=\"$i\"$selected>$i</option>";
}
?>
</select>
</div></td>
<td><div class=text><span class=smtext>PST offset</span>
<br><select class=blacktext name=time_offset>
<?
for ($i=-23; $i<24;$i++)
{
$selected = "";
if ($i == $time_offset) { $selected = " selected"; }
if ($i > 0) { $i = "+$i"; }
echo "<option value=\"$i\"$selected>$i hours</option>";
}
?>
</select>
</div></td>
</tr>
<tr>
<td colspan=2><div class=text>
<br>include:&nbsp;&nbsp;
<? $checked = ""; if ($inc_pics == 'yes') { $checked = " checked"; } ?>
<input type=checkbox name=inc_pics value=yes<? echo "$checked"; ?> class=blacktext>pics
<? $checked = ""; if ($inc_video == 'yes') { $checked = " checked"; } ?>
<input type=checkbox name=inc_video value=yes<? echo "$checked"; ?> class=blacktext>video
<? $checked = ""; if ($inc_map == 'yes') { $checked = " checked"; } ?>
<input type=checkbox name=inc_map value=yes<? echo "$checked"; ?> class=blacktext>map
</div></td>
</tr>
</table></td>
<td colspan=2><div class=text><span class=smtext>profile image</span>
<br><input class=blacktext type=file name="profile" size=40>
<ul>
<li>image will be resized automatically</li>
<li>leave blank to keep existing image</li>
</ul>
</div></td>
</tr>
<? /** tr>
<td colspan=2><div class=blacktext><span class=smtext>comments (viewer)</span>
<br><textarea class=blacktext name="notes" cols=46 rows=3 wrap="virtual"><? echo $notes; ?></textarea>
</div></td>
<td colspan=2><div class=blacktext><span class=smtext>comments (mobile viewer)</span>
<br><textarea class=blacktext name="mobile_notes" cols=46 rows=3 wrap="virtual"><? echo $mobile_notes; ?></textarea>
</div></td>
</tr **/ ?>
<tr>
<td colspan=2><div class=text><span class=smtext>static url</span>
<br><input class=blacktext type=text name="static_url" value="<? echo $static_url; ?>" size=23 maxlength=150>
</div></td>
<td colspan=2><div class=blacktext>&nbsp;
</div></td>
</tr>
<tr>
<td colspan=4><div class=blacktext><span class=smtext>extra footer (html)</span>
<br><textarea class=blacktext name="extra_html" cols=100 rows=4 wrap="virtual"><? echo $extra_html; ?></textarea>
</div></td>
</tr>
<tr>
<td colspan=4 align=center>
<input class=boldtext type="submit" name="submit" value="add/update stage"></td>
</tr>
</table>
</form>
<p>
<span class=smtext>Click date to edit stage info.<br />
Click check-mark to activate a given stage. (Red check indicates active stage.)</span>
<table border=0 cellpadding=0 cellspacing=0 bgcolor="#000000" width="700">
<tr><td>
<table border=0 cellpadding=3 cellspacing=1 bgcolor="#000000" width=100%>
<tr valign=top>
<td bgcolor=#cccccc align=center width="15%"><div class=blacktext><b>DATE</b></div></td>
<td bgcolor=#cccccc align=center><div class=blacktext><b>NAME</b></div></td>
<td bgcolor=#cccccc align=center width="35%"><div class=blacktext><b>ROUTE</b></div></td>
<td bgcolor=#cccccc align=center width="9%"><div class=blacktext><b>STATUS</b></div></td>
<td bgcolor=#cccccc align=center width="2%"><div class=blacktext>ACTIVE</div></td>
</tr>
<?php
$query = "SELECT *, DATE_FORMAT(stages.date, '%b %e, %Y') AS datef FROM stages WHERE eventID = $eventID ORDER BY date DESC";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$stageID = $r['ID'];
$status = $r['status'];
$name = $r['name'];
$date = $r['datef'];
$start_location = $r['start_location'];
$end_location = $r['end_location'];
$default_flag = $r['default_flag'];
$distance = $r['distance'];
$time_offset = $r['time_offset'];
$static_url = $r['static_url'];
if ($stageID == $ID) { echo "<tr bgcolor=#ffaaaa>"; }
else { echo "<tr bgcolor=#ffffff>"; }
echo "<td><div class=blacktext>&nbsp;<a href=\"stages.php?ID=${stageID}\">$date</a></div></td>";
echo "<td><div class=blacktext>$name";
echo "<br>[<a target=_blank href=\"viewer.php?ID=${stageID}\">viewer</a>]";
echo "&nbsp;[<a target=_blank href=\"$static_base${static_url}.html\">static viewer</a>]";
echo "</div></td>";
echo "<td><div class=blacktext>${start_location}&nbsp;to&nbsp;${end_location}<br>${distance}<br>&nbsp;- offset ${time_offset} hours from PST</div></td>";
echo "<td align=center><div class=blacktext>${status}</div></td>";
//echo "<td><a href=\"javascript:popup('stages_remove.php?ID=${stageID}', 'stage');\"><img src=\"images/x.gif\" border=0></a>&nbsp;";
echo "<td align=center>&nbsp;";
if ($stageID == $default_stageID)
{
echo "<img src=\"images/checkmark.gif\" border=0>";
}
else
{
echo "<a href=\"stages_set_default.php?ID=${stageID}\"><img src=\"images/checkmark_black.gif\" border=0 alt=\"make default\"></a>";
}
echo "</td>";
echo "</tr>";
}
}
?>
<tr valign=top>
<td bgcolor=#aaaaaa colspan=5><div class=blacktext>&nbsp;
</div></td>
</tr>
</table></td></tr>
</table>
</body>
</html>

View File

@ -0,0 +1,90 @@
<?require ("global.php");?>
<?php
$ID = 0;
if (isset($_POST['ID'])) { $ID = $_POST['ID']; }
list($msec, $sec) = explode(" ", microtime());
$stamp = date("Ymdhis") . substr($msec, 4);
$filename = ""; $uploaddir = ""; $uploadfile = ""; $profile_sql = "";
$inc_pics = 'no'; $inc_video = 'no'; $inc_map = 'no'; $extra_html = '';
if (isset($_POST['inc_pics']) && $_POST['inc_pics'] == 'yes') { $inc_pics = 'yes'; }
if (isset($_POST['inc_video']) && $_POST['inc_video'] == 'yes') { $inc_video = 'yes'; }
if (isset($_POST['inc_map']) && $_POST['inc_map'] == 'yes') { $inc_map = 'yes'; }
if (isset($_FILES['profile']['name']) && $_FILES['profile']['name'] != "")
{
$uploaddir = "$DOCUMENT_ROOT/tick/images/gallery/";
$pieces = preg_split('/\./', basename($_FILES['profile']['name']));
$filename = $stamp . "." . $pieces[1];
$uploadfile = $uploaddir . $filename;
move_uploaded_file($_FILES['profile']['tmp_name'], $uploadfile);
chmod($uploadfile, 0755);
$s = "/var/home/slowtwitch/slowtwitch.com/www/tick/scripts/pics.pl $filename --- 640";
exec("$s 2>&1", $updw);
$s = "/var/home/slowtwitch/slowtwitch.com/www/tick/scripts/pics.pl $filename t_ 60";
exec("$s 2>&1", $updw);
$profile_sql = "', profile = '" . $filename;
}
if ($ID != 0)
{
$query = "UPDATE stages SET name = '" . myaddslashes($_POST['name'])
. "', date = '" . $_POST['year'] . "-" . $_POST['month']
. "-" . $_POST['day']
. "', status = '" . $_POST['status']
. "', inc_pics = '" . $inc_pics
. "', inc_video = '" . $inc_video
. "', inc_map = '" . $inc_map
. "', start_location = '" . myaddslashes($_POST['start_location'])
. "', end_location = '" . myaddslashes($_POST['end_location'])
. "', distance = '" . myaddslashes($_POST['distance'])
. "', refresh = '" . $_POST['refresh']
. "', tick_sequence = '" . $_POST['tick_sequence']
. "', refresh_type = '" . $_POST['refresh_type']
. "', time_offset = '" . $_POST['time_offset']
. $profile_sql
. "', mobile_notes = '" . myaddslashes($_POST['mobile_notes'])
. "', extra_html = '" . myaddslashes($_POST['extra_html'])
. "', static_url = '" . myaddslashes($_POST['static_url'])
. "', notes = '" . myaddslashes($_POST['notes'])
. "' WHERE ID = '$ID'";
$result = mysql_query($query, $db);
}
else
{
$query = "INSERT INTO stages (eventID, name, status, inc_pics, inc_video, inc_map, date, start_location, end_location, distance, refresh, tick_sequence, refresh_type, time_offset, profile, mobile_notes, extra_html, static_url, notes) VALUES ('"
. $_POST['eventID'] . "','"
. myaddslashes($_POST['name']) . "','"
. $_POST['status'] . "','"
. $inc_pics . "','"
. $inc_video . "','"
. $inc_map . "','"
. $_POST['year'] . "-" . $_POST['month'] . "-" . $_POST['day'] . "','"
. myaddslashes($_POST['start_location']) . "','"
. myaddslashes($_POST['end_location']) . "','"
. myaddslashes($_POST['distance']) . "','"
. $_POST['refresh'] . "','"
. $_POST['tick_sequence'] . "','"
. $_POST['refresh_type'] . "','"
. $_POST['time_offset'] . "','"
. myaddslashes($filename) . "','"
. myaddslashes($_POST['mobile_notes']) . "','"
. myaddslashes($_POST['extra_html']) . "','"
. myaddslashes($_POST['static_url']) . "','"
. myaddslashes($_POST['notes']) . "')";
$result = mysql_query($query, $db);
$ID = mysql_insert_id();
//$query = "UPDATE stages SET static_url = '/tick/html/stage${ID}' WHERE ID = $ID";
$result = mysql_query($query, $db);
}
header("Location: /tick/stages.php");
?>

View File

@ -0,0 +1,32 @@
<?require ("global.php");?>
<?php
if (isset($_GET['ID']))
{
$ID = $_GET["ID"];
$query = "DELETE FROM ticks WHERE stageID = $ID";
$result = mysql_query($query, $db);
$query = "DELETE FROM maps WHERE stageID = $ID";
$result = mysql_query($query, $db);
$query = "DELETE FROM maps_coords WHERE stageID = $ID";
$result = mysql_query($query, $db);
$query = "DELETE FROM segments WHERE stageID = $ID";
$result = mysql_query($query, $db);
$query = "DELETE FROM markers WHERE stageID = $ID";
$result = mysql_query($query, $db);
$query = "DELETE FROM pics WHERE stageID = $ID";
$result = mysql_query($query, $db);
$query = "DELETE FROM stages WHERE ID = $ID LIMIT 1";
$result = mysql_query($query, $db);
}
header("Location: /tick/stages.php");
?>

View File

@ -0,0 +1,10 @@
<?php
if (isset($_GET['ID']))
{
setcookie("stageID", $_GET['ID']);
}
header("Location: /tick/stages.php");
?>

View File

@ -0,0 +1,83 @@
<?require ("global.php");?>
<?
$userID = 0;
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
else { header("Location: /tick/login.html"); }
$stageID = 0;
if (isset($_COOKIE['stageID'])) { $stageID = $_COOKIE['stageID']; }
else { header("Location: /tick/stages.php"); }
$query = "SELECT events.name as event_name, stages.* FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID AND events.userID = $userID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$event_name = $r['event_name'];
$name = $r['name'];
$standings_gc = $r['standings_gc'];
$standings_now = $r['standings_now'];
$standings_gc_url = $r['standings_gc_url'];
$standings_now_url = $r['standings_now_url'];
$standings_gc_header = $r['standings_gc_header'];
$standings_now_header = $r['standings_thru'];
}
mysql_free_result($result);
}
?>
<html>
<head>
<title>OneTicker :: Standings</title>
<link rel=stylesheet type="text/css" href="tick.css">
<script src="banner.js" type="text/javascript"></script>
</head>
<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4>
<script type="text/javascript">banner(5);</script>
<form name="standings" action="standings_update.php" method="post">
<input type="hidden" name="stageID" value="<? echo $stageID ?>">
<table border=0 cellspacing=2 cellpadding=2>
<tr><td colspan=2><div class=text>&nbsp;</div></td></tr>
<tr>
<td align=center><div class=text><b>Overall Standings</b></div></td>
<td align=center><div class=text><b>Current Standings</b></div></td>
</tr>
<tr valign=top>
<td align=center><div class=text>
<b>Header:</b>
<input class=blacktext type=text name="standings_gc_header" value="<? echo $standings_gc_header; ?>" size=40 maxlength=250>
<br><textarea class=blacktext name="standings_gc" cols=55 rows=6 wrap="virtual"><? echo $standings_gc; ?></textarea>
<br><b>Results URL:</b>
<input class=blacktext type=text name="standings_gc_url" value="<? echo $standings_gc_url; ?>" size=40 maxlength=250>
</div></td>
<td align=center><div class=text>
<b>Header:</b>
<input class=blacktext type=text name="standings_now_header" value="<? echo $standings_now_header; ?>" size=40 maxlength=250>
<br><textarea class=blacktext name="standings_now" cols=55 rows=6 wrap="virtual"><? echo $standings_now; ?></textarea>
<br><b>Results URL:</b>
<input class=blacktext type=text name="standings_now_url" value="<? echo $standings_now_url; ?>" size=40 maxlength=250>
</div></td>
</tr>
<tr><td colspan=2><div class=text>&nbsp;</div></td></tr>
<tr>
<td colspan="2" align=center>
<input class=boldtext type="submit" name="submit" value="update standings for <? echo "$event_name $name"; ?>"></td>
</tr>
</table>
</form>
</body>
</html>

View File

@ -0,0 +1,23 @@
<?require ("global.php");?>
<?php
$stageID = 0;
if (isset($_POST['stageID']))
{
$stageID = $_POST['stageID'];
$query = "UPDATE stages SET "
. "standings_gc = '" . myaddslashes($_POST['standings_gc']) . "', "
. "standings_now = '" . myaddslashes($_POST['standings_now']) . "', "
. "standings_gc_url = '" . myaddslashes($_POST['standings_gc_url']) . "', "
. "standings_now_url = '" . myaddslashes($_POST['standings_now_url']) . "', "
. "standings_gc_header = '" . myaddslashes($_POST['standings_gc_header']) . "', "
. "standings_thru = '" . myaddslashes($_POST['standings_now_header']) . "' "
. "WHERE ID = $stageID";
$result = mysql_query($query, $db);
staticify($_POST['stageID']);
}
header("Location: /tick/ticks.php");
?>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,218 @@
<?require ("global.php");?>
<?php
$userID = 0;
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
else { header("Location: /tick/login.html"); }
$stageID = 0;
if (isset($_COOKIE['stageID'])) { $stageID = $_COOKIE['stageID']; }
else { header("Location: /tick/stages.php"); }
$query = "SELECT events.name as event_name, stages.*, DATE_FORMAT(stages.date, '%b %e, %Y') AS datef FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID AND events.userID = $userID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$event_name = $r['event_name'];
$stage_string = "[${r['datef']}] ${event_name} ${r['name']}";
}
}
mysql_free_result($result);
$ID = 0;
$timestamp = ''; $year = 0; $month = 0; $day = 0;
$hour = 0; $minute = 0; $second = 0;
$headline = '';
$body = '';
if (isset($_GET['ID']))
{
$ID = $_GET["ID"];
$query = "SELECT * FROM ticks WHERE ID = $ID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$stageID = $r['stageID'];
$timestamp = $r['timestamp'];
list($date, $time) = split(" ", $timestamp);
list($year, $month, $day) = split("-", $date);
list($hour, $minute, $second) = split(":", $time);
$headline = $r['headline'];
$body = $r['body'];
}
}
mysql_free_result($result);
}
?>
<html>
<head>
<title>OneTicker :: Ticks</title>
<link rel=stylesheet type="text/css" href="tick.css">
<script src="banner.js" type="text/javascript"></script>
</head>
<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4>
<script type="text/javascript">banner(3);</script>
<form name="ticks" action="ticks_add.php" method="post">
<input type="hidden" name="ID" value="<? echo $ID ?>">
<input type="hidden" name="stageID" value="<? echo $stageID ?>">
<table border=0 cellspacing=1 cellpadding=1 width="480">
<tr>
<td><div class=text><b>Stage:</b></div></td>
<td><div class=text><? echo "$stage_string"; ?></div></td>
</tr>
<tr>
<td><div class=text><b>Date:</b></div></td>
<td><div class=text>
<select class=blacktext name=month>
<option value="1"<? if (($ID == 0 && date('m') == '01') || ($month == 1)) { echo " selected"; } ?>>January</option>
<option value="2"<? if (($ID == 0 && date('m') == '02') || ($month == 2)) { echo " selected"; } ?>>February</option>
<option value="3"<? if (($ID == 0 && date('m') == '03') || ($month == 3)) { echo " selected"; } ?>>March</option>
<option value="4"<? if (($ID == 0 && date('m') == '04') || ($month == 4)) { echo " selected"; } ?>>April</option>
<option value="5"<? if (($ID == 0 && date('m') == '05') || ($month == 5)) { echo " selected"; } ?>>May</option>
<option value="6"<? if (($ID == 0 && date('m') == '06') || ($month == 6)) { echo " selected"; } ?>>June</option>
<option value="7"<? if (($ID == 0 && date('m') == '07') || ($month == 7)) { echo " selected"; } ?>>July</option>
<option value="8"<? if (($ID == 0 && date('m') == '08') || ($month == 8)) { echo " selected"; } ?>>August</option>
<option value="9"<? if (($ID == 0 && date('m') == '09') || ($month == 9)) { echo " selected"; } ?>>September</option>
<option value="10"<? if (($ID == 0 && date('m') == '10') || ($month == 10)) { echo " selected"; } ?>>October</option>
<option value="11"<? if (($ID == 0 && date('m') == '11') || ($month == 11)) { echo " selected"; } ?>>November</option>
<option value="12"<? if (($ID == 0 && date('m') == '12') || ($month == 12)) { echo " selected"; } ?>>December</option>
</select>&nbsp;
<select class=blacktext name=day>
<?
for ($i=1; $i<32;$i++)
{
$selected = "";
if (($ID == 0 && date('d') == $i) || ($i == $day)) { $selected = " selected"; }
echo "<option value=\"$i\"$selected>$i</option>";
}
?>
</select>&nbsp;
<select class=blacktext name=year>
<?
for ($i=2006; $i<2015;$i++)
{
$selected = "";
if (($ID == 0 && date('Y') == $i) || ($i == $year)) { $selected = " selected"; }
echo "<option value=\"$i\"$selected>$i</option>";
}
?>
</select>
</div></td>
</tr>
<tr>
<td><div class=text><b>Time:</b></div></td>
<td><div class=text>
<select class=blacktext name=hour>
<?
for ($i=0; $i<24;$i++)
{
$selected = "";
if (($ID == 0 && date('H') == $i) || ($i == $hour)) { $selected = " selected"; }
echo "<option value=\"$i\"$selected>$i</option>";
}
?>
</select>:
<select class=blacktext name=minute>
<?
for ($i=0; $i<60;$i++)
{
$selected = "";
$display = $i;
if ($i < 10) { $display = "0${i}"; }
if (($ID == 0 && date('i') == $i) || ($i == $minute)) { $selected = " selected"; }
echo "<option value=\"$i\"$selected>$display</option>";
}
?>
</select>&nbsp;or&nbsp;
<?
$checked = "";
if ($ID == 0) { $checked = " checked"; }
echo "<input type=checkbox name=current_time value=yes${checked}>current time on server";
?>
</div></td>
</tr>
<tr>
<td><div class=text><b>Headline:</b></div></td>
<td><input class=blacktext type=text name="headline" value="<? echo $headline ?>" size=60 maxlength=200></td>
</tr>
<tr valign=top>
<td><div class=text><b>Body:</b></div></td>
<td><div class=blacktext>
<textarea class=blacktext name="body" cols=70 rows=12 wrap="virtual"><? echo $body ?></textarea>
</div></td>
</tr>
<tr>
<td colspan="2" align=center>
<input class=boldtext type="submit" name="submit" value="add/update tick"></td>
</tr>
</table>
</form>
<p><table border=0 cellpadding=0 cellspacing=0 bgcolor="#000000" width="700">
<tr><td>
<table border=0 cellpadding=3 cellspacing=1 bgcolor="#000000" width=100%>
<tr>
<td bgcolor=#cccccc align=center width="26%"><span class=blacktext><b>TIMESTAMP</b></span></td>
<td bgcolor=#cccccc align=center width="25%"><span class=blacktext><b>HEADLINE</b></span></td>
<td bgcolor=#cccccc align=center><span class=blacktext><b>BODY</b></span></td>
<td bgcolor=#cccccc align=center width="2%"><span class=blacktext>&nbsp;</span></td>
</tr>
<?php
$query = "SELECT *, DATE_FORMAT(ticks.timestamp, '%b %e, %Y at %l:%i %p') AS timef FROM ticks WHERE ticks.stageID = $stageID ORDER BY timestamp DESC";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$tickID = $r['ID'];
$timestamp = $r['timef'];
$headline = $r['headline'];
$body = $r['body'];
if (strlen($body) > 100) { $body = substr($body, 0, 99) . '...'; }
if ($tickID == $ID) { echo "<tr valign=top bgcolor=#ffaaaa>"; }
else { echo "<tr valign=top bgcolor=#ffffff>"; }
echo "<td><div class=blacktext>&nbsp;<a href=\"ticks.php?ID=${tickID}\">$timestamp</a></div></td>";
echo "<td><div class=blacktext>$headline</div></td>";
echo "<td><div class=blacktext>$body</div></td>";
echo "<td><a href=\"javascript:popup('ticks_remove.php?ID=${tickID}&stageID=${stageID}', 'tick');\"><img src=\"images/x.gif\" border=0></a></td>";
echo "</tr>";
}
}
mysql_free_result($result);
?>
<tr valign=top>
<td bgcolor=#aaaaaa colspan=7><div class=blacktext>&nbsp;
</div></td>
</tr>
</table></td></tr>
</table>
</body>
</html>

View File

@ -0,0 +1,52 @@
<?require ("global.php");?>
<?php
$ID = 0;
$datetime = "";
if (isset($_POST['ID'])) { $ID = $_POST['ID']; }
if (isset($_POST['current_time']) && $_POST['current_time'] == 'yes')
{
$time_offset = 0;
$query = "SELECT time_offset FROM stages WHERE ID = " . $_POST['stageID'];
$result = mysql_query($query, $db);
if ($result)
{
if ($r = mysql_fetch_array($result))
{
$time_offset = $r['time_offset'];
}
}
$datetime = "NOW() + INTERVAL $time_offset HOUR";
}
else
{
$datetime = "'" . $_POST['year'] . "-" . $_POST['month'] . "-"
. $_POST['day'] . " " . $_POST['hour'] . ":" . $_POST['minute']
. ":00" . "'";
}
if ($ID != 0)
{
$query = "UPDATE ticks SET "
. "stageID = '" . $_POST['stageID']
. "', timestamp = " . $datetime
. ", headline = '" . myaddslashes($_POST['headline'])
. "', body = '" . myaddslashes($_POST['body'])
. "' WHERE ID = '$ID'";
$result = mysql_query($query, $db);
}
else
{
$query = "INSERT INTO ticks (stageID, timestamp, headline, body) VALUES ('"
. $_POST['stageID'] . "',"
. $datetime . ",'"
. myaddslashes($_POST['headline']) . "','"
. myaddslashes($_POST['body']) . "')";
$result = mysql_query($query, $db) or mysql_error($result);
}
staticify($_POST['stageID']);
header("Location: /tick/ticks.php");
?>

View File

@ -0,0 +1,14 @@
<?require ("global.php");?>
<?php
if (isset($_GET['ID']))
{
$ID = $_GET["ID"];
$query = "DELETE FROM ticks WHERE ID = $ID LIMIT 1";
$result = mysql_query($query, $db);
}
staticify($_GET['stageID']);
header("Location: /tick/ticks.php");
?>

View File

@ -0,0 +1,23 @@
<?require ("global.php");?>
<?php
/** $query = "UPDATE stages SET temp_URL = 'lifetime_09' WHERE ID = 308";
$results = mysql_query($query, $db) OR die(mysql_error());
$query = "UPDATE stages SET temp_URL = 'rev3_09' WHERE ID = 307";
$results = mysql_query($query, $db) OR die(mysql_error());
$query = "UPDATE stages SET temp_URL = 'musselman_09' WHERE ID = 314";
$results = mysql_query($query, $db) OR die(mysql_error());
$query = "UPDATE stages SET temp_URL = 'nyc_09' WHERE ID = 309";
$results = mysql_query($query, $db) OR die(mysql_error());
$query = "UPDATE stages SET temp_URL = 'portlandmile_09' WHERE ID = 315";
$results = mysql_query($query, $db) OR die(mysql_error());
$query = "UPDATE stages SET temp_URL = 'portlandtri_09' WHERE ID = 316";
$results = mysql_query($query, $db) OR die(mysql_error());
$query = "UPDATE stages SET temp_URL = 'chicago_09' WHERE ID = 311";
$results = mysql_query($query, $db) OR die(mysql_error());
$query = "UPDATE stages SET temp_URL = 'losangeles_09' WHERE ID = 312";
$results = mysql_query($query, $db) OR die(mysql_error());
$query = "UPDATE stages SET temp_URL = 'dallas_09' WHERE ID = 313";
$results = mysql_query($query, $db) OR die(mysql_error()); **/
?>

View File

@ -0,0 +1,159 @@
<?require ("global.php");?>
<?php
$userID = 0;
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
else { header("Location: /tick/login.html"); }
$stageID = 0;
if (isset($_COOKIE['stageID'])) { $stageID = $_COOKIE['stageID']; }
else { header("Location: /tick/stages.php"); }
$query = "SELECT events.name as event_name, stages.*, DATE_FORMAT(stages.date, '%b %e, %Y') AS datef FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID AND events.userID = $userID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$event_name = $r['event_name'];
$stage_string = "[${r['datef']}] ${event_name} ${r['name']}";
}
}
mysql_free_result($result);
$ID = 0;
$thumbname = '';
$link = '';
$caption = '';
$courtesy_of = '';
$default_flag = '';
if (isset($_GET['ID']))
{
$ID = $_GET["ID"];
$query = "SELECT * FROM videos WHERE ID = $ID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$filename = $r['thumbname'];
$link = $r['link'];
$caption = $r['caption'];
$courtesy_of = $r['courtesy_of'];
$default_flag = $r['default_flag'];
}
}
}
?>
<html>
<head>
<title>OneTicker :: Videos</title>
<link rel=stylesheet type="text/css" href="tick.css">
<script src="banner.js" type="text/javascript"></script>
</head>
<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4>
<script type="text/javascript">banner(7);</script>
<form name="videos" enctype="multipart/form-data" action="videos_add.php" method="post">
<input type="hidden" name="ID" value="<? echo $ID ?>">
<input type="hidden" name="stageID" value="<? echo $stageID ?>">
<table border=0 cellspacing=1 cellpadding=1 width="480">
<tr>
<td><div class=text><b>Stage:</b></div></td>
<td><div class=text><? echo "$stage_string"; ?></div></td>
</tr>
<tr valign=top>
<td><div class=text><b>Thumbnail:</b></div></td>
<td><div class=text>
<input class=blacktext type=file name="thumbnail" size=40>
<ul>
<li>thumbnail will be resized appropriately</li>
<li>leave blank to keep existing thumbnail</li>
<li>DO NOT put non-alphanumeric characters in filenames</li>
<li>don't forget to activate thumbnails you want visible</li>
</ul>
</div></td>
</tr>
<tr>
<td><div class=text><b>Link:</b></div></td>
<td><input class=blacktext type=text name="link" value="<? echo "$link"; ?>" size=50 maxlength=175></td>
</tr>
<tr>
<td><div class=text><b>Caption:</b></div></td>
<td><input class=blacktext type=text name="caption" value="<? echo "$caption"; ?>" size=50 maxlength=175></td>
</tr>
<tr>
<td><div class=text><b>Credit:</b></div></td>
<td><input class=blacktext type=text name="courtesy_of" value="<? echo "$courtesy_of"; ?>" size=50 maxlength=175></td>
</tr>
<tr>
<td colspan="2" align=center>
<input class=boldtext type="submit" name="submit" value="add/update video"></td>
</tr>
</table>
</form>
<p><table border=0 cellpadding=3 cellspacing=3 bgcolor="#000000" width="640">
<tr valign=top>
<?php
$count = 1;
$query = "SELECT * FROM videos WHERE stageID = $stageID ORDER BY default_flag";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$videoID = $r['ID'];
$link = $r['link'];
$caption = $r['caption'];
$courtesy_of = $r['courtesy_of'];
$thumbname = $r['thumbname'];
$default_flag = $r['default_flag'];
$bgcolor = "#888888";
if ($default_flag == "yes" ) { $bgcolor = "#ffffff"; }
if ($videoID == $ID) { $bgcolor = "#ff6666"; }
echo '<td align=center width="33%"><div class=text>';
echo "<table cellpadding=2 cellspacing=0 border=0 bgcolor=${bgcolor}>";
echo "<tr><td align=center>";
echo "<a target=_blank href=\"${link}\"><img src=\"/tick/images/gallery/${thumbname}\" border=0></a></td></tr></table>";
if ($caption != "") { echo "<br>$caption"; }
if ($courtesy_of != "") { echo "<br><i>by $courtesy_of</i>"; }
echo "<br><a href=\"javascript:popup('videos_remove.php?ID=${videoID}', 'video');\"><img src=\"images/x.gif\" border=0></a>&nbsp;";
echo "[<a href=\"videos.php?ID=${videoID}\">edit</a>]&nbsp;";
if ($default_flag == "yes")
{
echo "[<a href=\"videos_set_default.php?stageID=${stageID}&become=no&ID=${videoID}\">deactivate</a>]";
}
else
{
echo "[<a href=\"videos_set_default.php?stageID=${stageID}&become=yes&ID=${videoID}\">activate</a>]";
}
echo "</div></td>";
if ($count % 3 == 0) { echo "</tr><tr valign=top>"; }
$count++;
}
}
?>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,57 @@
<?require ("global.php");?>
<?php
$ID = 0;
list($msec, $sec) = explode(" ", microtime());
$stamp = date("Ymdhis") . substr($msec, 4);
$filename = "";
$path = "";
$complete = "";
$url = "";
$sql = "";
if (isset($_POST['ID'])) { $ID = $_POST['ID']; }
if (isset($_FILES['thumbnail']['name']) && $_FILES['thumbnail']['name'] != "")
{
$path = "$DOCUMENT_ROOT/tick/images/gallery/";
$pieces = preg_split('/\./', basename($_FILES['thumbnail']['name']));
$filename = "t_" . $stamp . "." . $pieces[1];
$complete = $path . $filename;
move_uploaded_file($_FILES['thumbnail']['tmp_name'], $complete);
chmod($complete, 0755);
$s = "/var/home/slowtwitch/slowtwitch.com/www/tick/scripts/pics.pl $filename --- 130";
exec("$s 2>&1", $updw);
$url = "/tick/images/gallery/";
$sql = "thumbname = '" . $filename . "', thumburl = '" . $url . "', ";
}
if ($ID != 0)
{
$query = "UPDATE videos SET "
. $sql
. "link = '" . $_POST['link'] . "',"
. "caption = '" . myaddslashes($_POST['caption']) . "',"
. "courtesy_of = '" . myaddslashes($_POST['courtesy_of']) . "' "
. "WHERE ID = '$ID'";
$result = mysql_query($query, $db);
}
else
{
$query = "INSERT INTO videos (stageID,thumbname,thumburl,link,caption,courtesy_of,default_flag) VALUES ('"
. $_POST['stageID'] . "','"
. $filename . "','"
. $url . "','"
. $_POST['link'] . "','"
. myaddslashes($_POST['caption']) . "','"
. myaddslashes($_POST['courtesy_of']) . "','"
. "no')";
$result = mysql_query($query, $db);
}
$file = "$DOCUMENT_ROOT/tick/images/gallery/pic" . $_POST['stageID'] . ".txt";
header("Location: /tick/videos.php");
?>

View File

@ -0,0 +1,25 @@
<?require ("global.php");?>
<?php
if (isset($_GET['ID']))
{
$ID = $_GET["ID"];
$query = "SELECT thumbname FROM videos WHERE ID = $ID LIMIT 1";
$result = mysql_query($query, $db);
if ($result)
{
if ($r = mysql_fetch_array($result))
{
$thumbname = $r['thumbname'];
unlink("$DOCUMENT_ROOT/tick/images/gallery/${thumbname}");
}
}
$query = "DELETE FROM videos WHERE ID = $ID LIMIT 1";
$result = mysql_query($query, $db);
}
header("Location: /tick/videos.php");
?>

View File

@ -0,0 +1,16 @@
<?require ("global.php");?>
<?php
if (isset($_GET['ID']) && isset($_GET['become']))
{
$ID = $_GET["ID"];
$become = $_GET["become"];
$query = "UPDATE videos SET default_flag = '${become}' WHERE ID = $ID";
$result = mysql_query($query, $db);
staticify($_GET['stageID']);
}
header("Location: /tick/videos.php");
?>

View File

@ -0,0 +1,742 @@
<?require ("global.php");?>
<?php
$link = "dynamic";
$base_url = "http://www.slowtwitch.com/live/";
if (isset($_GET['link'])) { $link = $_GET['link']; }
$stageID = 0;
if (isset($_GET['ID']))
{
$stageID = $_GET['ID'];
$query = "SELECT events.name as event_name, events.header_html, events.footer_html, events.banner_html, events.tower_html, events.map_key, events.title, stages.*, DATE_FORMAT(stages.date, '%b %e, %Y') AS datef FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$event_name = $r['event_name'];
$map_key = $r['map_key'];
$title = $r['title'];
$eventID = $r['eventID'];
$header_html = $r['header_html'];
$footer_html = $r['footer_html'];
$banner_html = $r['banner_html'];
$tower_html = $r['tower_html'];
$name = $r['name'];
$date = $r['datef'];
$inc_pics = $r['inc_pics'];
$inc_video = $r['inc_video'];
$inc_map = $r['inc_map'];
$start_location = $r['start_location'];
$end_location = $r['end_location'];
$standings_gc = $r['standings_gc'];
$standings_now = $r['standings_now'];
$standings_gc_url = $r['standings_gc_url'];
$standings_now_url = $r['standings_now_url'];
$standings_gc_header = $r['standings_gc_header'];
$standings_now_header = $r['standings_thru'];
$profile = $r['profile'];
$distance = $r['distance'];
$refresh = $r['refresh'];
$tick_sequence = $r['tick_sequence'];
$refresh_type = $r['refresh_type'];
$popup_link = $r['popup_link'];
$popup_text = $r['popup_text'];
$popup_position = $r['popup_position'];
$extra_html = $r['extra_html'];
$notes = $r['notes'];
$static_link = $r['static_url'];
}
mysql_free_result($result);
}
$text_width = 345;
$map_width = 450;
if ($tower_html != "")
{
if ($inc_map == 'yes') // text, map, and tower
{
$text_width = 345;
$map_width = 330;
}
else // text and tower, but no map
{
$text_width = 675;
}
}
else
{
if ($inc_map == 'yes') // text and map, but no tower
{
$text_width = 345;
$map_width = 450;
}
else // only text
{
$text_width = 795;
}
}
$popup_url = "popwindow" . $stageID . ".html";
if ($link == "dynamic")
{
$popup_url = "popwindow.php?ID=" . $stageID;
$map_key = "ABQIAAAAeMrkW1kxL_t7AGsTQzv_9xRenuji4aHjAULXgP93zutp7Hv6ShRbebgpZJZpLLF2bt806Iyi896c8g";
}
$query = "SELECT * FROM maps WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$zoom = $r['zoom'];
$map_type = $r['map_type'];
$center_lat = $r['center_lat'];
$center_lon = $r['center_lon'];
}
mysql_free_result($result);
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<META HTTP-EQUIV="charset" CONTENT="UTF-8">
<title><? echo "$title"; ?></title>
<style type="text/css">
<!--
.text
{
font-family : Verdana, Arial, Geneva, Helvetica;
font-size : 11px;
color : #000000;
line-height : 120%;
}
.smtext
{
font-family : Verdana, Arial, Geneva, Helvetica;
font-size : 10px;
color : #000000;
line-height : 120%;
}
.bigtext
{
font-family : Verdana, Arial, Geneva, Helvetica;
font-size : 14px;
color : #000000;
line-height : 120%;
}
A
{
font-family : Verdana, Arial, Geneva, Helvetica;
font-weight : bold;
font-size : 11px;
color : #ed1c24;
text-decoration : none;
}
A:hover
{
color : #ed1c24;
font-family : Verdana, Arial, Geneva, Helvetica;
text-decoration : underline;
font-weight : bold;
}
div#commentary1
{
overflow: auto;
width: <? echo $text_width; ?>px;
height: 455px;
border-left: 1px gray solid;
border-bottom: 1px gray solid;
border-right: 1px gray solid;
border-top: 1px gray solid;
padding: 0px 5px 5px 0px;
margin: 0px;
display: block;
}
div#commentary2
{
overflow: auto;
width: <? echo $text_width; ?>px;
height: 455px;
border-left: 1px gray solid;
border-bottom: 1px gray solid;
border-right: 1px gray solid;
border-top: 1px gray solid;
padding: 0px 5px 5px 0px;
margin: 0px;
display: none;
}
-->
</style>
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<? include "../db_templates/google_analytics.html" ?>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=<? echo $map_key; ?>" type="text/javascript"></script>
<!-- begin script to create random number for ads -->
<script language="Javascript">
<!--
sgi_ord=Math.random()*10000000000000000;
//-->
</script>
<!-- End random number script -->
<script type="text/javascript">
//<![CDATA[
var map;
var text = new Array();
var timeoutID = 0;
var zoom = <? echo $zoom; ?>;
var center_lat = "<? echo $center_lat; ?>";
var center_lon = "<? echo $center_lon; ?>";
var base = new GIcon();
base.image = "images/pin_red.png";
base.shadow = "images/shadow.png";
base.iconSize = new GSize(12, 20);
base.shadowSize = new GSize(22, 20);
base.iconAnchor = new GPoint(6, 20);
base.infoWindowAnchor = new GPoint(5, 1);
loadText();
function createCookie(name,value,days)
{
if (days)
{
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)
{
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name)
{
createCookie(name,"",-1);
}
function show_route(points, color, size)
{
if (points.length > 0)
{
var chunk = 200;
if (points.length > chunk)
{
show_route(points.slice(0, chunk), color, size);
show_route(points.slice(chunk), color, size);
}
else
{
map.addOverlay(new GPolyline(points, color, size));
}
}
}
function toggleRefresh()
{
var refresh_rate = <? echo "$refresh"; ?> * 1000;
var refresh_type = "<? echo "$refresh_type"; ?>";
if ((refresh_rate > 0) && (refresh_type == 'javascript'))
{
if (timeoutID != 0) { clearTimeout(timeoutID); }
if (document.which.fresh.checked)
{
timeoutID = setTimeout('window.location.reload()', refresh_rate);
}
}
}
function popup(url, x, y)
{
window.open(url,'OneTicker','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=' + y + ',height=' + x);
}
function toggleText()
{
var on_style, off_style;
var on = "commentary2";
var off = "commentary1";
if (document.which.textorder.checked)
{
on = "commentary1";
off = "commentary2";
createCookie('textorder', 'recentfirst', 7);
}
else
{
createCookie('textorder', 'oldfirst', 7);
}
if (document.getElementById)
{
on_style = document.getElementById(on).style;
off_style = document.getElementById(off).style;
}
else if (document.all)
{
on_style = document.all[on].style;
off_style = document.all[off].style;
}
else if (document.layers)
{
on_style = document.layers[on].style;
off_style = document.layers[off].style;
}
on_style.display = "none";
off_style.display = "block";
}
function loadText()
{
<?php
$i = 0;
$query = "SELECT *, DATE_FORMAT(ticks.timestamp, '%l:%i %p') AS timef FROM ticks WHERE ticks.stageID = $stageID ORDER BY timestamp";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$body = chop(addslashes($r['body']));
$body = preg_replace("((\r\n)+)", " ", $body);
echo "text[" . $i . "] = new Array();";
echo "text[" . $i . "]['time'] = '" . $r['timef'] . "';";
echo "text[" . $i . "]['headline'] = '" . chop(addslashes($r['headline'])) . "';";
echo "text[" . $i . "]['body'] = '" . $body . "';";
$i++;
}
mysql_free_result($result);
}
?>
}
function loadCoords()
{
var routes, marker;
<?
$query = "SELECT * FROM segments WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
echo "routes = new Array();";
$query2 = "SELECT * FROM maps_coords WHERE segmentID = " . $r['ID'] . " ORDER BY sequence";
$result2 = mysql_query($query2, $db);
if ($result2)
{
while ($r2 = mysql_fetch_array($result2))
{
$lat = $r2['latitude'];
$lon = $r2['longitude'];
echo "point = new GLatLng(" . $lat . ", " . $lon . ");";
echo "routes.push(point);";
}
mysql_free_result($result2);
}
echo "show_route(routes, '" . $r['color'] . "', 5);";
}
mysql_free_result($result);
}
?>
<?
$query = "SELECT * FROM markers WHERE stageID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
echo 'base.image = "images/' . $r['icon'] . '";';
echo "marker = createMarker(base, new GLatLng(" . $r['latitude'] . ", " . $r['longitude'] . "), '" . $r['ID'] . "', '" . addslashes($r['title']) . "', '" . addslashes($r['text']) . "', '" . $r['image'] . "');";
echo "map.addOverlay(marker);";
}
mysql_free_result($result);
}
?>
}
function initCookies()
{
var biscuit = readCookie('textorder');
if (biscuit == null)
{
createCookie('textorder', 'oldfirst', 7);
biscuit = 'oldfirst';
}
if (biscuit == 'recentfirst')
{
document.which.textorder.checked = true;
}
}
function onLoad()
{
map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addMapType(G_PHYSICAL_MAP);
map.setCenter(new GLatLng(center_lat, center_lon), zoom, <? echo "$map_type"; ?>);
loadCoords();
}
function createMarker(icon, point, markerID, title, text, image)
{
var marker = new GMarker(point, {icon: icon});
var html = '<table cellpadding=1 cellspacing=1 border=0 width=200>';
if (image != "")
{
html = html + '<tr><td align=center><a target=_blank href="/tick/black.php?img=images/gallery/' + image + '"><img height="130" src="images/gallery/t_' + image + '" border=0></a><br></td></tr>';
}
html = html + '<tr><td><div class=text><b>' + title + '</b></td></tr>';
html = html + '<tr><td><div class=text>' + text + '</div></td></tr>';
html = html + '</table>';
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
//]]>
</script>
</head>
<body bgcolor=#ffffff marginheight=4 marginwidth=15 leftmargin=2 topmargin=4 onload="initCookies();toggleRefresh();toggleText();<? if ($inc_map == "yes") { echo ' onLoad()" onunload="GUnload()'; } ?>">
<form name="which">
<table cellspacing=1 cellpadding=1 width="800" border=1 align=center>
<tr> <!-- header -->
<td colspan=2 align=center width="100%"><? echo "$header_html"; ?></td>
</tr>
<tr bgcolor="#cccccc" valign=top> <!-- stage information -->
<td colspan=2><table cellpadding=0 cellspacing=0 border=0 width="100%">
<tr valign=top>
<td><div class=text>
<?
if ($profile != "")
{
echo "<a target=\"_blank\" href=\"/tick/black.php?img=images/gallery/${profile}\"><img src=\"images/gallery/t_${profile}\" border=0 align=left></a>";
}
?>
&nbsp;<span class=bigtext><b><? echo "$event_name :: $name"; ?></b></span>
<br>&nbsp;<? echo "$date"; ?>&nbsp;-&nbsp;
&nbsp;<? echo "$start_location"; ?><? if ($start_location != $end_location) { echo "&nbsp;to&nbsp;$end_location"; } ?>
<br>&nbsp;<? echo "$distance"; ?>
<br><? if ($notes != "") { echo "&nbsp;${notes}"; } ?>
<?
if ($profile != "")
{
echo "&nbsp;[<a target=\"_blank\" href=\"/tick/black.php?img=images/gallery/${profile}\">Course Profile</a>]";
}
if (($popup_link != "") && ($popup_position == "notes"))
{
echo "&nbsp;[";
echo "<a href=\"javascript:popup('" . $popup_url . "', 600, 380);\">";
echo "$popup_link" . '</a>]';
}
?>
</div></td>
<td width=280><div class=text><? echo "$banner_html"; ?></div></td>
</tr>
</table></td>
</tr>
<tr bgcolor="#dddddd" valign=top>
<td><table border=0 cellpadding=1 cellspacing=1 width="100%">
<tr>
<td><div class=text>
<b>Other races:&nbsp;</b>
<select name=stage class=text onChange="location.href = document.which.stage.options[document.which.stage.selectedIndex].value">
<option value="<? echo $base_url.$static_link.".html"; ?>">--please select--</option>
<?php
$query = "SELECT * FROM stages WHERE eventID = $eventID AND (status = 'ongoing' OR status = 'complete') ORDER BY date";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$location = $r['static_url'] . ".html";
if ($link == "static")
{
$location = "stage" . $r['ID'] . ".html";
}
$selected = "";
if ($stageID == $r['ID']) { $selected = " selected"; }
echo "<option value=\"$base_url${location}\"${selected}>${event_name} ${r['name']}</option>";
}
}
?>
</select>
</div></td>
<td align=center><div class=text>
<?
if (($refresh_type == 'javascript') && ($refresh != 0))
{
echo "<input type=checkbox name=fresh value=yes checked onClick='toggleRefresh();'>refresh page";
}
?>
</div></td>
<td align=center><div class=text>
<input type=checkbox name=textorder value=yes onClick='toggleText();'>most recent first
</div></td>
<?
if (($popup_link != "") && ($popup_position == "stages"))
{
echo "<td align=center><div class=text>[";
echo "<a href=\"javascript:popup('" . $popup_url . "', 600, 380);\">";
echo "$popup_link" . '</a>]</div></td>';
}
?>
</tr>
</table></td>
<?
if ($tower_html != "")
{
echo "<td width=120 height=600 rowspan=3 bgcolor=#ffffff><div class=text>";
echo "$tower_html";
echo "</div></td>";
}
?>
</tr>
<tr valign=top>
<td><table cellpadding=2 cellspacing=0 border=1 width="100%">
<tr valign=top>
<td width="345" height=100><div class=text><b><u><? echo "$standings_now_header"; ?></u></b>
&nbsp;&nbsp;<? if ($standings_now_url != "") { echo "[<a target=_blank href=\"${standings_now_url}\">all</a>]"; } ?>
<br><span class=smtext><? echo "$standings_now"; ?></span>
</div></td>
<td><div class=text><b><u><? echo "$standings_gc_header"; ?></u></b>
&nbsp;&nbsp;<? if ($standings_gc_url != "") { echo "[<a target=_blank href=\"${standings_gc_url}\">all</a>]"; } ?>
<br><span class=smtext><? echo "$standings_gc"; ?></span>
</div></td>
</tr>
</table></td>
</tr>
<tr valign=top><td><table border=0 cellpadding=0 cellspacing=0><tr valign=top>
<td><DIV ID="commentary1">
<dl>
<script type="text/javascript">
document.open();
for (var i=0; i < text.length; i++)
{
document.write("<dt class=text><b>&nbsp;" + text[i]['time'] + "&nbsp;&nbsp;" + text[i]['headline'] + "</b></dt>");
document.write("<dd class=text>" + text[i]['body'] + "<p></dd>");
}
document.close();
</script>
</dl></div>
<DIV ID="commentary2">
<dl>
<script type="text/javascript">
document.open();
for (var i = text.length - 1; i >= 0; i--)
{
document.write("<dt class=text><b>&nbsp;" + text[i]['time'] + "&nbsp;&nbsp;" + text[i]['headline'] + "</b></dt>");
document.write("<dd class=text>" + text[i]['body'] + "<p></dd>");
}
document.close();
</script>
</dl></div></td>
<?
if ($inc_map == "yes")
{
echo "<td halign=top>";
echo '<div id="map" style="width: ' . $map_width . 'px; height: 460px; border: 1px solid #979797">';
echo "</td>";
}
?>
</tr></table>
</td>
</tr>
<?
if ($footer_html != "")
{
echo "<tr bgcolor=#ffffff valign=middle>";
echo "<td colspan=2 align=center><div class=text>";
echo "$footer_html";
echo "</div></td></tr>";
}
if ($extra_html != "")
{
echo "<tr bgcolor=#ffffff>";
echo "<td colspan=2><div class=text>";
echo "$extra_html";
echo "</div></td></tr>";
}
?>
<!-- PICS -->
<?
if ($inc_pics == 'yes')
{
echo "<tr bgcolor=#ffffff>";
echo "<td colspan=2 bgcolor=#cccccc><div class=text><b>LATEST PHOTOS</b></div></td>";
echo "</tr>";
echo "<tr><td colspan=2>";
echo '<DIV STYLE="overflow: auto; width: 800px; height: 182px;
border-top: 1px gray solid; padding:0px; margin: 0px">';
echo "<table cellpadding=1 cellspacing=1 border=0 width=100%><tr valign=top>";
$query = "SELECT * FROM pics WHERE stageID = $stageID AND default_flag = 'yes' ORDER BY ID DESC";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$fullname = $r['fullname'];
$caption = $r['caption'];
$credit = $r['courtesy_of'];
echo "<td align=center><div class=text><a target=_blank href=\"/tick/black.php?img=images/gallery/${fullname}\"><img border=0 src=\"images/gallery/t_${fullname}\"></a><br><b>${caption}</b>";
if ($credit != "") { echo "<br><i>by ${credit}</i>"; }
echo "</div></td>";
}
mysql_free_result($result);
}
echo "</tr></table></td>";
echo "</tr>";
}
?>
<!-- video -->
<?
if ($inc_video == 'yes')
{
echo "<tr bgcolor=#ffffff>";
echo "<td colspan=2 bgcolor=#cccccc><div class=text><b>LATEST VIDEO</b></div></td>";
echo "</tr>";
echo "<tr><td colspan=2>";
echo '<DIV STYLE="overflow: auto; width: 800px; height: 182px;
border-top: 1px gray solid; padding:0px; margin: 0px">';
echo "<table cellpadding=1 cellspacing=1 border=0 width=100%><tr valign=top>";
$query = "SELECT * FROM videos WHERE stageID = $stageID AND default_flag = 'yes' ORDER BY ID DESC";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$thumbname = $r['thumbname'];
$link = $r['link'];
$caption = $r['caption'];
$credit = $r['courtesy_of'];
echo "<td align=center><div class=text><a target=_blank href=\"${link}\"><img border=0 src=\"images/gallery/${thumbname}\"></a>";
if ($caption != "") { echo "<br>${caption}"; }
if ($credit != "") { echo " <i>by ${credit}</i>"; }
echo "</div></td>";
}
mysql_free_result($result);
}
echo "</tr></table></td>";
echo "</tr>";
}
?>
<tr>
<td colspan=2 align=center bgcolor="#dddddd" width="100%"><div class=text>&copy; 2010-2012 Slowtwitch, Inc.</div></td>
</tr>
</table>
</form>
</body>
</html>

View File

@ -0,0 +1,205 @@
<?require ("global.php");?>
<?php
$link = "dynamic";
if (isset($_GET['link'])) { $link = $_GET['link']; }
$stageID = 0;
if (isset($_GET['ID']))
{
$stageID = $_GET['ID'];
$query = "SELECT events.name as event_name, stages.*, DATE_FORMAT(stages.date, '%b %e, %Y') AS datef FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$event_name = $r['event_name'];
$eventID = $r['eventID'];
$name = $r['name'];
$date = $r['datef'];
$start_location = $r['start_location'];
$end_location = $r['end_location'];
$distance = $r['distance'];
$refresh = $r['refresh'];
$tick_sequence = $r['tick_sequence'];
$refresh_type = $r['refresh_type'];
$mobile_notes = $r['mobile_notes'];
$notes = $r['notes'];
}
mysql_free_result($result);
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<META HTTP-EQUIV="charset" CONTENT="UTF-8">
<title>VeloNews :: Live Race Coverage</title>
<style type="text/css">
<!--
.text
{
font-family : Verdana, Arial, Geneva, Helvetica;
font-size : 11px;
color : #000000;
line-height : 120%;
}
.smtext
{
font-family : Verdana, Arial, Geneva, Helvetica;
font-size : 10px;
color : #000000;
line-height : 120%;
}
.bigtext
{
font-family : Verdana, Arial, Geneva, Helvetica;
font-size : 14px;
color : #000000;
line-height : 120%;
}
A
{
font-family : Verdana, Arial, Geneva, Helvetica;
font-weight : bold;
font-size : 11px;
color : #ed1c24;
text-decoration : none;
}
A:hover
{
color : #ed1c24;
font-family : Verdana, Arial, Geneva, Helvetica;
text-decoration : underline;
font-weight : bold;
}
-->
</style>
</head>
<body bgcolor=#ffffff marginheight=4 marginwidth=15 leftmargin=2 topmargin=4>
<form name="which">
<table cellspacing=1 cellpadding=1 width="300" border=1 align=center>
<tr> <!-- header -->
<td align=center width="100%"><? echo "$header_html"; ?></td>
</tr>
<tr bgcolor="#cccccc" valign=top> <!-- stage information -->
<td><table cellpadding=0 cellspacing=0 border=0 width="100%">
<tr valign=top>
<td><div class=text>
&nbsp;<span class=bigtext><b><? echo "$event_name $name"; ?></b></span>
<br>&nbsp;<? echo "$date"; ?>&nbsp;-&nbsp;
&nbsp;<? echo "$start_location"; ?>&nbsp;to&nbsp;<? echo "$end_location"; ?>
<br>&nbsp;<? echo "$distance"; ?>
<!--<? if ($notes != "") { echo "<br>&nbsp;${notes}"; } ?>-->
<? if ($mobile_notes != "") { echo "<br>&nbsp;${mobile_notes}"; } ?>
</div></td>
</tr>
</table></td>
</tr>
<tr bgcolor="#dddddd">
<td><table border=0 cellpadding=0 cellspacing=0 width="100%">
<tr>
<td align=center><div class=text>
<b>Other stages:&nbsp;</b>
<select name=stage class=text onChange="location.href = document.which.stage.options[document.which.stage.selectedIndex].value">
<?php
$query = "SELECT * FROM stages WHERE eventID = $eventID AND (status = 'ongoing' OR status = 'complete') ORDER BY date";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$location = "/tick/viewer_mobile.php?ID=" . $r['ID'];
if ($link == "static")
{
$location = "stage" . $r['ID'] . "_mobile.html";
}
$selected = "";
if ($stageID == $r['ID']) { $selected = " selected"; }
echo "<option value=\"${location}\"${selected}>${event_name} ${r['name']}</option>";
}
}
?>
</select>
</div></td>
<?
if (($popup_link != "") && ($popup_position == "stages"))
{
echo "<td align=center><div class=text>[";
echo "<a href=\"javascript:popup('html/pop_stage" . $stageID . ".html', 300, 300);\">";
echo "$popup_link" . '</a>]</div></td>';
}
?>
</tr>
</table></td>
</tr>
<tr valign=top><td><table border=0 cellpadding=0 cellspacing=0><tr valign=top>
<td><DIV ID="commentary" STYLE="overflow: auto; width: 300px; height: 300px;
border-left: 1px gray solid; border-bottom: 1px gray solid;
border-right: 1px gray solid; border-top: 1px gray solid;
padding:0px; margin: 0px">
<dl>
<?php
$query = "SELECT *, DATE_FORMAT(ticks.timestamp, '%l:%i %p') AS timef FROM ticks WHERE ticks.stageID = $stageID ORDER BY timestamp" . $tick_sequence;
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$timestamp = $r['timef'];
$headline = $r['headline'];
$body = $r['body'];
echo "<dt class=text><b>&nbsp;${timestamp}&nbsp;&nbsp;${headline}</b></dt>";
echo "<dd class=text>${body}<p></dd>";
}
}
mysql_free_result($result);
?>
</dl></div></td>
</tr></table>
</td>
</tr>
</tr></table></td>
</tr>
</tr></table></td>
</tr>
</table>
</form>
</body>
</html>