2021-03-18 18:26:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								<?php
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								if (isset($_GET['new'])) {
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									User::add();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-19 19:38:54 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Template::render_header(_("New user"), "newuser", true); ?>
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<div class="text-center">
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-18 18:26:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									<h2>Add new user</h2>
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								</div>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-18 18:26:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								<form action="<?php echo WEB_URL; ?>/admin/?do=new-user&new=user" method="POST" class="form-horizontal">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									<?php if (isset($message)) { ?>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										<p class="alert alert-danger"><?php echo $message ?></p>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									<?php
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									} ?>
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									<div class="form-group">
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-18 18:26:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										<div class="col-sm-6"><label for="name"><?php echo _("Name"); ?>: </label><input type="text" maxlength="50" name="name" value="<?php echo ((isset($_POST['name'])) ? htmlspecialchars($_POST['name'], ENT_QUOTES) : ''); ?>" id="name" placeholder="<?php echo _("Name"); ?>" class="form-control" required></div>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										<div class="col-sm-6"><label for="surname"><?php echo _("Surname"); ?>: </label><input type="text" maxlength="50" name="surname" value="<?php echo ((isset($_POST['surname'])) ? htmlspecialchars($_POST['surname'], ENT_QUOTES) : ''); ?>" id="surname" placeholder="<?php echo _("Surname"); ?>" class="form-control" required></div>
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									</div>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									<div class="form-group">
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-18 18:26:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										<div class="col-sm-6"><label for="username"><?php echo _("Username"); ?>:</label><input type="text" maxlength="50" name="username" value="<?php echo ((isset($_POST['username'])) ? htmlspecialchars($_POST['username'], ENT_QUOTES) : ''); ?>" id="username" placeholder="<?php echo _("Username"); ?>" class="form-control" required></div>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										<div class="col-sm-6"><label for="email"><?php echo _("Email"); ?>:</label><input type="email" maxlength="60" name="email" value="<?php echo ((isset($_POST['email'])) ? htmlspecialchars($_POST['email'], ENT_QUOTES) : ''); ?>" id="email" placeholder="<?php echo _("Email"); ?>" class="form-control" required></div>
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									</div>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									<div class="form-group">
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-18 18:26:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										<div class="col-sm-6"><label for="password"><?php echo _("Password"); ?>:</label><input type="password" name="password" value="<?php echo ((isset($_POST['password'])) ? htmlspecialchars($_POST['password'], ENT_QUOTES) : ''); ?>" id="password" placeholder="<?php echo _("Password"); ?>" class="form-control" required></div>
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										<div class="col-sm-6">
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-18 18:26:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											<label for="permission"><?php echo _("Permission"); ?>: </label>
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											<select name="permission" id="permission" class="form-control">
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-18 18:26:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												<?php
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												if (!empty($_POST['permission'])) {
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													$permission = $_POST['permission'];
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-18 18:26:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												} else {
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													$permission = 2;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												foreach ($permissions as $key => $value) {
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-18 18:26:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
													if ($permission == $key) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
														echo '<option value="' . $key . '" selected>' . $value . '</option>';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													} else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
														echo '<option value="' . $key . '">' . $value . '</option>';
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												?>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											</select>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										</div>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									</div>
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-18 23:20:41 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									<button type="submit" class="btn btn-primary float-end"><?php echo _("Submit"); ?></button>
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-18 18:26:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								</form>
							 |