Changeset 187 for trunk/global.php


Ignore:
Timestamp:
Apr 5, 2009, 3:54:46 PM (16 years ago)
Author:
george
Message:
  • Přidáno: Možnost registrace podsítí pro klienty.
  • Upraveno: Skripty pro generování nastavení routerů byly upraveny pro podporu tabulky NetworkSubnet.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/global.php

    r178 r187  
    3232    global $Database;
    3333
    34     //echo('Přidávám modul '.get_class($Module).'<br>');
     34    //echo('Přidávám modul '.get_class($Module).'<br />');
    3535    $Module->System = &$this;
    3636    $Module->Database = &$Database;
     
    202202  return(str_replace(
    203203    array("á","č","ď","é","ě","í","ľ","ň","ó","ř","š","ť","ú","ů","ý","ž","Á","Č","Ď","É","Ě","Í","Ľ","Ň","Ó","Ř","Š","Ť","Ú","Ů","Ý","Ž"),
    204     array("a","c","d","e","e","i","l","n","o","r","s","t","u","u","y","z","A","C","D","E","E","I","L","N","O","R","S","T","U","U","Y","Z"), $Text));
    205 }
     204    array("a","c","d","e","e","i","l","n","o","r","s","t","u","u","y","z","A","C","D","E","E","I","L","N","O","R","S","T","U","U","Y","Z"),
     205    $Text));
     206}
     207
     208function CIDRToAddressRange($Subnet, $Mask)
     209{
     210  $SubnetParts = explode('.', $Subnet);
     211  $SubnetBinary = ($SubnetParts[0] << 24) | ($SubnetParts[1] << 16) | ($SubnetParts[2] << 8) | $SubnetParts[3];
     212  $SubnetTopBinary = $SubnetBinary + (1 << (32 - $Mask)) - 1;
     213  $SubnetTopParts = array(($SubnetTopBinary >> 24) & 255, ($SubnetTopBinary >> 16) & 255, ($SubnetTopBinary >> 8) & 255, ($SubnetTopBinary & 255));
     214  $SubnetTop = implode('.', $SubnetTopParts);
     215  return(array('From' => $Subnet, 'To' => $SubnetTop));
     216}
     217
     218function RouterOSIdent($Name)
     219{
     220  return(strtr(strtolower(trim($Name)), array(' ' => '-', '.' => '', '(' => '-', ')' => '-',
     221  'č' => 'c', 'š' => 's', 'ě' => 'e', 'ř' => 'r', 'ž' => 'z', 'ý' => 'y', 'á' => 'a', 'í' => 'i', 'é' => 'e', 'ů' => 'u', 'ú' => 'u', 'ď' => 'd', 'ť' => 't', 'ň' => 'n', 'ó' => 'o',
     222  'Č' => 'c', 'Š' => 's', 'Ě' => 'e', 'Ř' => 'r', 'Ž' => 'z', 'Ý' => 'y', 'Á' => 'a', 'Í' => 'i', 'É' => 'e', 'Ů' => 'u', 'Ú' => 'u', 'Ď' => 'd', 'Ť' => 't', 'Ň' => 'n', 'Ó' => 'o',
     223)));
     224}
     225
     226
    206227
    207228?>
Note: See TracChangeset for help on using the changeset viewer.