<?php

/**
 * Uninstall file for staffman
 *
 * @version $Id: uninstall.php,v 1.6 2004/06/01 19:21:57 gbrackett Exp $
 * @author  George Brackett <gbrackett@NOSPAM.luceatlux.com>
 */

/* Make change required for 0.9.3-2 and above */
if ($GLOBALS["core"]->version > "0.9.3-1") {
	require_once(PHPWS_SOURCE_DIR . "core/File.php");
}

/* return to home page if the user is not a Deity */
if (!$_SESSION["OBJ_user"]->isDeity()) {
	header("location:index.php");
	exit();
}

/* read sql install script, execute it, suppress errors */
if ($GLOBALS['core']->sqlImport(PHPWS_SOURCE_DIR . "mod/staffman/boost/uninstall.sql", TRUE, TRUE)) {

	/* report success */
	$content = "All Staff Listing tables successfully removed.<br />";
	$status = 1;
	
	/* uninstall menu item, if any */
	if (isset($_SESSION["OBJ_menuman"])) {
		if($GLOBALS["core"]->sqlDelete("mod_menuman_items", "menu_item_url", "%module=staffman%", "LIKE"))
			$content .= "Removed link to Staffmember Listing from menu.<br />";
	}
	
	$ok = PHPWS_File::rmdir(PHPWS_SOURCE_DIR . "images/staffman/");
	if ($ok) {
		$content .= "The staffmember images directory was successfully removed.<br />";
	} else {
		$content .= "The staffmember images directory could not be removed.<br />";
	}

} else
	$content .= "Unable to access the database.<br />";

?>
