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


include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");

getSecHttpVars("1",array("cscIdRoot", "customerId", "cscIdActual", "f_fileName", "f_path", "f_width", "f_height"));

// Select user-type for mode of security check 
$userType = getFieldValueFromId("user","usr_id",$usr_id,"usr_type");
$userTypeName = getUserTypeName($userType);

// Check authentication verifying emmployee an his/her costcenter- and customer-association
if ( !( authCheckHQ($hq_id,$usr_id,$emp_id) || authCheck($hq_id,$usr_id,$emp_id,$cscIdRoot,$customerId,$cscIdActual) ) || $userTypeName == "" ) :
   die ("$PHP_SELF: Access denied!");
endif;      

if ($f_path == "") : $f_path = "../documents/photos/"; endif;
if ($f_width == "") : $f_width = "800"; endif;
// if ($f_height == "") : $f_height = "600"; endif;

$outputPhoto = "";
if ($f_fileName != "") :
   if (substr($f_path, 0, 4) == "EMC2") : $f_path = ".." . substr($f_path, 4); endif;
   // $outputPhoto .= "<img src=\"" . $f_path . $f_fileName . "\" border=\"" . "0" . "\" height=\"" . $f_height . "\" width=\"" . $f_width . "\">";
   $outputPhoto .= "<img src=\"" . $f_path . $f_fileName . "\" border=\"" . "0" . "\" width=\"" . $f_width . "\">";
endif;

echo $outputPhoto;
?>
