Fixes for issues found testing first time setup in the different configurations. Reviewed-on: https://gitea.subcultureofone.org/greg/tkr/pulls/68 Co-authored-by: Greg Sarjeant <greg@subcultureofone.org> Co-committed-by: Greg Sarjeant <greg@subcultureofone.org>
		
			
				
	
	
		
			111 lines
		
	
	
		
			6.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			111 lines
		
	
	
		
			6.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php /** @var SettingsModel $settings */ ?>
 | |
| <?php /** @var UserModel $user */ ?>
 | |
| <?php /** @var isSetup bool */ ?>
 | |
| <?php
 | |
|     $title = $isSetup ? 'Setup' : 'Admin';
 | |
|     $urlPath = $isSetup ? 'tkr-setup' : 'admin'
 | |
| ?>
 | |
|         <h1><?php echo $title ?></h1>
 | |
|         <main>
 | |
|             <form
 | |
|                 action="<?php echo Util::buildRelativeUrl($settings->basePath, $urlPath) ?>"
 | |
|                 method="post">
 | |
|                 <input type="hidden" name="csrf_token" value="<?php echo Util::escape_html($_SESSION['csrf_token']) ?>">
 | |
|                 <fieldset>
 | |
|                     <legend>User settings</legend>
 | |
|                     <div class="fieldset-items">
 | |
|                         <label for="username">Username <span class=required>*</span></label>
 | |
|                         <input type="text"
 | |
|                             id="username"
 | |
|                             name="username"
 | |
|                             value="<?php echo Util::escape_html($user->username) ?>"
 | |
|                             required>
 | |
|                         <label for="display_name">Display name <span class=required>*</span></label>
 | |
|                         <input type="text"
 | |
|                                id="display_name"
 | |
|                                name="display_name"
 | |
|                                value="<?php echo Util::escape_html($user->displayName) ?>"
 | |
|                                required>
 | |
|                         <label for="website">Website </label>
 | |
|                         <input type="text"
 | |
|                             id="website"
 | |
|                             name="website"
 | |
|                             value="<?php echo Util::escape_html($user->website) ?>">
 | |
|                     </div>
 | |
|                 </fieldset>
 | |
|                 <fieldset>
 | |
|                     <legend>Site settings</legend>
 | |
|                     <div class="fieldset-items">
 | |
|                         <label for="site_title">Title <span class=required>*</span></label>
 | |
|                         <input type="text"
 | |
|                             id="site_title"
 | |
|                             name="site_title"
 | |
|                             value="<?php echo Util::escape_html($settings->siteTitle) ?>"
 | |
|                             required>
 | |
|                         <label for="site_description">Description <span class=required>*</span></label>
 | |
|                         <input type="text"
 | |
|                             id="site_description"
 | |
|                             name="site_description"
 | |
|                             value="<?php echo Util::escape_html($settings->siteDescription) ?>">
 | |
|                         <label for="base_url">Base URL <span class=required>*</span></label>
 | |
|                         <input type="text"
 | |
|                             id="base_url"
 | |
|                             name="base_url"
 | |
|                             value="<?php echo Util::escape_html($settings->baseUrl) ?>"
 | |
|                             required>
 | |
|                         <label for="base_path">Base path <span class=required>*</span></label>
 | |
|                         <input type="text"
 | |
|                             id="base_path"
 | |
|                             name="base_path"
 | |
|                             value="<?php echo Util::escape_html($settings->basePath) ?>"
 | |
|                             required>
 | |
|                         <label for="items_per_page">Ticks per page (max 50) <span class=required>*</span></label>
 | |
|                         <input type="number"
 | |
|                             id="items_per_page"
 | |
|                             name="items_per_page"
 | |
|                             value="<?php echo $settings->itemsPerPage ?>" min="1" max="50"
 | |
|                             required>
 | |
|                         <label for="tick_delete_hours">Tick delete window (hours)</label>
 | |
|                         <input type="number"
 | |
|                             id="tick_delete_hours"
 | |
|                             name="tick_delete_hours"
 | |
|                             value="<?php echo ($settings->tickDeleteHours ?? 1) ?>" min="1">
 | |
|                         <label for="strict_accessibility">Strict accessibility</label>
 | |
|                         <input type="checkbox"
 | |
|                                id="strict_accessibility"
 | |
|                                name="strict_accessibility"
 | |
|                                value="1"
 | |
|                                <?php if ($settings->strictAccessibility): ?> checked <?php endif; ?>>
 | |
|                         <label for="log_level">Log Level</label>
 | |
|                         <select id="log_level" name="log_level">
 | |
|                             <option value="1" <?php echo ($settings->logLevel ?? 2) == 1 ? 'selected' : '' ?>>DEBUG</option>
 | |
|                             <option value="2" <?php echo ($settings->logLevel ?? 2) == 2 ? 'selected' : '' ?>>INFO</option>
 | |
|                             <option value="3" <?php echo ($settings->logLevel ?? 2) == 3 ? 'selected' : '' ?>>WARNING</option>
 | |
|                             <option value="4" <?php echo ($settings->logLevel ?? 2) == 4 ? 'selected' : '' ?>>ERROR</option>
 | |
|                         </select>
 | |
|                     </div>
 | |
|                 </fieldset>
 | |
|                 <fieldset>
 | |
|                     <legend>Change password</legend>
 | |
|                     <div class="fieldset-items">
 | |
|                         <label for="password">New password
 | |
|                             <?php if($isSetup): ?><span class=required>*</span><?php endif; ?>
 | |
|                         </label>
 | |
|                         <input type="password"
 | |
|                                id="password"
 | |
|                                name="password"
 | |
|                                <?php if($isSetup): ?>required <?php endif; ?>
 | |
|                         >
 | |
|                         <label for="confirm_password">Confirm new password
 | |
|                             <?php if($isSetup): ?><span class=required>*</span><?php endif; ?>
 | |
|                         </label>
 | |
|                         <input type="password"
 | |
|                                id="confirm_password"
 | |
|                                name="confirm_password"
 | |
|                                <?php if($isSetup): ?>required <?php endif; ?>
 | |
|                         >
 | |
|                     </div>
 | |
|                 </fieldset>
 | |
|                 <button type="submit" class="submit-btn">Save Settings</button>
 | |
|             </form>
 | |
|         </main>
 |