<commit_before>﻿<?php
if (! defined ( 'DATALIFEENGINE' )) {
	die ( "Hacking attempt!" );
}
include ENGINE_DIR . '/data/tagsadd.php';

extract($_POST);

if($tagsconf['onof'] == 1 && $tagsconf['send'] == 1) {
	$subject = "Пользовательские теги к {$title}";
	$subjecto = "Ваши теги к {$title}";
	$mess = "{$username} предложил к новости <a href=\"{$link}\" target=\"_blank\" >{$title}</a> новые теги: {$tags}.";
	$messo = "Вами предложенные теги к <a href=\"{$link}\" target=\"_blank\" >{$title}</a>: {$tags}.";
	$date = time();
	$tagsadd = explode( ',', $_POST['utags'] );
	$tag = array();
	foreach ($tagsadd as $key) {
		$tag[] = "<span class=\"label label-danger\">{$key}</span>";
	}
	$tags = implode(',', $tag);
	if (empty($_POST['utags'])) {
		$link = "/";
	} else {
		$link = $link;
		$master = $tagsconf['master'];
		$admin = $tagsconf['admin'];
		$users = $db->query("SELECT * FROM " . PREFIX . "_users WHERE name='{$admin}'");
		$adminid = $users['user_id'];
		$db->super_query("INSERT INTO " . PREFIX . "_post_tags (news_id, username, tags) VALUES ('{$news}','{$username}','{$tags}')");
		$db->query( "INSERT INTO " . USERPREFIX . "_pm (subj, text, user, user_from, date, pm_read, folder, sendid) values ('{$subject}','{$mess}','1','{$username}','{$date}','0','inbox','0')");
		if($tagsconf['user'] == 1) $db->query( "INSERT INTO " . USERPREFIX . "_pm (subj, text, user, user_from, date, pm_read, folder, sendid) values ('{$subjecto}','{$messo}','{$userid}','{$master}','{$date}','0','inbox','0')");
		$db->query( "UPDATE " . USERPREFIX . "_users SET pm_all=pm_all+1, pm_unread=pm_unread+1  WHERE user_id='{$adminid}'" );
		if($tagsconf['user'] == 1) $db->query( "UPDATE " . USERPREFIX . "_users SET pm_all=pm_all+1, pm_unread=pm_unread+1  WHERE user_id='{$userid}'" );
	}
}

if($tagsconf['onof'] != 1) $link = "/";

print "<script language='Javascript'><!--
function reload() {location = \"$link\"}; setTimeout('reload()', 0);
//--></script>";
?><commit_msg>Оптимизирован код<commit_after>﻿<?php
if (! defined ( 'DATALIFEENGINE' )) {
	die ( "Hacking attempt!" );
}
require_once (ENGINE_DIR.'/api/api.class.php');
include ENGINE_DIR . '/data/tagsadd.php';

extract($_POST);

if($tagsconf['onof'] && $tagsconf['send']) {
	$date = time();
	$tagsadd = explode( ',', $_POST['utags'] );
	$tag = array();
	foreach ($tagsadd as $key) {
		$tag[] = "<span class=\"label label-danger\">{$key}</span>";
	}
	$tags = implode(' ', $tag);
	$subject = "Пользовательские теги к {$title}";
	$subjecto = "Ваши теги к {$title}";
	$mess = "{$username} предложил к новости <a href=\"{$link}\" target=\"_blank\" >{$title}</a> новые теги: {$tags}.";
	$messo = "Вами предложенные теги к <a href=\"{$link}\" target=\"_blank\" >{$title}</a>: {$tags}.";

	if (empty($_POST['utags'])) {
		$link = "/";
	} else {
		$link = $link;
		$master = $tagsconf['master'];
		$admin = $tagsconf['admin'];
		$users = $db->super_query("SELECT * FROM " . PREFIX . "_users WHERE name='{$admin}'");
		$adminid = $users['user_id'];
		$db->super_query("INSERT INTO " . PREFIX . "_post_tags (news_id, username, tags) VALUES ('{$news}','{$username}','{$tags}')");
		$db->query( "INSERT INTO " . USERPREFIX . "_pm (subj, text, user, user_from, date, pm_read, folder, sendid) values ('{$subject}','{$mess}','{$adminid}','{$username}','{$date}','0','inbox','0')");
		if($tagsconf['user']) $db->query( "INSERT INTO " . USERPREFIX . "_pm (subj, text, user, user_from, date, pm_read, folder, sendid) values ('{$subjecto}','{$messo}','{$userid}','{$master}','{$date}','0','inbox','0')");
		$db->query( "UPDATE " . USERPREFIX . "_users SET pm_all=pm_all+1, pm_unread=pm_unread+1  WHERE user_id='{$adminid}'" );
		if($tagsconf['user']) $db->query( "UPDATE " . USERPREFIX . "_users SET pm_all=pm_all+1, pm_unread=pm_unread+1  WHERE user_id='{$userid}'" );
	}
}

print "<script type=\"text/javascript\">
    window.location.replace(\"$link\");
</script>";
?>
{'fraction_non_alphanumeric': 0.26793032786885246, 'fraction_numerical': 0.00589139344262295, 'mean_word_length': 5.278135048231511, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 34, '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': '4084724', 'n_tokens_mistral': 1539, 'n_tokens_neox': 1501, 'n_words': 307}