<commit_before><?php
require_once("module.php");

class Media extends Module
{
	const MEDIA_IMAGE = 'Image';
	const MEDIA_ICON = 'Icon';
	const MEDIA_VIDEO = 'Video';
	const MEDIA_AUDIO = 'Audio';
	protected $validImageAndIconTypes = array('jpg','png');
	protected $validAudioTypes = array('mp3','m4a','caf');
	protected $validVideoTypes = array('mp4','m4v','3gp','mov');

	/**
	 * Fetch all Media
	 * @returns the media
	 */
	public function getMedia($intGameID)
	{
		$prefix = Module::getPrefix($intGameID);
		if (!$prefix && $intGameID != 0) return new returnData(1, NULL, "invalid game id");

		if ($intGameID == 0) $query = "SELECT * FROM media WHERE game_id = 0";
		else $query = "SELECT * FROM media WHERE game_id = {$prefix} or game_id = 0";

		$rsResult = @mysql_query($query);
		if (mysql_error()) return new returnData(3, NULL, "SQL Error");

		$returnData = new returnData(0, array());

		//Calculate the media types
		while ($mediaRow = mysql_fetch_array($rsResult)) {

			$mediaItem = array();
			$mediaItem['media_id'] = $mediaRow['media_id'];
			$mediaItem['game_id'] = $mediaRow['game_id'];
			$mediaItem['name'] = $mediaRow['name'];
			$mediaItem['file_path'] = $mediaRow['file_path'];
			$mediaItem['file_name'] = $mediaRow['file_path']; //this is for legacy reasons... Phil 10/12/2012
			$mediaItem['url_path'] = Config::gamedataWWWPath . "/" . Config::gameMediaSubdir;

			if ($mediaRow['is_icon'] == '1') $mediaItem['type'] = self::MEDIA_ICON;
			else $mediaItem['type'] = $this->getMediaType($mediaRow['file_path']);

			if ($mediaRow['game_id'] == 0) $mediaItem['is_default'] = 1;
			else $mediaItem['is_default'] = 0;<commit_msg>prevented player media from being lumped in with default media<commit_after><?php
require_once("module.php");

class Media extends Module
{
	const MEDIA_IMAGE = 'Image';
	const MEDIA_ICON = 'Icon';
	const MEDIA_VIDEO = 'Video';
	const MEDIA_AUDIO = 'Audio';
	protected $validImageAndIconTypes = array('jpg','png');
	protected $validAudioTypes = array('mp3','m4a','caf');
	protected $validVideoTypes = array('mp4','m4v','3gp','mov');

	/**
	 * Fetch all Media
	 * @returns the media
	 */
	public function getMedia($intGameID)
	{
		$prefix = Module::getPrefix($intGameID);
		if (!$prefix && $intGameID != 0) return new returnData(1, NULL, "invalid game id");

		if ($intGameID == 0) $query = "SELECT * FROM media WHERE game_id = 0 AND SUBSTRING(file_path,1,1) != 'p'";
		else $query = "SELECT * FROM media WHERE game_id = {$prefix} OR (game_id = 0 AND SUBSTRING(file_path,1,1) != 'p')";

		$rsResult = @mysql_query($query);
		if (mysql_error()) return new returnData(3, NULL, "SQL Error");

		$returnData = new returnData(0, array());

		//Calculate the media types
		while ($mediaRow = mysql_fetch_array($rsResult)) {

			$mediaItem = array();
			$mediaItem['media_id'] = $mediaRow['media_id'];
			$mediaItem['game_id'] = $mediaRow['game_id'];
			$mediaItem['name'] = $mediaRow['name'];
			$mediaItem['file_path'] = $mediaRow['file_path'];
			$mediaItem['file_name'] = $mediaRow['file_path']; //this is for legacy reasons... Phil 10/12/2012
			$mediaItem['url_path'] = Config::gamedataWWWPath . "/" . Config::gameMediaSubdir;

			if ($mediaRow['is_icon'] == '1') $mediaItem['type'] = self::MEDIA_ICON;
			else $mediaItem['type'] = $this->getMediaType($mediaRow['file_path']);

			if ($mediaRow['game_id'] == 0) $mediaItem['is_default'] = 1;
			else $mediaItem['is_default'] = 0;
{'fraction_non_alphanumeric': 0.18595161760419704, 'fraction_numerical': 0.0151559312153891, 'mean_word_length': 5.285714285714286, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5297383', 'n_tokens_mistral': 1285, 'n_tokens_neox': 1169, 'n_words': 272}