Location: PHPKode > projects > Content*Builder > contentbuilder/plugins/user_managment/usrManagment.inc.php
<?php
	$hasEditPerms = 0;
	if((USR_MNG & $cbPerms) || (ADMIN & $cbPerms)) {
		$hasEditPerms = 1;
	}
	
	if($hasEditPerms) {
		if(isset($delbox)) {
			reset($delbox);
			while(list($k, $v) = each($delbox)) {
				if($mode["admin-protect"] == "on") {
					$select = mysql_fetch_array(mysql_query("SELECT system FROM ".TABLE."_perms WHERE permID='$v'"));
					if((ADMIN & $select["system"])) { $deleteprotect = true; }
				}
				if(empty($deleteprotect) AND $result2[userid] != $v) {
					$dquery = mysql_query("DELETE FROM ".TABLE."_user WHERE userid = '$v'");
					$pquery = mysql_query("DELETE FROM ".TABLE."_profile WHERE userid = '$v'");
					$fquery = mysql_query("DELETE FROM ".TABLE."_perms WHERE permID = '$v'");
				}
			}
		}
	
		// RE-Aktivierung von Usern
		if(isset($reactivateBox)) {
			foreach($reactivateBox as $k => $v) {
				$dquery = mysql_query("INSERT INTO ".TABLE."_perms (permID) VALUES ('$v')");
				$dquery = mysql_query("UPDATE ".TABLE."_user SET del = '0' WHERE userid = '$v'");
			}
		}
		// Deaktivierung von Usern
		if(isset($deactivateBox)) {
			foreach($deactivateBox as $k => $v) {
				if($mode["admin-protect"] == "on") {
					$select = mysql_fetch_array(mysql_query("SELECT system FROM ".TABLE."_perms WHERE permID='$v'"));
					if((ADMIN & $select["system"])) { $deactivateprotect = true; }
				}
				if(empty($deactivateprotect) AND $result2[userid] != $v) {
					$dquery = mysql_query("UPDATE ".TABLE."_user SET del = '1', ugroup = '0' WHERE userid = '$v'");
					$fquery = mysql_query("DELETE FROM ".TABLE."_perms WHERE permID = '$v'");
				}
			}
		}
	}
	
	// Darf der User alle Benutzer berbeiten, oder nicht?
	if($hasEditPerms) {
		if($showDeactivatedUsers == 1) {
			$query_where = "WHERE del = '1'";
		} else {
			$query_where = "WHERE del != '1' OR del IS NULL";
		}
		$queryt = mysql_query("SELECT * FROM ".TABLE."_user $query_where ORDER BY name");
	} else {
		$query_where = "WHERE userid = '$cbUserID'";
		$queryt = mysql_query("SELECT * FROM ".TABLE."_user $query_where ORDER BY name");
	}

	if(!$queryt) {
		$errorList[] = $usr_msg["no_users"];
	} else {
		$result=mysql_query("SELECT * FROM ".TABLE."_user $query_where");
		while($getquery = mysql_fetch_array($queryt)) {
			$usernm = substr($getquery["name"],0,30);
			if(strlen($getquery["name"]) > 30) {
				$usernm .= "...";
			}

			$firstsub = substr($getquery["dateadd"],0,10);
			$dt = explode("-",$firstsub);
			$dat1 = $dt[2].".".$dt[1].".".$dt[0];
			$secondsub = substr($getquery["dateadd"],-8,5);
			$getquery["dateadd"] = $dat1."&nbsp;".$secondsub." Uhr";
			
			if($getquery['del'] == 1) {
				$usrDeactiveSel[] = "checked"; 
			} else {
				$usrDeactiveSel[] = ""; 
			}
			
			$usrID[]	= $getquery["userid"];
			$usrName[]	= $usernm;
			$usrAddDate[] = $getquery["dateadd"];
		}
		$tpl->assign("userOverview",
			array ( "USERID"	=> $usrID,
					"USERNAME"	=> $usrName,
					"USERADDDATE" => $usrAddDate,
					"DEACTIVESELECT" => $usrDeactiveSel
			)
		);
		
		$tpl->assign( "usrOverviewSet", "1");
	}
	
	if(!(USR_MNG & $cbPerms)) {
		$errorList[] = $usr_msg["cannot_modify"];
	}
	
	if(count($errorList) > 0) {
		$tpl->assign("errorSet", "1");
		$tpl->assign("errorList", $errorList);
	}

	$mainPluginContent[]  = $tpl->fetch($config['templates']."usrManagement.template", null, "pluginUsr".$cbUserID);
	$mainMessageContent[] = $tpl->fetch($config['templates']."messages.template", null, "pluginUsr".$cbUserID);
?>
Return current item: Content*Builder