Changeset 904


Ignore:
Timestamp:
Feb 19, 2021, 12:03:36 PM (4 years ago)
Author:
chronos
Message:
  • Added: Show gateway and net mask in contract.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

    r903 r904  
    11<?php
    22
    3 $Revision = 903; // Subversion revision
     3$Revision = 904; // Subversion revision
    44$DatabaseRevision = 901; // SQL structure revision
    55$ReleaseTime = strtotime('2021-02-19');
  • trunk/Modules/Contract/Contract.php

    r902 r904  
    185185    $IpAddress = $NetworkInterface['LocalIP'];
    186186    $MacAddress = $NetworkInterface['MAC'];
    187     $NetMask = '';
    188     $DefaultGateway = '';
     187
     188    $DbResult = $this->Database->query('SELECT * FROM NetworkSubnet '.
     189      'WHERE CompareNetworkPrefix(INET_ATON("'.$IpAddress.'"), INET_ATON(`AddressRange`), `Mask`)');
     190    if ($DbResult->num_rows > 0)
     191    {
     192      $Subnet = $DbResult->fetch_assoc();
     193      $DefaultGateway = $Subnet['Gateway'];
     194      $NetworkAddressIPv4 = new NetworkAddressIPv4();
     195      $NetworkAddressIPv4->Prefix = $Subnet['Mask'];
     196      $NetworkAddressIPv4->Address = $NetworkAddressIPv4->GetNetMask();
     197      $NetMask = $NetworkAddressIPv4->AddressToString();
     198    } else die('Subnet not found.');
     199
    189200    $Interface = 'Ethernet';
    190201    $PrimaryDNS = '10.145.64.8';
     
    291302      '<strong>II. Poskytované služby:</strong><br/>'.
    292303      '<table width="100%" border="1">'.
    293       '<tr><td width="50%" aling="center">Zvolený typ (tarif) služby:</td><td width="50%">'.NotBlank($ServiceType).'</td></tr>'.
     304      '<tr><td width="50%">Zvolený typ (tarif) služby:</td><td>'.NotBlank($ServiceType).'</td></tr>'.
    294305      '</table>'.
    295306      '<br/>'.
     
    320331      '<br/><br/><br/><br/>'.
    321332      '<table width="100%">'.
    322       '<tr><td width="50%" aling="center">odběratel</td><td width="50%">dodavatel</td></tr>'.
     333      '<tr><td width="50%" align="center">odběratel</td><td width="50%" align="center">dodavatel</td></tr>'.
    323334      '</table>'.
    324335      '</td></tr>'.
Note: See TracChangeset for help on using the changeset viewer.