Location: PHPKode > projects > Content*Builder > contentbuilder/plugins/col_man/colRightAdmin.inc.php
<?php

if((ADMIN & $cbPerms) || (COL_MNG & $cbPerms)) {
	if($editColRightSet == "general") {
		$_specific = 0;
	} else {
		$_specific = 1;
	}
	
	/*
	* Löschen von Rechte Paletten
	*/
	if($updateRightOverview != "") {
		if(is_array($colRightPatternDelete)) {
			foreach($colRightPatternDelete as $k => $v) {
				if($v == 1) {
					mysql_query("DELETE FROM ".TABLE."_permission WHERE permissionID = '$k'");
				}
			}
		}
	}
 	
	if($action == "editRightSet") {
		if(!$updateRightPattern) {
			$unassignedGroupData = array();
			
			$editPattern = 0;
			if($colRightPatternID) {
				$patternData = mysql_fetch_assoc(mysql_query("SELECT usergroup.*, perm.value AS permValue, perm.permissionID AS permissionID, perm.parameter AS parameter FROM ".TABLE."_permission AS perm, ".TABLE."_usergroups AS usergroup WHERE perm.parameter LIKE usergroup.groupID AND perm.permissionID = '$colRightPatternID'"));
				
				/*
				* alle Einträge um escapende Slashes bereinigen
				*/
				foreach($patternData as $k => $v) {
					$patternData[$k] = stripslashes($v);
				}
				
				$rights = $patternData[permValue];
				$patternData['editColumn']      = (COLUMN_PERM_EDIT_COLUMN       & $rights)?'1':'0';
				$patternData['editOwnArticles'] = (COLUMN_PERM_EDIT_OWN_ARTICLES & $rights)?'1':'0';
				$patternData['editAllArticles'] = (COLUMN_PERM_EDIT_ALL_ARTICLES & $rights)?'1':'0';
				$patternData['publishArticles'] = (COLUMN_PERM_PUBLISH_ARTICLES  & $rights)?'1':'0';
				$patternData['uploadMedia']     = (COLUMN_PERM_MEDIA_UPLOAD      & $rights)?'1':'0';
				
				$tpl->assign("patternData", $patternData);
				$editPattern = 1;
			} else {
				$groupQuery = mysql_query("SELECT usergroup.name, usergroup.groupID, perm.parameter FROM ".TABLE."_usergroups AS usergroup LEFT JOIN ".TABLE."_permission AS perm ON usergroup.groupID LIKE perm.parameter WHERE ISNULL(perm.parameter) OR (perm.type != 'columnPerm' AND perm.parameter != '$editColRightSet') GROUP BY usergroup.groupID");
				
				$_allGroupsAssigned = 0;
				if(mysql_num_rows($groupQuery) == 0) {
					$_allGroupsAssigned = 1;
				}
				$tpl->assign("allGroupsAssigned", $_allGroupsAssigned);
				
				$counter = 0;
				$_allGroupsAssigned = 1;
				while($groupRow = mysql_fetch_assoc($groupQuery)) {
					foreach($groupRow as $k => $v) {
						$groupRow[$k] = stripslashes($v);
					}
						
					$unassignedGroupData[$counter] = $groupRow;
					++$counter;
				}
				
				$tpl->assign("unassignedGroupData", $unassignedGroupData);
			}
			
			$tpl->assign("columnEditStatus", $editPattern);
			$tpl->assign("columnGroupRightModify_set", "1");
		} else {
			$right = 0;
			if($colRightEditColumn == 1) {
				$right |= COLUMN_PERM_EDIT_COLUMN;
			}
			if($colRightEditOwnArticles == 1) {
				$right |= COLUMN_PERM_EDIT_OWN_ARTICLES;
			}
			if($colRightEditAllArticles == 1) {
				$right |= COLUMN_PERM_EDIT_ALL_ARTICLES;
			}
			if($colRightPublishArticles == 1) {
				$right |= COLUMN_PERM_PUBLISH_ARTICLES;
			}
			if($colRightUploadMedia == 1) {
				$right |= COLUMN_PERM_MEDIA_UPLOAD;
			}
			
			if(is_array($colRightGroupList)) {
				foreach($colRightGroupList as $v) {
					$columnPerms->updatePermission($editColRightSet, $right, $v);
				}
			} elseif($colRightGroupID) {
				$columnPerms->updatePermission($editColRightSet, $right, $colRightGroupID);
			}
			unset($action);
		}
	}
	
	if(!$action) {
		/*
		* Abrufen aller allgemeinen Rechte Paletten und den dazugehörigen Gruppen
		*/
		$groupGeneralRightQuery = mysql_query("SELECT usergroup.*, perm.value AS permValue, perm.permissionID AS permissionID, perm.parameter AS parameter FROM ".TABLE."_permission AS perm, ".TABLE."_usergroups AS usergroup WHERE perm.parameter = usergroup.groupID AND perm.type = 'columnPerms' AND perm.name = '$editColRightSet' ORDER BY usergroup.name");
		
		/*
		* Wenn Gruppen gefunden wurden, setzen des Flags und senden der Info ans Template
		*/
		$_set = 0;
		if(mysql_num_rows($groupGeneralRightQuery) > 0) {
			$_set = 1;
		}
		$tpl->assign("columnGroupRight_set", $_set);
		
		/*
		* Abrufen aller Gruppen und speichern der Daten im Array $patternData
		*/
		$patternData = array();
		$counter = 0;
		while($groupGeneralRightRow = mysql_fetch_assoc($groupGeneralRightQuery)) {
			/*
			* alle Einträge um escapende Slashes bereinigen
			*/
			foreach($groupGeneralRightRow as $k => $v) {
				$groupGeneralRightRow[$k] = stripslashes($v);
			}
			
			$patternData[$counter] = $groupGeneralRightRow;
			
			/*
			* Rechte abfragen
			*/
			$rights = $groupGeneralRightRow[permValue];
			$patternData[$counter]['editColumn']      = (COLUMN_PERM_EDIT_COLUMN       & $rights)?'1':'0';
			$patternData[$counter]['editOwnArticles'] = (COLUMN_PERM_EDIT_OWN_ARTICLES & $rights)?'1':'0';
			$patternData[$counter]['editAllArticles'] = (COLUMN_PERM_EDIT_ALL_ARTICLES & $rights)?'1':'0';
			$patternData[$counter]['publishArticles'] = (COLUMN_PERM_PUBLISH_ARTICLES  & $rights)?'1':'0';
			$patternData[$counter]['uploadMedia']     = (COLUMN_PERM_MEDIA_UPLOAD      & $rights)?'1':'0';
			++$counter;
		}
		
		$tpl->assign("colPatternData", $patternData);
		$tpl->assign("columnGroupRightOverview_set", "1");
	}
	
	/* 
	* Ausgabe des Templates
	*/
	$tpl->assign("colPatternSpecific", $_specific);
	$tpl->assign("colPatternSetName",  $editColRightSet);
	$rightAdminTPLOutput = $tpl->fetch($config['templates']."colRightAdmin.template", null, "pluginColumn".$cbUserID);
}

?>
Return current item: Content*Builder