<commit_before><?php

/**
 * @name		Photo Module
 * @author		<NAME>
 * @author		<NAME>
 * @copyright	2014 by <NAME>, <NAME>
 */

if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');

function getPhoto($photoID, $albumID) {

	global $database;

	$query	= "SELECT * FROM lychee_photos WHERE id = '$photoID';";
	$result = $database->query($query);
	$return = $result->fetch_array();

	if ($albumID!='false') {

		if ($return['album']!=0) {

			$result = $database->query("SELECT public FROM lychee_albums WHERE id = '" . $return['album'] . "';");
			$return_album = $result->fetch_array();
			if ($return_album['public']=="1") $return['public'] = "2";

		}

		$return['original_album']	= $return['album'];
		$return['album']			= $albumID;
		$return['sysdate']			= date('d M. Y', strtotime($return['sysdate']));
		if (strlen($return['takedate'])>0) $return['takedate'] = date('d M. Y', strtotime($return['takedate']));

	}

	unset($return['album_public']);

	return $return;

}

function setPhotoPublic($photoID, $url) {

	global $database;

	$result	= $database->query("SELECT public FROM lychee_photos WHERE id = '$photoID';");
	$row	= $result->fetch_object();
	$public = ($row->public==0 ? 1 : 0);
	$result = $database->query("UPDATE lychee_photos SET public = '$public' WHERE id = '$photoID';");

	if (!$result) return false;
	return true;

}<commit_msg>Removed data overhead = less data transferred when opening a photo<commit_after><?php

/**
 * @name		Photo Module
 * @author		<NAME>
 * @author		<NAME>
 * @copyright	2014 by <NAME>, <NAME>
 */

if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');

function getPhoto($photoID, $albumID) {

	global $database;

	$query	= "SELECT * FROM lychee_photos WHERE id = '$photoID';";
	$result = $database->query($query);
	$return = $result->fetch_array();

	if ($albumID!='false') {

		if ($return['album']!=0) {

			$result = $database->query("SELECT public FROM lychee_albums WHERE id = '" . $return['album'] . "';");
			$return_album = $result->fetch_array();
			if ($return_album['public']=="1") $return['public'] = "2";

		}

		$return['original_album']	= $return['album'];
		$return['album']			= $albumID;
		$return['sysdate']			= date('d M. Y', strtotime($return['sysdate']));
		if (strlen($return['takedate'])>0) $return['takedate'] = date('d M. Y', strtotime($return['takedate']));

	}

	unset($return['album_public']);

	// Remove unused items
	foreach ($return as $key => $value) {
		if (is_int($key)) unset($return[$key]);
	}

	return $return;

}

function setPhotoPublic($photoID, $url) {

	global $database;

	$result	= $database->query("SELECT public FROM lychee_photos WHERE id = '$photoID';");
	$row	= $result->fetch_object();
	$public = ($row->public==0 ? 1 : 0);
	$result = $database->query("UPDATE lychee_photos SET public = '$public' WHERE id = '$photoID';");

	if (!$result) return false;
	return true;

}
{'fraction_non_alphanumeric': 0.21349862258953167, 'fraction_numerical': 0.007575757575757576, 'mean_word_length': 4.928571428571429, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5286118', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1019, 'n_words': 236}