Преглед на файлове

Contacts: Private or Shared. User can create a private contact only visible to them, or can choose to share a contact with others by assigning it to group(s). Users can view only contacts assigned to their group(s) and contacts NOT assigned to any group.

Nate Jones преди 11 години
родител
ревизия
59066deb23
променени са 3 файла, в които са добавени 22 реда и са изтрити 9 реда
  1. 13 7
      core/users/signup.php
  2. 8 1
      core/users/userdelete.php
  3. 1 1
      core/users/users.php

+ 13 - 7
core/users/signup.php

@@ -44,12 +44,17 @@ else {
 $username = check_str($_POST["username"]);
 $username = check_str($_POST["username"]);
 $password = check_str($_POST["password"]);
 $password = check_str($_POST["password"]);
 $confirmpassword = check_str($_POST["confirmpassword"]);
 $confirmpassword = check_str($_POST["confirmpassword"]);
-$group_name = check_str($_POST["group_name"]);
+$group_uuid_name = check_str($_POST["group_uuid_name"]);
 $user_email = check_str($_POST["user_email"]);
 $user_email = check_str($_POST["user_email"]);
 $contact_organization = check_str($_POST["contact_organization"]);
 $contact_organization = check_str($_POST["contact_organization"]);
 $contact_name_given = check_str($_POST["contact_name_given"]);
 $contact_name_given = check_str($_POST["contact_name_given"]);
 $contact_name_family = check_str($_POST["contact_name_family"]);
 $contact_name_family = check_str($_POST["contact_name_family"]);
 
 
+if ($group_uuid_name != '') {
+	$group_data = explode('|', $group_uuid_name);
+	$group_uuid = $group_data[0];
+	$group_name = $group_data[1];
+}
 
 
 if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") {
 if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") {
 
 
@@ -140,13 +145,14 @@ if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") {
 	unset($sql);
 	unset($sql);
 
 
 	//add the user to the group
 	//add the user to the group
-	if (strlen($group_name) > 0) {
+	if (strlen($group_uuid) > 0) {
 		if ( ($group_name == "superadmin" && if_group("superadmin")) || $group_name != "superadmin") {
 		if ( ($group_name == "superadmin" && if_group("superadmin")) || $group_name != "superadmin") {
 			$sql = "insert into v_group_users ";
 			$sql = "insert into v_group_users ";
 			$sql .= "( ";
 			$sql .= "( ";
 			$sql .= "group_user_uuid, ";
 			$sql .= "group_user_uuid, ";
 			$sql .= "domain_uuid, ";
 			$sql .= "domain_uuid, ";
 			$sql .= "group_name, ";
 			$sql .= "group_name, ";
+			$sql .= "group_uuid, ";
 			$sql .= "user_uuid ";
 			$sql .= "user_uuid ";
 			$sql .= ") ";
 			$sql .= ") ";
 			$sql .= "values ";
 			$sql .= "values ";
@@ -154,6 +160,7 @@ if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") {
 			$sql .= "'".$group_user_uuid."', ";
 			$sql .= "'".$group_user_uuid."', ";
 			$sql .= "'".$domain_uuid."', ";
 			$sql .= "'".$domain_uuid."', ";
 			$sql .= "'".$group_name."', ";
 			$sql .= "'".$group_name."', ";
+			$sql .= "'".$group_uuid."', ";
 			$sql .= "'".$user_uuid."' ";
 			$sql .= "'".$user_uuid."' ";
 			$sql .= ")";
 			$sql .= ")";
 			$db->exec(check_sql($sql));
 			$db->exec(check_sql($sql));
@@ -275,14 +282,13 @@ if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") {
 	$sql .= "order by group_name asc ";
 	$sql .= "order by group_name asc ";
 	$prep_statement = $db->prepare(check_sql($sql));
 	$prep_statement = $db->prepare(check_sql($sql));
 	$prep_statement->execute();
 	$prep_statement->execute();
-	echo "			<select name=\"group_name\" class='formfld' style='width: auto; margin-right: 3px;'>\n";
+	echo "			<select name=\"group_uuid_name\" class='formfld' style='width: auto; margin-right: 3px;'>\n";
 	echo "				<option value=\"\"></option>\n";
 	echo "				<option value=\"\"></option>\n";
 	$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
 	$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
 	foreach($result as $field) {
 	foreach($result as $field) {
-		if ($field['group_name'] == "superadmin" && !if_group("superadmin")) { continue; }	//only show the superadmin group to other users in the superadmin group
-		if (!in_array($field["group_name"], $assigned_groups)) {
-			echo "		<option value='".$field['group_name']."'>".$field['group_name']."</option>\n";
-		}
+		if ($field['group_name'] == "superadmin" && !if_group("superadmin")) { continue; } //only show the superadmin group to other superadmins
+		if ($field['group_name'] == "admin" && (!if_group("superadmin") && !if_group("admin") )) { continue; }	//only show the admin group to other admins
+		echo "			<option value='".$field['group_uuid']."|".$field['group_name']."'>".$field['group_name']."</option>\n";
 	}
 	}
 	echo "			</select>";
 	echo "			</select>";
 	unset($sql, $result);
 	unset($sql, $result);

+ 8 - 1
core/users/userdelete.php

@@ -34,6 +34,12 @@ else {
 	return;
 	return;
 }
 }
 
 
+//add multi-lingual support
+	require_once "app_languages.php";
+	foreach($text as $key => $value) {
+		$text[$key] = $value[$_SESSION['domain']['language']['code']];
+	}
+
 //get the id
 //get the id
 	$user_uuid = check_str($_GET["id"]);
 	$user_uuid = check_str($_GET["id"]);
 
 
@@ -54,7 +60,7 @@ else {
 //required to be a superadmin to delete a member of the superadmin group
 //required to be a superadmin to delete a member of the superadmin group
 	$superadmin_list = superadmin_list($db);
 	$superadmin_list = superadmin_list($db);
 	if (if_superadmin($superadmin_list, $user_uuid)) {
 	if (if_superadmin($superadmin_list, $user_uuid)) {
-		if (!if_group("superadmin")) { 
+		if (!if_group("superadmin")) {
 			//access denied - do not delete the user
 			//access denied - do not delete the user
 			header("Location: index.php");
 			header("Location: index.php");
 			return;
 			return;
@@ -84,6 +90,7 @@ else {
 	}
 	}
 
 
 //redirect the user
 //redirect the user
+	$_SESSION["message"] = $text['message-delete'];
 	header("Location: index.php");
 	header("Location: index.php");
 
 
 ?>
 ?>

+ 1 - 1
core/users/users.php

@@ -187,7 +187,7 @@ echo "	<td align=\"center\">\n";
 					echo $text['option-false'];
 					echo $text['option-false'];
 				}
 				}
 				echo "&nbsp;</td>\n";
 				echo "&nbsp;</td>\n";
-				echo "	<td valign='top' align='right'>";
+				echo "	<td valign='top' align='right' class='tr_link_void'>";
 				if (permission_exists('user_edit')) {
 				if (permission_exists('user_edit')) {
 					echo "<a href='usersupdate.php?id=".$row['user_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
 					echo "<a href='usersupdate.php?id=".$row['user_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
 				}
 				}