<commit_before>﻿<?php 	
	switch ($data['type']){
			case 'add':
				$name = check_str($data['name']);
				$query = "INSERT INTO `Departments` (`Name`)
				VALUES ('$name');";		
					if($mysql->query($query)) {
						$output = array('id' => $mysql->insert_id, 'name' => $name);
					} 
							
						else 	{
							throw403();
						};				
				break;
				
			case 'list':
				$query = "-- Получение списка аудиторий
						SELECT `ID`, `name` FROM `Departments`;";
				if ($result = $mysql->query($query)) {	
					$output = array();
					while ($row = $result->fetch_row())  {
						$output[] = array(
						'id' => $row[0],
						'name' => $row[1] 
						);						
					};		
					 /* очищаем результирующий набор */
					$result->close();
					
				} 	else {
						throw403();
					} 	



			
				break;
			case 'modify':
				$new_name=check_str($data['name']);
				$ID = checkInt($data['depID']);
				$query = "-- Изменение данных аудитории
						UPDATE `Departments` 
						SET `name` = '$new_name' , `Modified` = CURRENT_TIMESTAMP 
						WHERE `id` = $ID;";							
						if(!($mysql->query($query))) {								
							throw403();
						} 
				
							else {
								$output = array('id' => $ID, 'name' => $new_name);
						}						
				break;
				
				
			case 'delete':
				$ID = checkInt($data['depID']);
				$query = "DELETE FROM `departments` WHERE `departments`.`ID` = $ID;
				INSERT INTO `dellog` (`Text`, `ID`) VALUES ('dep', $ID);";
					runMultiQuery($query); 					
					$output = array('id' =>$ID);						
				break;
			 
	}
		?><commit_msg>Update dep_mod.php<commit_after>﻿<?php 	
	switch ($data['type']){
		case 'add':
			$name = check_str($data['name']);
			$query = "INSERT INTO `Departments` (`Name`)
			VALUES ('$name');";		
				if($mysql->query($query)) {
					$output = array('id' => $mysql->insert_id, 'name' => $name);
				} 
							
					else 	{
						throw403();
					}				
			break;
				
		case 'list':
			$query = "-- Получение списка аудиторий
					SELECT `ID`, `name` FROM `Departments`;";
			if ($result = $mysql->query($query)) {	
				$output = array();
				while ($row = $result->fetch_row())  {
					$output[] = array(
					'id' => $row[0],
					'name' => $row[1] 
					);						
				};		
					 /* очищаем результирующий набор */
				$result->close();					
			} 	else {
					throw403();
				} 	
			break;
		case 'modify':
			$new_name=check_str($data['name']);
			$ID = checkInt($data['depID']);
			$query = "-- Изменение данных аудитории
					UPDATE `Departments` 
					SET `name` = '$new_name' , `Modified` = CURRENT_TIMESTAMP 
					WHERE `id` = $ID;";							
					if(!($mysql->query($query))) {								
						throw403();
					} 
				
						else {
							$output = array('id' => $ID, 'name' => $new_name);
					}						
			break;
				
				
		case 'delete':
			$ID = checkInt($data['depID']);
			$query = "DELETE FROM `departments` WHERE `departments`.`ID` = $ID;
			INSERT INTO `dellog` (`Text`, `ID`) VALUES ('dep', $ID);";
				runMultiQuery($query); 					
				$output = array('id' =>$ID);						
			break;
			 
	}
		?>
{'fraction_non_alphanumeric': 0.2020997375328084, 'fraction_numerical': 0.007217847769028871, 'mean_word_length': 2.082912032355915, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1158504', 'n_tokens_mistral': 1614, 'n_tokens_neox': 1107, 'n_words': 215}