<commit_before><?php
//Layoutmaker.php AJAX backend

$ajaxPage = true;

$loguser['blocklayouts'] = 0; //force layouts to show up
$base = $_POST['base'];

if(!isset($base) || strpos($base, ".") !== FALSE)
	Kill("Invalid base layout.");

$basefile = "plugins/layoutmaker/bases/".$base.".php";
if(is_file($basefile))
	include($basefile);
else
	Kill("Invalid base layout.");

print "<style type=\"text/css\">".ApplyParameters($cssTemplate)."</style>";

$previewPost['num'] = "preview";
$previewPost['id'] = "preview";
$previewPost['uid'] = $_POST['ID'];
$copies = explode(",","title,name,displayname,picture,sex,powerlevel,avatar,rankset,signsep,posts,regdate,lastactivity,lastposttime");
foreach($copies as $toCopy)
	$previewPost[$toCopy] = $loguser[$toCopy];
$previewPost['postheader'] = trim(ApplyParameters($markupTemplateA));
$previewPost['text'] = $profilePreviewText;
$previewPost['signature'] = trim(ApplyParameters($markupTemplateB));

MakePost($previewPost, POST_SAMPLE);

write("
<form action=\"".actionLink("layoutmakerinstall")."\" method=\"post\">
<table class=\"width100\">
	<tr class=\"header1\">
		<th colspan=\"2\"><commit_msg>Fixed post preview in layout maker.<commit_after><?php
//Layoutmaker.php AJAX backend

$ajaxPage = true;

$loguser['blocklayouts'] = 0; //force layouts to show up
$base = $_POST['base'];

if(!isset($base) || strpos($base, ".") !== FALSE)
	Kill("Invalid base layout.");

$basefile = "plugins/layoutmaker/bases/".$base.".php";
if(is_file($basefile))
	include($basefile);
else
	Kill("Invalid base layout.");

print "<style type=\"text/css\">".ApplyParameters($cssTemplate)."</style>";

$previewPost['num'] = "preview";
$previewPost['id'] = "preview";
$previewPost['uid'] = $_POST['ID'];
$copies = explode(",","title,name,displayname,picture,sex,powerlevel,avatar,rankset,signsep,posts,regdate,lastactivity,lastposttime");
foreach($copies as $toCopy)
	$previewPost[$toCopy] = $loguser[$toCopy];
$previewPost['postheader'] = trim(ApplyParameters($markupTemplateA));
$previewPost['text'] = Settings::get("profilePreviewText");
$previewPost['signature'] = trim(ApplyParameters($markupTemplateB));

MakePost($previewPost, POST_SAMPLE);

write("
<form action=\"".actionLink("layoutmakerinstall")."\" method=\"post\">
<table class=\"width100\">
	<tr class=\"header1\">
		<th colspan=\"2\">
{'fraction_non_alphanumeric': 0.21724137931034482, 'fraction_numerical': 0.005172413793103448, 'mean_word_length': 8.101960784313725, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, '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': '5700132', 'n_tokens_mistral': 769, 'n_tokens_neox': 759, 'n_words': 130}