Location: PHPKode > projects > Kwalbum > kwalbum/pages/AdminPermissionsPage.php
<?php
/**
 * @version 2.1.2
 * @package kwalbum
 * @since 2008-09-04
 */
require_once 'include/IPage.php';

class AdminPermissionsPage implements IPage
{
	function GetHead(& $title)
	{
		if (false == USER_IS_ADMIN)
			return;
		global $DB, $P;

		if (isset($P['act']))
		{
			$view = @$P['view'];
			$add = @$P['add'];
			$admin = @$P['admin'];
			$delete = @$P['del'];
			foreach($P['id'] as $id)
			{
				$id = (int)$id;
				if (@$delete[$id])
				{
					$DB->Delete(USER_TABLE, "UserId = $id");
					$DB->Delete(FAVORITE_TABLE, "FavoriteUserIdFk = $id");
				} else
				{
					$query = "UPDATE ".USER_TABLE.
					" SET UserCanAdd='".($add[$id] ? 1 : 0).
					"', UserIsAdmin='".($admin[$id] ? 1 : 0).
					"', UserCanView='".($view[$id] ? 1 : 0)."'" .
					" WHERE UserId='$id'";
					$DB->query($query);
				}
			}
		}

		$title = 'Change User Permissions';
		return '';
	}

	function ShowBody()
	{
		if (false == USER_IS_ADMIN)
			return;
		global $URLP, $DB;
		$query = 'SELECT UserId, UserName, UserTitle, UserEmail, UserCanView, UserCanAdd, UserIsAdmin, UserVisitDt FROM '.USER_TABLE.
		" WHERE UserId!=".USER_ID." ORDER BY UserTitle ASC";
		$result = $DB->Query($query);
		if (0 < $result->num_rows)
			require 'AdminPermissionsPage.html.php';
		else
			echo '<br/><div class="error">There are no other users yet besides you!</div>';
	}
}
?>
Return current item: Kwalbum