Changeset 62 for trunk/www/view/debug.php
- Timestamp:
- Aug 5, 2009, 7:30:23 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/view/debug.php
r56 r62 28 28 function ShowListOnRow($Row) 29 29 { 30 $Row['Time'] = '<a href="?Action= ServerDebug&Id='.$Row['Id'].'&Show=Backtrace">'.str_replace(' ', ' ', $Row['Time']).'</a>';30 $Row['Time'] = '<a href="?Action=DebugView&Id='.$Row['Id'].'&Show=Backtrace">'.str_replace(' ', ' ', $Row['Time']).'</a>'; 31 31 $Row['Uptime'] = TimeToHumanTime($Row['Uptime']); 32 32 return($Row); … … 39 39 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 40 40 { 41 $ Server = new Server($this->Database, $_GET['Id']);42 if(($this->System->Modules['User']->User['Id'] == $ Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))41 $Realm = new Realm($this->Database, $_GET['Id']); 42 if(($this->System->Modules['User']->User['Id'] == $Realm->GetUser()) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 43 43 { 44 44 $Output = '<h4>Ladící záznamy restartů</h4>'; 45 45 $Table = new Table($this->ItemListFormClass); 46 46 $Table->OnRow = array($this, 'ShowListOnRow'); 47 $Table->Definition['Table'] = '(SELECT * FROM Debug WHERE Server='.$_GET['Id'].')';47 $Table->Definition['Table'] = '(SELECT * FROM Debug WHERE Realm='.$_GET['Id'].')'; 48 48 $Table->LoadValuesFromDatabase($this->Database); 49 49 $Output .= $Table->Show(); … … 59 59 function Item() 60 60 { 61 global $System; 62 61 63 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 62 64 { 63 $ Server = new Server($this->Database, $_GET['Id']);64 if(($this->System->Modules['User']->User['Id'] == $ Server->Server['User']) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))65 $Realm = new Realm($this->Database, $_GET['Id']); 66 if(($this->System->Modules['User']->User['Id'] == $Realm->GetUser()) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)) 65 67 { 66 68 $Output = '<div>Ladící informace serveru</div>'; 67 $MangosDebug = new MangosDebug($this->Database); 68 $Output .= $MangosDebug->Show($Server->Id); 69 70 $MangosDebug = new MangosDebug($this->Database, $this->System); 71 $Form = new Form($this->ItemFormClass); 72 if($Form->LoadValuesFromDatabase($_GET['Id'])) 73 { 74 $Form->Values['Uptime'] = TimeToHumanTime($Form->Values['Uptime']); 75 $Output .= $Form->ShowTable(); 76 77 $Output .= '<a href="?Action=DebugView&Id='.$_GET['Id'].'&Show=Backtrace">Backtrace</a>'. 78 ' <a href="?Action=DebugView&Id='.$_GET['Id'].'&Show=Log">Mangos log</a>'. 79 ' <a href="?Action=DebugView&Id='.$_GET['Id'].'&Show=Error">Console error log</a>'. 80 ' <a href="?Action=DebugView&Id='.$_GET['Id'].'&Show=DbErrors">Database error log</a>'. 81 ' <a href="?Action=DebugView&Id='.$_GET['Id'].'&Show=Configuration">Mangos configuration</a>'. 82 '<hr>'; 83 if(array_key_exists('Show', $_GET)) 84 { 85 $Show = addslashes($_GET['Show']); 86 switch($Show) 87 { 88 case 'Backtrace': 89 $DbResult = $this->Database->select('Debug', 'Backtrace', 'Id='.$_GET['Id']); 90 $DbRow = $DbResult->fetch_assoc(); 91 $Content = htmlspecialchars($DbRow['Backtrace']); 92 for($I = 1; $I < $MangosDebug->MaxMangosThreadCount; $I++) 93 { 94 $Content = str_replace('Thread '.$I.' ', '<hr><strong id="'.$I.'">Thread '.$I.'</strong>', $Content); 95 $Content = str_replace(' '.$I.' Thread ', '<a href="#'.$I.'"">'.$I.' Thread</a>', $Content); 96 } 97 $Output .= '<strong>Backtrace:</strong> <br><pre>'.$Content.'</pre>'; 98 break; 99 case 'Log': 100 $DbResult = $this->Database->select('Debug', 'Log', 'Id='.$_GET['Id']); 101 $DbRow = $DbResult->fetch_assoc(); 102 $Output .= '<strong>Console standard output log:</strong> <br><pre>'.htmlspecialchars($DbRow['Log']).'</pre>'; 103 break; 104 case 'Error': 105 $DbResult = $this->Database->select('Debug', 'ErrorLog', 'Id='.$_GET['Id']); 106 $DbRow = $DbResult->fetch_assoc(); 107 $Output .= '<strong>Console error log:</strong> <br><pre>'.htmlspecialchars($DbRow['ErrorLog']).'</pre>'; 108 break; 109 case 'DbErrors': 110 $DbResult = $this->Database->select('Debug', 'DbErrors', 'Id='.$_GET['Id']); 111 $DbRow = $DbResult->fetch_assoc(); 112 $Output .= '<strong>Database error log:</strong> <br><pre>'.htmlspecialchars($DbRow['DbErrors']).'</pre>'; 113 break; 114 case 'Configuration': 115 $DbResult = $this->Database->select('Debug', 'Configuration', 'Id='.$_GET['Id']); 116 $DbRow = $DbResult->fetch_assoc(); 117 $Output .= '<strong>Mangos configuration:</strong> <br><pre>'.htmlspecialchars($DbRow['Configuration']).'</pre>'; 118 break; 119 } 120 } 121 } else $Output = 'Položka nenalezena'; 69 122 } else $this->SystemMessage('Ladící informace', 'Nemáte oprávnění'); 70 123 } else $Output = USER_BAD_ROLE; 71 124 return($Output); 72 } 125 } 73 126 } 74 127
Note:
See TracChangeset
for help on using the changeset viewer.