<?php
//@2013-06-24 funkcja do sprawdzania czy ktos ma perma do edycji danego ID - jezeli nie ma classify to nie moze nawet zobaczyc rekordu do read
function A_CLASSIFIED_CHECK($TEST_ID) {
global $thiss,$result,$db;

//if(empty($TEST_TABLE)) $TEST_TABLE=$thiss->DETECT_TABLE_NAME;
if(!isset($_SESSION[$thiss->DETECT_TABLE_COLUMN]['DESC_TO_KEY']['A_CLASSIFIED'])) {
	return(false);

}
		if(empty($TEST_ID)) DEBUG_S(-3,'ERROR: function didnt get 1 argument TEST_ID',$TEST_ID,__FILE__,__FUNCTION__,__LINE__);
		
		$exit=false;
		$sql="select A_CLASSIFIED from `".$thiss->DETECT_TABLE_NAME."` where ID='".$TEST_ID."'";
		$res=DB::query($sql);
		while ($h=DB::fetch_array($res)) {
			if(isset($_SESSION['AUTH_LDAP_CLIENT__LDAP_USERS'])) {
			if(in_array($h['A_CLASSIFIED'],$_SESSION['AUTH_LDAP_CLIENT__LDAP_USERS'][$_SESSION['ADM_ACCOUNT']]) ||(empty($h['A_CLASSIFIED']) ))  {
				return(true);
		    } else { 
				return(false);
			} 
			
			} else if(strstr($h['A_CLASSIFIED'], $_SESSION['ADM_ACCOUNT'])||(empty($h['A_CLASSIFIED']))) {
			   return(true);
			} else {
			    return(false);
			}
		}
	
	return(false);



}
