Changeset 154 for www/is/restart.php
- Timestamp:
- Feb 16, 2009, 7:54:34 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 ?>
Note:
See TracChangeset
for help on using the changeset viewer.