Browse Source

Groups: Token integration.

Nate 6 years ago
parent
commit
61c02bd9e4
2 changed files with 14 additions and 3 deletions
  1. 13 0
      core/groups/groupadd.php
  2. 1 3
      core/groups/groupedit.php

+ 13 - 0
core/groups/groupadd.php

@@ -54,6 +54,14 @@
 			}
 			}
 			$group_description = $_POST["group_description"];
 			$group_description = $_POST["group_description"];
 
 
+		//validate the token
+			$token = new token;
+			if (!$token->validate($_SERVER['PHP_SELF'])) {
+				message::add($text['message-invalid_token'],'negative');
+				header('Location: groups.php');
+				exit;
+			}
+
 		//check for global/domain duplicates
 		//check for global/domain duplicates
 			$sql = "select count(*) from v_groups where ";
 			$sql = "select count(*) from v_groups where ";
 			$sql .= "group_name = :group_name ";
 			$sql .= "group_name = :group_name ";
@@ -94,6 +102,10 @@
 			return;
 			return;
 	}
 	}
 
 
+//create token
+	$object = new token;
+	$token = $object->create($_SERVER['PHP_SELF']);
+
 //include the header
 //include the header
 	include "resources/header.php";
 	include "resources/header.php";
 	$document['title'] = $text['title-group_add'];
 	$document['title'] = $text['title-group_add'];
@@ -155,6 +167,7 @@
 
 
 	echo "<tr>\n";
 	echo "<tr>\n";
 	echo "<td colspan='2' align='right'>\n";
 	echo "<td colspan='2' align='right'>\n";
+	echo "	<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
 	echo "	<br />";
 	echo "	<br />";
 	echo "	<input type='submit' class='btn' value=\"".$text['button-save']."\">\n";
 	echo "	<input type='submit' class='btn' value=\"".$text['button-save']."\">\n";
 	echo "</td>\n";
 	echo "</td>\n";

+ 1 - 3
core/groups/groupedit.php

@@ -400,9 +400,7 @@
 
 
 	echo "<tr>\n";
 	echo "<tr>\n";
 	echo "<td colspan='2' align='right'>\n";
 	echo "<td colspan='2' align='right'>\n";
-	if (is_uuid($group_uuid)) {
-		echo "	<input type='hidden' name='group_uuid' value='".escape($group_uuid)."'>\n";
-	}
+	echo "	<input type='hidden' name='group_uuid' value='".escape($group_uuid)."'>\n";
 	echo "	<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
 	echo "	<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
 	echo "	<br />";
 	echo "	<br />";
 	echo "	<input type='submit' class='btn' value=\"".$text['button-save']."\">\n";
 	echo "	<input type='submit' class='btn' value=\"".$text['button-save']."\">\n";