From 3effb5a700b36f218f3d68e441294c026bc1b120 Mon Sep 17 00:00:00 2001 From: phpipam <miha.petkovsek@telemach.si> Date: Mon, 29 Jan 2024 08:47:19 +0100 Subject: [PATCH] UI updates --- app/admin/api/edit-result.php | 4 +- app/admin/api/index.php | 44 +++++++++++----------- app/admin/authentication-methods/index.php | 16 +++++--- app/admin/groups/index.php | 20 +++++----- app/admin/mail/index.php | 7 +++- app/admin/password-policy/index.php | 17 ++++++--- css/bootstrap/bootstrap-custom-dark.css | 3 ++ css/bootstrap/bootstrap-custom-dark.scss | 3 ++ functions/classes/class.Addresses.php | 32 ++++++++++------ functions/version.php | 2 +- 10 files changed, 90 insertions(+), 58 deletions(-) diff --git a/app/admin/api/edit-result.php b/app/admin/api/edit-result.php index 3e1aa133..013c130c 100755 --- a/app/admin/api/edit-result.php +++ b/app/admin/api/edit-result.php @@ -72,6 +72,6 @@ else { ); # execute - if(!$Admin->object_modify("api", $_POST['action'], "id", $values)) { $Result->show("danger", _("API"). $_POST['action'] ._("error"), true); } - else { $Result->show("success", _("API"). $_POST['action'] ._("success"), true); } + if(!$Admin->object_modify("api", $_POST['action'], "id", $values)) { $Result->show("danger", _("API"). " ".$_POST['action'] ." "._("error"), true); } + else { $Result->show("success", _("API"). " ".$_POST['action'] ." "._("success"), true); } } \ No newline at end of file diff --git a/app/admin/api/index.php b/app/admin/api/index.php index 3088c7c4..217c9052 100755 --- a/app/admin/api/index.php +++ b/app/admin/api/index.php @@ -11,7 +11,7 @@ $User->check_user_session(); $all_apis = $Admin->fetch_all_objects("api"); # app security texts -$app_perms_text = array( _("SSL with User token")=>"ssl_token", _("SSL with App code token")=>"ssl_code", _("Encrypted")=>"crypt", _("User token")=>"none"); +$app_perms_text = array("SSL with User token"=>"ssl_token","SSL with App code token"=>"ssl_code","Encrypted"=>"crypt", "User token"=>"none"); ?> @@ -19,7 +19,7 @@ $app_perms_text = array( _("SSL with User token")=>"ssl_token", _("SSL with App <h4><?php print _('API management'); ?></h4> <hr><br> -<!-- only if API enabled --> +<!-- only IF aPI enabled --> <?php if($User->settings->api==1) { ?> <!-- Add new --> <button class='btn btn-sm btn-default open_popup' style="margin-bottom:10px;" data-script='app/admin/api/edit.php' data-class='700' data-action='add'><i class='fa fa-plus'></i> <?php print _('Create API key'); ?></button> @@ -28,21 +28,23 @@ $app_perms_text = array( _("SSL with User token")=>"ssl_token", _("SSL with App /* print existing APIs */ if($all_apis!==false) { - print '<table id="userPrint" class="table nosearch sorted table-striped table-top table-auto" data-cookie-id-table="admin_api">'; + print "<div class='clearfix'></div>"; + print '<div class="panel panel-default" style="width:auto;border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;float:left">'; + print '<table id="userPrint" class="table nosearch sor2ted table-striped table-top table-auto" data-cookie-id-table="admin_api">'; # headers print "<thead>"; print '<tr>'; - print "<th>"._('App id').'</th>'; + print "<th>"._('App id').'</th>'; print "<th>"._('App code').'</th>'; - print "<th>"._('App permissions').'</th>'; - print "<th>"._('App security').'</th>'; - print "<th>"._('Transaction locking').'</th>'; - print "<th>"._('Lock timeout').'</th>'; - print "<th>"._('Nest custom fields').'</th>'; - print "<th>"._('Show links').'</th>'; - print "<th>"._('Comment').'</th>'; - print "<th>"._('Last access').'</th>'; - print '<th></th>'; + print "<th>"._('App permissions').'</th>'; + print "<th>"._('App security').'</th>'; + print "<th>"._('Transaction locking').'</th>'; + print "<th>"._('Lock timeout').'</th>'; + print "<th>"._('Nest custom fields').'</th>'; + print "<th>"._('Show links').'</th>'; + print "<th>"._('Comment').'</th>'; + print "<th>"._('Last access').'</th>'; + print '<th></th>'; print '</tr>'; print "</thead>"; @@ -67,7 +69,7 @@ $app_perms_text = array( _("SSL with User token")=>"ssl_token", _("SSL with App elseif($a['app_permissions']==3) { $a['app_permissions'] = _("Read / Write / Admin"); } # wait update - $a['app_lock_wait'] = $a['app_lock']==1 ? $a['app_lock_wait']." "._("sec") : "/"; + $a['app_lock_wait'] = $a['app_lock']==1 ? $a['app_lock_wait']." sec" : "/"; # reformat lock and nesting $a['app_lock'] = $a['app_lock']==1 ? _("Yes") : _("No"); @@ -77,7 +79,7 @@ $app_perms_text = array( _("SSL with User token")=>"ssl_token", _("SSL with App $a['app_security'] = array_search($a['app_security'], $app_perms_text); - $a['app_last_access'] = is_blank($a['app_last_access']) ? _("Never") : $a['app_last_access']; + $a['app_last_access'] = strlen($a['app_last_access'])==0 ? "Never" : $a['app_last_access']; print ' <td>' . $a['app_permissions'] . '</td>'. "\n"; print ' <td>' . $a['app_security'] . '</td>'. "\n"; @@ -100,20 +102,18 @@ $app_perms_text = array( _("SSL with User token")=>"ssl_token", _("SSL with App } print "</tbody>"; print "</table>"; + print "</div>"; + print "<div class='clearfix'></div>"; } else { $Result->show("info alert-nomargin", _("No Apps available")."!", false); } ?> - <hr> - <h4><?php print _('API documentation'); ?></h4> - <ul> - <li><a target=_ href="<?php print create_link('tools/documentation/API'); ?>"><?php print _("Documentation"); ?> <i class='fa fa-book'></i></a></li> - <li><a target=_ href="https://phpipam.net/api-documentation/">https://phpipam.net/api-documentation/</a></li> - </ul> + <a href="http://phpipam.net/api-documentation/">http://phpipam.net/api-documentation/</a> + <?php } else { $Result->show("info", _('Please enable API module under server management'), false); -} +} \ No newline at end of file diff --git a/app/admin/authentication-methods/index.php b/app/admin/authentication-methods/index.php index 9882c468..e67f29e8 100644 --- a/app/admin/authentication-methods/index.php +++ b/app/admin/authentication-methods/index.php @@ -28,8 +28,11 @@ foreach($all_method_types as $type) { </div> +<div class='clearfix'></div> +<div class="panel panel-default pull-left" style="width:auto;border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;"> + <!-- table --> -<table id="userPrint" class="table sorted nosearch table-striped table-top table-auto" data-cookie-id-table="admin_authm"> +<table id="userPrint" class="table nosearch table-striped table-top" data-cookie-id-table="admin_authm" style="bordmarginer-bottom:0px;"> <!-- Headers --> <thead> @@ -55,7 +58,7 @@ foreach($all_methods as $method) { $user_num = $Database->numObjectsFilter("users", "authMethod", $method->id); print "<tr>"; - print " <td>$method->type</td>"; + print " <td><span class='badge badge1 badge-white'>$method->type</span></td>"; print " <td>$method->description</td>"; //parameters print " <td>"; @@ -104,13 +107,15 @@ foreach($all_methods as $method) { ?> </tbody> </table> +</div> +<div class='clearfix'></div> -<hr> -<div class="alert alert-info alert-absolute" style="margin-top:30px;"> + +<div class="alert alert-info alert-absolute"> <?php print _("Here you can set different authentication methods for your users."); ?> <hr> - <?php print _("phpIPAM currently supports 7 methods for authentication:"); ?> + <?php print _("phpIPAM currently supports following authentication methods:"); ?> <ul> <li><?php print _("Local authentication"); ?></li> <li><?php print _("Apache authentication"); ?></li> @@ -119,6 +124,7 @@ foreach($all_methods as $method) { <li><?php print _("NetIQ authentication"); ?></li> <li><?php print _("Radius authentication"); ?></li> <li><?php print _("SAMLv2 authentication"); ?></li> + <li><?php print _("Passkey authentication"); ?></li> </ul> <br> <?php print _("For AD/LDAP/NetIQ connection phpipam is using adLDAP, for documentation please check ")."<a href='http://adldap.sourceforge.net/'>adLDAP</a><br><br>"; ?> diff --git a/app/admin/groups/index.php b/app/admin/groups/index.php index cc0fc4e7..802cf31d 100755 --- a/app/admin/groups/index.php +++ b/app/admin/groups/index.php @@ -56,8 +56,7 @@ $colspanCustom = 0; <!-- Headers --> <thead> <tr> - <th><?php print _('Group name'); ?></th> - <th><?php print _('Group description'); ?></th> + <th><?php print _('Group'); ?></th> <th><?php print _('Belonging users'); ?></th> <th><?php print _('Section permissions'); ?></th> <?php @@ -78,12 +77,14 @@ $colspanCustom = 0; <tbody> <!-- admins --> <tr> - <td><strong><?php print _('Administrators'); ?></strong></td> - <td><?php print _('Administrator level users'); ?></td> + <td> + <span class='badge badge1 badge-white'><?php print _('Administrators'); ?></span><br> + <span class="muted"><?php print _('Administrator level users'); ?></span> + </td> <td> <?php - foreach($admins as $a) { - print $a->real_name."<br>"; + foreach($admins as $user) { + print '<img src="css/images/userVader.png" alt="Standard user icon" rel="tooltip" title="" data-original-title="User"> '."<a href='".create_link("administration","users",$user->id)."'>".$user->real_name."</a><br>"; } ?> </td> @@ -99,8 +100,9 @@ if($groups) { $g = (array) $g; print '<tr>' . "\n"; - print ' <td><strong>' . $g['g_name'] . '</strong></td>'. "\n"; - print ' <td>' . $g['g_desc'] . '</td>'. "\n"; + print ' <td>'; + print ' <span class="badge badge1 badge-white">' . $g['g_name'] . '</span><br>'. "\n"; + print ' <span class="muted">' . $g['g_desc'] . '</span></td>'. "\n"; # users in group print " <td>"; $u = $Admin->group_fetch_users($g['g_id']); @@ -108,7 +110,7 @@ if($groups) { foreach($u as $name) { # get details $user = $Admin->fetch_object("users", "id", $name); - print $user->real_name."<br>"; + print '<img src="css/images/userTrooper.png" alt="Standard user icon" rel="tooltip" title="" data-original-title="User"> '."<a href='".create_link("administration","users",$user->id)."'>".$user->real_name."</a><br>"; } } else { print "<span class='text-muted'>"._("No users")."</span>"; diff --git a/app/admin/mail/index.php b/app/admin/mail/index.php index c78ea817..0e8b5153 100755 --- a/app/admin/mail/index.php +++ b/app/admin/mail/index.php @@ -17,9 +17,12 @@ $csrf = $User->Crypto->csrf_cookie ("create", "mail"); <!-- title --> <h4>phpIPAM <?php print _('Mail settings'); ?></h4> <hr> +<br> + +<div class="panel panel-default" style="width:auto;position:absolute;border: 1px solid rgba(255, 255, 255, 0.1) !important;padding-bottom:0px !important"> <form name="mailsettings" id="mailsettings"> -<table id="mailsettingstbl" class="table table-hover table-condensed table-top table-auto"> +<table id="mailsettingstbl" class="table table-condensed table-top table-auto" style="margin-bottom:0px;"> <!-- Server settings --> <tr class="settings-title"> @@ -153,7 +156,7 @@ $csrf = $User->Crypto->csrf_cookie ("create", "mail"); </table> </form> - +</div> <!-- Result --> <div id="settingsMailEdit"></div> diff --git a/app/admin/password-policy/index.php b/app/admin/password-policy/index.php index 02b54a35..48e02423 100644 --- a/app/admin/password-policy/index.php +++ b/app/admin/password-policy/index.php @@ -14,14 +14,17 @@ $policy = pf_json_decode($User->settings->passwordPolicy); ?> <!-- title --> -<h4><?php print _('phpIPAM password policy settings'); ?></h4> -<span class="text-muted"><?php print _("Here you can set password policy for user authentication."); ?></span> +<h4><?php print _('phpIPAM password policy settings'); ?></h4><hr> + +<br><span class="text-muted"><?php print _("Here you can set password policy for user authentication."); ?></span> <br><br> +<div class="panel panel-default" style="width:auto;position:absolute;border: 1px solid rgba(255, 255, 255, 0.1) !important;padding-bottom:0px !important"> +<div class="panel-heading"><?php print _("Password policy"); ?></div> <form name="passpolicy" id="passpolicy"> -<table id="passpolicy" class="table table-hover table-condensed table-auto"> +<table id="passpolicy" class="table table-hover table-condensed table-auto" style="margin-bottom:0px"> @@ -110,11 +113,15 @@ $policy = pf_json_decode($User->settings->passwordPolicy); <!-- Submit --> <tr class="th"> <td class="title"></td> - <td class="submit" colspan="2"> - <input type="submit" class="btn btn-default btn-success btn-sm submit_popup" data-script="app/admin/password-policy/save.php" data-result_div="policyResult" data-form='passpolicy' value="<?php print _("Save"); ?>"> + <td> + <input type="submit" class="btn btn-default btn-success btn-sm submit_popup" style="width:100% !important" data-script="app/admin/password-policy/save.php" data-result_div="policyResult" data-form='passpolicy' value="<?php print _("Save"); ?>"> + </td> + <td> <div id="policyResult"></div> </td> </tr> </table> </form> + +</div> diff --git a/css/bootstrap/bootstrap-custom-dark.css b/css/bootstrap/bootstrap-custom-dark.css index 3891e021..17462e06 100644 --- a/css/bootstrap/bootstrap-custom-dark.css +++ b/css/bootstrap/bootstrap-custom-dark.css @@ -120,6 +120,9 @@ html .badge { background: rgba(0, 0, 0, 0.2) !important; border: 1px solid #58606b !important; } +html .badge-white { + color: white !important; +} html .badge.alert-success { color: #dff0d8 !important; border-color: #3c763d !important; diff --git a/css/bootstrap/bootstrap-custom-dark.scss b/css/bootstrap/bootstrap-custom-dark.scss index 6e04a901..b4b4f74e 100644 --- a/css/bootstrap/bootstrap-custom-dark.scss +++ b/css/bootstrap/bootstrap-custom-dark.scss @@ -929,6 +929,9 @@ html { border: 1px solid white; color: white !important; } + span.badge-white { + color: white !important; + } } } td { diff --git a/functions/classes/class.Addresses.php b/functions/classes/class.Addresses.php index 832c534c..719273af 100644 --- a/functions/classes/class.Addresses.php +++ b/functions/classes/class.Addresses.php @@ -962,8 +962,9 @@ class Addresses extends Common_functions { // set PTR zone name from IP/mash $zone = $this->PowerDNS->get_ptr_zone_name ($this->transform_address ($subnet->subnet, "dotted"), $subnet->mask); + // try to fetch - return $this->PowerDNS->fetch_domain_by_name ($zone); + return $this->PowerDNS->fetch_domain_by_name ($zone); } /** @@ -990,18 +991,25 @@ class Addresses extends Common_functions { // fetch domain $domain = $this->pdns_fetch_domain ($address->subnetId); - // formulate new record - $record = $this->PowerDNS->formulate_new_record ($domain->id, $this->PowerDNS->get_ip_ptr_name ($this->transform_address ($address->ip_addr, "dotted")), "PTR", $address->hostname, $values->ttl); - // insert record - $this->PowerDNS->add_domain_record ($record, false); - // link to address - $id = $id===null ? $this->lastId : $id; - $this->ptr_link ($id, $this->PowerDNS->lastId); - // ok - if ($print_error && php_sapi_name()!="cli") - $this->Result->show("success", _("PTR record created"), false); + // does domain exist ? + if($domain===null) { + $this->Result->show("warning", _("Domain does not exist").".", false); + return false; + } + else { + // formulate new record + $record = $this->PowerDNS->formulate_new_record ($domain->id, $this->PowerDNS->get_ip_ptr_name ($this->transform_address ($address->ip_addr, "dotted")), "PTR", $address->hostname, $values->ttl); + // insert record + $this->PowerDNS->add_domain_record ($record, false); + // link to address + $id = $id===null ? $this->lastId : $id; + $this->ptr_link ($id, $this->PowerDNS->lastId); + // ok + if ($print_error && php_sapi_name()!="cli") + $this->Result->show("success", _("PTR record created"), false); - return true; + return true; + } } /** diff --git a/functions/version.php b/functions/version.php index da913411..e7f74bfe 100644 --- a/functions/version.php +++ b/functions/version.php @@ -4,7 +4,7 @@ define("VERSION", "1.7"); //decimal release version e.g 1.32 /* set latest version */ define("VERSION_VISIBLE", "1.7.0"); //visible version in footer e.g 1.3.2 /* set latest revision */ -define("REVISION", "001"); //increment on static content changes (js/css) or point releases to avoid caching issues +define("REVISION", "002"); //increment on static content changes (js/css) or point releases to avoid caching issues /* set last possible upgrade */ define("LAST_POSSIBLE", "1.4"); //minimum required version to be able to upgrade /* set published - hide dbversion in footer */ -- GitLab