<commit_before><?php
	abstract class Library_Gallery
	{
		public static function getFolderTemplate(Model_Users $owner, $id_parent, $on_own_gallery = false, $name, $tags = null, $baseURL = null, $can_edit_tags = false, $can_delete_file = false)
		{
			$tpl_gallery		=	null;
			$tpl_delete			=	null;
			$tpl_adding_form	=	null;
			$documents			=	$owner->getDocuments($id_parent); // Get folders AND files
			
			$hierarchy = '';
			$parent = Model_Files::getById($id_parent);
			if(!empty($parent))
			{
				while($parent = $parent->getParentFile())
				{
					$hierarchy = ' >> <a href="' . $baseURL . 'spritecomics/gallery/details/' . $parent->getId() . '">' . $parent->prop('name') . '</a>' . $hierarchy;
				}
				$hierarchy = '<a href="' . $baseURL . 'spritecomics/gallery/' . $owner->getId() . '">' . Library_i18n::get('spritecomics.gallery.details.root') . '</a>' . $hierarchy;
			}
			
			if($documents->isEmpty())
				$tpl_gallery	=	\Eliya\Tpl::get('spritecomics/gallery/empty');
			else
			{
				foreach($documents as $document)
				{
					$type			=	$document->prop('is_dir') ? 'folder' : 'file';
					$tpl_gallery	.=	\Eliya\Tpl::get('spritecomics/gallery/'.$type, ['document' => $document]);
				}
			}

			if($on_own_gallery)
			{
				$tpl_adding_form	=	\Eliya\Tpl::get('spritecomics/gallery/add', ['parent_file_id' => $id_parent]);

				if( ! empty($id_parent))
					$tpl_delete			=	\Eliya\Tpl::get('spritecomics/gallery/delete', ['id_to_delete' => $id_parent]);
			}
			
			$tpl_tags = '';
			if(!empty($id_parent))
			{
				$tpl_tags = \Eliya\Tpl::get('spritecomics/gallery/tags', [
					'id' => $id_parent,
					'tags' => $tags,
					'is_index' => empty($id_parent),
					'can_edit' => $can_edit_tags || $on_own_gallery
				]);
			}

			return \Eliya\Tpl::get('spritecomics/gallery', [
				'tpl_gallery'		=>	$tpl_gallery,
				'tpl_delete'		=>	$tpl_delete,
				'tpl_adding_form'	=>	$tpl_adding_form,<commit_msg>Moderators can remove dirs<commit_after><?php
	abstract class Library_Gallery
	{
		public static function getFolderTemplate(Model_Users $owner, $id_parent, $on_own_gallery = false, $name, $tags = null, $baseURL = null, $can_edit_tags = false, $can_delete_file = false)
		{
			$tpl_gallery		=	null;
			$tpl_delete			=	null;
			$tpl_adding_form	=	null;
			$documents			=	$owner->getDocuments($id_parent); // Get folders AND files
			
			$hierarchy = '';
			$parent = Model_Files::getById($id_parent);
			if(!empty($parent))
			{
				while($parent = $parent->getParentFile())
				{
					$hierarchy = ' >> <a href="' . $baseURL . 'spritecomics/gallery/details/' . $parent->getId() . '">' . $parent->prop('name') . '</a>' . $hierarchy;
				}
				$hierarchy = '<a href="' . $baseURL . 'spritecomics/gallery/' . $owner->getId() . '">' . Library_i18n::get('spritecomics.gallery.details.root') . '</a>' . $hierarchy;
			}
			
			if($documents->isEmpty())
				$tpl_gallery	=	\Eliya\Tpl::get('spritecomics/gallery/empty');
			else
			{
				foreach($documents as $document)
				{
					$type			=	$document->prop('is_dir') ? 'folder' : 'file';
					$tpl_gallery	.=	\Eliya\Tpl::get('spritecomics/gallery/'.$type, ['document' => $document]);
				}
			}

			if($on_own_gallery)
			{
				$tpl_adding_form	=	\Eliya\Tpl::get('spritecomics/gallery/add', ['parent_file_id' => $id_parent]);
			}
			if(($on_own_gallery || $can_delete_file) && !empty($id_parent))
			{
				$tpl_delete			=	\Eliya\Tpl::get('spritecomics/gallery/delete', ['id_to_delete' => $id_parent]);
			}
			
			$tpl_tags = '';
			if(!empty($id_parent))
			{
				$tpl_tags = \Eliya\Tpl::get('spritecomics/gallery/tags', [
					'id' => $id_parent,
					'tags' => $tags,
					'is_index' => empty($id_parent),
					'can_edit' => $can_edit_tags || $on_own_gallery
				]);
			}

			return \Eliya\Tpl::get('spritecomics/gallery', [
				'tpl_gallery'		=>	$tpl_gallery,
				'tpl_delete'		=>	$tpl_delete,
				'tpl_adding_form'	=>	$tpl_adding_form,
{'fraction_non_alphanumeric': 0.1950345533657538, 'fraction_numerical': 0.0010238034297414896, 'mean_word_length': 3.4971231300345225, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 49, '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': '1764086', 'n_tokens_mistral': 1832, 'n_tokens_neox': 1535, 'n_words': 211}