session_start();
include_once dirname(__FILE__) . "/ressources/class.templates.inc";
include_once dirname(__FILE__) . "/ressources/class.ldap.inc";
include_once dirname(__FILE__) . "/ressources/class.user.inc";
//permissions
if (!CheckRights()) {
    $tpl = new templates();
    echo "alert('" . $tpl->javascript_parse_text("{ERROR_NO_PRIVS}") . '");';
}
if (isset($_GET["popup"])) {
    USER_JUNK_LEARNING_POPUP();
    exit;
}
if (isset($_GET["EnableUserSpamLearning"])) {
    USER_JUNK_LEARNING_SAVE();
    exit;
}
js();
function js()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $uid = $_GET["uid"];
    $title = $tpl->_ENGINE_parse_body("{$uid}::{EnableUserSpamLearning}");
    $html = "\n\t\n\tfunction USER_JUNK_LEARNING_JS(){\n\t\tYahooWin2(650,'{$page}?popup=yes&uid={$uid}','{$title}');\n\t\n\t}\n\t\nvar x_USER_JUNK_LEARNING_SAVE=function (obj) {\n\ttempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);}\n\tUSER_JUNK_LEARNING_JS();\n    }\t \t\n\t\n\tfunction USER_JUNK_LEARNING_SAVE(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('uid','{$uid}');\n\t\tXHR.appendData('EnableUserSpamLearning',document.getElementById('EnableUserSpamLearning').value);\n\t\tdocument.getElementById('EnableUserSpamLearning_div').innerHTML='<center style=\"width:100%\"><img src=img/wait_verybig.gif></center>';\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_USER_JUNK_LEARNING_SAVE);\n\t}\n\t\n\tUSER_JUNK_LEARNING_JS();\n\t\n\t";
    echo $html;
}
function USER_JUNK_LEARNING_POPUP()
{
    $page = CurrentPageName();
<?php
session_start();
include_once(dirname(__FILE__)."/ressources/class.templates.inc");
include_once(dirname(__FILE__)."/ressources/class.ldap.inc");
include_once(dirname(__FILE__)."/ressources/class.user.inc");

//permissions	
	if(!CheckRights()){
		$tpl=new templates();
		echo "alert('".$tpl->javascript_parse_text("{ERROR_NO_PRIVS}").'");';
	}

	if(isset($_GET["popup"])){USER_JUNK_LEARNING_POPUP();exit;}
	if(isset($_GET["EnableUserSpamLearning"])){USER_JUNK_LEARNING_SAVE();exit;}

js();
	
function js(){
	$page=CurrentPageName();
	$tpl=new templates();
	$title=$tpl->_ENGINE_parse_body("{EnableUserSpamLearning}");
	$uid=$_GET["uid"];
	$html="
	
	function USER_JUNK_LEARNING_JS(){
		YahooWin2(650,'$page?popup=yes&uid=$uid','$title');
	
	}
	
var x_USER_JUNK_LEARNING_SAVE= function (obj) {
	USER_JUNK_LEARNING_JS();