- Timestamp:
- May 14, 2013, 9:21:06 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/index.php
r533 r538 6 6 function ShowMenu() 7 7 { 8 global $System ;8 global $System, $Config; 9 9 10 10 $Output = '<h3>Volby pro správu</h3>'. 11 '<a href="https:// wowpreklad.zdechov.net/mysql/">Správa databáze</a><br/>'.11 '<a href="https://'.$Config['Web']['Host'].'/phpmyadmin/">Správa databáze</a><br/>'. 12 12 '<small>Rozhraní phpMyAdmin pro přímou správu databáze</small><br/><br/>'. 13 13 '<a href="'.$System->Link('/action.php?action=dbkit').'">DB opravy</a><br/>'. … … 23 23 '<a href="'.$System->Link('/admin/?action=addnew').'">Přidání aktuality</a><br/>'. 24 24 '<small>Přidá aktulitu na hlavní stranu projektu</small><br/><br/>'. 25 '<a href="'.$System->Link('/admin/?action= error').'">Testovací chyba</a><br/>'.26 '<small> Vyvolá testovací chybu</small><br/><br/>';25 '<a href="'.$System->Link('/admin/?action=testing').'">Testování</a><br/>'. 26 '<small>Testovací funkce</small><br/><br/>'; 27 27 return($Output); 28 28 } … … 68 68 } 69 69 70 function TestError( )70 function TestError($P1, $P2) 71 71 { 72 72 $s = $TT[0]; 73 } 74 75 function TestException($P1, $P2) 76 { 77 throw new Exception('Test exception'); 78 } 79 80 function TestSQLError($Query) 81 { 82 global $System; 83 84 $DbResult = $System->Database->query($Query); 85 } 86 87 function Testing() 88 { 89 global $System; 90 91 $Output = '<a href="'.$System->Link('/admin/?action=error').'">Testovací chyba</a><br/>'. 92 '<small>Vyvolá testovací chybu</small><br/><br/>'. 93 '<a href="'.$System->Link('/admin/?action=exception').'">Testovací výjimka</a><br/>'. 94 '<small>Vyvolá testovací chybu</small><br/><br/>'. 95 '<a href="'.$System->Link('/admin/?action=sqlerror').'">Chybný SQL dotaz</a><br/>'. 96 '<small>Vyvolá testovací chybu</small><br/><br/>'; 97 return($Output); 73 98 } 74 99 … … 80 105 if($_GET['action'] == 'img_level') $Output .= ImgLevelShow(); 81 106 else if($_GET['action'] == 'delerrlog') $Output .= DeleteErrorLog(); 82 else if($_GET['action'] == 'error') $Output .= TestError(); 107 else if($_GET['action'] == 'error') $Output .= TestError(12, 'test'); 108 else if($_GET['action'] == 'exception') $Output .= TestException(12, 'test'); 109 else if($_GET['action'] == 'sqlerror') $Output .= TestSQLError('SELECT dads FROM sdas'); 110 else if($_GET['action'] == 'testing') $Output .= Testing(); 83 111 else if($_GET['action'] == 'addnew') 84 112 { -
trunk/dictionary.php
r533 r538 130 130 if($User->Licence(LICENCE_USER)) 131 131 { 132 $System->Database->query('DELETE FROM `Dictionary` WHERE (`User`='.$User->Id.') AND (`Id`='. $_GET['id'].')');132 $System->Database->query('DELETE FROM `Dictionary` WHERE (`User`='.$User->Id.') AND (`Id`='.($_GET['id'] * 1).')'); 133 133 $Output = ShowMessage('Záznam odstraněn.'); 134 134 } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL); … … 142 142 if($User->Licence(LICENCE_USER)) 143 143 { 144 $DbResult = $System->Database->query('SELECT * FROM `Dictionary` WHERE `Id`='.$_GET['id']); 145 $DbRow = $DbResult->fetch_assoc(); 146 $DbResult = $System->Database->query('SELECT * FROM `Dictionary` WHERE (`User` IS NULL) '. 147 'AND (`Entry`='.$DbRow['Entry'].') AND (`Language`= '.$Config['OriginalLanguage'].')'); 148 $DbRow2 = $DbResult->fetch_assoc(); 149 $Output = '<form action="dictionary.php?action=save" method="post">'. 144 $DbResult = $System->Database->query('SELECT * FROM `Dictionary` WHERE `Id`='.($_GET['id'] * 1)); 145 if($DbResult->num_rows > 0) 146 { 147 $DbRow = $DbResult->fetch_assoc(); 148 $DbResult = $System->Database->query('SELECT * FROM `Dictionary` WHERE (`User` IS NULL) '. 149 'AND (`Entry`='.$DbRow['Entry'].') AND (`Language`= '.$Config['OriginalLanguage'].')'); 150 $DbRow2 = $DbResult->fetch_assoc(); 151 $Output = '<form action="dictionary.php?action=save" method="post">'. 150 152 '<fieldset><legend>Upravení slova</legend>'. 151 153 '<input type="hidden" name="id" value="'.$_GET['id'].'"/>'. … … 159 161 '</fieldset>'. 160 162 '</form>'; 163 } else $Output = ShowMessage('Položka nenalezena', MESSAGE_CRITICAL); 161 164 } else $Output = ShowMessage('Nemáte oprávnění', MESSAGE_CRITICAL); 162 165 return($Output); -
trunk/includes/Database.php
r525 r538 38 38 var $ShowSQLQuery = false; 39 39 40 function __construct($Host, $User, $Password, $Database) 40 function __construct() 41 { 42 } 43 44 function Connect($Host, $User, $Password, $Database) 41 45 { 42 46 if($this->Type == 'mysql') $ConnectionString = 'mysql:host='.$Host.';dbname='.$Database; … … 61 65 { 62 66 $Result->num_rows = $Result->PDOStatement->rowCount(); 67 $this->insert_id = $this->PDO->lastInsertId(); 63 68 } else 64 69 { … … 66 71 $this->Error = $this->Error[2]; 67 72 if(($this->Error != '') and ($this->ShowSQLError == true)) 68 {69 73 echo('<div><strong>SQL Error: </strong>'.$this->Error.'<br />'.$Query.'</div>'); 70 echo(debug_backtrace()); 71 } 74 throw new Exception('SQL Error: '.$this->Error); 72 75 } 73 $this->insert_id = $this->PDO->lastInsertId();74 76 return($Result); 75 77 } -
trunk/includes/Page.php
r536 r538 234 234 235 235 $Output = '<strong>Překladové skupiny:</strong><br /><div id="TranslationMenu">'; 236 $DbResult = $System->Database->select('Group', 'Id, Name' );236 $DbResult = $System->Database->select('Group', 'Id, Name', '1 ORDER BY Name'); 237 237 while($Group = $DbResult->fetch_assoc()) 238 238 { -
trunk/includes/Version.php
r537 r538 1 1 <?php 2 2 3 $Revision = 53 7; // Subversion revision3 $Revision = 538; // Subversion revision 4 4 $DatabaseRevision = 537; // Database structure revision 5 $ReleaseTime = '2013-05-1 2';5 $ReleaseTime = '2013-05-14'; 6 6 7 7 ?> -
trunk/includes/error.php
r507 r538 1 1 <?php 2 2 3 function EmptyErrorHandler($Number, $Message, $Filename, $LineNumber, $Variables) 4 { 5 } 6 7 function CustomErrorHandler($Number, $Message, $Filename, $LineNumber, $Variables) 3 function Report($Backtrace) 8 4 { 9 5 global $Config; 10 6 11 set_error_handler('EmptyErrorHandler'); 7 $Error = ''; 8 $Date = date('Y-m-d H:i:s'); 9 foreach($Backtrace as $Item) 10 { 11 if(!array_key_exists('line', $Item)) $Item['line'] = ''; 12 if(!array_key_exists('file', $Item)) $Item['file'] = ''; 13 if(!array_key_exists('function', $Item)) $Item['function'] = ''; 14 $Error .= ' '.$Item['file'].'('.$Item['line'].")\t".$Item['function']; 15 $Arguments = ''; 16 if(array_key_exists('args', $Item) and is_array($Item['args'])) 17 foreach($Item['args'] as $Item) 18 { 19 if(is_array($Item)) $Arguments .= "'".serialize($Item)."',"; 20 else $Arguments .= "'".serialize($Item)."',"; 21 } 22 if(strlen($Arguments) > 0) $Error .= '('.substr($Arguments, 0, -1).')'; 23 $Error .= "\n"; 24 } 25 $Error .= "\n"; 26 //if($Config['Web']['ErrorLogFile'] != '') 27 //error_log($Error, 3, $Config['Web']['ErrorLogFile']); 28 // Pošli mi zprávu (pokud je to kritická chyba) 29 //mail($Config['Web']['AdminEmail'], $Config['Web']['Title'].' - Chybové hlášení', $Error); 30 // Show error message 31 if($Config['Web']['ShowPHPError'] == true) 32 { 33 echo('<?xml version="1.0" encoding="utf-8"?>'."\n". 34 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'. 35 '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">'. 36 '<head>'. 37 '<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />'. 38 '</head><body>'. 39 'Došlo k vnitřní chybě!<br /> O chybě byl uvědoměn správce webu a chybu brzy odstraní.<br /><br />'); 40 echo('<pre>'.$Error.'</pre><br />'); 41 echo('</body></html>'); 42 } 43 WriteLog($Error, LOG_TYPE_ERROR); 44 } 12 45 13 $Date = date('Y-m-d H:i:s'); // časové razítko položky 46 function ErrorHandler($Number, $Message, $FileName, $LineNumber, $Variables) 47 { 48 $UserErrors = E_ALL; //E_ERROR | E_WARNING | E_PARSE; 14 49 $ErrorType = array 15 50 ( … … 26 61 1024 => 'User Notice' 27 62 ); 28 $UserErrors = E_ALL; //E_ERROR | E_WARNING | E_PARSE;29 63 30 64 if(($UserErrors & $Number)) 31 65 { 32 $Error = '# '.$Date.' : '.$Message.' on line '.$LineNumber."\n";33 66 $Backtrace = debug_backtrace(); 34 $Backtrace[0]['function'] = '';67 $Backtrace[0]['function'] = $Message; 35 68 $Backtrace[0]['args'] = ''; 36 //$First = array_shift($Backtrace); 37 //print_r($First); 38 39 //array_unshift($Backtrace, $First); 40 //array_shift($Backtrace); 41 //print_r($Backtrace); 42 foreach($Backtrace as $Item) 43 { 44 //print_r($Item); 45 if(!array_key_exists('line', $Item)) $Item['line'] = ''; 46 if(!array_key_exists('file', $Item)) $Item['file'] = ''; 47 if(!array_key_exists('function', $Item)) $Item['function'] = ''; 48 $Error .= ' '.$Item['file'].'('.$Item['line'].")\t".$Item['function']; 49 $Arguments = ''; 50 if(array_key_exists('args', $Item) and is_array($Item['args'])) 51 foreach($Item['args'] as $Item) 52 { 53 if(is_array($Item)) $Arguments .= "'".serialize($Item)."',"; 54 else $Arguments .= "'".serialize($Item)."',"; 55 } 56 if(strlen($Arguments) > 0) $Error .= '('.substr($Arguments, 0, -1).')'; 57 $Error .= "\n"; 58 59 } 60 $Error .= "\n"; 61 //if($Config['Web']['ErrorLogFile'] != '') 62 //error_log($Error, 3, $Config['Web']['ErrorLogFile']); 63 // Pošli mi zprávu (pokud je to kritická chyba) 64 //mail($Config['Web']['AdminEmail'], $Config['Web']['Title'].' - Chybové hlášení', $Error); 65 // Show error message 66 if($Config['Web']['ShowPHPError'] == true) 67 { 68 echo('<?xml version="1.0" encoding="utf-8"?>'."\n". 69 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'. 70 '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">'. 71 '<head>'. 72 '<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />'. 73 '</head><body>'. 74 'Došlo k vnitřní chybě!<br /> O chybě byl uvědoměn správce webu a chybu brzy odstraní.<br /><br />'); 75 echo('<pre>'.$Error.'</pre><br />'); // V případě ladění chybu i zobraz 76 echo('</body></html>'); 77 } 78 WriteLog($Error, LOG_TYPE_ERROR); 69 $Backtrace[0]['file'] = $FileName; 70 $Backtrace[0]['line'] = $LineNumber; 71 Report($Backtrace); 79 72 if((E_ERROR | E_PARSE) & $Number) die(); 80 73 } 81 set_error_handler('CustomErrorHandler');82 74 } 83 75 84 //set_error_handler('CustomErrorHandler'); 76 function ExceptionHandler(Exception $Exception) 77 { 78 $Backtrace = $Exception->getTrace(); 79 array_unshift($Backtrace, array( 80 'function' => $Exception->getMessage(), 81 'file' => $Exception->getFile(), 82 'line' => $Exception->getLine(), 83 )); 84 Report($Backtrace); 85 die(); 86 } 85 87 86 88 ?> -
trunk/includes/global.php
r536 r538 47 47 $User = new User($System); 48 48 49 set_error_handler('CustomErrorHandler'); 49 set_error_handler('ErrorHandler'); 50 set_exception_handler('ExceptionHandler'); 50 51 51 52 // TODO: Global initialized variable should be removed -
trunk/includes/system.php
r507 r538 32 32 33 33 $this->Config = $Config; 34 $this->Database = new Database($this->Config['Database']['Host'], 34 $this->Database = new Database(); 35 $this->Database->Connect($this->Config['Database']['Host'], 35 36 $this->Config['Database']['User'], $this->Config['Database']['Password'], 36 37 $this->Config['Database']['Database']); -
trunk/log.php
r536 r538 57 57 $Output .= '<a href="log.php?type='.$LogType['Id'].'" style="color:'.$LogType['Color'].'" title="'.$LogType['Name'].'">'.$LogType['Name'].'</a> '; 58 58 } 59 }60 59 // echo ' Formát: datum: text zprávy (uživatel, IP)<br /><br />'; 61 60 $Output .= '<br /><br />'; … … 92 91 { 93 92 if($Line['Type'] == LOG_TYPE_ERROR) $Line['Text'] = htmlspecialchars($Line['Text']); 94 $Output .= '<tr><td>'.$Line['Date'].'</td>'. 93 $Line['Text'] = str_replace("\n", '<br>', $Line['Text']); 94 $Output .= '<tr><td>'.$Line['Date'].'</td>'. 95 95 '<td>'.$Line['LogName'].'</td>'. 96 96 '<td><span style="color: '.$Line['LogColor'].'">'.$Line['Text'].'</span></td>'. … … 100 100 $Output .= '</table>'. 101 101 $PageList['Output']; 102 102 } else $Output .= ShowMessage('Nemáte oprávnění.', MESSAGE_CRITICAL); 103 103 104 ShowPage($Output); 104 105 }
Note:
See TracChangeset
for help on using the changeset viewer.