Changeset 154


Ignore:
Timestamp:
Feb 16, 2009, 7:54:34 PM (15 years ago)
Author:
george
Message:
  • Upraveno: Postupné odstraňování odkazů na tabulku users.
  • Upraveno: Některé stránky přepracovány do nového zobrazovacího systému.
  • Přidáno: Tabulka Subject rozdělena na tabulky Subject a Member. Transformační skript upraven.
Location:
www
Files:
4 added
13 edited

Legend:

Unmodified
Added
Removed
  • www/backup/index.php

    r150 r154  
    11<?php
    2 // Stránka pro řízení zálohování
    3 include('../style.php');
    4 ShowHeader('Zálohovací systém', 'Nastavení zálohování');
     2include_once('../global.php');
    53
    6 $Database->select_db('backup');
    7 $zpet = '<p><a href="index.php">Zpět</a></p>';
     4class BackupManagePage extends Page
     5{
     6  var $FullTitle = 'Zálohovací systém';
     7  var $ShortTitle = 'Nastavení zálohování';
     8 
     9  function Show()
     10  { 
     11        if(!$this->System->Modules['User']->CheckPermission('Network', 'Administration')) return('Nemáte oprávnění');
     12       
     13    $this->Database->select_db('backup');
     14    $zpet = '<p><a href="index.php">Zpět</a></p>';
    815
    9 if(!array_key_exists('action', $_GET)) $_GET['action'] = '';
     16    if(!array_key_exists('action', $_GET)) $_GET['action'] = '';
    1017
    11 switch($_GET['action'])
    12 {
    13   case 'add':
    14     $Database->insert('items', array('name' => $_POST['name'], 'parent' => $_POST['parent'], 'description' => $_POST['description']));
    15     echo('<p>Položka byla přidána.</p>'.$zpet);
    16     break;
    17   case 'backup_now':
    18     echo ('<pre>'.exec('/a/bin/backup-user.sh').'</pre>');
    19     echo('<p>Záloha byla vytvořena.</p>'.$zpet);
    20     break;
    21   case 'edit':
    22     $Database->update('items','id = '.$_POST['id'], array('name' => $_POST['name'], 'description' => $_POST['description']));
    23     echo('<p>Položka byla upravena.</p>'.$zpet);
    24     break;
    25   case 'update':
    26     //print_r($_POST);
    27     while(list($key, $val) = each($_POST))
     18    $Output = '';
     19    switch($_GET['action'])
    2820    {
    29       list($command, $id) = explode("_", $key);
    30       switch($command)
    31       {
    32         case 'edit':
    33           echo('<strong>Úprava položky:</strong><br/>');
    34           DB_Query('SELECT * FROM items WHERE id='.$id);
    35           while ($Item = DB_Row())
     21      case 'add':
     22        $this->Database->insert('items', array('name' => $_POST['name'], 'parent' => $_POST['parent'], 'description' => $_POST['description']));
     23        $Output .= '<p>Položka byla přidána.</p>'.$zpet;
     24        break;
     25      case 'backup_now':
     26        $Output .= '<pre>'.exec('/a/bin/backup-user.sh').'</pre>';
     27        $Output .= '<p>Záloha byla vytvořena.</p>'.$zpet;
     28        break;
     29      case 'edit':
     30        $this->Database->update('items','id = '.$_POST['id'], array('name' => $_POST['name'], 'description' => $_POST['description']));
     31        $Output .= '<p>Položka byla upravena.</p>'.$zpet;
     32        break;
     33      case 'update':
     34        //print_r($_POST);
     35        while(list($key, $val) = each($_POST))
     36        {
     37          list($command, $id) = explode("_", $key);
     38          switch($command)
    3639          {
    37             echo('<form action="index.php?action=edit" method="post"><input type="hidden" name="id" value="'.$id.'">');
    38             echo('Název/cesta<br/><input type="text" name="name" value="'.$Item['name'].'"><br/>Popis<br/><input type="text" name="description" value="'.$Item['description'].'"><br/><input type="submit" value="Odeslat"></form>');
     40            case 'edit':
     41              $Output .= '<strong>Úprava položky:</strong><br/>';
     42              $DbResult = $this->Database->query('SELECT * FROM items WHERE id='.$id);
     43              while ($Item = $DbResult->fetch_assoc())
     44              {
     45                $Output .= '<form action="index.php?action=edit" method="post"><input type="hidden" name="id" value="'.$id.'">';
     46                $Output .= 'Název/cesta<br/><input type="text" name="name" value="'.$Item['name'].'"><br/>Popis<br/><input type="text" name="description" value="'.$Item['description'].'"><br/><input type="submit" value="Odeslat"></form>';
     47              }
     48              break;
     49            case 'remove':
     50              $this->Database->query('DELETE FROM items WHERE id='.$id);
     51              $Output .= '<p>Položka byla smazána!</p>'.$zpet;
     52              break;
     53            case 'except':
     54              $Output .= '<strong>Přidání vyjímky:</strong><br/>';
     55              $DbResult = $this->Database->query('SELECT * FROM items WHERE id='.$id);
     56              while ($Item = $DbResult->fetch_array())
     57              {
     58                $Output .= '<form action="index.php?action=add" method="post"><input type="hidden" name="parent" value="'.$id.'">';
     59                $Output .= 'Název/cesta<br/><input type="text" name="name"><br/>Popis<br/><input type="text" name="description""><br/><input type="submit" value="Odeslat"></form>';
     60              }
     61              break;
    3962          }
    40           break;
    41         case 'remove':
    42           $Database->query("DELETE FROM items WHERE id=$id");
    43           echo('<p>Položka byla smazána!</p>'.$zpet);
    44           break;
    45         case 'except':
    46           echo('<strong>Přidání vyjímky:</strong><br/>');
    47           $DbResult = $Database->query("SELECT * FROM items WHERE id=$id");
    48           while ($Item = $DbResult->fetch_array())
     63          $Output .= $zpet;
     64        }
     65        break;
     66      default:
     67        $Output .= '<form action="index.php?action=update" method="post">';
     68        $Output .= '<table width="100%"><tr><td width="50%" valign="top">';
     69        // Seznam segmentů a zařízení
     70        $Output .= 'Seznam zálohovaných složek:<br><table border="1" cellspacing="0" cellpadding="3"><tr><th>Název/cesta</th><th>Popis</th><th>Operace</th></tr>';
     71        $DbResult = $this->Database->query('SELECT * FROM items WHERE parent=0');
     72        while($Row = $DbResult->fetch_array())
     73        {
     74          $Output .= '<tr><td>'.$Row['name'].'</td><td>&nbsp;'.$Row['description'].'</td><td><input type="submit" name="edit_'.$Row['id'].'" value="Upravit"/><input type="submit" name="remove_'.$Row['id'].'" value="Vymazat"/><input type="submit" name="except_'.$Row['id'].'" value="Přidat vyjímku"/></td></tr>';
     75          $DbResult2 = $this->Database->query("SELECT * FROM items WHERE parent=".$Row['id']);
     76          while($Except = $DbResult2->fetch_array())
    4977          {
    50             echo('<form action="index.php?action=add" method="post"><input type="hidden" name="parent" value="'.$id.'">');
    51             echo('Název/cesta<br/><input type="text" name="name"><br/>Popis<br/><input type="text" name="description""><br/><input type="submit" value="Odeslat"></form>');
     78            $Output .= '<tr><td>-&nbsp;&nbsp;'.$Except['name'].'</td><td>&nbsp;'.$Except['description'].'</td><td><input type="submit" name="edit_'.$Except['id'].'" value="Upravit vyjímku"/><input type="submit" name="remove_'.$Except['id'].'" value="Vymazat vyjímku"/></td></tr>';
    5279          }
    53           break;
    54       }
    55       echo($zpet);
    56     }
     80        }
     81        $Output .= '</table><br/></form>';
     82        $Output .= '<strong>Přidat položku</strong><br/>';
     83        $Output .= '<form action="index.php?action=add" method="post">Název/cesta<br/><input type="text" name="name"><br/>Popis<br/><input type="text" name="description"><br/><input type="submit" value="Odeslat"></form>';
     84        $Output .= '<strong>Provést zálohování</strong><br/>';
     85        $Output .= '<form action="index.php?action=backup_now" method="post"><input type="submit" value="Zálohuj"></form>';
     86        $Output .= '<strong>Popis zálohovacího systému</strong><br>Data jsou zálohována na pomocný 11 GB disk jako komprimovaný soubor. Zálohy dalších velkých souborů je nutné provádět ručně na klientské počítače správců sítě.<br/>Složky jsou kopírovány rekurzivně do hloubky (tzn. včetně podsložek). Pokud nechcete, aby složka byla procházena do hloubky, uveďte za její cestu "/*", jinak ale za názvem lomítko neuvádějte. Kromě toho je možné ke každé složce uvést seznam vyjímek. Ty jsou uváděny jako relativní cesty k souborům a složkám.<br>';
     87        }
     88        return($Output);
     89  }
     90}
    5791
    58     break;
    59   default:
    60     echo('<form action="index.php?action=update" method="post">');
    61     echo('<table width="100%"><tr><td width="50%" valign="top">');
    62     // Seznam segmentů a zařízení
    63     echo('Seznam zálohovaných složek:<br><table border="1" cellspacing="0" cellpadding="3"><tr><th>Název/cesta</th><th>Popis</th><th>Operace</th></tr>');
    64     $DbResult = $Database->query("SELECT * FROM items WHERE parent=0");
    65     while($Row = $DbResult->fetch_array())
    66     {
    67       echo('<tr><td>'.$Row['name'].'</td><td>&nbsp;'.$Row['description'].'</td><td><input type="submit" name="edit_'.$Row['id'].'" value="Upravit"/><input type="submit" name="remove_'.$Row['id'].'" value="Vymazat"/><input type="submit" name="except_'.$Row['id'].'" value="Přidat vyjímku"/></td></tr>');
    68       $DbResult2 = $Database->query("SELECT * FROM items WHERE parent=".$Row['id']);
    69       while($Except = $DbResult2->fetch_array())
    70       {
    71         echo('<tr><td>-&nbsp;&nbsp;'.$Except['name'].'</td><td>&nbsp;'.$Except['description'].'</td><td><input type="submit" name="edit_'.$Except['id'].'" value="Upravit vyjímku"/><input type="submit" name="remove_'.$Except['id'].'" value="Vymazat vyjímku"/></td></tr>');
    72       }
    73     }
    74     echo('</table><br/></form>');
    75     echo('<strong>Přidat položku</strong><br/>');
    76     echo('<form action="index.php?action=add" method="post">Název/cesta<br/><input type="text" name="name"><br/>Popis<br/><input type="text" name="description"><br/><input type="submit" value="Odeslat"></form>');
    77     echo('<strong>Provést zálohování</strong><br/>');
    78     echo('<form action="index.php?action=backup_now" method="post"><input type="submit" value="Zálohuj"></form>');
    79     echo('<strong>Popis zálohovacího systému</strong><br>Data jsou zálohována na pomocný 11 GB disk jako komprimovaný soubor. Zálohy dalších velkých souborů je nutné provádět ručně na klientské počítače správců sítě.<br/>Složky jsou kopírovány rekurzivně do hloubky (tzn. včetně podsložek). Pokud nechcete, aby složka byla procházena do hloubky, uveďte za její cestu "/*", jinak ale za názvem lomítko neuvádějte. Kromě toho je možné ke každé složce uvést seznam vyjímek. Ty jsou uváděny jako relativní cesty k souborům a složkám.<br>');
    80   }
    81 ShowFooter();
     92$System->AddModule(new BackupManagePage());
     93$System->Modules['BackupManagePage']->GetOutput();
     94
    8295?>
  • www/block/index.php

    r110 r154  
    66</head><body>
    77
     8<?php
     9/*
    810<div style="font-size: 20 pt;">Nemáte povoleno přistupovat k internetu!</div>
    911<br>
    1012<strong>Důvod:</strong>
    11 <?php
    1213$Duvody = array('Internet máte povolen, avšak došlo k chybě při kontrole přístupů k internetu.',
    1314'Váš počítač má blokován přístup k internetu.',
     
    3334} else echo($Duvody[4]);
    3435echo('<br><br>V případě problémů kontaktujte správce na emailové adrese robie@centrum.cz<br>');
     36*/
    3537?>
    3638Pokračujte na hlavní stránku serveru Centrála <a href="http://centrala.zdechov.net/">zde</a>
  • www/finance/user_state.php

    r153 r154  
    1818    $UserId = $this->System->Modules['User']->User['Id'];
    1919    if(!array_key_exists('show', $_GET)) $_GET['show'] = '';
    20     $DbResult = $this->Database->query("SELECT *,CONCAT(second_name, ' ', first_name) as fullname FROM users WHERE id=".$UserId);
     20    $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id=(SELECT Subject FROM Member WHERE Id=(SELECT Member FROM User='.$UserId.'))');
    2121    $Row2 = $DbResult->fetch_array();
    2222    $TarifName = $Tarify[$Row2['inet_tarif_next']]['name'];
     
    2424
    2525    // Tabulka operaci
    26     $Output .= 'Výpis operací pro účastníka '.$Row2['fullname'].':<br>';
     26    $Output .= 'Výpis operací pro účastníka '.$Row2['Name'].':<br>';
    2727    $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3"><tr><th>Datum</th><th>Popis</th><th>Částka</th><th>Doklad</th></tr>';
    2828    $Operations = array();
  • www/form_classes.php

    r148 r154  
    120120  'TFinanceSubject' => array(
    121121    'Type' => 'Reference',
    122     'Table' => 'users',
     122    'Table' => 'User',
    123123    'Id' => 'id',
    124     'Name' => 'CONCAT(second_name, " ", first_name)',
     124    'Name' => 'CONCAT(SecondName, " ", FirstName)',
    125125    'Filter' => 'role=2',
    126126  ),
  • www/global.php

    r153 r154  
    187187  global $Database;
    188188 
    189   $DbResult = $Database->query('SELECT id FROM users WHERE (SELECT user FROM hosts WHERE IP="'.$IP.'") = users.id');
     189  $DbResult = $Database->query('SELECT Id FROM User WHERE (SELECT user FROM hosts WHERE IP="'.$IP.'") = User.Id');
    190190  $DbRow = $DbResult->fetch_assoc();
    191   return($DbRow['id']);
     191  return($DbRow['Id']);
    192192}
    193193 
  • www/hostlist.php

    r148 r154  
    1313    while($Host = $DbResult->fetch_array())
    1414    {
    15       $DbResult2 = $this->Database->select('users','*, CONCAT(second_name," ",first_name) as fullname','id='.$Host['user']);
     15      $DbResult2 = $this->Database->select('User','*, CONCAT(SecondName, " ", FirstName) as FullName', 'Id='.$Host['user']);
    1616      $User = $DbResult2->fetch_array();
    1717      if($Host['online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = '';
    1818      if($Host['IP'] == '') $Host['IP'] = '&nbsp;';
    19       $Output .= '<tr><td style="text-align: left; '.$Style.'">'.$Host['name'].'</td><td>'.$Host['IP'].'</td><td style="text-align: right;">'.HumanDate($Host['last_online']).'</td><td style="text-align: right;">'.$User['fullname'].'</td></tr>';
     19      $Output .= '<tr><td style="text-align: left; '.$Style.'">'.$Host['name'].'</td><td>'.$Host['IP'].'</td><td style="text-align: right;">'.HumanDate($Host['last_online']).'</td><td style="text-align: right;">'.$User['FullName'].'</td></tr>';
    2020    }
    2121    $Output .= '</table></div>';
  • www/index.php

    r153 r154  
    104104    $Output = '<img alt="" src="images/favicons/comp.gif" width="16" height="16" /> '.$OnlineComputers.' / '.$TotalComputers.' &nbsp;  &nbsp; ';
    105105
    106     $DbResult = $this->Database->select('users', 'COUNT(*)', 'role=2');
     106    $DbResult = $this->Database->select('Member', 'COUNT(*)', 'MemberState=0');
    107107    $DbRow = $DbResult->fetch_array();
    108108    $TotalUser = $DbRow[0];
     
    121121    if($this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState'))
    122122    {
    123       $DbResult = $this->Database->select('users', 'cash', 'User='.$this->System->Modules['User']->User['Id']);
     123      $DbResult = $this->Database->select('Subject', 'Money', 'Id=(SELECT Subject FROM Member WHERE Id=(SELECT Member FROM User WHERE Id='.$this->System->Modules['User']->User['Id'].'))');
    124124      if($DbResult->num_rows > 0)
    125125      {
    126         $DbRow = $DbResult->fetch_array();
    127         $Finance = $DbRow[0];
    128         $Output2 .= ' &nbsp;  &nbsp; <img alt="" src="images/favicons/money.gif" width="16" height="16" /> '.$Finance.' Kč';
     126        $DbRow = $DbResult->fetch_assoc();
     127        $Output2 .= ' &nbsp;  &nbsp; <img alt="" src="images/favicons/money.gif" width="16" height="16" /> '.$DbRow['Money'].' Kč';
    129128      }
    130129    }
     
    157156  }
    158157
    159   // Zobrazení seznamu online počítačů
    160158  function OnlineHostList()
    161159  {
     
    172170  }
    173171
    174   // Zobrazení seznamu neplaticich uzivatelu
    175172  function ShowBadPayerList()
    176173  {
    177174    $Output .= '<div class="PanelTitle">Dlužníci:</div><span style="font-size: smaller;">';
    178     $DbResult = $Database->select('users', 'CONCAT(second_name, " ", first_name) as fullname', 'cash<0 AND role=2 ORDER BY cash');
     175    $DbResult = $Database->select('Subject', 'Name', 'Money < 0 ORDER BY Money');
    179176    while($Row = $DbResult->fetch_array())
    180177    {
    181       $Output .= $Row['fullname'].'<br />';
     178      $Output .= $Row['Name'].'<br />';
    182179    }
    183180    $Output .= '</span>';
     
    185182  }
    186183
    187   // Zobrazení času běhu počítače
    188184  function GetServerUptime()
    189185  {
    190186    $Data = explode(' ',exec('uptime'));
    191     $Data = array_slice($Data,3,-8);
     187    $Data = array_slice($Data, 3, -8);
    192188    $Uptime = '';
    193189    foreach($Data as $Item)
    194190    {
    195       if(strpos($Item,':')) $Uptime .= substr($Item,0,-1).' hodin';
     191      if(strpos($Item, ':')) $Uptime .= substr($Item, 0, -1).' hodin';
    196192      else $Uptime .= $Item.' ';
    197193    }
    198     $Uptime = str_replace('2 days,','2 dny a',$Uptime);
    199     $Uptime = str_replace('3 days,','3 dny a',$Uptime);
    200     $Uptime = str_replace('4 days,','4 dny a',$Uptime);
    201     $Uptime = str_replace('days,','dní a',$Uptime);
    202     $Uptime = str_replace('day,','den a',$Uptime);
    203     $Uptime = str_replace('min,','minut',$Uptime);
     194    $Uptime = str_replace('2 days,', '2 dny a', $Uptime);
     195    $Uptime = str_replace('3 days,', '3 dny a', $Uptime);
     196    $Uptime = str_replace('4 days,', '4 dny a', $Uptime);
     197    $Uptime = str_replace('days,', 'dní a', $Uptime);
     198    $Uptime = str_replace('day,', 'den a', $Uptime);
     199    $Uptime = str_replace('min,', 'minut', $Uptime);
    204200    return($Uptime);
    205201  }
     
    209205    global $Database, $Config, $User;
    210206
    211     //$Database->select_db('share');
    212     //$Output = $this->InfoBar();
    213     // Process cookies
    214207        $Output = '';
    215208    if(array_key_exists('Action', $_GET))
     
    301294    $Database->select_db('is');
    302295
     296    $Output .= $this->InfoBar();
    303297    $Output .= '<table id="MainTable"><tr><td valign="top">';
    304298    $Output .= '<div class="Panel">'.$this->ShowLinks($this->Links['main']).'</div>';
  • www/is/administration_page.php

    r150 r154  
    1818<a href="'.$this->System->Config['Web']['RootFolder'].'/statistic/bandwidth.php">Zatížení linky do internetu</a><br>
    1919<a href="'.$this->System->Config['Web']['RootFolder'].'/statistic/bandwidth_full.php">Zatížení linky do internetu všechny počítače</a><br>
    20 <a href="'.$this->System->Config['Web']['RootFolder'].'/is/dostupnost.php">Dostupnost sítě</a><br>
     20<a href="'.$this->System->Config['Web']['RootFolder'].'/network/dostupnost.php">Dostupnost sítě</a><br>
    2121<a href="'.$this->System->Config['Web']['RootFolder'].'/is/wlan.php">Bezdrátové sítě v okolí</a><br>
    2222<a href="'.$this->System->Config['Web']['RootFolder'].'/is/restart.php">Správa restartů služeb</a><br>
  • www/is/restart.php

    r44 r154  
    11<?php
    2 include('../style.php');
    3 ShowHeader('Restart služeb', 'Restart služeb');
     2include_once('../global.php');
    43
    5 $State = array('Neplánováno', 'V plánu');
     4class ServiceRestartPage extends Page
     5{
     6  var $FullTitle = 'Restart služeb';
     7  var $ShortTitle = 'Restart služeb';
     8  var $State = array('Neplánováno', 'V plánu');
     9  var $Period = 60;
     10 
     11  function Show()
     12  { 
     13        if(!$this->System->Modules['User']->CheckPermission('Network', 'Administration')) return('Nemáte oprávnění');
    614
    7 if(array_key_exists('set', $_POST))
    8 {
    9   foreach($_POST as $Index => $Item)
    10   {
    11     if(is_numeric($Index))
     15    if(array_key_exists('set', $_POST))
    1216    {
    13       $Id = addslashes($Index);   
    14       $Database->update('services_restart', 'id='.$Id, array('changed' => 1));
     17      foreach($_POST as $Index => $Item)
     18      {
     19        if(is_numeric($Index))
     20        {
     21          $Id = addslashes($Index);   
     22          $this->Database->update('services_restart', 'id='.$Id, array('changed' => 1));
     23        }
     24      }
    1525    }
     26
     27    $Output = 'Vyberte služby, které chcete restartovat:<br><form method="post">';
     28    $Output .= '<table border="1" cellspacing="0"><tr><th>Služba</th><th>Restart</th><th>Zbývající čas</th></tr>';
     29    $DbResult = $this->Database->select('services_restart', '*, UNIX_TIMESTAMP(last_time)');
     30    while($Service = $DbResult->fetch_array())
     31    {
     32      if($Service['changed'] == 1)
     33      {
     34        $RemainingTime = $this->Period - (time() - $Service['UNIX_TIMESTAMP(last_time)']);
     35        if($RemainingTime < 0) $RemainingTime = 0;
     36        $Schedule = date('i:s', $RemainingTime);
     37      } else $Schedule = '&nbsp;';
     38      $Output .= '<tr><td><input type="checkbox" name="'.$Service['id'].'">'.$Service['caption'].'</td><td>'.$this->State[$Service['changed']].'</td><td>'.$Schedule.'</td></tr>';
     39    }
     40    $Output .= '</table><input type="submit" name="set" value="Naplánovat restart vybraných"></form>';
     41        return($Output);
    1642  }
    1743}
    1844
    19 $Period = 60;
    20 
    21 echo('Vyberte služby, které chcete restartovat:<br><form method="post">');
    22 echo('<table border="1" cellspacing="0"><tr><th>Služba</th><th>Restart</th><th>Zbývající čas</th></tr>');
    23 $DbResult = $Database->select('services_restart', '*, UNIX_TIMESTAMP(last_time)');
    24 while($Service = $DbResult->fetch_array())
    25 {
    26   if($Service['changed'] == 1)
    27   {
    28     $RemainingTime = $Period - (time()-$Service['UNIX_TIMESTAMP(last_time)']);
    29     if($RemainingTime < 0) $RemainingTime = 0;
    30     $Schedule = date('i:s', $RemainingTime);
    31   } else $Schedule = '&nbsp;';
    32   echo('<tr><td><input type="checkbox" name="'.$Service['id'].'">'.$Service['caption'].'</td><td>'.$State[$Service['changed']].'</td><td>'.$Schedule.'</td></tr>');
    33 
    34 }
    35 echo('</table><input type="submit" name="set" value="Naplánovat restart vybraných"></form>');
     45$System->AddModule(new ServiceRestartPage());
     46$System->Modules['ServiceRestartPage']->GetOutput();
    3647
    3748?>
  • www/mapy/pokryti.php

    r4 r154  
    3636    // Preload user list
    3737    $Users = array();
    38     $DbResult = $Database->select('users','*');
     38    $DbResult = $Database->select('Member', '*');
    3939    while($Row = $DbResult->fetch_array()) $Users = array_merge($Users, array('i'.$Row['id'] => array('name' => $Row['name'], 'x' => $Row['PositionX'], 'y' => $Row['PositionY'])));     
    4040   
  • www/network/user_hosts.php

    r153 r154  
    1414<tr><th>Jméno počítače</th><th>Místní IP adresa</th><th>Veřejná IP adresa</th><th>CZFree IP adresa</th><th>Naposledy online</th><th>Fyzická adresa</th></tr>';
    1515
    16     $DbResult = $this->Database->select('hosts', '*', 'type=0 AND user='.$this->System->Modules['User']->User['Id']);
     16    $DbResult = $this->Database->select('hosts', '*', 'type=0 AND user='.$this->System->Modules['User']->User['Member']);
    1717    while($Host = $DbResult->fetch_array())
    1818    {
  • www/temp/transform.php

    r153 r154  
    136136    $this->Database->query('TRUNCATE TABLE User');
    137137    $this->Database->query('TRUNCATE TABLE Subject');
     138    $this->Database->query('TRUNCATE TABLE Member');
    138139
    139140    // Init permission groups
     
    208209    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupNetworkAdmins, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
    209210
     211    $this->Database->insert('PermissionOperation', array('Module' => 'Network', 'Operation' => 'Administration'));
     212    $OperationId = $this->Database->insert_id;
     213    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupNetworkAdmins, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
     214
    210215    $this->Database->insert('PermissionOperation', array('Module' => 'Log', 'Operation' => 'Show'));
    211216    $OperationId = $this->Database->insert_id;
     
    220225    while($DbRow = $DbResult->fetch_array())
    221226    {
    222       $this->Database->insert('User', array('Id' => $DbRow['id'], 'Name' => $DbRow['nick'], 'FirstName' => $DbRow['first_name'], 'SecondName' => $DbRow['second_name'], 'PhoneNumber' => $DbRow['phone'], 'Password' => substr(sha1(strtoupper($DbRow['nick'])), 0, 70), 'ICQ' => $DbRow['icq'], 'Email' => $DbRow['email'], 'Locked' => 0));
    223       $UserId = $this->Database->insert_id;
    224       if($DbRow['id'] == 1)
    225       {
    226         $this->Database->insert('PermissionUserAssignment', array('User' => $UserId, 'GroupOrOperation' => $PermissionGroupAdmin, 'Type' => 'Group'));
     227      if($DbRow['role'] == 0)
     228      {
     229        $this->Database->insert('Subject', array('Id' => $DbRow['id'], 'Name' => $DbRow['subject_name'], 'AddressStreet' => $DbRow['street'], 'AddressTown' => $DbRow['town'], 'AddressPSC' => $DbRow['psc'], 'IC' => $DbRow['ico'], 'DIC' => $DbRow['dic'], 'MapPositionX' => $DbRow['PositionX'], 'MapPositionY' => $DbRow['PositionY']));
     230      } else
     231      if($DbRow['role'] == 1)
     232      {
     233        $this->Database->insert('User', array('Id' => $DbRow['id'], 'Name' => $DbRow['nick'], 'FirstName' => $DbRow['first_name'], 'SecondName' => $DbRow['second_name'], 'PhoneNumber' => $DbRow['phone'], 'Password' => substr(sha1(strtoupper($DbRow['nick'])), 0, 70), 'ICQ' => $DbRow['icq'], 'Email' => $DbRow['email'], 'Locked' => 0));
     234        $UserId = $this->Database->insert_id;
     235        $this->Database->insert('PermissionUserAssignment', array('User' => $UserId, 'GroupOrOperation' => $PermissionGroupMembers, 'Type' => 'Group'));
    227236      } else
    228237      if($DbRow['role'] == 2)
    229238      {
    230         $this->Database->insert('Subject', array('Id' => $DbRow['id'], 'Name' => $DbRow['subject_name'], 'AddressStreet' => $DbRow['street'], 'AddressTown' => $DbRow['town'], 'AddressPSC' => $DbRow['psc'], 'IC' => $DbRow['ico'], 'DIC' => $DbRow['dic'], 'FamilyMemberCount' => $DbRow['family'], 'MapPositionX' => $DbRow['PositionX'], 'MapPositionY' => $DbRow['PositionY'], 'NetworkSegment' => $DbRow['network_segment'], 'InternetTariffCurrentMonth' => $DbRow['inet_tarif_now'], 'InternetTariffNextMonth' => $DbRow['inet_tarif_next'], 'MembershipDate' => $DbRow['membership_date']));
    231         $this->Database->insert('PermissionUserAssignment', array('User' => $UserId, 'GroupOrOperation' => $PermissionGroupSubjects, 'Type' => 'Group'));
    232       } else
    233         $this->Database->insert('PermissionUserAssignment', array('User' => $UserId, 'GroupOrOperation' => $PermissionGroupMembers, 'Type' => 'Group'));
     239        $this->Database->insert('Subject', array('Id' => $DbRow['id'], 'Name' => $DbRow['subject_name'], 'AddressStreet' => $DbRow['street'], 'AddressTown' => $DbRow['town'], 'AddressPSC' => $DbRow['psc'], 'IC' => $DbRow['ico'], 'DIC' => $DbRow['dic'], 'MapPositionX' => $DbRow['PositionX'], 'MapPositionY' => $DbRow['PositionY']));
     240                $SubjectId = $this->Database->insert_id;
     241                $this->Database->insert('Member', array('Id' => $DbRow['id'], 'Subject' => $SubjectId, 'FamilyMemberCount' => $DbRow['family'], 'NetworkSegment' => $DbRow['network_segment'], 'InternetTariffCurrentMonth' => $DbRow['inet_tarif_now'], 'InternetTariffNextMonth' => $DbRow['inet_tarif_next'], 'MembershipDate' => $DbRow['membership_date'], 'MemberState' => 0, 'BillingPeriod' => $DbRow['BillingPeriod']));
     242        $MemberId = $this->Database->insert_id;
     243        $this->Database->insert('User', array('Id' => $DbRow['id'], 'Name' => $DbRow['nick'], 'FirstName' => $DbRow['first_name'], 'SecondName' => $DbRow['second_name'], 'PhoneNumber' => $DbRow['phone'], 'Password' => substr(sha1(strtoupper($DbRow['nick'])), 0, 70), 'ICQ' => $DbRow['icq'], 'Email' => $DbRow['email'], 'Locked' => 0, 'Member' => $MemberId));
     244        $UserId = $this->Database->insert_id;
     245                $this->Database->update('Member', 'Id='.$MemberId, array('ResponsibleUser' => $UserId));
     246                if($DbRow['id'] == 1) $this->Database->insert('PermissionUserAssignment', array('User' => $UserId, 'GroupOrOperation' => $PermissionGroupAdmin, 'Type' => 'Group'));
     247          else $this->Database->insert('PermissionUserAssignment', array('User' => $UserId, 'GroupOrOperation' => $PermissionGroupSubjects, 'Type' => 'Group'));
     248      }
    234249    }
    235250
  • www/userlist.php

    r148 r154  
    1111    $Output = '<table class="WideTable" style="font-size: small;"><tr><th>Jméno uživatele</th><th>E-mail</th><th>ICQ</th><th>Telefon</th><th>Počítače</th></tr>';
    1212
    13     $DbResult = $this->Database->select('users', '*, CONCAT(second_name," ",first_name) as fullname', '1 ORDER BY fullname');
     13    $DbResult = $this->Database->select('User', '*, TRIM(CONCAT(SecondName, " ", FirstName)) as FullName', 'Name != "Anonym" ORDER BY FullName');
    1414    while($User = $DbResult->fetch_array())
    1515    {
    16       if($User['icq'] > 0) $ICQ = $User['icq']; else $ICQ = '&nbsp;';
    17       if($User['phone'] > 0) $Phone = $User['phone']; else $Phone = '&nbsp;';
     16      if($User['ICQ'] > 0) $ICQ = $User['ICQ']; else $ICQ = '&nbsp;';
     17      if($User['PhoneNumber'] > 0) $Phone = $User['PhoneNumber']; else $Phone = '&nbsp;';
    1818
    19       $DbResult2 = $this->Database->select('hosts', '*', 'user='.$User['id'].' AND block=0 ORDER BY name');
     19      $DbResult2 = $this->Database->select('hosts', '*', 'user='.$User['Id'].' AND block=0 ORDER BY name');
    2020      $Hosts = '';
    2121      while($Host = $DbResult2->fetch_array())
     
    2525      }
    2626      if($Hosts != '') $Hosts = substr($Hosts, 0, -2);
    27       $Output .= '<tr><td>'.$User['fullname'].'</td><td>'.$User['email'].'&nbsp;</td><td>'.$ICQ.'</td><td>'.$Phone.'</td><td>'.$Hosts.'</td></tr>';
     27      $Output .= '<tr><td>'.$User['FullName'].'</td><td>'.$User['Email'].'&nbsp;</td><td>'.$ICQ.'</td><td>'.$Phone.'</td><td>'.$Hosts.'</td></tr>';
    2828    }
    2929    $Output .= '</table>';
Note: See TracChangeset for help on using the changeset viewer.