<?php
/*=======================================================================
 *
 * jb_detail_sign.php
 *
 * Autor: Marc Vollmann
 *
 =======================================================================*/

include_once ("../include/global.inc.php");
include_once ("../include/auth.inc.php");
include_once ("../include/image.inc.php");

ob_start();
include_once ("../include/inc_phpSniff.inc.php");


getSecHttpVars("1",array("jb_id", "tr_sort", "dbhistory"));

getLanguage(__FILE__);

// Decision to use the job archive or normal tables
getDBNames($dbhistory);

$trSign = "";

if ($jb_id != "" && $tr_sort != "") :

      // Check current browser and version of the client
      $phpSniff = new phpSniff();
      $browser = $phpSniff->get_property("browser");
      $browser_majver = $phpSniff->get_property("maj_ver");
      ob_end_clean();

      $sqlquery = "SELECT tr_sign FROM " . $dbh_tr . " WHERE jb_id = $jb_id AND tr_sort = $tr_sort";
      
      $result = $db->query($sqlquery);
      if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
   
      while ($row = $result->fetch_assoc()):
            $trSign = trim($row["tr_sign"]);
      endwhile;
      $result->free();
      
      // Output of the image
      if ($trSign != "") :
         if ($browser == "ie" && $browser_majver <= "5") :
            header ("Content-type: image/jpeg");
            $im = createSignImage(splitRawCoordinates ($trSign));
            imagejpeg ($im);
         else :
            header ("Content-type: image/png");
            $im = createSignImage(splitRawCoordinates ($trSign));
            imagepng ($im);
         endif;
      else :
         echo getLngt("Keine Unterschrift vorhanden!") . "<br>";
      endif;
endif;


// $trSign = "A10,15;30,40;10,5;40,70A0,0;0,90;90,90;90,0;0,0";
?>
   
