Changeset 154
- Timestamp:
- Feb 16, 2009, 7:54:34 PM (16 years ago)
- Location:
- www
- Files:
-
- 4 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
www/backup/index.php
r150 r154 1 1 <?php 2 // Stránka pro řízení zálohování 3 include('../style.php'); 4 ShowHeader('Zálohovací systém', 'Nastavení zálohování'); 2 include_once('../global.php'); 5 3 6 $Database->select_db('backup'); 7 $zpet = '<p><a href="index.php">Zpět</a></p>'; 4 class 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>'; 8 15 9 if(!array_key_exists('action', $_GET)) $_GET['action'] = '';16 if(!array_key_exists('action', $_GET)) $_GET['action'] = ''; 10 17 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']) 28 20 { 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) 36 39 { 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; 39 62 } 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> '.$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()) 49 77 { 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>- '.$Except['name'].'</td><td> '.$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>'; 52 79 } 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 } 57 91 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> '.$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>- '.$Except['name'].'</td><td> '.$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 82 95 ?> -
www/block/index.php
r110 r154 6 6 </head><body> 7 7 8 <?php 9 /* 8 10 <div style="font-size: 20 pt;">Nemáte povoleno přistupovat k internetu!</div> 9 11 <br> 10 12 <strong>Důvod:</strong> 11 <?php12 13 $Duvody = array('Internet máte povolen, avšak došlo k chybě při kontrole přístupů k internetu.', 13 14 'Váš počítač má blokován přístup k internetu.', … … 33 34 } else echo($Duvody[4]); 34 35 echo('<br><br>V případě problémů kontaktujte správce na emailové adrese robie@centrum.cz<br>'); 36 */ 35 37 ?> 36 38 Pokračujte na hlavní stránku serveru Centrála <a href="http://centrala.zdechov.net/">zde</a> -
www/finance/user_state.php
r153 r154 18 18 $UserId = $this->System->Modules['User']->User['Id']; 19 19 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.'))'); 21 21 $Row2 = $DbResult->fetch_array(); 22 22 $TarifName = $Tarify[$Row2['inet_tarif_next']]['name']; … … 24 24 25 25 // Tabulka operaci 26 $Output .= 'Výpis operací pro účastníka '.$Row2[' fullname'].':<br>';26 $Output .= 'Výpis operací pro účastníka '.$Row2['Name'].':<br>'; 27 27 $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>'; 28 28 $Operations = array(); -
www/form_classes.php
r148 r154 120 120 'TFinanceSubject' => array( 121 121 'Type' => 'Reference', 122 'Table' => ' users',122 'Table' => 'User', 123 123 'Id' => 'id', 124 'Name' => 'CONCAT( second_name, " ", first_name)',124 'Name' => 'CONCAT(SecondName, " ", FirstName)', 125 125 'Filter' => 'role=2', 126 126 ), -
www/global.php
r153 r154 187 187 global $Database; 188 188 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'); 190 190 $DbRow = $DbResult->fetch_assoc(); 191 return($DbRow[' id']);191 return($DbRow['Id']); 192 192 } 193 193 -
www/hostlist.php
r148 r154 13 13 while($Host = $DbResult->fetch_array()) 14 14 { 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']); 16 16 $User = $DbResult2->fetch_array(); 17 17 if($Host['online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = ''; 18 18 if($Host['IP'] == '') $Host['IP'] = ' '; 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>'; 20 20 } 21 21 $Output .= '</table></div>'; -
www/index.php
r153 r154 104 104 $Output = '<img alt="" src="images/favicons/comp.gif" width="16" height="16" /> '.$OnlineComputers.' / '.$TotalComputers.' '; 105 105 106 $DbResult = $this->Database->select(' users', 'COUNT(*)', 'role=2');106 $DbResult = $this->Database->select('Member', 'COUNT(*)', 'MemberState=0'); 107 107 $DbRow = $DbResult->fetch_array(); 108 108 $TotalUser = $DbRow[0]; … … 121 121 if($this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState')) 122 122 { 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'].'))'); 124 124 if($DbResult->num_rows > 0) 125 125 { 126 $DbRow = $DbResult->fetch_array(); 127 $Finance = $DbRow[0]; 128 $Output2 .= ' <img alt="" src="images/favicons/money.gif" width="16" height="16" /> '.$Finance.' Kč'; 126 $DbRow = $DbResult->fetch_assoc(); 127 $Output2 .= ' <img alt="" src="images/favicons/money.gif" width="16" height="16" /> '.$DbRow['Money'].' Kč'; 129 128 } 130 129 } … … 157 156 } 158 157 159 // Zobrazení seznamu online počítačů160 158 function OnlineHostList() 161 159 { … … 172 170 } 173 171 174 // Zobrazení seznamu neplaticich uzivatelu175 172 function ShowBadPayerList() 176 173 { 177 174 $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'); 179 176 while($Row = $DbResult->fetch_array()) 180 177 { 181 $Output .= $Row[' fullname'].'<br />';178 $Output .= $Row['Name'].'<br />'; 182 179 } 183 180 $Output .= '</span>'; … … 185 182 } 186 183 187 // Zobrazení času běhu počítače188 184 function GetServerUptime() 189 185 { 190 186 $Data = explode(' ',exec('uptime')); 191 $Data = array_slice($Data, 3,-8);187 $Data = array_slice($Data, 3, -8); 192 188 $Uptime = ''; 193 189 foreach($Data as $Item) 194 190 { 195 if(strpos($Item, ':')) $Uptime .= substr($Item,0,-1).' hodin';191 if(strpos($Item, ':')) $Uptime .= substr($Item, 0, -1).' hodin'; 196 192 else $Uptime .= $Item.' '; 197 193 } 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); 204 200 return($Uptime); 205 201 } … … 209 205 global $Database, $Config, $User; 210 206 211 //$Database->select_db('share');212 //$Output = $this->InfoBar();213 // Process cookies214 207 $Output = ''; 215 208 if(array_key_exists('Action', $_GET)) … … 301 294 $Database->select_db('is'); 302 295 296 $Output .= $this->InfoBar(); 303 297 $Output .= '<table id="MainTable"><tr><td valign="top">'; 304 298 $Output .= '<div class="Panel">'.$this->ShowLinks($this->Links['main']).'</div>'; -
www/is/administration_page.php
r150 r154 18 18 <a href="'.$this->System->Config['Web']['RootFolder'].'/statistic/bandwidth.php">Zatížení linky do internetu</a><br> 19 19 <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> 21 21 <a href="'.$this->System->Config['Web']['RootFolder'].'/is/wlan.php">Bezdrátové sítě v okolí</a><br> 22 22 <a href="'.$this->System->Config['Web']['RootFolder'].'/is/restart.php">Správa restartů služeb</a><br> -
www/is/restart.php
r44 r154 1 1 <?php 2 include('../style.php'); 3 ShowHeader('Restart služeb', 'Restart služeb'); 2 include_once('../global.php'); 4 3 5 $State = array('Neplánováno', 'V plánu'); 4 class 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í'); 6 14 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)) 12 16 { 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 } 15 25 } 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 = ' '; 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); 16 42 } 17 43 } 18 44 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 = ' '; 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(); 36 47 37 48 ?> -
www/mapy/pokryti.php
r4 r154 36 36 // Preload user list 37 37 $Users = array(); 38 $DbResult = $Database->select(' users','*');38 $DbResult = $Database->select('Member', '*'); 39 39 while($Row = $DbResult->fetch_array()) $Users = array_merge($Users, array('i'.$Row['id'] => array('name' => $Row['name'], 'x' => $Row['PositionX'], 'y' => $Row['PositionY']))); 40 40 -
www/network/user_hosts.php
r153 r154 14 14 <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>'; 15 15 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']); 17 17 while($Host = $DbResult->fetch_array()) 18 18 { -
www/temp/transform.php
r153 r154 136 136 $this->Database->query('TRUNCATE TABLE User'); 137 137 $this->Database->query('TRUNCATE TABLE Subject'); 138 $this->Database->query('TRUNCATE TABLE Member'); 138 139 139 140 // Init permission groups … … 208 209 $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupNetworkAdmins, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation')); 209 210 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 210 215 $this->Database->insert('PermissionOperation', array('Module' => 'Log', 'Operation' => 'Show')); 211 216 $OperationId = $this->Database->insert_id; … … 220 225 while($DbRow = $DbResult->fetch_array()) 221 226 { 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')); 227 236 } else 228 237 if($DbRow['role'] == 2) 229 238 { 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 } 234 249 } 235 250 -
www/userlist.php
r148 r154 11 11 $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>'; 12 12 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'); 14 14 while($User = $DbResult->fetch_array()) 15 15 { 16 if($User[' icq'] > 0) $ICQ = $User['icq']; else $ICQ = ' ';17 if($User[' phone'] > 0) $Phone = $User['phone']; else $Phone = ' ';16 if($User['ICQ'] > 0) $ICQ = $User['ICQ']; else $ICQ = ' '; 17 if($User['PhoneNumber'] > 0) $Phone = $User['PhoneNumber']; else $Phone = ' '; 18 18 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'); 20 20 $Hosts = ''; 21 21 while($Host = $DbResult2->fetch_array()) … … 25 25 } 26 26 if($Hosts != '') $Hosts = substr($Hosts, 0, -2); 27 $Output .= '<tr><td>'.$User[' fullname'].'</td><td>'.$User['email'].' </td><td>'.$ICQ.'</td><td>'.$Phone.'</td><td>'.$Hosts.'</td></tr>';27 $Output .= '<tr><td>'.$User['FullName'].'</td><td>'.$User['Email'].' </td><td>'.$ICQ.'</td><td>'.$Phone.'</td><td>'.$Hosts.'</td></tr>'; 28 28 } 29 29 $Output .= '</table>';
Note:
See TracChangeset
for help on using the changeset viewer.