diff options
| author | Malf Furious <m@lfurio.us> | 2018-09-21 23:24:44 -0400 | 
|---|---|---|
| committer | Malf Furious <m@lfurio.us> | 2018-09-21 23:24:44 -0400 | 
| commit | 30db08f5a270e3a6a3790eee41e1fe736b3639e9 (patch) | |
| tree | ba93ae2621d36e05d58d640ce49d03dee0fea4b8 | |
| parent | 652a62ede6849d04302153d8a3a7fad492b18c5b (diff) | |
| download | scrott-30db08f5a270e3a6a3790eee41e1fe736b3639e9.tar.gz scrott-30db08f5a270e3a6a3790eee41e1fe736b3639e9.zip | |
settings:  Add admin-only settings tab to settings modal
This is an interface to alter the settings stored in the 'settings'
database table.  Typically restricted to administrators only.
| -rw-r--r-- | app/view/settings.php | 71 | 
1 files changed, 71 insertions, 0 deletions
| diff --git a/app/view/settings.php b/app/view/settings.php index 9208f4c..21b75ba 100644 --- a/app/view/settings.php +++ b/app/view/settings.php @@ -17,6 +17,7 @@ namespace settings;  require_once "model/settings.php";  require_once "view/formctrl.php";  require_once "view/datalsts.php"; +require_once "class/settings.class.php";  require_once "class/obj.class.php";  require_once "class/user.class.php"; @@ -46,6 +47,14 @@ require_once "class/user.class.php";                                  <span class="glyphicon glyphicon-user"></span> <?=$u->getDisplayName()?>                              </a>                          </li> + +                        <?php if ($u->admin == 1) { ?> +                            <li class="<?=oneStr("active", $s)?>"> +                                <a href="#settingsAdminTab" data-toggle="tab"> +                                    <span class="glyphicon glyphicon-sunglasses"></span> Admin +                                </a> +                            </li> +                        <?php } ?>                      </ul>                      <?php $s = false; ?> @@ -54,6 +63,12 @@ require_once "class/user.class.php";                          <div class="tab-pane fade <?=oneStr("in active", $s)?>" id="settingsUserTab">                              <?=userTab($u)?>                          </div> + +                        <?php if ($u->admin == 1) { ?> +                            <div class="tab-pane fade <?=oneStr("in active", $s)?>" id="settingsAdminTab"> +                                <?=adminTab()?> +                            </div> +                        <?php } ?>                      </div>                  </div>              </div> @@ -146,3 +161,59 @@ require_once "class/user.class.php";      </form>  <?php } ?> +<?php function adminTab() : void { ?> + +    <form method="post" action="<?=ap()?>"> +        <?=\formctrl\formname( "settings-admin" )?> + +        <p> </p> + +        <div class="well well-sm"> +            See detailed statistics, manage users and other objects in the <a href="<?=ar()?>/admin">Administration Panel</a> +        </div> + +        <legend><h4>General Settings</h4></legend> +        <?=\formctrl\checkbox( "Require SSL", "sslOnly", \settings::sslOnly() )?> +        <?=\formctrl\checkbox( "Allow anyone to create an account", "allowPublicSignup", \settings::allowPublicSignup() )?> + +        <p> </p> + +        <legend><h4>SMTP Settings</h4></legend> + +        <?php $res = \settings::smtpResult(); ?> + +        <?php if ($res == "true") { ?> +            <p class="text-success pull-right">Last mail attempt was successful</p> +        <?php } else if ($res == "false") { ?> +            <p class="text-danger pull-right">Last mail attempt failed</p> +        <?php } else { ?> +            <p class="text-warning pull-right">No mail has been attempted yet</p> +        <?php } ?> + +        <?=\formctrl\text( "From Address", "smtpEmailAddress", \settings::smtpEmailAddress(), "", false )?> +        <?=\formctrl\text( "From Name", "smtpFrom", \settings::smtpFrom(), "", false )?> +        <?=\formctrl\text( "SMTP Server", "smtpServer", \settings::smtpServer(), "", false )?> +        <?=\formctrl\text( "Server Port", "smtpPort", \settings::smtpPort() )?> + +        <div class="form-group"> +            <label>SMTP Security</label> + +            <?php $sec = \settings::smtpSecurity(); ?> +            <select name="input[smtpSecurity]" class="form-control selectpicker"> +                <option value="" <?=($sec == "" ? "selected" : "")?>>None</option> +                <option value="ssl" <?=($sec == "ssl" ? "selected" : "")?>>SSL</option> +                <option value="tls" <?=($sec == "tls" ? "selected" : "")?>>TLS</option> +            </select> +        </div> + +        <?=\formctrl\text( "Username", "smtpUname", \settings::smtpUname(), "", false )?> +        <?=\formctrl\password( "Password", "smtpPasswd", false )?> + +        <button type="submit" class="btn btn-success pull-right"> +            <span class="glyphicon glyphicon-ok"></span> Save Changes +        </button> + +        <p> </p> +    </form> + +<?php } ?> | 
