<?php

require_once("syncinclude.php");

$return=3;
logExtra(Dump($_POST));
if (auth())
{
	logExtra("auth ok");
	$return=0;
	/*
	$KategoriePict = new KategoriePict();
	if (intval($_POST["action"]) == 1 && $KategoriePict->setzePostDaten() && intval($_POST['KeyKategoriePict']))
	{
		$GLOBALS["DB"]->executeQuery("DELETE from tkategoriepict where kKategoriePict=".intval($_POST['KeyKategoriePict']),4);

		if ($KategoriePict->insertInDB())
			$return = 0;
		else
			$return = 1;

		//bilder skalieren
		$picbig = $picpath . $KategoriePict->cPfad;

		if (file_exists($picbig))
		{
			$picsmall = substr($picpath . $KategoriePict->cPfad, 0, -4).'-s.jpg';
			$image = imagecreatefromjpeg($picbig);
			list($width, $height) = getimagesize($picbig);
			

			//thumbnail
			$ratio = $width / $height;
			$new_width = 100;
			$new_height = round (100 / $ratio);
			
			if ($new_height>100)
			{
				$new_height=100;
				$new_width=100*$ratio;
			}

			$image_p = imagecreatetruecolor($new_width, $new_height);
			imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
			imagejpeg($image_p, $picsmall, 80);
		}
 	}
	else
		$return=5;

	*/
	if (intval($_POST["action"]) == 3 && intval($_POST['KeyKategorie'])>0)
	{
		$return = 0;
		//hol categories_id
		$categories_id = getFremdKategorie(intval($_POST['KeyKategorie']));
		eS_execute_query("update categories set categories_picture='' where categories_id=".$categories_id);
		
	}
}

echo($return);
logge($return);
?>