Ignore:
Timestamp:
Apr 14, 2015, 10:20:16 PM (10 years ago)
Author:
chronos
Message:
  • Removed: Spaces on end of line.
  • Modified: Tabs converted to spaces.
Location:
trunk/Modules/NetworkConfigRouterOS
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/NetworkConfigRouterOS/Generators/AddressPortability.php

    r548 r738  
    66$Path = array('ip', 'dhcp-server', 'lease');
    77
    8 $Host = array(); 
     8$Host = array();
    99
    1010function ConvertExpireTime2($Time)
  • trunk/Modules/NetworkConfigRouterOS/Generators/Common.php

    r548 r738  
    66{
    77  global $Database;
    8  
     8
    99  $DbResult = $Database->query('SELECT `Id` FROM `NetworkMark` WHERE `Comment`="'.$Comment.'"');
    1010  if($DbResult->num_rows > 0)
     
    1616    $DbResult = $Database->query('INSERT INTO `NetworkMark` (`Comment`) VALUES ("'.$Comment.'")');
    1717    return($Database->insert_id);
    18   } 
     18  }
    1919}
    2020
     
    2222{
    2323  global $Database;
    24  
     24
    2525  $DbResult = $Database->query('SELECT `Id` FROM `NetworkMangleSubgroup` WHERE `AddressRange`="'.$AddressRange.'"');
    2626  if($DbResult->num_rows > 0)
     
    3232    $DbResult = $Database->query('INSERT INTO `NetworkMangleSubgroup` (`AddressRange`) VALUES ("'.$AddressRange.'")');
    3333    return($Database->insert_id);
    34   } 
     34  }
    3535}
    3636
     
    3838{
    3939  global $Config;
    40  
     40
    4141  $Found = false;
    4242  foreach($Tree['Items'] as $Index => $Node)
     
    5050  if($Found == false)
    5151  {
    52     if($InterSubnets and ($Tree['Address']->Prefix < $Config['MainRouter']['MangleRuleSubgroupMinPrefix']) and 
     52    if($InterSubnets and ($Tree['Address']->Prefix < $Config['MainRouter']['MangleRuleSubgroupMinPrefix']) and
    5353    ($Address->Prefix > ($Tree['Address']->Prefix + 1)))
    5454    {
     
    6161    } else
    6262    {
    63      
     63
    6464      $NewNode = array('Address' => $Address, 'Name' => $Name, 'Items' => array(), 'ForceMark' => $ForceMark);
    65      
     65
    6666      // Should be existed items placed under new node?
    6767      $Found = false;
    6868      foreach($Tree['Items'] as $Index => $Node)
    6969      {
    70         if(($Node['Address']->Address == $NewNode['Address']->Address) and 
    71         ($Node['Address']->Prefix == $NewNode['Address']->Prefix)) $Found = true;       
    72        
     70        if(($Node['Address']->Address == $NewNode['Address']->Address) and
     71        ($Node['Address']->Prefix == $NewNode['Address']->Prefix)) $Found = true;
     72
    7373        //echo($Index.',');
    7474        if($Address->Contain($Node['Address']))
     
    7878        }
    7979      }
    80       if($Found == false) $Tree['Items'][] = $NewNode;     
     80      if($Found == false) $Tree['Items'][] = $NewNode;
    8181    }
    8282  }
     
    8989  {
    9090    ShowSubnetNode($Item, $Indent + 1);
    91   } 
     91  }
    9292}
    9393
  • trunk/Modules/NetworkConfigRouterOS/Generators/DHCP.php

    r617 r738  
    2929    $Items[] = array('mac-address' => $Interface['MAC'], 'address' => $Interface['LocalIP'], 'server' => $Server, 'comment' => $Name);
    3030  }
    31  
    32   print_r($Routerboard->ListUpdate($Path, array('mac-address', 'address', 'server', 'comment'), $Items, array('server' => $Server, 'dynamic' => 'no')));   
     31
     32  print_r($Routerboard->ListUpdate($Path, array('mac-address', 'address', 'server', 'comment'), $Items, array('server' => $Server, 'dynamic' => 'no')));
    3333  echo("\n");
    3434}
  • trunk/Modules/NetworkConfigRouterOS/Generators/FirewallFilter.php

    r617 r738  
    2424
    2525// Inet traffic groups
    26 //$Items[] = array('chain' => 'forward', 'out-interface' => $InetInterface, 'action' => 'jump', 'jump-target' => 'inet-out', 'comment' => 'inet-out');     
     26//$Items[] = array('chain' => 'forward', 'out-interface' => $InetInterface, 'action' => 'jump', 'jump-target' => 'inet-out', 'comment' => 'inet-out');
    2727//$Items[] = array('chain' => 'forward', 'in-interface' => $InetInterface, 'action' => 'jump', 'jump-target' => 'inet-in', 'comment' => 'inet-in');
    2828
     
    6363  $DbResult2 = $System->Database->select('NetworkSubnet', '*', 'Member='.$Member['Id']);
    6464  while($Subnet = $DbResult2->fetch_assoc())
    65   {   
     65  {
    6666    $Subnet['Name'] = RouterOSIdent('subnet-'.$Subnet['Name']);
    6767    echo($Subnet['Name'].'('.$Subnet['AddressRange'].'/'.$Subnet['Mask'].'), ');
     
    7575        else $Src = $Subnet['AddressRange'].'/'.$Subnet['Mask'];
    7676      $Items[] = array('chain' => 'forward', 'out-interface' => $InetInterface, 'src-address' => $Src, 'action' => 'drop','comment' => $Subnet['Name'].'-out-drop');
    77    
     77
    7878      $NewAddress = new NetworkAddressIPv4();
    7979      $NewAddress->AddressFromString($Subnet['AddressRange']);
  • trunk/Modules/NetworkConfigRouterOS/Generators/FirewallMangle.php

    r735 r738  
    3030  $NewAddress->AddressFromString($Subnet['AddressRange']);
    3131  $NewAddress->Prefix = $Subnet['Mask'];
    32   InsertToAddressTree($AddressTree, $NewAddress, 'subnet-'.RouterOSIdent($Subnet['Name'])); 
     32  InsertToAddressTree($AddressTree, $NewAddress, 'subnet-'.RouterOSIdent($Subnet['Name']));
    3333}
    3434
     
    5858    }
    5959  }
    60  
     60
    6161  $DbResult2 = $System->Database->select('NetworkSubnet', '*', '`Member`='.$Member['Id']);
    6262  while($Subnet = $DbResult2->fetch_assoc())
     
    8080{
    8181  global $InetInterface, $ItemsFirewall;
    82  
     82
    8383  foreach($Node['Items'] as $Index => $Item)
    8484  {
     
    8989      $Address = $Item['Address']->AddressToString();
    9090      if($Item['Address']->Prefix != 32) $Address .= '/'.$Item['Address']->Prefix;
    91      
     91
    9292      $PacketMark = GetMarkByComment($Item['Name'].'-out');
    9393      $ItemsFirewall[] = array('chain' => 'inet-'.$ParentSubnetId.'-out', 'src-address' => $Address, 'out-interface' =>  $InetInterface, 'action' => 'mark-packet', 'new-packet-mark' => $PacketMark, 'passthrough' => 'no', 'comment' => $Item['Name'].'-out');
     
    100100      $SubnetId = GetSubgroupByRange($Item['Address']->AddressToString().'/'.$Item['Address']->Prefix);
    101101      $PacketMark = GetMarkByComment($Item['Name'].'-out');
    102      
     102
    103103      $Address = $Item['Address']->AddressToString();
    104104      if($Item['Address']->Prefix != 32) $Address .= '/'.$Item['Address']->Prefix;
    105      
    106       $ItemsFirewall[] = array('chain' => 'inet-'.$ParentSubnetId.'-out', 'src-address' => $Address, 'out-interface' => $InetInterface, 'action' => 'jump', 'jump-target' => 'inet-'.$SubnetId.'-out', 'comment' => $Item['Name'].'-out');   
    107       $ItemsFirewall[] = array('chain' => 'inet-'.$ParentSubnetId.'-in', 'dst-address' => $Address, 'in-interface' => $InetInterface, 'action' => 'jump', 'jump-target' => 'inet-'.$SubnetId.'-in', 'comment' => $Item['Name'].'-in');   
    108      
    109       ProcessNode($Item);     
    110     }   
     105
     106      $ItemsFirewall[] = array('chain' => 'inet-'.$ParentSubnetId.'-out', 'src-address' => $Address, 'out-interface' => $InetInterface, 'action' => 'jump', 'jump-target' => 'inet-'.$SubnetId.'-out', 'comment' => $Item['Name'].'-out');
     107      $ItemsFirewall[] = array('chain' => 'inet-'.$ParentSubnetId.'-in', 'dst-address' => $Address, 'in-interface' => $InetInterface, 'action' => 'jump', 'jump-target' => 'inet-'.$SubnetId.'-in', 'comment' => $Item['Name'].'-in');
     108
     109      ProcessNode($Item);
     110    }
    111111  }
    112112  if($Node['ForceMark'] == true)
     
    133133// Slow free internet
    134134$PacketMark = GetMarkByComment('free-out');
    135 $ItemsFirewall[] = array('chain' => 'inet-1-out', 'out-interface' => $InetInterface, 
     135$ItemsFirewall[] = array('chain' => 'inet-1-out', 'out-interface' => $InetInterface,
    136136  'action' => 'mark-packet', 'new-packet-mark' => $PacketMark, 'comment' => 'free-out', 'passthrough' => 'yes');
    137137$PacketMark = GetMarkByComment('free-in');
    138 $ItemsFirewall[] = array('chain' => 'inet-1-in', 'in-interface' => $InetInterface, 
    139         'action' => 'mark-packet', 'new-packet-mark' => $PacketMark, 'comment' => 'free-in', 'passthrough' => 'no');
     138$ItemsFirewall[] = array('chain' => 'inet-1-in', 'in-interface' => $InetInterface,
     139  'action' => 'mark-packet', 'new-packet-mark' => $PacketMark, 'comment' => 'free-in', 'passthrough' => 'no');
    140140// Unregistred clients add to address list
    141 $ItemsFirewall[] = array('chain' => 'inet-1-out', 'out-interface' => $InetInterface, 'src-address' => '10.145.0.0/16', 
    142         'action' => 'add-src-to-address-list', 'address-list' => 'unregistred', 'timeout' => '1d',
    143         'comment' => 'unregistred-clients');
     141$ItemsFirewall[] = array('chain' => 'inet-1-out', 'out-interface' => $InetInterface, 'src-address' => '10.145.0.0/16',
     142  'action' => 'add-src-to-address-list', 'address-list' => 'unregistred', 'timeout' => '1d',
     143  'comment' => 'unregistred-clients');
    144144
    145145//print_r($ItemsFirewall);
  • trunk/Modules/NetworkConfigRouterOS/Generators/FirewallNAT.php

    r735 r738  
    3434
    3535// Skip local subnet
    36 //$Items[] = array('chain' => 'inet-out', 'dst-address' => '172.16.1.1/30', 'action' => 'accept', 'comment' => 'Local_subnet');     
     36//$Items[] = array('chain' => 'inet-out', 'dst-address' => '172.16.1.1/30', 'action' => 'accept', 'comment' => 'Local_subnet');
    3737//$Items[] = array('chain' => 'inet-in', 'dst-address' => '172.16.1.1/30', 'action' => 'accept', 'comment' => 'Local_subnet');
    3838
     
    4646  $DbResult2 = $System->Database->query('SELECT `NetworkInterface`.*, `NetworkDevice`.`Name` AS `DeviceName`, `NetworkDevice`.`InboundNATPriority` FROM `NetworkInterface`'.
    4747  ' LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` WHERE (`NetworkInterface`.`ExternalIP` <> "")'.
    48   ' AND (`NetworkInterface`.`LocalIP` <> "")'. 
     48  ' AND (`NetworkInterface`.`LocalIP` <> "")'.
    4949  ' AND (`NetworkDevice`.`Member` = '.$Member['Id'].') AND (`NetworkInterface`.`LocalIP` != `NetworkInterface`.`ExternalIP`) ORDER BY `id` DESC');
    5050  while($Interface = $DbResult2->fetch_assoc())
     
    5757    {
    5858      $Items[] = array('chain' => 'inet-out', 'src-address' => $Interface['LocalIP'], 'action' => 'src-nat',  'to-addresses' => $Interface['ExternalIP'], 'comment' => $Name.'-out');
    59       if($Interface['InboundNATPriority'] > 0) 
     59      if($Interface['InboundNATPriority'] > 0)
    6060        $Items[] = array('chain' => 'inet-in', 'dst-address' => $Interface['ExternalIP'], 'action' => 'dst-nat', 'to-addresses' => $Interface['LocalIP'], 'comment' => $Name.'-in');
    61     } else 
     61    } else
    6262    {
    6363      $Items[] = array('chain' => 'dstnat', 'src-address' => $Interface['LocalIP'], 'protocol' => 'tcp', 'dst-port' => 80, 'action' => 'dst-nat',  'to-addresses' => $IPCentrala, 'to-ports' => 81, 'comment' => $Name.'-out');
     
    6868  $DbResult2 = $System->Database->select('NetworkSubnet', '*', '`Member`='.$Member['Id']);
    6969  while($Subnet = $DbResult2->fetch_assoc())
    70   {   
     70  {
    7171    $Subnet['Name'] = RouterOSIdent('subnet-'.$Subnet['Name']);
    7272    echo($Subnet['Name'].'('.$Subnet['AddressRange'].'/'.$Subnet['Mask'].'), ');
     
    8282        else $Src = $Subnet['AddressRange'].'/'.$Subnet['Mask'];
    8383      $Items[] = array('chain' => 'inet-out', 'src-address' => $Src, 'action' => 'src-nat', 'to-addresses' => $Range, 'comment' => $Subnet['Name'].'-out');
    84    
     84
    8585      $NewAddress = new NetworkAddressIPv4();
    8686      $NewAddress->AddressFromString($Subnet['AddressRange']);
     
    114114
    115115// Accept free-access clients
    116 $Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16', 
    117         'src-address-list' => 'free-access', 'in-interface' => $LocalInterface,
    118         'action' => 'accept', 'comment' => 'Free_access');
     116$Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16',
     117  'src-address-list' => 'free-access', 'in-interface' => $LocalInterface,
     118  'action' => 'accept', 'comment' => 'Free_access');
    119119// Redirect unregistred clients to free access activation page
    120 $Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16', 
    121         'src-address-list' => 'unregistred', 'in-interface' => $LocalInterface,
    122         'action' => 'dst-nat', 'to-addresses' => '10.145.64.8', 'to-ports' => 82, 'comment' => 'Redirect_unregistred');
     120$Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16',
     121  'src-address-list' => 'unregistred', 'in-interface' => $LocalInterface,
     122  'action' => 'dst-nat', 'to-addresses' => '10.145.64.8', 'to-ports' => 82, 'comment' => 'Redirect_unregistred');
    123123
    124124/*
  • trunk/Modules/NetworkConfigRouterOS/Generators/Netwatch.php

    r617 r738  
    3535    }
    3636  }
    37   $Routerboard->ListUpdate($Path, array('host', 'interval', 'comment'), $Items);   
     37  $Routerboard->ListUpdate($Path, array('host', 'interval', 'comment'), $Items);
    3838  echo("\n");
    3939}
  • trunk/Modules/NetworkConfigRouterOS/Generators/NetwatchImport.php

    r697 r738  
    2121  // Load netwatch status from all DHCP routers
    2222  $DbResult3 = $System->Database->query('SELECT `DHCP`, `AddressRange`, `Mask` FROM `NetworkSubnet` '.
    23                 'WHERE (`Configure` = 1) AND (`Member` IS NULL) GROUP BY DHCP');
     23    'WHERE (`Configure` = 1) AND (`Member` IS NULL) GROUP BY DHCP');
    2424  while($Subnet = $DbResult3->fetch_assoc())
    2525  {
     
    5454        array('LastOnline' => TimeToMysqlDateTime($StartTime)));
    5555
    56         if($Interface['Online'] != $Interface['NewOnline'])
     56    if($Interface['Online'] != $Interface['NewOnline'])
    5757    {
    58         // Online state changed
     58      // Online state changed
    5959      $DbResult = $System->Database->query('INSERT INTO `NetworkInterfaceUpDown` (`Interface`,
    60         `State`, `Time`, `Duration`) VALUES ('.$Interface['Id'].', '.$Interface['NewOnline'].', "'.
     60        `State`, `Time`, `Duration`) VALUES ('.$Interface['Id'].', '.$Interface['NewOnline'].', "'.
    6161         TimeToMysqlDateTime($StartTime).'", NULL)');
    6262      // Update previous record duration in UpDown table
     
    6464      '`TM`.`Time`, (SELECT `Time` FROM (SELECT * FROM `NetworkInterfaceUpDown`) AS `TA` WHERE (`TA`.`Time` > `TM`.`Time`) '.
    6565      'AND (`TA`.`Interface`=`TM`.`Interface`) ORDER BY `TA`.`Time` ASC LIMIT 1)) '.
    66         'WHERE (`TM`.`Duration` IS NULL) AND (`TM`.`Interface` ='.$Interface['Id'].')');
     66      'WHERE (`TM`.`Duration` IS NULL) AND (`TM`.`Interface` ='.$Interface['Id'].')');
    6767      $System->Database->update('NetworkInterface', '`Id` = "'.$Interface['Id'].'"',
    6868        array('Online' => $Interface['NewOnline']));
     
    7575  while($DbRow = $DbResult->fetch_assoc())
    7676  {
    77         echo('IP '.$DbRow['LocalIP'].' online but time not updated.'."\n");
     77    echo('IP '.$DbRow['LocalIP'].' online but time not updated.'."\n");
    7878  }
    7979  $DbResult = $System->Database->select('NetworkInterface', '*', '(`Online` = 0) AND '.
  • trunk/Modules/NetworkConfigRouterOS/Generators/Queue.php

    r726 r738  
    2222{
    2323  global $UsedNames;
    24  
     24
    2525  if(in_array($Name, $UsedNames)) die("\n".'Duplicate name: '.$Name);
    2626  else $UsedNames[] = $Name;
     
    5353if($DbResult->num_rows == 1)
    5454{
    55         $Service = $DbResult->fetch_array();
     55  $Service = $DbResult->fetch_array();
    5656  $FreeInetSpeed = $Service['InternetSpeedMax'] * 1000;
    5757} else $FreeInetSpeed = 0;
     
    128128      }
    129129    }
    130  
     130
    131131    $DbResult2 = $System->Database->select('NetworkSubnet', '*', '`Service`='.$Service['RelId']);
    132132    while($Subnet = $DbResult2->fetch_assoc())
  • trunk/Modules/NetworkConfigRouterOS/Generators/Signal.php

    r682 r738  
    3535      if($DbResult->num_rows > 0)
    3636      {
    37         $DbRow = $DbResult->fetch_assoc();
     37        $DbRow = $DbResult->fetch_assoc();
    3838        $Interface = $DbRow['Id'];
    3939      } else $Interface = null;
  • trunk/Modules/NetworkConfigRouterOS/NetworkConfigRouterOS.php

    r735 r738  
    2828  function DoStart()
    2929  {
    30         $this->System->Pages['zdarma'] = 'PageFreeAccess';
     30    $this->System->Pages['zdarma'] = 'PageFreeAccess';
    3131    $this->System->FormManager->RegisterClass('NetworkInterfaceUpDown', array(
    3232      'Title' => 'Změny stavu rozhraní',
     
    4444}
    4545
    46 class PageFreeAccess extends Page 
     46class PageFreeAccess extends Page
    4747{
    4848  var $FullTitle = 'Přístup zdarma k Internetu';
     
    5151  var $AddressList = 'free-access';
    5252  var $Timeout;
    53  
     53
    5454  function __construct($System)
    5555  {
    56         parent::__construct($System);
    57         $this->Timeout = 24 * 60 * 60;
     56    parent::__construct($System);
     57    $this->Timeout = 24 * 60 * 60;
    5858  }
    59  
    60         function Show()
    61         {
    62                 $IPAddress = GetRemoteAddress();
    63                 if(IsInternetAddr($IPAddress))
    64                         return('<p>Internet zdarma je dostupný pouze z vnitřní sítě.</p>'); 
    65                 $Time = time();
    66        
    67                 $DbResult = $this->Database->select('NetworkFreeAccess', '*', '(IPAddress="'.$IPAddress.
    68                         '") ORDER BY Time DESC LIMIT 1');
    69                 if($DbResult->num_rows > 0)
    70                 {
    71                         $DbRow = $DbResult->fetch_assoc();
    72                         $ActivationTime = MysqlDateTimeToTime($DbRow['Time']);
    73       if(($ActivationTime + $this->Timeout) < $Time) 
     59
     60  function Show()
     61  {
     62    $IPAddress = GetRemoteAddress();
     63    if(IsInternetAddr($IPAddress))
     64      return('<p>Internet zdarma je dostupný pouze z vnitřní sítě.</p>');
     65    $Time = time();
     66
     67    $DbResult = $this->Database->select('NetworkFreeAccess', '*', '(IPAddress="'.$IPAddress.
     68      '") ORDER BY Time DESC LIMIT 1');
     69    if($DbResult->num_rows > 0)
     70    {
     71      $DbRow = $DbResult->fetch_assoc();
     72      $ActivationTime = MysqlDateTimeToTime($DbRow['Time']);
     73      if(($ActivationTime + $this->Timeout) < $Time)
    7474      {
    75         $Activated = false;
    76       } else $Activated = true;                 
    77                 } else $Activated = false;
    78                
    79                 if(array_key_exists('a', $_GET))
    80                 {
    81                   if($_GET['a'] == 'activate')
    82                   {
    83                         if($Activated == false)
    84                         {
    85                                 $DbResult = $this->Database->insert('NetworkFreeAccess',
    86                                         array('IPAddress' => $IPAddress, 'Time' => TimeToMysqlDateTime(time()),
    87                                         'Configured' => 0));
    88                                 $ActivationTime = $Time;
    89                                 $Activated = true;
    90                         }
    91                   }     
    92                 }
    93                 $Output = '<div style="text-align:center;"><h3>Vítejte v síti ZděchovNET</h3></div>';
    94                 //$Output .= 'Vaše adresa IP je: '.GetRemoteAddress().'<br/>';         
    95                 $Output .= '<p>Pro přístup k Internetu zdarma sdílenou rychlostí 128/128 kbit/s klikněte na odkaz níže.
    96                         Internet bude zpřístupněn po dobu 24 hodin. Po uplynutí této doby je potřeba provést novou aktivaci.</p>';
    97                 $Output .= '<p>Pokud jste platícím zákazníkem a přesto se vám zobrazuje tato stránka, tak pravděpodobně nemáte registrovano v síti vaše klientské zařízení.</p>';
    98                
    99                 $PrefixMultiplier = new PrefixMultiplier();
    100                 if($Activated) $Output .= 'Aktivováno. Vyprší za '.$PrefixMultiplier->Add($ActivationTime + $this->Timeout - $Time, '', 4, 'Time');
    101                   else $Output .= '<a href="?a=activate">Aktivovat</a>';
    102                
    103                 return($Output);
     75        $Activated = false;
     76      } else $Activated = true;
     77    } else $Activated = false;
     78
     79    if(array_key_exists('a', $_GET))
     80    {
     81      if($_GET['a'] == 'activate')
     82      {
     83        if($Activated == false)
     84        {
     85          $DbResult = $this->Database->insert('NetworkFreeAccess',
     86            array('IPAddress' => $IPAddress, 'Time' => TimeToMysqlDateTime(time()),
     87            'Configured' => 0));
     88          $ActivationTime = $Time;
     89          $Activated = true;
     90        }
     91      }
     92    }
     93    $Output = '<div style="text-align:center;"><h3>Vítejte v síti ZděchovNET</h3></div>';
     94    //$Output .= 'Vaše adresa IP je: '.GetRemoteAddress().'<br/>';
     95    $Output .= '<p>Pro přístup k Internetu zdarma sdílenou rychlostí 128/128 kbit/s klikněte na odkaz níže.
     96      Internet bude zpřístupněn po dobu 24 hodin. Po uplynutí této doby je potřeba provést novou aktivaci.</p>';
     97    $Output .= '<p>Pokud jste platícím zákazníkem a přesto se vám zobrazuje tato stránka, tak pravděpodobně nemáte registrovano v síti vaše klientské zařízení.</p>';
     98
     99    $PrefixMultiplier = new PrefixMultiplier();
     100    if($Activated) $Output .= 'Aktivováno. Vyprší za '.$PrefixMultiplier->Add($ActivationTime + $this->Timeout - $Time, '', 4, 'Time');
     101      else $Output .= '<a href="?a=activate">Aktivovat</a>';
     102
     103    return($Output);
    104104  }
    105105}
     
    107107class ScheduleConfigureFreeAccess extends SchedulerTask
    108108{
    109         function Execute()
    110         {
    111                 $Output = '';
    112                 $Commands = array();
    113                 $DbResult = $this->Database->select('NetworkFreeAccess', '`Id`, `IPAddress`', '(`Configured`=0)');
    114                 while($DbRow = $DbResult->fetch_assoc())
    115                 {
    116                         $Commands[] = '/ip firewall address-list add address='.$DbRow['IPAddress'].
    117                         ' list=free-access timeout=1d';
    118                 }
    119                 $DbResult = $this->Database->update('NetworkFreeAccess', '`Configured`=0', array('Configured' => 1));
    120                
    121                 $Routerboard = new Routerboard($this->System->Config['MainRouter']['HostName']);
    122                 $Routerboard->UserName = $this->System->Config['MainRouter']['UserName'];
    123                 $Routerboard->Timeout = $this->System->Config['MainRouter']['ConnectTimeout'];
    124                 $Routerboard->Debug = true;
    125                 $Routerboard->ExecuteBatch(implode(';', $Commands));
    126                                        
    127                 return($Output);
    128         }
     109  function Execute()
     110  {
     111    $Output = '';
     112    $Commands = array();
     113    $DbResult = $this->Database->select('NetworkFreeAccess', '`Id`, `IPAddress`', '(`Configured`=0)');
     114    while($DbRow = $DbResult->fetch_assoc())
     115    {
     116      $Commands[] = '/ip firewall address-list add address='.$DbRow['IPAddress'].
     117      ' list=free-access timeout=1d';
     118    }
     119    $DbResult = $this->Database->update('NetworkFreeAccess', '`Configured`=0', array('Configured' => 1));
     120
     121    $Routerboard = new Routerboard($this->System->Config['MainRouter']['HostName']);
     122    $Routerboard->UserName = $this->System->Config['MainRouter']['UserName'];
     123    $Routerboard->Timeout = $this->System->Config['MainRouter']['ConnectTimeout'];
     124    $Routerboard->Debug = true;
     125    $Routerboard->ExecuteBatch(implode(';', $Commands));
     126
     127    return($Output);
     128  }
    129129}
  • trunk/Modules/NetworkConfigRouterOS/Routerboard2.php

    r548 r738  
    6767  function GetDHCPServerLeasesList()
    6868  {
    69     return($this->GetList('/ip dhcp-server lease', array('address', 'active-address', 'comment', 'lease-time', 'status', 'host-name'))); 
     69    return($this->GetList('/ip dhcp-server lease', array('address', 'active-address', 'comment', 'lease-time', 'status', 'host-name')));
    7070  }
    7171}
  • trunk/Modules/NetworkConfigRouterOS/RouterboardAPI.php

    r704 r738  
    4848    if($this->SSL)
    4949    {
    50         $IP = 'ssl://'.$IP;
     50      $IP = 'ssl://'.$IP;
    5151    }
    5252    $this->Socket = @fsockopen($IP, $this->Port, $this->ErrorNo, $this->ErrorStr, $this->Timeout);
  • trunk/Modules/NetworkConfigRouterOS/SSH.php

    r548 r738  
    3737            /*
    3838            //echo(') '.strlen($Buffer).' '.ord($Buffer{0}).'(');
    39             for($I = 0; $I < strlen($Buffer); $I++) 
     39            for($I = 0; $I < strlen($Buffer); $I++)
    4040            {
    4141              if(((ord($Buffer{$I}) >= 32) and (ord($Buffer{$I}) <= 128)) or ($Buffer{$I} = "\n") or ($Buffer{$I} = "\r")) echo($Buffer{$I});
     
    5555    echo($Response);
    5656    return(explode("\n", substr($Response, 0, -1)));
    57   } 
     57  }
    5858}
Note: See TracChangeset for help on using the changeset viewer.