<commit_before><?php

require_once('config.class.php');
require_once('media.php');

$conn = mysql_pconnect(Config::dbHost, Config::dbUser, Config::dbPass);
mysql_select_db (Config::dbSchema);
$prefix = $_REQUEST['gameId'];
$query = "SELECT {$prefix}_items.*, media.*, players.*
			FROM {$prefix}_items, media, players
			WHERE {$prefix}_items.media_id = media.media_id AND {$prefix}_items.creator_player_id = players.player_id";
$result = mysql_query($query);


// Creates an array of strings to hold the lines of the KML file.
$kml = array('<?xml version="1.0" encoding="UTF-8"?>');
$kml[] = '<kml xmlns="http://earth.google.com/kml/2.1">';
$kml[] = ' <Document>';


// Iterates through the rows, printing a node for each row.
while ($row = @mysql_fetch_assoc($result)) 
{
  $kml[] = ' <Placemark id="placemark' . $row['item_id'] . '">';
  $kml[] = ' <name>' . htmlentities($row['name']) . '</name>';
  
  $mediaURL = Config::gamedataWWWPath . "/{$_REQUEST['gameId']}/{$row['file_name']}";
  
  $mediaObject = new Media;
  $type = $mediaObject->getMediaType($mediaURL);
  if ($type == Media::MEDIA_IMAGE) $mediaHtml = "<a target = '_blank' href = '{$mediaURL}'><img src = '$mediaURL' width = '100%'/></a>";
  else   $mediaHtml = '<a target = "_blank" href = "' . $mediaURL . '">Video Link</a>
  				<object height="175" width="212"> 
               	<param value="' . $mediaURL . '" name="movie"> 
                <param value="transparent" name="wmode"> 
                <embed wmode="transparent" type="application/x-shockwave-flash" src="'. $mediaURL .'" height="175" width="212"> 
               </object>
               ';
  
  
            
  
  $description = array("<![CDATA[");
  $description[] = "<strong>Created By:</strong> {$row['user_name']}<br/>";
  $description[] = "<strong>Date:</strong> {$row['origin_timestamp']}<br/>";
  $description[] = '<p>' . htmlentities($row['description']) . '</p>';
  $description[] = $mediaHtml;
  $description[] = "]]>";
  $descriptionHtml = join("\n", $description);
  
  $kml[] = ' <description>' . $descriptionHtml . '</description>';
  $kml[] = ' <Point>';
  $kml[] = ' <coordinates>' . $row['origin_longitude'] . ','  . $row['origin_latitude'] . '</coordinates>';
  $kml[] = ' </Point>';
  $kml[] = ' </Placemark>';
 
} 

// End XML file
$kml[] = ' </Document>';
$kml[] = '</kml>';
$kmlOutput = join("\n", $kml);
header('Content-type: application/vnd.google-earth.kml+xml');
echo $kmlOutput;


?><commit_msg>downloaded kml file now properly named<commit_after><?php

require_once('config.class.php');
require_once('media.php');

$conn = mysql_pconnect(Config::dbHost, Config::dbUser, Config::dbPass);
mysql_select_db (Config::dbSchema);
$prefix = $_REQUEST['gameId'];
$query = "SELECT {$prefix}_items.*, media.*, players.*
			FROM {$prefix}_items, media, players
			WHERE {$prefix}_items.media_id = media.media_id AND {$prefix}_items.creator_player_id = players.player_id";
$result = mysql_query($query);


// Creates an array of strings to hold the lines of the KML file.
$kml = array('<?xml version="1.0" encoding="UTF-8"?>');
$kml[] = '<kml xmlns="http://earth.google.com/kml/2.1">';
$kml[] = ' <Document>';


// Iterates through the rows, printing a node for each row.
while ($row = @mysql_fetch_assoc($result)) 
{
  $kml[] = ' <Placemark id="placemark' . $row['item_id'] . '">';
  $kml[] = ' <name>' . htmlentities($row['name']) . '</name>';
  
  $mediaURL = Config::gamedataWWWPath . "/{$_REQUEST['gameId']}/{$row['file_name']}";
  
  $mediaObject = new Media;
  $type = $mediaObject->getMediaType($mediaURL);
  if ($type == Media::MEDIA_IMAGE) $mediaHtml = "<a target = '_blank' href = '{$mediaURL}'><img src = '$mediaURL' width = '100%'/></a>";
  else   $mediaHtml = '<a target = "_blank" href = "' . $mediaURL . '">Video Link</a>
  				<object height="175" width="212"> 
               	<param value="' . $mediaURL . '" name="movie"> 
                <param value="transparent" name="wmode"> 
                <embed wmode="transparent" type="application/x-shockwave-flash" src="'. $mediaURL .'" height="175" width="212"> 
               </object>
               ';
  
  
            
  
  $description = array("<![CDATA[");
  $description[] = "<strong>Created By:</strong> {$row['user_name']}<br/>";
  $description[] = "<strong>Date:</strong> {$row['origin_timestamp']}<br/>";
  $description[] = '<p>' . htmlentities($row['description']) . '</p>';
  $description[] = $mediaHtml;
  $description[] = "]]>";
  $descriptionHtml = join("\n", $description);
  
  $kml[] = ' <description>' . $descriptionHtml . '</description>';
  $kml[] = ' <Point>';
  $kml[] = ' <coordinates>' . $row['origin_longitude'] . ','  . $row['origin_latitude'] . '</coordinates>';
  $kml[] = ' </Point>';
  $kml[] = ' </Placemark>';
 
} 

// End XML file
$kml[] = ' </Document>';
$kml[] = '</kml>';
$kmlOutput = join("\n", $kml);
header('Content-type: application/vnd.google-earth.kml+xml');
header('Content-Disposition: attachment; filename="ARISGame.kml"');
echo $kmlOutput;


?>
{'fraction_non_alphanumeric': 0.2313060817547358, 'fraction_numerical': 0.007976071784646061, 'mean_word_length': 3.981132075471698, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 2, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5094061', 'n_tokens_mistral': 1778, 'n_tokens_neox': 1701, 'n_words': 342}