Location: PHPKode > projects > LDAP Navigator > ldapnavigator-0.9.6/modules/schema/loader.php
<?php

	include_once( "./lib/Net/LDAP/Schema.php" );

	$cacheFileName = $config->tmpdir . "/ldapnav_schema.cache";
	$statusMsg = "";
	
	$URL_REFRESH = "<a class=menu href=\"$PHP_SELF?A=$A&refresh=1\">";
	
	if( @$refresh || ! file_exists( $cacheFileName) ) 
	{	
		$statusMsg = "LDAP Schema reloaded from the server $ldapmanager[host]";
		$s = new Net_LDAP_schema( $ds );

		if( ! $s->Read() ) {
			ErrorPage( "Schema Error",
				"Could not read the schema from the server.\nPossibly LDAP Navigator is not compatible with your server\nLDAP Error message: $s->errmsg" 
			);
		}
		// cache the schema 
		$data = serialize( $s );
		$fo = fopen( $cacheFileName , "w" );
		fwrite( $fo, $data, strlen($data));
		fclose( $fo );	
		
	} else {
	
		$fo = @fopen( $cacheFileName, "r" );
		if( ! $fo )
			ErrorPage( "Schema Error",
				"I/O error. You may try to $URL_REFRESH refresh the schema cache here</a>" 
			);
		$data = fread( $fo, filesize($cacheFileName) );
		fclose( $fo );	
		$s = unserialize( $data );
		if( ! $s || ! is_object($s) )
			ErrorPage( "Schema Error" ,
				"Invalid cache.\nPlease try to $URL_REFRESH refresh the schema cache</a>" 
			);
	}
	
?>
Return current item: LDAP Navigator