Changeset 69
- Timestamp:
- Feb 28, 2016, 10:54:30 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 16 added
- 2 deleted
- 13 edited
- 4 moved
-
.htaccess (added)
-
Application (added)
-
Application/Core.php (moved) (moved from trunk/Application.php ) (2 diffs)
-
Application/DefaultConfig.php (added)
-
Application/UpdateTrace.php (moved) (moved from trunk/UpdateTrace.php ) (2 diffs)
-
Application/Version.php (moved) (moved from trunk/Version.php ) (1 diff)
-
Application/View.php (added)
-
Config (added)
-
Global.php (modified) (3 diffs)
-
Graph.php (modified) (2 diffs)
-
Modules (added)
-
Modules/Measure (added)
-
Modules/Measure/Measure.php (moved) (moved from trunk/Measure.php ) (3 diffs)
-
Packages/Common/AppModule.php (added)
-
Packages/Common/Application.php (added)
-
Packages/Common/Base.php (added)
-
Packages/Common/Common.php (modified) (4 diffs)
-
Packages/Common/Config.php (added)
-
Packages/Common/Database.php (modified) (4 diffs)
-
Packages/Common/Error.php (modified) (2 diffs)
-
Packages/Common/Image.php (modified) (6 diffs)
-
Packages/Common/Locale.php (added)
-
Packages/Common/Mail.php (modified) (14 diffs)
-
Packages/Common/NetworkAddress.php (modified) (1 diff)
-
Packages/Common/Page.php (added)
-
Packages/Common/RSS.php (modified) (5 diffs)
-
Packages/Common/Setup.php (added)
-
Packages/Common/Table.php (added)
-
Packages/Common/UTF8.php (modified) (3 diffs)
-
Packages/Common/Update.php (added)
-
Update.php (deleted)
-
add.php (modified) (2 diffs)
-
config.sample.php (deleted)
-
index.php (modified) (1 diff)
-
style/style.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Core.php
r68 r69 1 1 <?php 2 2 3 class Application 3 $ConfigFileName = dirname(__FILE__).'/../Config/Config.php'; 4 if(file_exists($ConfigFileName)) include_once($ConfigFileName); 5 6 include_once(dirname(__FILE__).'/../Global.php'); 7 include_once(dirname(__FILE__).'/Version.php'); 8 include_once(dirname(__FILE__).'/View.php'); 9 include_once(dirname(__FILE__).'/UpdateTrace.php'); 10 include_once(dirname(__FILE__).'/DefaultConfig.php'); 11 12 class Core extends Application 4 13 { 5 var $Database; 14 var $Pages; 15 var $ShowPage; 16 var $BaseURL; 6 17 7 function Start() 18 function __construct() 19 { 20 parent::__construct(); 21 $this->Pages = array(); 22 $this->ShowPage = true; 23 $this->BaseURL = $_SERVER['SCRIPT_NAME']; 24 if(substr($this->BaseURL, -10, 10) == '/index.php') 25 $this->BaseURL = substr($this->BaseURL, 0, -10); 26 } 27 28 function RunCommon() 8 29 { 9 30 global $Config, $DatabaseRevision; 10 11 $FileName = dirname(__FILE__).'/config.php';12 if(file_exists($FileName)) include_once($FileName);13 else {14 die('Configuration file "'.$FileName.'" not found.');15 }16 31 17 32 session_start(); … … 33 48 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item); 34 49 35 // Check database persistence structure 36 $UpdateManager = new UpdateManager(); 37 $UpdateManager->Database = $this->Database; 38 $UpdateManager->Revision = $DatabaseRevision; 39 if(!$UpdateManager->IsInstalled()) die('Systém vyžaduje instalaci databáze.'); 40 if(!$UpdateManager->IsUpToDate()) die('Systém vyžaduje aktualizaci databáze.'); 50 $this->Config = &$Config; 41 51 52 // Register and start existing modules 53 $this->Setup = new Setup($this); 54 $this->Setup->Start(); 55 if($this->Setup->CheckState()) 56 { 57 $this->ModuleManager->Start(); 58 } 59 } 60 61 function Run() 62 { 63 $this->RunCommon(); 64 if($this->ShowPage) 65 { 66 $this->PathItems = ProcessURL(); 67 $this->ShowPage(); 68 } 69 } 70 71 function ShowPage() 72 { 73 $this->BaseView = new BaseView($this); 74 75 /* @var $Page Page */ 76 $ClassName = $this->SearchPage($this->PathItems, $this->Pages); 77 if($ClassName != '') 78 { 79 $Page = new $ClassName($this); 80 } else { 81 $Page = new PageMissing($this); 82 } 83 echo($this->BaseView->GetOutput($Page)); 84 } 85 86 function RegisterPage($Path, $Handler) 87 { 88 if(is_array($Path)) 89 { 90 $Page = &$this->Pages; 91 $LastKey = array_pop($Path); 92 foreach($Path as $PathItem) 93 { 94 $Page = &$Page[$PathItem]; 95 } 96 if(!is_array($Page)) $Page = array('' => $Page); 97 $Page[$LastKey] = $Handler; 98 } else $this->Pages[$Path] = $Handler; 99 } 100 101 function UnregisterPage($Path) 102 { 103 unset($this->Pages[$Path]); 104 } 105 106 function SearchPage($PathItems, $Pages) 107 { 108 if(count($PathItems) > 0) $PathItem = $PathItems[0]; 109 else $PathItem = ''; 110 if(array_key_exists($PathItem, $Pages)) 111 { 112 if(is_array($Pages[$PathItem])) 113 { 114 array_shift($PathItems); 115 return($this->SearchPage($PathItems, $Pages[$PathItem])); 116 } else return($Pages[$PathItem]); 117 } else return(''); 118 } 119 120 function Link($Target) 121 { 122 return($this->BaseURL.$Target); 42 123 } 43 124 } 125 126 class PageMissing extends Page 127 { 128 function __construct($System) 129 { 130 parent::__construct($System); 131 $this->ParentClass = ''; 132 $this->Title = T('Page not found'); 133 } 134 135 function Show() 136 { 137 Header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); 138 return('<h3 align="center">'.T('Required page not found')); 139 } 140 } -
trunk/Application/UpdateTrace.php
r68 r69 1 1 <?php 2 2 3 class UpdateTrace 3 function FullInstall($Manager) 4 4 { 5 var $Manager; 6 7 function FullInstall($Manager) 8 { 9 $this->Manager->Execute('CREATE TABLE IF NOT EXISTS `SystemVersion` ( 5 $Manager->Execute('CREATE TABLE IF NOT EXISTS `SystemVersion` ( 10 6 `Id` int(11) NOT NULL AUTO_INCREMENT, 11 7 `Revision` int(11) NOT NULL, 12 8 PRIMARY KEY (`Id`) 13 9 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'); 14 $this->Manager->Execute('INSERT INTO `SystemVersion` (`Id`, `Version`) VALUES (NULL, 65);'); 15 } 10 $Manager->Execute('INSERT INTO `SystemVersion` (`Id`, `Revision`) VALUES (NULL, 65);'); 11 $Manager->Execute('CREATE TABLE IF NOT EXISTS `measure` ( 12 `Id` int(11) NOT NULL auto_increment, 13 `Name` varchar(255) collate utf8_general_ci NOT NULL, 14 `Description` varchar(255) collate utf8_general_ci NOT NULL, 15 `Divider` int(11) NOT NULL default 1, 16 `Unit` varchar(16) collate utf8_general_ci NOT NULL, 17 `Continuity` tinyint(1) NOT NULL default 0, 18 `Period` int(11) NOT NULL default 60, 19 `OldName` varchar(32) collate utf8_general_ci NOT NULL, 20 `PermissionView` varchar(255) collate utf8_general_ci NOT NULL default "all", 21 `PermissionAdd` varchar(255) collate utf8_general_ci NOT NULL default "localhost.localdomain", 22 `Info` varchar(255) collate utf8_general_ci NOT NULL, 23 `Enabled` int(11) NOT NULL default 1, 24 `Cumulative` int(11) NOT NULL default 0, 25 `DataTable` varchar(32) collate utf8_general_ci NOT NULL default "data", 26 `DataType` varchar(32) collate utf8_general_ci NOT NULL, 27 PRIMARY KEY (`Id`) 28 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'); 29 } 16 30 17 function UpdateTo67($Manager) 18 { 19 $this->Manager->Execute('RENAME TABLE `measure` TO `Measure`;'); 20 $this->Manager->Execute('CREATE TABLE IF NOT EXISTS `Permission` ( 31 function UpdateTo67($Manager) 32 { 33 $Manager->Execute('RENAME TABLE `measure` TO `Measure`;'); 34 /* 35 $Manager->Execute('CREATE TABLE IF NOT EXISTS `Permission` ( 21 36 `Id` int(11) NOT NULL AUTO_INCREMENT, 22 37 `Measure` int(11) NOT NULL, … … 26 41 KEY `Measure` (`Measure`) 27 42 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'); 28 $this->Manager->Execute('ALTER TABLE `Permission` ADD FOREIGN KEY (`Measure`) '.29 'REFERENCES `Measure`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');30 $DbResult = $this->Manager->Execute('SELECT `Id`, `PermissionAdd` FROM `Measure`');31 while($DbRow = $DbResult->fetch_assoc())32 {33 $this->Manager->Execute('INSERT INTO `Permission` (`Measure`, `Operation`) VALUES ('.43 $Manager->Execute('ALTER TABLE `Permission` ADD FOREIGN KEY (`Measure`) '. 44 'REFERENCES `Measure`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;'); 45 $DbResult = $Manager->Execute('SELECT `Id`, `PermissionAdd` FROM `Measure`'); 46 while($DbRow = $DbResult->fetch_assoc()) 47 { 48 $Manager->Execute('INSERT INTO `Permission` (`Measure`, `Operation`) VALUES ('. 34 49 $DbRow['Id'].', "add");'); 35 50 } 36 $DbResult = $this->Manager->Execute('SELECT `Id`, `PermissionView` FROM `Measure`');37 while($DbRow = $DbResult->fetch_assoc())38 {39 $ this->Manager->Execute('INSERT INTO `Permission` (`Measure`, `Operation`) VALUES ('.51 $DbResult = $Manager->Execute('SELECT `Id`, `PermissionView` FROM `Measure`'); 52 while($DbRow = $DbResult->fetch_assoc()) 53 { 54 $Manager->Execute('INSERT INTO `Permission` (`Measure`, `Operation`) VALUES ('. 40 55 $DbRow['Id'].', "view");'); 41 }42 //$this->Manager->Execute('');43 56 } 57 */ 58 } 44 59 45 function __construct() 60 class Updates 61 { 62 function Get() 46 63 { 47 $this->Updates =array(64 return(array( 48 65 65 => array('Revision' => 67, 'Function' => 'UpdateTo67'), 49 ) ;66 )); 50 67 } 51 68 } -
trunk/Application/Version.php
r68 r69 8 8 $Revision = 67; 9 9 $DatabaseRevision = 67; 10 $ReleaseTime = strtotime('2016-0 1-03');10 $ReleaseTime = strtotime('2016-02-28'); -
trunk/Global.php
r67 r69 1 1 <?php 2 2 3 include_once('Version.php');4 3 include_once('Types.php'); 5 4 include_once('Classes.php'); 6 5 include_once('Packages/Common/Common.php'); 7 include_once('Measure.php');8 include_once('Application.php');9 include_once('Update.php');10 6 11 7 function HumanDate($Time) … … 18 14 list($Usec, $Sec) = explode(" ", microtime()); 19 15 return ((float)$Usec + (float)$Sec); 20 }21 22 function ShowPage($Content)23 {24 global $Config, $ReleaseTime, $Revision;25 26 $Output = '<?xml version="1.0" encoding="'.$Config['Web']['Charset'].'"?>'."\n".27 '<!DOCTYPE html>'.28 '<html>'.29 '<head>'.30 '<meta http-equiv="Content-Language" content="cs"/>'.31 '<meta http-equiv="content-type" content="text/html; charset='.$Config['Web']['Charset'].'" />'.32 '<meta name="robots" content="all" />'.33 '<title>'.$Config['Web']['Title'].'</title>'.34 '<link rel="StyleSheet" href="style/style.css" type="text/css" media="all"/>'.35 '</head><body>';36 $Output .= $Content;37 $Output .= '<br/><div style="text-align: center; font-size: small;">Verze: '.$Revision.' ('.HumanDate($ReleaseTime).')'.38 ' <a href="http://svn.zdechov.net/trac/statistic/browser/trunk">Zdrojový kód</a> '.39 '<a href="http://svn.zdechov.net/trac/statistic/log/trunk?verbose=on">Historie změn</a></div>';40 $Output .= '</body></html>';41 echo($Output);42 16 } 43 17 … … 97 71 return($Output); 98 72 } 73 74 function ProcessURL() 75 { 76 if(array_key_exists('REDIRECT_QUERY_STRING', $_SERVER)) 77 $PathString = $_SERVER['REDIRECT_QUERY_STRING']; 78 else $PathString = ''; 79 if(substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1); 80 $PathItems = explode('/', $PathString); 81 if(array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false)) 82 $_SERVER['QUERY_STRING'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1); 83 else $_SERVER['QUERY_STRING'] = ''; 84 parse_str($_SERVER['QUERY_STRING'], $_GET); 85 return($PathItems); 86 } 87 88 function GetQueryStringArray($QueryString) 89 { 90 $Result = array(); 91 $Parts = explode('&', $QueryString); 92 foreach($Parts as $Part) 93 { 94 if($Part != '') 95 { 96 if(!strpos($Part, '=')) $Part .= '='; 97 $Item = explode('=', $Part); 98 $Result[$Item[0]] = $Item[1]; 99 } 100 } 101 return($Result); 102 } 103 104 function SetQueryStringArray($QueryStringArray) 105 { 106 $Parts = array(); 107 foreach($QueryStringArray as $Index => $Item) 108 { 109 $Parts[] = $Index.'='.$Item; 110 } 111 return(implode('&', $Parts)); 112 } -
trunk/Graph.php
r67 r69 1 1 <?php 2 2 3 include ('Global.php');3 include_once('Application/Core.php'); 4 4 5 5 class MeasureGraph … … 216 216 } 217 217 218 $Application = new Application(); 219 $Application->Start(); 220 $Graph = new MeasureGraph($this->Database); 218 $Core = new Core(); 219 $Core->ShowPage = false; 220 $Core->Run(); 221 $Graph = new MeasureGraph($Core->Database); 221 222 $Graph->Render(); -
trunk/Modules/Measure/Measure.php
r68 r69 1 1 <?php 2 3 include_once(dirname(__FILE__).'/Page.php'); 4 5 class ModuleMeasure extends AppModule 6 { 7 function __construct($System) 8 { 9 parent::__construct($System); 10 $this->Name = 'Measure'; 11 $this->Version = '1.0'; 12 $this->Creator = 'Chronos'; 13 $this->License = 'GNU/GPL'; 14 $this->Description = 'Measurement processing'; 15 $this->Dependencies = array(); 16 } 17 18 function DoStart() 19 { 20 $this->System->RegisterPage('', 'PageMain'); 21 } 22 } 2 23 3 24 include_once('Point.php'); … … 47 68 function Load($Id) 48 69 { 49 $Result = $this->Database->select(' measure', '*', 'Id='.$Id);70 $Result = $this->Database->select('Measure', '*', '`Id`='.$Id); 50 71 if($Result->num_rows > 0) 51 72 { … … 60 81 $Time = time(); 61 82 62 $Result = $this->Database->select($this->Data['DataTable'], '*', '(` measure`='.$this->Data['Id'].') AND '.83 $Result = $this->Database->select($this->Data['DataTable'], '*', '(`Measure`='.$this->Data['Id'].') AND '. 63 84 '(`level`=0) ORDER BY `time` DESC LIMIT 2'); 64 85 if($Result->num_rows == 0) { -
trunk/Packages/Common/Common.php
r61 r69 10 10 include_once(dirname(__FILE__).'/VarDumper.php'); 11 11 include_once(dirname(__FILE__).'/Error.php'); 12 include_once(dirname(__FILE__).'/Base.php'); 13 include_once(dirname(__FILE__).'/Application.php'); 14 include_once(dirname(__FILE__).'/AppModule.php'); 15 include_once(dirname(__FILE__).'/Config.php'); 16 include_once(dirname(__FILE__).'/Page.php'); 17 include_once(dirname(__FILE__).'/Locale.php'); 18 include_once(dirname(__FILE__).'/Update.php'); 19 include_once(dirname(__FILE__).'/Setup.php'); 20 include_once(dirname(__FILE__).'/Table.php'); 12 21 13 22 class PackageCommon … … 15 24 var $Name; 16 25 var $Version; 26 var $ReleaseDate; 17 27 var $License; 18 28 var $Creator; … … 22 32 { 23 33 $this->Name = 'Common'; 24 $this->Version = '1.1'; 34 $this->Version = '1.2'; 35 $this->ReleaseDate = strtotime('2016-01-22'); 25 36 $this->Creator = 'Chronos'; 26 37 $this->License = 'GNU/GPL'; … … 28 39 } 29 40 } 41 42 class Paging 43 { 44 var $TotalCount; 45 var $ItemPerPage; 46 var $Around; 47 var $SQLLimit; 48 var $Page; 49 50 function __construct(System $System) 51 { 52 $this->ItemPerPage = $System->Config['Web']['ItemsPerPage']; 53 $this->Around = $System->Config['Web']['VisiblePagingItems']; 54 } 55 56 function Show() 57 { 58 $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']); 59 60 $Result = ''; 61 if(array_key_exists('all', $QueryItems)) 62 { 63 $PageCount = 1; 64 $ItemPerPage = $this->TotalCount; 65 } else 66 { 67 $ItemPerPage = $this->ItemPerPage; 68 $Around = round($this->Around / 2); 69 $PageCount = floor($this->TotalCount / $ItemPerPage) + 1; 70 } 71 72 if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0; 73 if(array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1; 74 if($_SESSION['Page'] < 0) $_SESSION['Page'] = 0; 75 if($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1; 76 $CurrentPage = $_SESSION['Page']; 77 78 $Result .= 'Počet položek: <strong>'.$this->TotalCount.'</strong> Stránky: '; 79 80 $Result = ''; 81 if($PageCount > 1) 82 { 83 if($CurrentPage > 0) 84 { 85 $QueryItems['page'] = 0; 86 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'"><<</a> '; 87 $QueryItems['page'] = ($CurrentPage - 1); 88 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'"><</a> '; 89 } 90 $PagesMax = $PageCount - 1; 91 $PagesMin = 0; 92 if($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around; 93 if($PagesMin < ($CurrentPage - $Around)) 94 { 95 $Result.= ' ... '; 96 $PagesMin = $CurrentPage - $Around; 97 } 98 for($i = $PagesMin; $i <= $PagesMax; $i++) 99 { 100 if($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> '; 101 else { 102 $QueryItems['page'] = $i; 103 $Result .= '<a href="?'.SetQueryStringArray($QueryItems).'">'.($i + 1).'</a> '; 104 } 105 } 106 if($PagesMax < ($PageCount - 1)) $Result .= ' ... '; 107 if($CurrentPage < ($PageCount - 1)) 108 { 109 $QueryItems['page'] = ($CurrentPage + 1); 110 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'">></a> '; 111 $QueryItems['page'] = ($PageCount - 1); 112 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'">>></a>'; 113 } 114 } 115 $QueryItems['all'] = '1'; 116 if($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>'; 117 118 $Result = '<div style="text-align: center">'.$Result.'</div>'; 119 $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage; 120 $this->Page = $CurrentPage; 121 return($Result); 122 } 123 } -
trunk/Packages/Common/Database.php
r55 r69 2 2 3 3 // Extended database class 4 // Date: 201 1-11-254 // Date: 2016-01-11 5 5 6 6 class DatabaseResult … … 27 27 class Database 28 28 { 29 var $Prefix = '';29 var $Prefix; 30 30 var $Functions; 31 31 var $Type; 32 32 var $PDO; 33 var $Error = '';33 var $Error; 34 34 var $insert_id; 35 var $LastQuery = '';35 var $LastQuery; 36 36 var $ShowSQLError; 37 37 var $ShowSQLQuery; 38 var $LogSQLQuery; 39 var $LogFile; 38 40 39 41 function __construct() 40 42 { 43 $this->Prefix = ''; 44 $this->Functions = array('NOW()', 'CURDATE()', 'CURTIME()', 'UUID()'); 41 45 $this->Type = 'mysql'; // mysql, pgsql 46 $this->Error = ''; 47 $this->LastQuery = ''; 42 48 $this->ShowSQLError = false; 43 49 $this->ShowSQLQuery = false; 44 $this->Functions = array('NOW()', 'CURDATE()', 'CURTIME()', 'UUID()'); 50 $this->LogSQLQuery = false; 51 $this->LogFile = dirname(__FILE__).'/../../Query.log'; 45 52 } 46 53 … … 77 84 function query($Query) 78 85 { 79 if(!$this->Connected()) throw new Exception('Not connected to database'); 86 if(!$this->Connected()) throw new Exception(T('Not connected to database')); 87 if(($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true)) $QueryStartTime = microtime(); 80 88 $this->LastQuery = $Query; 89 if(($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true)) 90 $Duration = ' ; '.round(microtime() - $QueryStartTime, 4). ' s'; 91 if($this->LogSQLQuery == true) 92 file_put_contents($this->LogFile, $Query.$Duration."\n", FILE_APPEND); 81 93 if($this->ShowSQLQuery == true) 82 echo('<div style="border-bottom-width: 1px; border-bottom-style: solid; padding-bottom: 3px; padding-top: 3px; font-size: 12px; font-family: Arial;">'.$Query.'</div>'."\n"); 94 echo('<div style="border-bottom-width: 1px; border-bottom-style: solid; '. 95 'padding-bottom: 3px; padding-top: 3px; font-size: 12px; font-family: Arial;">'.$Query.$Duration.'</div>'."\n"); 83 96 $Result = new DatabaseResult(); 84 97 $Result->PDOStatement = $this->PDO->query($Query); … … 175 188 } 176 189 190 function quote($Text) 191 { 192 return($this->PDO->quote($Text)); 193 } 194 177 195 public function __sleep() 178 196 { -
trunk/Packages/Common/Error.php
r61 r69 74 74 die(); 75 75 } 76 76 77 77 function ShowDefaultError($Message) 78 78 { … … 112 112 113 113 foreach($this->OnError as $OnError) 114 $OnError[0]->$OnError[1]($Error);114 call_user_func($OnError, $Error); 115 115 } 116 116 } -
trunk/Packages/Common/Image.php
r55 r69 12 12 var $FileName; 13 13 var $Color; 14 15 function __construct() 14 15 function __construct() 16 16 { 17 17 $this->Color = COLOR_BLACK; … … 27 27 var $Y; 28 28 29 function __construct() 29 function __construct() 30 30 { 31 31 $this->Color = COLOR_BLACK; … … 40 40 var $Color; 41 41 42 function __construct() 42 function __construct() 43 43 { 44 44 $this->Color = COLOR_BLACK; … … 47 47 } 48 48 49 class Image 49 class Image 50 50 { 51 var $Image; 51 var $Image; 52 52 var $Type; 53 53 var $Font; 54 54 var $Pen; 55 55 56 56 function __construct() 57 57 { … … 59 59 $this->Type = IMAGETYPE_PNG; 60 60 $this->Pen = new Pen(); 61 $this->Font = new Font(); 62 $this->Brush = new Brush(); 61 $this->Font = new Font(); 62 $this->Brush = new Brush(); 63 63 } 64 64 65 65 function SaveToFile($FileName) 66 66 { 67 if($this->Type == IMAGETYPE_JPEG) 67 if($this->Type == IMAGETYPE_JPEG) 68 68 { 69 69 imagejpeg($this->Image, $FileName); 70 70 } else 71 if($this->Type == IMAGETYPE_GIF) 71 if($this->Type == IMAGETYPE_GIF) 72 72 { 73 73 imagegif($this->Image, $FileName); 74 74 } else 75 if($this->Type == IMAGETYPE_PNG) 75 if($this->Type == IMAGETYPE_PNG) 76 76 { 77 77 imagepng($this->Image, $FileName); 78 78 } 79 79 } 80 80 81 81 function LoadFromFile($FileName) 82 82 { 83 83 $ImageInfo = getimagesize($FileName); 84 84 $this->Type = $ImageInfo[2]; 85 if($this->Type == IMAGETYPE_JPEG) 85 if($this->Type == IMAGETYPE_JPEG) 86 86 { 87 87 $this->Image = imagecreatefromjpeg($FileName); 88 88 } else 89 if($this->Type == IMAGETYPE_GIF) 89 if($this->Type == IMAGETYPE_GIF) 90 90 { 91 91 $this->Image = imagecreatefromgif($FileName); 92 92 } else 93 if( $this->Type == IMAGETYPE_PNG) 93 if( $this->Type == IMAGETYPE_PNG) 94 94 { 95 95 $this->Image = imagecreatefrompng($FileName); 96 } 96 } 97 97 } 98 98 99 99 function Output() 100 100 { … … 103 103 104 104 function SetSize($Width, $Height) 105 { 105 { 106 106 $NewImage = imagecreatetruecolor($Width, $Height); 107 imagecopy($NewImage, $this->Image, 0, 0, 0, 0, $this->GetWidth(), $this->GetHeight()); 107 imagecopy($NewImage, $this->Image, 0, 0, 0, 0, $this->GetWidth(), $this->GetHeight()); 108 108 imagedestroy($this->Image); 109 109 $this->Image = $NewImage; 110 110 } 111 111 112 function GetWidth() 113 { 112 function GetWidth() 113 { 114 114 return(imagesx($this->Image)); 115 115 } 116 117 function GetHeight() 116 117 function GetHeight() 118 118 { 119 119 return(imagesy($this->Image)); 120 120 } 121 121 122 122 function TextOut($X, $Y, $Text) 123 123 { 124 124 imagettftext($this->Image, $this->Font->Size, 0, $X, $Y, $this->ConvertColor($this->Font->Color), $this->Font->FileName, $Text); 125 125 } 126 126 127 127 function ConvertColor($Color) 128 128 { 129 129 return(imagecolorallocate($this->Image, ($Color >> 16) & 0xff, ($Color >> 8) & 0xff, $Color & 0xff)); 130 130 } 131 131 132 132 function FillRect($X1, $Y1, $X2, $Y2) 133 133 { 134 134 imagefilledrectangle($this->Image, $X1, $Y1, $X2, $Y2, $this->ConvertColor($this->Brush->Color)); 135 135 } 136 136 137 137 function Line($X1, $Y1, $X2, $Y2) 138 138 { -
trunk/Packages/Common/Mail.php
r55 r69 13 13 var $From; 14 14 var $Recipients; 15 var $Bodies; 15 var $Bodies; 16 16 var $Attachments; 17 17 var $AgentIdent; … … 19 19 var $ReplyTo; 20 20 var $Headers; 21 21 22 22 function __construct() 23 23 { 24 $this->Priorities = array('1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)'); 24 $this->Priorities = array('1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)'); 25 25 $this->Boundary = md5(date('r', time())); 26 26 $this->AgentIdent = 'PHP/Mail'; 27 27 $this->Clear(); 28 28 } 29 29 30 30 function Clear() 31 31 { … … 63 63 function AddBody($Content, $MimeType = 'text/plain', $Charset = 'utf-8') 64 64 { 65 $this->Bodies[] = array('Content' => $Content, 'Type' => strtolower($MimeType), 65 $this->Bodies[] = array('Content' => $Content, 'Type' => strtolower($MimeType), 66 66 'Charset' => strtolower($Charset)); 67 67 } … … 75 75 { 76 76 if(!intval($Priority)) return(false); 77 77 78 78 if(!isset($this->priorities[$Priority - 1])) return(false); 79 79 80 $this->xheaders['X-Priority'] = $this->priorities[$Priority - 1]; 80 $this->xheaders['X-Priority'] = $this->priorities[$Priority - 1]; 81 81 return(true); 82 82 } 83 83 84 84 function AttachFile($FileName, $FileType, $Disposition = DISPOSITION_ATTACHMENT) 85 { 86 $this->Attachments[] = array('FileName' => $FileName, 'FileType' => $FileType, 85 { 86 $this->Attachments[] = array('FileName' => $FileName, 'FileType' => $FileType, 87 87 'Disposition' => $Disposition, 'Type' => 'File'); 88 88 } … … 90 90 function AttachData($FileName, $FileType, $Data, $Disposition = DISPOSITION_ATTACHMENT) 91 91 { 92 $this->Attachments[] = array('FileName' => $FileName, 'FileType' => $FileType, 92 $this->Attachments[] = array('FileName' => $FileName, 'FileType' => $FileType, 93 93 'Disposition' => $Disposition, 'Type' => 'Data', 'Data' => $Data); 94 94 } … … 96 96 function Send() 97 97 { 98 if(count($this->Bodies) == 0) throw new Exception( 'Mail: Need at least one text body');99 98 if(count($this->Bodies) == 0) throw new Exception(T('Mail message need at least one text body')); 99 100 100 $Body = $this->BuildAttachment($this->BuildBody()); 101 101 102 102 $To = ''; 103 103 $this->Headers['CC'] = ''; 104 104 $this->Headers['BCC'] = ''; 105 foreach($this->Recipients as $Index => $Recipient) 105 foreach($this->Recipients as $Index => $Recipient) 106 106 { 107 107 if($Recipient['Type'] == 'SendCombined') … … 126 126 } 127 127 } 128 if($To == '') throw new Exception( 'Mail: Need at least one recipient address');129 128 if($To == '') throw new Exception(T('Mail message need at least one recipient address')); 129 130 130 $this->Headers['Mime-Version'] = '1.0'; 131 131 132 132 if($this->AgentIdent != '') $this->Headers['X-Mailer'] = $this->AgentIdent; 133 133 if($this->ReplyTo != '') $this->Headers['Reply-To'] = $this->ReplyTo; … … 135 135 136 136 $Headers = ''; 137 foreach($this->Headers as $Header => $Value) 137 foreach($this->Headers as $Header => $Value) 138 138 { 139 139 if(($Header != 'Subject') and ($Value != '')) $Headers .= $Header.': '.$Value."\n"; 140 } 140 } 141 141 142 142 $this->Subject = strtr($this->Subject, "\r\n", ' '); 143 143 144 if($this->Subject == '') throw new Exception( 'Mail: Missing Subject');145 144 if($this->Subject == '') throw new Exception(T('Mail message missing Subject')); 145 146 146 147 147 $res = mail($To, $this->Subject, $Body, $Headers); … … 152 152 { 153 153 if(ereg(".*<(.+)>", $Address, $regs)) $Address = $regs[1]; 154 if(ereg("^[^@ ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)\$", $Address)) 154 if(ereg("^[^@ ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)\$", $Address)) 155 155 return(true); 156 156 else return(false); … … 159 159 function CheckAdresses($Addresses) 160 160 { 161 foreach($Addresses as $Address) 162 { 163 if(!$this->ValidEmail($Address)) 164 throw new Exception('Mail: Invalid address '.$Address);165 } 166 } 167 161 foreach($Addresses as $Address) 162 { 163 if(!$this->ValidEmail($Address)) 164 throw new Exception(sprintf(T('Mail message invalid address %s'), $Address)); 165 } 166 } 167 168 168 private function ContentEncoding($Charset) 169 169 { … … 175 175 { 176 176 if(count($this->Attachments) > 0) 177 { 177 { 178 178 $this->Headers['Content-Type'] = "multipart/mixed;\n boundary=\"PHP-mixed-".$this->Boundary."\""; 179 179 $Result = "This is a multi-part message in MIME format.\n". 180 "--PHP-mixed-".$this->Boundary."\n"; 180 "--PHP-mixed-".$this->Boundary."\n"; 181 181 $Result .= $Body; 182 183 foreach($this->Attachments as $Attachment) 182 183 foreach($this->Attachments as $Attachment) 184 184 { 185 185 $FileName = $Attachment['FileName']; … … 189 189 if($Attachment['Type'] == 'File') 190 190 { 191 if(!file_exists($FileName)) 192 throw new Exception( 'Mail: Attached file '.$FileName.' can\'t be found');191 if(!file_exists($FileName)) 192 throw new Exception(sprintf(T('Mail message attached file %s can\'t be found'), $FileName)); 193 193 $Data = file_get_contents($FileName); 194 } else 194 } else 195 195 if($Attachment['Type'] == 'Data') $Data = $Attachment['Data']; 196 196 else $Data = ''; 197 197 198 198 $Result .= "\n".'--PHP-mixed-'.$this->Boundary."\n". 199 199 "Content-Type: ".$ContentType."; name=\"".$BaseName."\"\n". … … 203 203 } 204 204 } else $Result = $Body; 205 return($Result); 206 } 207 205 return($Result); 206 } 207 208 208 private function BuildBody() 209 209 { 210 210 $Result = ''; 211 if(count($this->Bodies) > 1) 211 if(count($this->Bodies) > 1) 212 212 { 213 213 $this->Headers['Content-Type'] = 'multipart/alternative; boundary="PHP-alt-'.$this->Boundary.'"'; 214 214 $Result .= 'Content-Type: multipart/alternative; boundary="PHP-alt-'.$this->Boundary.'"'. 215 215 "\n\n"; 216 } else 216 } else 217 217 { 218 218 $this->Headers['Content-Type'] = $this->Bodies[0]['Type'].'; charset='.$this->Bodies[0]['Charset']; … … 220 220 } 221 221 222 222 223 223 foreach($this->Bodies as $Body) 224 224 { 225 if(count($this->Bodies) > 1) $Result .= "\n\n".'--PHP-alt-'.$this->Boundary."\n"; 225 if(count($this->Bodies) > 1) $Result .= "\n\n".'--PHP-alt-'.$this->Boundary."\n"; 226 226 $Result .= 'Content-Type: '.$Body['Type'].'; charset='.$Body['Charset']. 227 "\nContent-Transfer-Encoding: ".$this->ContentEncoding($Body['Charset'])."\n\n".$Body['Content']."\n"; 227 "\nContent-Transfer-Encoding: ".$this->ContentEncoding($Body['Charset'])."\n\n".$Body['Content']."\n"; 228 228 } 229 229 return($Result); 230 } 230 } 231 231 } 232 232 -
trunk/Packages/Common/NetworkAddress.php
r55 r69 60 60 class NetworkAddressIPv6 61 61 { 62 var $Address;63 var $Prefix;62 var $Address; 63 var $Prefix; 64 64 65 function __construct()66 {67 $this->Address = 0;68 $this->Prefix = 0;69 }65 function __construct() 66 { 67 $this->Address = 0; 68 $this->Prefix = 0; 69 } 70 70 71 71 function AddressToString() 72 72 { 73 return(inet_ntop($this->Address));73 return(inet_ntop($this->Address)); 74 74 } 75 75 76 76 function AddressFromString($Value) 77 77 { 78 $this->Address = inet_pton($Value);78 $this->Address = inet_pton($Value); 79 79 } 80 80 81 81 function GetOctets() 82 82 { 83 $Result = array();84 $Data = array_reverse(unpack('C*', $this->Address));85 foreach($Data as $Item)86 {83 $Result = array(); 84 $Data = array_reverse(unpack('C*', $this->Address)); 85 foreach($Data as $Item) 86 { 87 87 88 $Result[] = dechex($Item & 15);89 $Result[] = dechex(($Item >> 4) & 15);90 }91 return($Result);88 $Result[] = dechex($Item & 15); 89 $Result[] = dechex(($Item >> 4) & 15); 90 } 91 return($Result); 92 92 } 93 93 94 94 function EncodeMAC($MAC) 95 95 { 96 $MAC = explode(':', $MAC);97 $Data = unpack('C*', $this->Address);98 $Data[9] = hexdec($MAC[0]) ^ 0x02;99 $Data[10] = hexdec($MAC[1]);100 $Data[11] = hexdec($MAC[2]);101 $Data[12] = 0xff;102 $Data[13] = 0xfe;103 $Data[14] = hexdec($MAC[3]);104 $Data[15] = hexdec($MAC[4]);105 $Data[16] = hexdec($MAC[5]);106 $this->Address = pack_array('C*', $Data);96 $MAC = explode(':', $MAC); 97 $Data = unpack('C*', $this->Address); 98 $Data[9] = hexdec($MAC[0]) ^ 0x02; 99 $Data[10] = hexdec($MAC[1]); 100 $Data[11] = hexdec($MAC[2]); 101 $Data[12] = 0xff; 102 $Data[13] = 0xfe; 103 $Data[14] = hexdec($MAC[3]); 104 $Data[15] = hexdec($MAC[4]); 105 $Data[16] = hexdec($MAC[5]); 106 $this->Address = pack_array('C*', $Data); 107 107 } 108 108 -
trunk/Packages/Common/RSS.php
r61 r69 1 1 <?php 2 2 3 class RSS 3 class RSS 4 4 { 5 5 var $Charset; … … 9 9 var $WebmasterEmail; 10 10 var $Items; 11 11 12 12 function __construct() 13 13 { … … 17 17 18 18 function Generate() 19 { 19 { 20 20 $Result = '<?xml version="1.0" encoding="'.$this->Charset.'" ?>'."\n". //<? 21 21 '<rss version="2.0">'."\n". … … 26 26 " <language>cs</language>\n". 27 27 " <webMaster>".$this->WebmasterEmail."</webMaster>\n". 28 " <pubDate>".date('r')."</pubDate>\n". 28 " <pubDate>".date('r')."</pubDate>\n". 29 29 " <ttl>20</ttl>\n"; 30 30 foreach($this->Items as $Item) … … 33 33 ' <title>'.htmlspecialchars($Item['Title'])."</title>\n". 34 34 ' <description>'.htmlspecialchars($Item['Description'])."</description>\n". 35 ' <pubDate>'.date('r',$Item['Time'])."</pubDate>\n".36 ' <link>'.$Item['Link']."</link>\n".35 ' <pubDate>'.date('r',$Item['Time'])."</pubDate>\n". 36 ' <link>'.$Item['Link']."</link>\n". 37 37 " </item>\n"; 38 38 } -
trunk/Packages/Common/UTF8.php
r55 r69 21 21 ISO8859-1: iso1 22 22 Windows1257: win1257 23 23 24 24 example: $new_string=to_utf8($some_string,"win1250"); 25 25 */ … … 28 28 /* 29 29 translation table - actually, it's array where key is hexadecimal number of 30 character in ISO8859-2/Windows1250 and value is its two byte representation in UTF-8 30 character in ISO8859-2/Windows1250 and value is its two byte representation in UTF-8 31 31 */ 32 32 33 class Encoding 33 class Encoding 34 34 { 35 35 function __construct() 36 36 { 37 $this->CharTable = array(37 $this->CharTable = array( 38 38 'iso2' => array( 39 0x80=>"\xc2\x80",40 0x81=>"\xc2\x81",41 0x82=>"\xc2\x82",42 0x83=>"\xc2\x83",43 0x84=>"\xc2\x84",44 0x85=>"\xc2\x85",45 0x86=>"\xc2\x86",46 0x87=>"\xc2\x87",47 0x88=>"\xc2\x88",48 0x89=>"\xc2\x89",49 0x8A=>"\xc2\x8a",50 0x8B=>"\xc2\x8b",51 0x8C=>"\xc2\x8c",52 0x8D=>"\xc2\x8d",53 0x8E=>"\xc2\x8e",54 0x8F=>"\xc2\x8f",55 0x90=>"\xc2\x90",56 0x91=>"\xc2\x91",57 0x92=>"\xc2\x92",58 0x93=>"\xc2\x93",59 0x94=>"\xc2\x94",60 0x95=>"\xc2\x95",61 0x96=>"\xc2\x96",62 0x97=>"\xc2\x97",63 0x98=>"\xc2\x98",64 0x99=>"\xc2\x99",65 0x9A=>"\xc2\x9a",66 0x9B=>"\xc2\x9b",67 0x9C=>"\xc2\x9c",68 0x9D=>"\xc2\x9d",69 0x9E=>"\xc2\x9e",70 0x9F=>"\xc2\x9f",71 0xA0=>"\xc2\xa0",72 0xA1=>"\xc4\x84",73 0xA2=>"\xcb\x98",74 0xA3=>"\xc5\x81",75 0xA4=>"\xc2\xa4",76 0xA5=>"\xc4\xbd",77 0xA6=>"\xc5\x9a",78 0xA7=>"\xc2\xa7",79 0xA8=>"\xc2\xa8",80 0xA9=>"\xc5\xa0",81 0xAA=>"\xc5\x9e",82 0xAB=>"\xc5\xa4",83 0xAC=>"\xc5\xb9",84 0xAD=>"\xc2\xad",85 0xAE=>"\xc5\xbd",86 0xAF=>"\xc5\xbb",87 0xB0=>"\xc2\xb0",88 0xB1=>"\xc4\x85",89 0xB2=>"\xcb\x9b",90 0xB3=>"\xc5\x82",91 0xB4=>"\xc2\xb4",92 0xB5=>"\xc4\xbe",93 0xB6=>"\xc5\x9b",94 0xB7=>"\xcb\x87",95 0xB8=>"\xc2\xb8",96 0xB9=>"\xc5\xa1",97 0xBA=>"\xc5\x9f",98 0xBB=>"\xc5\xa5",99 0xBC=>"\xc5\xba",100 0xBD=>"\xcb\x9d",101 0xBE=>"\xc5\xbe",102 0xBF=>"\xc5\xbc",103 0xC0=>"\xc5\x94",104 0xC1=>"\xc3\x81",105 0xC2=>"\xc3\x82",106 0xC3=>"\xc4\x82",107 0xC4=>"\xc3\x84",108 0xC5=>"\xc4\xb9",109 0xC6=>"\xc4\x86",110 0xC7=>"\xc3\x87",111 0xC8=>"\xc4\x8c",112 0xC9=>"\xc3\x89",113 0xCA=>"\xc4\x98",114 0xCB=>"\xc3\x8b",115 0xCC=>"\xc4\x9a",116 0xCD=>"\xc3\x8d",117 0xCE=>"\xc3\x8e",118 0xCF=>"\xc4\x8e",119 0xD0=>"\xc4\x90",120 0xD1=>"\xc5\x83",121 0xD2=>"\xc5\x87",122 0xD3=>"\xc3\x93",123 0xD4=>"\xc3\x94",124 0xD5=>"\xc5\x90",125 0xD6=>"\xc3\x96",126 0xD7=>"\xc3\x97",127 0xD8=>"\xc5\x98",128 0xD9=>"\xc5\xae",129 0xDA=>"\xc3\x9a",130 0xDB=>"\xc5\xb0",131 0xDC=>"\xc3\x9c",132 0xDD=>"\xc3\x9d",133 0xDE=>"\xc5\xa2",134 0xDF=>"\xc3\x9f",135 0xE0=>"\xc5\x95",136 0xE1=>"\xc3\xa1",137 0xE2=>"\xc3\xa2",138 0xE3=>"\xc4\x83",139 0xE4=>"\xc3\xa4",140 0xE5=>"\xc4\xba",141 0xE6=>"\xc4\x87",142 0xE7=>"\xc3\xa7",143 0xE8=>"\xc4\x8d",144 0xE9=>"\xc3\xa9",145 0xEA=>"\xc4\x99",146 0xEB=>"\xc3\xab",147 0xEC=>"\xc4\x9b",148 0xED=>"\xc3\xad",149 0xEE=>"\xc3\xae",150 0xEF=>"\xc4\x8f",151 0xF0=>"\xc4\x91",152 0xF1=>"\xc5\x84",153 0xF2=>"\xc5\x88",154 0xF3=>"\xc3\xb3",155 0xF4=>"\xc3\xb4",156 0xF5=>"\xc5\x91",157 0xF6=>"\xc3\xb6",158 0xF7=>"\xc3\xb7",159 0xF8=>"\xc5\x99",160 0xF9=>"\xc5\xaf",161 0xFA=>"\xc3\xba",162 0xFB=>"\xc5\xb1",163 0xFC=>"\xc3\xbc",164 0xFD=>"\xc3\xbd",165 0xFE=>"\xc5\xa3",166 0xFF=>"\xcb\x99"39 0x80=>"\xc2\x80", 40 0x81=>"\xc2\x81", 41 0x82=>"\xc2\x82", 42 0x83=>"\xc2\x83", 43 0x84=>"\xc2\x84", 44 0x85=>"\xc2\x85", 45 0x86=>"\xc2\x86", 46 0x87=>"\xc2\x87", 47 0x88=>"\xc2\x88", 48 0x89=>"\xc2\x89", 49 0x8A=>"\xc2\x8a", 50 0x8B=>"\xc2\x8b", 51 0x8C=>"\xc2\x8c", 52 0x8D=>"\xc2\x8d", 53 0x8E=>"\xc2\x8e", 54 0x8F=>"\xc2\x8f", 55 0x90=>"\xc2\x90", 56 0x91=>"\xc2\x91", 57 0x92=>"\xc2\x92", 58 0x93=>"\xc2\x93", 59 0x94=>"\xc2\x94", 60 0x95=>"\xc2\x95", 61 0x96=>"\xc2\x96", 62 0x97=>"\xc2\x97", 63 0x98=>"\xc2\x98", 64 0x99=>"\xc2\x99", 65 0x9A=>"\xc2\x9a", 66 0x9B=>"\xc2\x9b", 67 0x9C=>"\xc2\x9c", 68 0x9D=>"\xc2\x9d", 69 0x9E=>"\xc2\x9e", 70 0x9F=>"\xc2\x9f", 71 0xA0=>"\xc2\xa0", 72 0xA1=>"\xc4\x84", 73 0xA2=>"\xcb\x98", 74 0xA3=>"\xc5\x81", 75 0xA4=>"\xc2\xa4", 76 0xA5=>"\xc4\xbd", 77 0xA6=>"\xc5\x9a", 78 0xA7=>"\xc2\xa7", 79 0xA8=>"\xc2\xa8", 80 0xA9=>"\xc5\xa0", 81 0xAA=>"\xc5\x9e", 82 0xAB=>"\xc5\xa4", 83 0xAC=>"\xc5\xb9", 84 0xAD=>"\xc2\xad", 85 0xAE=>"\xc5\xbd", 86 0xAF=>"\xc5\xbb", 87 0xB0=>"\xc2\xb0", 88 0xB1=>"\xc4\x85", 89 0xB2=>"\xcb\x9b", 90 0xB3=>"\xc5\x82", 91 0xB4=>"\xc2\xb4", 92 0xB5=>"\xc4\xbe", 93 0xB6=>"\xc5\x9b", 94 0xB7=>"\xcb\x87", 95 0xB8=>"\xc2\xb8", 96 0xB9=>"\xc5\xa1", 97 0xBA=>"\xc5\x9f", 98 0xBB=>"\xc5\xa5", 99 0xBC=>"\xc5\xba", 100 0xBD=>"\xcb\x9d", 101 0xBE=>"\xc5\xbe", 102 0xBF=>"\xc5\xbc", 103 0xC0=>"\xc5\x94", 104 0xC1=>"\xc3\x81", 105 0xC2=>"\xc3\x82", 106 0xC3=>"\xc4\x82", 107 0xC4=>"\xc3\x84", 108 0xC5=>"\xc4\xb9", 109 0xC6=>"\xc4\x86", 110 0xC7=>"\xc3\x87", 111 0xC8=>"\xc4\x8c", 112 0xC9=>"\xc3\x89", 113 0xCA=>"\xc4\x98", 114 0xCB=>"\xc3\x8b", 115 0xCC=>"\xc4\x9a", 116 0xCD=>"\xc3\x8d", 117 0xCE=>"\xc3\x8e", 118 0xCF=>"\xc4\x8e", 119 0xD0=>"\xc4\x90", 120 0xD1=>"\xc5\x83", 121 0xD2=>"\xc5\x87", 122 0xD3=>"\xc3\x93", 123 0xD4=>"\xc3\x94", 124 0xD5=>"\xc5\x90", 125 0xD6=>"\xc3\x96", 126 0xD7=>"\xc3\x97", 127 0xD8=>"\xc5\x98", 128 0xD9=>"\xc5\xae", 129 0xDA=>"\xc3\x9a", 130 0xDB=>"\xc5\xb0", 131 0xDC=>"\xc3\x9c", 132 0xDD=>"\xc3\x9d", 133 0xDE=>"\xc5\xa2", 134 0xDF=>"\xc3\x9f", 135 0xE0=>"\xc5\x95", 136 0xE1=>"\xc3\xa1", 137 0xE2=>"\xc3\xa2", 138 0xE3=>"\xc4\x83", 139 0xE4=>"\xc3\xa4", 140 0xE5=>"\xc4\xba", 141 0xE6=>"\xc4\x87", 142 0xE7=>"\xc3\xa7", 143 0xE8=>"\xc4\x8d", 144 0xE9=>"\xc3\xa9", 145 0xEA=>"\xc4\x99", 146 0xEB=>"\xc3\xab", 147 0xEC=>"\xc4\x9b", 148 0xED=>"\xc3\xad", 149 0xEE=>"\xc3\xae", 150 0xEF=>"\xc4\x8f", 151 0xF0=>"\xc4\x91", 152 0xF1=>"\xc5\x84", 153 0xF2=>"\xc5\x88", 154 0xF3=>"\xc3\xb3", 155 0xF4=>"\xc3\xb4", 156 0xF5=>"\xc5\x91", 157 0xF6=>"\xc3\xb6", 158 0xF7=>"\xc3\xb7", 159 0xF8=>"\xc5\x99", 160 0xF9=>"\xc5\xaf", 161 0xFA=>"\xc3\xba", 162 0xFB=>"\xc5\xb1", 163 0xFC=>"\xc3\xbc", 164 0xFD=>"\xc3\xbd", 165 0xFE=>"\xc5\xa3", 166 0xFF=>"\xcb\x99" 167 167 ), 168 168 'win1250' => array( 169 0x80=>"\xc2\x80",170 0x81=>"\xc2\x81",171 0x82=>"\xe2\x80\x9a",172 0x83=>"\xc2\x83",173 0x84=>"\xe2\x80\x9e",174 0x85=>"\xe2\x80\xa6",175 0x86=>"\xe2\x80\xa0",176 0x87=>"\xe2\x80\xa1",177 0x88=>"\xc2\x88",178 0x89=>"\xe2\x80\xb0",179 0x8a=>"\xc5\xa0",180 0x8b=>"\xe2\x80\xb9",181 0x8c=>"\xc5\x9a",182 0x8d=>"\xc5\xa4",183 0x8e=>"\xc5\xbd",184 0x8f=>"\xc5\xb9",185 0x90=>"\xc2\x90",186 0x91=>"\xe2\x80\x98",187 0x92=>"\xe2\x80\x99",188 0x93=>"\xe2\x80\x9c",189 0x94=>"\xe2\x80\x9d",190 0x95=>"\xe2\x80\xa2",191 0x96=>"\xe2\x80\x93",192 0x97=>"\xe2\x80\x94",193 0x98=>"\xe2\x80\x98",194 0x99=>"\xe2\x84\xa2",195 0x9a=>"\xc5\xa1",196 0x9b=>"\xe2\x80\xba",197 0x9c=>"\xc5\x9b",198 0x9d=>"\xc5\xa5",199 0x9e=>"\xc5\xbe",200 0x9f=>"\xc5\xba",201 0xa0=>"\xc2\xa0",202 0xa1=>"\xcb\x87",203 0xa2=>"\xcb\x98",204 0xa3=>"\xc5\x81",205 0xa4=>"\xc2\xa4",206 0xa5=>"\xc4\x84",207 0xa6=>"\xc2\xa6",208 0xa7=>"\xc2\xa7",209 0xa8=>"\xc2\xa8",210 0xa9=>"\xc2\xa9",211 0xaa=>"\xc5\x9e",212 0xab=>"\xc2\xab",213 0xac=>"\xc2\xac",214 0xad=>"\xc2\xad",215 0xae=>"\xc2\xae",216 0xaf=>"\xc5\xbb",217 0xb0=>"\xc2\xb0",218 0xb1=>"\xc2\xb1",219 0xb2=>"\xcb\x9b",220 0xb3=>"\xc5\x82",221 0xb4=>"\xc2\xb4",222 0xb5=>"\xc2\xb5",223 0xb6=>"\xc2\xb6",224 0xb7=>"\xc2\xb7",225 0xb8=>"\xc2\xb8",226 0xb9=>"\xc4\x85",227 0xba=>"\xc5\x9f",228 0xbb=>"\xc2\xbb",229 0xbc=>"\xc4\xbd",230 0xbd=>"\xcb\x9d",231 0xbe=>"\xc4\xbe",232 0xbf=>"\xc5\xbc",233 0xc0=>"\xc5\x94",234 0xc1=>"\xc3\x81",235 0xc2=>"\xc3\x82",236 0xc3=>"\xc4\x82",237 0xc4=>"\xc3\x84",238 0xc5=>"\xc4\xb9",239 0xc6=>"\xc4\x86",240 0xc7=>"\xc3\x87",241 0xc8=>"\xc4\x8c",242 0xc9=>"\xc3\x89",243 0xca=>"\xc4\x98",244 0xcb=>"\xc3\x8b",245 0xcc=>"\xc4\x9a",246 0xcd=>"\xc3\x8d",247 0xce=>"\xc3\x8e",248 0xcf=>"\xc4\x8e",249 0xd0=>"\xc4\x90",250 0xd1=>"\xc5\x83",251 0xd2=>"\xc5\x87",252 0xd3=>"\xc3\x93",253 0xd4=>"\xc3\x94",254 0xd5=>"\xc5\x90",255 0xd6=>"\xc3\x96",256 0xd7=>"\xc3\x97",257 0xd8=>"\xc5\x98",258 0xd9=>"\xc5\xae",259 0xda=>"\xc3\x9a",260 0xdb=>"\xc5\xb0",261 0xdc=>"\xc3\x9c",262 0xdd=>"\xc3\x9d",263 0xde=>"\xc5\xa2",264 0xdf=>"\xc3\x9f",265 0xe0=>"\xc5\x95",266 0xe1=>"\xc3\xa1",267 0xe2=>"\xc3\xa2",268 0xe3=>"\xc4\x83",269 0xe4=>"\xc3\xa4",270 0xe5=>"\xc4\xba",271 0xe6=>"\xc4\x87",272 0xe7=>"\xc3\xa7",273 0xe8=>"\xc4\x8d",274 0xe9=>"\xc3\xa9",275 0xea=>"\xc4\x99",276 0xeb=>"\xc3\xab",277 0xec=>"\xc4\x9b",278 0xed=>"\xc3\xad",279 0xee=>"\xc3\xae",280 0xef=>"\xc4\x8f",281 0xf0=>"\xc4\x91",282 0xf1=>"\xc5\x84",283 0xf2=>"\xc5\x88",284 0xf3=>"\xc3\xb3",285 0xf4=>"\xc3\xb4",286 0xf5=>"\xc5\x91",287 0xf6=>"\xc3\xb6",288 0xf7=>"\xc3\xb7",289 0xf8=>"\xc5\x99",290 0xf9=>"\xc5\xaf",291 0xfa=>"\xc3\xba",292 0xfb=>"\xc5\xb1",293 0xfc=>"\xc3\xbc",294 0xfd=>"\xc3\xbd",295 0xfe=>"\xc5\xa3",296 0xff=>"\xcb\x99"169 0x80=>"\xc2\x80", 170 0x81=>"\xc2\x81", 171 0x82=>"\xe2\x80\x9a", 172 0x83=>"\xc2\x83", 173 0x84=>"\xe2\x80\x9e", 174 0x85=>"\xe2\x80\xa6", 175 0x86=>"\xe2\x80\xa0", 176 0x87=>"\xe2\x80\xa1", 177 0x88=>"\xc2\x88", 178 0x89=>"\xe2\x80\xb0", 179 0x8a=>"\xc5\xa0", 180 0x8b=>"\xe2\x80\xb9", 181 0x8c=>"\xc5\x9a", 182 0x8d=>"\xc5\xa4", 183 0x8e=>"\xc5\xbd", 184 0x8f=>"\xc5\xb9", 185 0x90=>"\xc2\x90", 186 0x91=>"\xe2\x80\x98", 187 0x92=>"\xe2\x80\x99", 188 0x93=>"\xe2\x80\x9c", 189 0x94=>"\xe2\x80\x9d", 190 0x95=>"\xe2\x80\xa2", 191 0x96=>"\xe2\x80\x93", 192 0x97=>"\xe2\x80\x94", 193 0x98=>"\xe2\x80\x98", 194 0x99=>"\xe2\x84\xa2", 195 0x9a=>"\xc5\xa1", 196 0x9b=>"\xe2\x80\xba", 197 0x9c=>"\xc5\x9b", 198 0x9d=>"\xc5\xa5", 199 0x9e=>"\xc5\xbe", 200 0x9f=>"\xc5\xba", 201 0xa0=>"\xc2\xa0", 202 0xa1=>"\xcb\x87", 203 0xa2=>"\xcb\x98", 204 0xa3=>"\xc5\x81", 205 0xa4=>"\xc2\xa4", 206 0xa5=>"\xc4\x84", 207 0xa6=>"\xc2\xa6", 208 0xa7=>"\xc2\xa7", 209 0xa8=>"\xc2\xa8", 210 0xa9=>"\xc2\xa9", 211 0xaa=>"\xc5\x9e", 212 0xab=>"\xc2\xab", 213 0xac=>"\xc2\xac", 214 0xad=>"\xc2\xad", 215 0xae=>"\xc2\xae", 216 0xaf=>"\xc5\xbb", 217 0xb0=>"\xc2\xb0", 218 0xb1=>"\xc2\xb1", 219 0xb2=>"\xcb\x9b", 220 0xb3=>"\xc5\x82", 221 0xb4=>"\xc2\xb4", 222 0xb5=>"\xc2\xb5", 223 0xb6=>"\xc2\xb6", 224 0xb7=>"\xc2\xb7", 225 0xb8=>"\xc2\xb8", 226 0xb9=>"\xc4\x85", 227 0xba=>"\xc5\x9f", 228 0xbb=>"\xc2\xbb", 229 0xbc=>"\xc4\xbd", 230 0xbd=>"\xcb\x9d", 231 0xbe=>"\xc4\xbe", 232 0xbf=>"\xc5\xbc", 233 0xc0=>"\xc5\x94", 234 0xc1=>"\xc3\x81", 235 0xc2=>"\xc3\x82", 236 0xc3=>"\xc4\x82", 237 0xc4=>"\xc3\x84", 238 0xc5=>"\xc4\xb9", 239 0xc6=>"\xc4\x86", 240 0xc7=>"\xc3\x87", 241 0xc8=>"\xc4\x8c", 242 0xc9=>"\xc3\x89", 243 0xca=>"\xc4\x98", 244 0xcb=>"\xc3\x8b", 245 0xcc=>"\xc4\x9a", 246 0xcd=>"\xc3\x8d", 247 0xce=>"\xc3\x8e", 248 0xcf=>"\xc4\x8e", 249 0xd0=>"\xc4\x90", 250 0xd1=>"\xc5\x83", 251 0xd2=>"\xc5\x87", 252 0xd3=>"\xc3\x93", 253 0xd4=>"\xc3\x94", 254 0xd5=>"\xc5\x90", 255 0xd6=>"\xc3\x96", 256 0xd7=>"\xc3\x97", 257 0xd8=>"\xc5\x98", 258 0xd9=>"\xc5\xae", 259 0xda=>"\xc3\x9a", 260 0xdb=>"\xc5\xb0", 261 0xdc=>"\xc3\x9c", 262 0xdd=>"\xc3\x9d", 263 0xde=>"\xc5\xa2", 264 0xdf=>"\xc3\x9f", 265 0xe0=>"\xc5\x95", 266 0xe1=>"\xc3\xa1", 267 0xe2=>"\xc3\xa2", 268 0xe3=>"\xc4\x83", 269 0xe4=>"\xc3\xa4", 270 0xe5=>"\xc4\xba", 271 0xe6=>"\xc4\x87", 272 0xe7=>"\xc3\xa7", 273 0xe8=>"\xc4\x8d", 274 0xe9=>"\xc3\xa9", 275 0xea=>"\xc4\x99", 276 0xeb=>"\xc3\xab", 277 0xec=>"\xc4\x9b", 278 0xed=>"\xc3\xad", 279 0xee=>"\xc3\xae", 280 0xef=>"\xc4\x8f", 281 0xf0=>"\xc4\x91", 282 0xf1=>"\xc5\x84", 283 0xf2=>"\xc5\x88", 284 0xf3=>"\xc3\xb3", 285 0xf4=>"\xc3\xb4", 286 0xf5=>"\xc5\x91", 287 0xf6=>"\xc3\xb6", 288 0xf7=>"\xc3\xb7", 289 0xf8=>"\xc5\x99", 290 0xf9=>"\xc5\xaf", 291 0xfa=>"\xc3\xba", 292 0xfb=>"\xc5\xb1", 293 0xfc=>"\xc3\xbc", 294 0xfd=>"\xc3\xbd", 295 0xfe=>"\xc5\xa3", 296 0xff=>"\xcb\x99" 297 297 ), 298 298 'iso1' => array( 299 0xA0=>"\xc2\xa0",300 0xA1=>"\xc2\xa1",301 0xA2=>"\xc2\xa2",302 0xA3=>"\xc2\xa3",303 0xA4=>"\xc2\xa4",304 0xA5=>"\xc2\xa5",305 0xA6=>"\xc2\xa6",306 0xA7=>"\xc2\xa7",307 0xA8=>"\xc2\xa8",308 0xA9=>"\xc2\xa9",309 0xAA=>"\xc2\xaa",310 0xAB=>"\xc2\xab",311 0xAC=>"\xc2\xac",312 0xAD=>"\xc2\xad",313 0xAE=>"\xc2\xae",314 0xAF=>"\xc2\xaf",315 0xB0=>"\xc2\xb0",316 0xB1=>"\xc2\xb1",317 0xB2=>"\xc2\xb2",318 0xB3=>"\xc2\xb3",319 0xB4=>"\xc2\xb4",320 0xB5=>"\xc2\xb5",321 0xB6=>"\xc2\xb6",322 0xB7=>"\xc2\xb7",323 0xB8=>"\xc2\xb8",324 0xB9=>"\xc2\xb9",325 0xBA=>"\xc2\xba",326 0xBB=>"\xc2\xbb",327 0xBC=>"\xc2\xbc",328 0xBD=>"\xc2\xbd",329 0xBE=>"\xc2\xbe",330 0xBF=>"\xc2\xbf",331 0xC0=>"\xc3\x80",332 0xC1=>"\xc3\x81",333 0xC2=>"\xc3\x82",334 0xC3=>"\xc3\x83",335 0xC4=>"\xc3\x84",336 0xC5=>"\xc3\x85",337 0xC6=>"\xc3\x86",338 0xC7=>"\xc3\x87",339 0xC8=>"\xc3\x88",340 0xC9=>"\xc3\x89",341 0xCA=>"\xc3\x8a",342 0xCB=>"\xc3\x8b",343 0xCC=>"\xc3\x8c",344 0xCD=>"\xc3\x8d",345 0xCE=>"\xc3\x8e",346 0xCF=>"\xc3\x8f",347 0xD0=>"\xc3\x90",348 0xD1=>"\xc3\x91",349 0xD2=>"\xc3\x92",350 0xD3=>"\xc3\x93",351 0xD4=>"\xc3\x94",352 0xD5=>"\xc3\x95",353 0xD6=>"\xc3\x96",354 0xD7=>"\xc3\x97",355 0xD8=>"\xc3\x98",356 0xD9=>"\xc3\x99",357 0xDA=>"\xc3\x9a",358 0xDB=>"\xc3\x9b",359 0xDC=>"\xc3\x9c",360 0xDD=>"\xc3\x9d",361 0xDE=>"\xc3\x9e",362 0xDF=>"\xc3\x9f",363 0xE0=>"\xc3\xa0",364 0xE1=>"\xc3\xa1",365 0xE2=>"\xc3\xa2",366 0xE3=>"\xc3\xa3",367 0xE4=>"\xc3\xa4",368 0xE5=>"\xc3\xa5",369 0xE6=>"\xc3\xa6",370 0xE7=>"\xc3\xa7",371 0xE8=>"\xc3\xa8",372 0xE9=>"\xc3\xa9",373 0xEA=>"\xc3\xaa",374 0xEB=>"\xc3\xab",375 0xEC=>"\xc3\xac",376 0xED=>"\xc3\xad",377 0xEE=>"\xc3\xae",378 0xEF=>"\xc3\xaf",379 0xF0=>"\xc3\xb0",380 0xF1=>"\xc3\xb1",381 0xF2=>"\xc3\xb2",382 0xF3=>"\xc3\xb3",383 0xF4=>"\xc3\xb4",384 0xF5=>"\xc3\xb5",385 0xF6=>"\xc3\xb6",386 0xF7=>"\xc3\xb7",387 0xF8=>"\xc3\xb8",388 0xF9=>"\xc3\xb9",389 0xFA=>"\xc3\xba",390 0xFB=>"\xc3\xbb",391 0xFC=>"\xc3\xbc",392 0xFD=>"\xc3\xbd",393 0xFE=>"\xc3\xbe"299 0xA0=>"\xc2\xa0", 300 0xA1=>"\xc2\xa1", 301 0xA2=>"\xc2\xa2", 302 0xA3=>"\xc2\xa3", 303 0xA4=>"\xc2\xa4", 304 0xA5=>"\xc2\xa5", 305 0xA6=>"\xc2\xa6", 306 0xA7=>"\xc2\xa7", 307 0xA8=>"\xc2\xa8", 308 0xA9=>"\xc2\xa9", 309 0xAA=>"\xc2\xaa", 310 0xAB=>"\xc2\xab", 311 0xAC=>"\xc2\xac", 312 0xAD=>"\xc2\xad", 313 0xAE=>"\xc2\xae", 314 0xAF=>"\xc2\xaf", 315 0xB0=>"\xc2\xb0", 316 0xB1=>"\xc2\xb1", 317 0xB2=>"\xc2\xb2", 318 0xB3=>"\xc2\xb3", 319 0xB4=>"\xc2\xb4", 320 0xB5=>"\xc2\xb5", 321 0xB6=>"\xc2\xb6", 322 0xB7=>"\xc2\xb7", 323 0xB8=>"\xc2\xb8", 324 0xB9=>"\xc2\xb9", 325 0xBA=>"\xc2\xba", 326 0xBB=>"\xc2\xbb", 327 0xBC=>"\xc2\xbc", 328 0xBD=>"\xc2\xbd", 329 0xBE=>"\xc2\xbe", 330 0xBF=>"\xc2\xbf", 331 0xC0=>"\xc3\x80", 332 0xC1=>"\xc3\x81", 333 0xC2=>"\xc3\x82", 334 0xC3=>"\xc3\x83", 335 0xC4=>"\xc3\x84", 336 0xC5=>"\xc3\x85", 337 0xC6=>"\xc3\x86", 338 0xC7=>"\xc3\x87", 339 0xC8=>"\xc3\x88", 340 0xC9=>"\xc3\x89", 341 0xCA=>"\xc3\x8a", 342 0xCB=>"\xc3\x8b", 343 0xCC=>"\xc3\x8c", 344 0xCD=>"\xc3\x8d", 345 0xCE=>"\xc3\x8e", 346 0xCF=>"\xc3\x8f", 347 0xD0=>"\xc3\x90", 348 0xD1=>"\xc3\x91", 349 0xD2=>"\xc3\x92", 350 0xD3=>"\xc3\x93", 351 0xD4=>"\xc3\x94", 352 0xD5=>"\xc3\x95", 353 0xD6=>"\xc3\x96", 354 0xD7=>"\xc3\x97", 355 0xD8=>"\xc3\x98", 356 0xD9=>"\xc3\x99", 357 0xDA=>"\xc3\x9a", 358 0xDB=>"\xc3\x9b", 359 0xDC=>"\xc3\x9c", 360 0xDD=>"\xc3\x9d", 361 0xDE=>"\xc3\x9e", 362 0xDF=>"\xc3\x9f", 363 0xE0=>"\xc3\xa0", 364 0xE1=>"\xc3\xa1", 365 0xE2=>"\xc3\xa2", 366 0xE3=>"\xc3\xa3", 367 0xE4=>"\xc3\xa4", 368 0xE5=>"\xc3\xa5", 369 0xE6=>"\xc3\xa6", 370 0xE7=>"\xc3\xa7", 371 0xE8=>"\xc3\xa8", 372 0xE9=>"\xc3\xa9", 373 0xEA=>"\xc3\xaa", 374 0xEB=>"\xc3\xab", 375 0xEC=>"\xc3\xac", 376 0xED=>"\xc3\xad", 377 0xEE=>"\xc3\xae", 378 0xEF=>"\xc3\xaf", 379 0xF0=>"\xc3\xb0", 380 0xF1=>"\xc3\xb1", 381 0xF2=>"\xc3\xb2", 382 0xF3=>"\xc3\xb3", 383 0xF4=>"\xc3\xb4", 384 0xF5=>"\xc3\xb5", 385 0xF6=>"\xc3\xb6", 386 0xF7=>"\xc3\xb7", 387 0xF8=>"\xc3\xb8", 388 0xF9=>"\xc3\xb9", 389 0xFA=>"\xc3\xba", 390 0xFB=>"\xc3\xbb", 391 0xFC=>"\xc3\xbc", 392 0xFD=>"\xc3\xbd", 393 0xFE=>"\xc3\xbe" 394 394 ), 395 395 'win1257' => array( 396 0x80=>"\xe2\x82\xac",397 0x81=>"\xc0\x4",398 0x82=>"\xe2\x80\x9a",399 0x83=>"\xc0\x4",400 0x84=>"\xe2\x80\x9e",401 0x85=>"\xe2\x80\xa6",402 0x86=>"\xe2\x80\xa0",403 0x87=>"\xe2\x80\xa1",404 0x88=>"\xc0\x4",405 0x89=>"\xe2\x80\xb0",406 0x8A=>"\xc0\x4",407 0x8B=>"\xe2\x80\xb9",408 0x8C=>"\xc0\x4",409 0x8D=>"\xc2\xa8",410 0x8E=>"\xcb\x87",411 0x8F=>"\xc2\xb8",412 0x90=>"\xc0\x4",413 0x91=>"\xe2\x80\x98",414 0x92=>"\xe2\x80\x99",415 0x93=>"\xe2\x80\x9c",416 0x94=>"\xe2\x80\x9d",417 0x95=>"\xe2\x80\xa2",418 0x96=>"\xe2\x80\x93",419 0x97=>"\xe2\x80\x94",420 0x98=>"\xc0\x4",421 0x99=>"\xe2\x84\xa2",422 0x9A=>"\xc0\x4",423 0x9B=>"\xe2\x80\xba",424 0x9C=>"\xc0\x4",425 0x9D=>"\xc2\xaf",426 0x9E=>"\xcb\x9b",427 0x9F=>"\xc0\x4",428 0xA0=>"\xc2\xa0",429 0xA1=>"\xc0\x4",430 0xA2=>"\xc2\xa2",431 0xA3=>"\xc2\xa3",432 0xA4=>"\xc2\xa4",433 0xA5=>"\xc0\x4",434 0xA6=>"\xc2\xa6",435 0xA7=>"\xc2\xa7",436 0xA8=>"\xc3\x98",437 0xA9=>"\xc2\xa9",438 0xAA=>"\xc5\x96",439 0xAB=>"\xc2\xab",440 0xAC=>"\xc2\xac",441 0xAD=>"\xc2\xad",442 0xAE=>"\xc2\xae",443 0xAF=>"\xc3\x86",444 0xB0=>"\xc2\xb0",445 0xB1=>"\xc2\xb1",446 0xB2=>"\xc2\xb2",447 0xB3=>"\xc2\xb3",448 0xB4=>"\xc2\xb4",449 0xB5=>"\xc2\xb5",450 0xB6=>"\xc2\xb6",451 0xB7=>"\xc2\xb7",452 0xB8=>"\xc3\xb8",453 0xB9=>"\xc2\xb9",454 0xBA=>"\xc5\x97",455 0xBB=>"\xc2\xbb",456 0xBC=>"\xc2\xbc",457 0xBD=>"\xc2\xbd",458 0xBE=>"\xc2\xbe",459 0xBF=>"\xc3\xa6",460 0xC0=>"\xc4\x84",461 0xC1=>"\xc4\xae",462 0xC2=>"\xc4\x80",463 0xC3=>"\xc4\x86",464 0xC4=>"\xc3\x84",465 0xC5=>"\xc3\x85",466 0xC6=>"\xc4\x98",467 0xC7=>"\xc4\x92",468 0xC8=>"\xc4\x8c",469 0xC9=>"\xc3\x89",470 0xCA=>"\xc5\xb9",471 0xCB=>"\xc4\x96",472 0xCC=>"\xc4\xa2",473 0xCD=>"\xc4\xb6",474 0xCE=>"\xc4\xaa",475 0xCF=>"\xc4\xbb",476 0xD0=>"\xc5\xa0",477 0xD1=>"\xc5\x83",478 0xD2=>"\xc5\x85",479 0xD3=>"\xc3\x93",480 0xD4=>"\xc5\x8c",481 0xD5=>"\xc3\x95",482 0xD6=>"\xc3\x96",483 0xD7=>"\xc3\x97",484 0xD8=>"\xc5\xb2",485 0xD9=>"\xc5\x81",486 0xDA=>"\xc5\x9a",487 0xDB=>"\xc5\xaa",488 0xDC=>"\xc3\x9c",489 0xDD=>"\xc5\xbb",490 0xDE=>"\xc5\xbd",491 0xDF=>"\xc3\x9f",492 0xE0=>"\xc4\x85",493 0xE1=>"\xc4\xaf",494 0xE2=>"\xc4\x81",495 0xE3=>"\xc4\x87",496 0xE4=>"\xc3\xa4",497 0xE5=>"\xc3\xa5",498 0xE6=>"\xc4\x99",499 0xE7=>"\xc4\x93",500 0xE8=>"\xc4\x8d",501 0xE9=>"\xc3\xa9",502 0xEA=>"\xc5\xba",503 0xEB=>"\xc4\x97",504 0xEC=>"\xc4\xa3",505 0xED=>"\xc4\xb7",506 0xEE=>"\xc4\xab",507 0xEF=>"\xc4\xbc",508 0xF0=>"\xc5\xa1",509 0xF1=>"\xc5\x84",510 0xF2=>"\xc5\x86",511 0xF3=>"\xc3\xb3",512 0xF4=>"\xc5\x8d",513 0xF5=>"\xc3\xb5",514 0xF6=>"\xc3\xb6",515 0xF7=>"\xc3\xb7",516 0xF8=>"\xc5\xb3",517 0xF9=>"\xc5\x82",518 0xFA=>"\xc5\x9b",519 0xFB=>"\xc5\xab",520 0xFC=>"\xc3\xbc",521 0xFD=>"\xc5\xbc",522 0xFE=>"\xc5\xbe",523 0xFF=>"\xcb\x99"396 0x80=>"\xe2\x82\xac", 397 0x81=>"\xc0\x4", 398 0x82=>"\xe2\x80\x9a", 399 0x83=>"\xc0\x4", 400 0x84=>"\xe2\x80\x9e", 401 0x85=>"\xe2\x80\xa6", 402 0x86=>"\xe2\x80\xa0", 403 0x87=>"\xe2\x80\xa1", 404 0x88=>"\xc0\x4", 405 0x89=>"\xe2\x80\xb0", 406 0x8A=>"\xc0\x4", 407 0x8B=>"\xe2\x80\xb9", 408 0x8C=>"\xc0\x4", 409 0x8D=>"\xc2\xa8", 410 0x8E=>"\xcb\x87", 411 0x8F=>"\xc2\xb8", 412 0x90=>"\xc0\x4", 413 0x91=>"\xe2\x80\x98", 414 0x92=>"\xe2\x80\x99", 415 0x93=>"\xe2\x80\x9c", 416 0x94=>"\xe2\x80\x9d", 417 0x95=>"\xe2\x80\xa2", 418 0x96=>"\xe2\x80\x93", 419 0x97=>"\xe2\x80\x94", 420 0x98=>"\xc0\x4", 421 0x99=>"\xe2\x84\xa2", 422 0x9A=>"\xc0\x4", 423 0x9B=>"\xe2\x80\xba", 424 0x9C=>"\xc0\x4", 425 0x9D=>"\xc2\xaf", 426 0x9E=>"\xcb\x9b", 427 0x9F=>"\xc0\x4", 428 0xA0=>"\xc2\xa0", 429 0xA1=>"\xc0\x4", 430 0xA2=>"\xc2\xa2", 431 0xA3=>"\xc2\xa3", 432 0xA4=>"\xc2\xa4", 433 0xA5=>"\xc0\x4", 434 0xA6=>"\xc2\xa6", 435 0xA7=>"\xc2\xa7", 436 0xA8=>"\xc3\x98", 437 0xA9=>"\xc2\xa9", 438 0xAA=>"\xc5\x96", 439 0xAB=>"\xc2\xab", 440 0xAC=>"\xc2\xac", 441 0xAD=>"\xc2\xad", 442 0xAE=>"\xc2\xae", 443 0xAF=>"\xc3\x86", 444 0xB0=>"\xc2\xb0", 445 0xB1=>"\xc2\xb1", 446 0xB2=>"\xc2\xb2", 447 0xB3=>"\xc2\xb3", 448 0xB4=>"\xc2\xb4", 449 0xB5=>"\xc2\xb5", 450 0xB6=>"\xc2\xb6", 451 0xB7=>"\xc2\xb7", 452 0xB8=>"\xc3\xb8", 453 0xB9=>"\xc2\xb9", 454 0xBA=>"\xc5\x97", 455 0xBB=>"\xc2\xbb", 456 0xBC=>"\xc2\xbc", 457 0xBD=>"\xc2\xbd", 458 0xBE=>"\xc2\xbe", 459 0xBF=>"\xc3\xa6", 460 0xC0=>"\xc4\x84", 461 0xC1=>"\xc4\xae", 462 0xC2=>"\xc4\x80", 463 0xC3=>"\xc4\x86", 464 0xC4=>"\xc3\x84", 465 0xC5=>"\xc3\x85", 466 0xC6=>"\xc4\x98", 467 0xC7=>"\xc4\x92", 468 0xC8=>"\xc4\x8c", 469 0xC9=>"\xc3\x89", 470 0xCA=>"\xc5\xb9", 471 0xCB=>"\xc4\x96", 472 0xCC=>"\xc4\xa2", 473 0xCD=>"\xc4\xb6", 474 0xCE=>"\xc4\xaa", 475 0xCF=>"\xc4\xbb", 476 0xD0=>"\xc5\xa0", 477 0xD1=>"\xc5\x83", 478 0xD2=>"\xc5\x85", 479 0xD3=>"\xc3\x93", 480 0xD4=>"\xc5\x8c", 481 0xD5=>"\xc3\x95", 482 0xD6=>"\xc3\x96", 483 0xD7=>"\xc3\x97", 484 0xD8=>"\xc5\xb2", 485 0xD9=>"\xc5\x81", 486 0xDA=>"\xc5\x9a", 487 0xDB=>"\xc5\xaa", 488 0xDC=>"\xc3\x9c", 489 0xDD=>"\xc5\xbb", 490 0xDE=>"\xc5\xbd", 491 0xDF=>"\xc3\x9f", 492 0xE0=>"\xc4\x85", 493 0xE1=>"\xc4\xaf", 494 0xE2=>"\xc4\x81", 495 0xE3=>"\xc4\x87", 496 0xE4=>"\xc3\xa4", 497 0xE5=>"\xc3\xa5", 498 0xE6=>"\xc4\x99", 499 0xE7=>"\xc4\x93", 500 0xE8=>"\xc4\x8d", 501 0xE9=>"\xc3\xa9", 502 0xEA=>"\xc5\xba", 503 0xEB=>"\xc4\x97", 504 0xEC=>"\xc4\xa3", 505 0xED=>"\xc4\xb7", 506 0xEE=>"\xc4\xab", 507 0xEF=>"\xc4\xbc", 508 0xF0=>"\xc5\xa1", 509 0xF1=>"\xc5\x84", 510 0xF2=>"\xc5\x86", 511 0xF3=>"\xc3\xb3", 512 0xF4=>"\xc5\x8d", 513 0xF5=>"\xc3\xb5", 514 0xF6=>"\xc3\xb6", 515 0xF7=>"\xc3\xb7", 516 0xF8=>"\xc5\xb3", 517 0xF9=>"\xc5\x82", 518 0xFA=>"\xc5\x9b", 519 0xFB=>"\xc5\xab", 520 0xFC=>"\xc3\xbc", 521 0xFD=>"\xc5\xbc", 522 0xFE=>"\xc5\xbe", 523 0xFF=>"\xcb\x99" 524 524 ), 525 525 ); … … 529 529 { 530 530 $Result = ''; 531 for($I = 0; $I < strlen($String); $I++) 531 for($I = 0; $I < strlen($String); $I++) 532 532 { 533 533 if(ord($String[$I]) < 128) $Result .= $String[$I]; -
trunk/add.php
r68 r69 1 1 <?php 2 2 3 include ('Global.php');3 include_once('Application/Core.php'); 4 4 5 $Application = new Application(); 6 $Application->Start(); 5 $Core = new Core(); 6 $Core->ShowPage = false; 7 $Core->Run(); 8 7 9 8 10 if(array_key_exists('MeasureId', $_GET) and array_key_exists('Value', $_GET)) … … 10 12 $MeasureId = addslashes($_GET['MeasureId']); 11 13 $Value = addslashes($_GET['Value']); 12 $Measure = new Measure($ Application->Database);14 $Measure = new Measure($Core->Database); 13 15 $Measure->Load($MeasureId); 14 16 $HostName = gethostbyaddr($_SERVER['REMOTE_ADDR']); -
trunk/index.php
r67 r69 1 1 <?php 2 include('Global.php');3 2 4 class MainView 5 { 6 var $Months; 7 var $GrafTimeRanges; 3 include_once('Application/Core.php'); 8 4 9 function __construct($Database) 10 { 11 $this->Database = &$Database; 12 $this->Months = array('', 'Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 13 'Říjen', 'Listopad', 'Prosinec'); 14 15 $this->GrafTimeRanges = array( 16 'hour' => array( 17 'caption' => 'Hodina', 18 'period' => 3600, 19 ), 20 'day' => array( 21 'caption' => 'Den', 22 'period' => 3600 * 24, 23 ), 24 'week' => array( 25 'caption' => 'Týden', 26 'period' => 3600 * 24 * 7, 27 ), 28 'month' => array( 29 'caption' => 'Měsíc', 30 'period' => 3600 * 24 * 30, 31 ), 32 'year' => array( 33 'caption' => 'Rok', 34 'period' => 3600 * 24 * 365, 35 ), 36 'years' => array( 37 'caption' => 'Desetiletí', 38 'period' => 3600 * 24 * 365 * 10, 39 ), 40 ); 41 } 42 43 function EditTime($Time) 44 { 45 $Output = '<form style="display: inline;" action="?Operation=SetTime&Time='.$Time.'" method="post">'; 46 $TimeParts = getdate($_SESSION[$Time]); 47 48 // Day selection 49 $Output .= '<select name="Day">'; 50 for($I = 1; $I < 32; $I++) 51 { 52 if($I == $TimeParts['mday']) $Selected = ' selected="1"'; else $Selected = ''; 53 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 54 } 55 $Output .= '</select>. '; 56 57 // Month selection 58 $Output .= '<select name="Month">'; 59 foreach($this->Months as $Index => $Month) 60 { 61 if($Index == $TimeParts['mon']) $Selected = ' selected="1"'; else $Selected = ''; 62 if($Index > 0) $Output .= '<option value="'.$Index.'"'.$Selected.'>'.$Month.'</option>'; 63 } 64 $Output .= '</select>. '; 65 66 // Year selection 67 $Output .= '<select name="Year">'; 68 for($I = 2000; $I <= date("Y"); $I++) 69 { 70 if($I == $TimeParts['year']) $Selected = ' selected="1"'; else $Selected = ''; 71 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 72 } 73 $Output .= '</select> '; 74 75 // Hour selection 76 $Output .= '<select name="Hour">'; 77 for($I = 0; $I < 24; $I++) 78 { 79 if($I == $TimeParts['hours']) $Selected = ' selected="1"'; else $Selected = ''; 80 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 81 } 82 $Output .= '</select> : '; 83 84 // Minute selection 85 $Output .= '<select name="Minute">'; 86 for($I = 0; $I < 60; $I++) 87 { 88 if($I == $TimeParts['minutes']) $Selected = ' selected="1"'; else $Selected = ''; 89 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 90 } 91 $Output .= '</select> '; 92 93 $Output .= '<input type="submit" value="Nastavit">'; 94 $Output .= '</form>'; 95 $Output .= ' <form style="display: inline;" action="?Operation=SetTimeNow&Time='.$Time.'" method="post">'; 96 $Output .= '<input type="submit" value="Aktuální čas">'; 97 $Output .= '</form>'; 98 99 return($Output); 100 } 101 102 /* Produce table with available measures */ 103 function ShowMeasureTable() 104 { 105 $PrefixMultiplier = new PrefixMultiplier(); 106 $Output = '<table border="1" cellspacing="0" cellpadding="2" style="font-size: small; margin: 0px auto;">'; 107 $Output .= '<tr><th>Měřená veličina</th><th>Poslední hodnota</th><th>Čas posledního měření</th><th>Interpolace</th><th>Poznámky</th>'; 108 if(array_key_exists('Debug', $_GET)) $Output .= '<th>Počet položek</th><th>Čas vykonání</th>'; 109 $Output .= '</tr>'; 110 $Result = $this->Database->select('measure', '*', '(Enabled=1) AND ((PermissionView="all") OR (PermissionView="'.gethostbyaddr($_SERVER['REMOTE_ADDR']).'")) ORDER BY Description'); 111 while($Measure = $Result->fetch_array()) 112 { 113 $StopWatchStart = GetMicrotime(); 114 if(array_key_exists('Debug', $_GET)) 115 { 116 $DbResult = $this->Database->select($Measure['DataTable'], 'COUNT(*)', 'measure='.$Measure['Id']); 117 $RowCount = $DbResult->fetch_array(); 118 $RowCount = $RowCount[0]; 119 } 120 $Result2 = $this->Database->select($Measure['DataTable'], 'time, avg', '(measure='.$Measure['Id'].') AND (level=0) ORDER BY time DESC LIMIT 1'); 121 if($Result2->num_rows > 0) 122 { 123 $Row = $Result2->fetch_array(); 124 $LastMeasureTime = date('j.n.Y G:i:s', MysqlDateTimeToTime($Row['time'])); 125 $LastMeasureValue = $PrefixMultiplier->Add($Row['avg'], $Measure['Unit']); 126 } else { 127 $LastMeasureTime = ' '; 128 $LastMeasureValue = ' '; 129 } 130 if($Measure['Continuity'] == 1) $Interpolate = 'Ano'; else $Interpolate = 'Ne'; 131 if($Measure['Info'] == '') $Measure['Info'] = ' '; 132 $GenerationTime = floor((GetMicrotime() - $StopWatchStart) * 1000 ) / 1000; 133 $Output .= '<tr><td style="text-align: left"><a href="?Measure='.$Measure['Id'].'&Differential=0">'.$Measure['Description'].'</a></td><td align="center">'.$LastMeasureValue.'</td><td align="center">'.$LastMeasureTime.'</td><td align="center">'.$Interpolate.'</td><td>'.$Measure['Info'].'</td>'; 134 if(array_key_exists('Debug', $_GET)) $Output .= '<td>'.$RowCount.'</td><td>'.$GenerationTime.'</td>'; 135 $Output .= '</tr>'; 136 } 137 $Output .= '</table>'; 138 return($Output); 139 } 140 141 function ShowGraph() 142 { 143 $Output = '<strong>Graf:</strong><br>'; 144 $Output .= '<img alt="Graf" src="Graph.php?Measure='.$_SESSION['Measure'].'&From='. 145 $_SESSION['TimeStart'].'&To='.$_SESSION['TimeEnd']. 146 '&Width=750&Height=200&Differential='. 147 $_SESSION['Differential'].'" width="750" height="200"><br>'; 148 $Output .= '<a href="?Measure='.$_SESSION['Measure'].'&TimeStart='. 149 $_SESSION['TimeStart'].'&TimeEnd='.$_SESSION['TimeEnd']. 150 '&TimeSpecify=1&Differential='.$_SESSION['Differential']. 151 '">Odkaz na vybraný graf</a><br/>'; 152 return($Output); 153 } 154 155 function ShowTimeRange() 156 { 157 $Output = ''; 158 if($_SESSION['TimeSpecify'] == 0) 159 { 160 $_SESSION['TimeEnd'] = time() - 60; 161 $_SESSION['TimeStart'] = $_SESSION['TimeEnd'] - $this->GrafTimeRanges[$_SESSION['Period']]['period']; 162 } 163 164 if(!array_key_exists('Operation', $_GET)) $_GET['Operation'] = ''; 165 switch($_GET['Operation']) 166 { 167 case 'SetTime': 168 if(array_key_exists('Time', $_GET) and array_key_exists('Month', $_POST) and array_key_exists('Day', $_POST) and 169 array_key_exists('Year', $_POST) and array_key_exists('Hour', $_POST) and array_key_exists('Minute', $_POST)) 170 { 171 if(($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd')) 172 { 173 $_SESSION[$_GET['Time']] = mktime($_POST['Hour'], $_POST['Minute'], 0, $_POST['Month'], 174 $_POST['Day'], $_POST['Year']); 175 $$_GET['Time'] = $_SESSION[$_GET['Time']]; 176 } 177 } 178 break; 179 case 'SetTimeNow': 180 if(array_key_exists('Time', $_GET)) 181 { 182 if(($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd')) 183 { 184 $_SESSION[$_GET['Time']] = time(); 185 $$_GET['Time'] = $_SESSION[$_GET['Time']]; 186 } 187 } 188 break; 189 190 } 191 $Output .= '<strong>Časový úsek:</strong><br>'; 192 193 // Show graph time range menu 194 if($_SESSION['TimeSpecify'] == 0) 195 { 196 $Output .= 'Délka úseku: '; 197 foreach($this->GrafTimeRanges as $Index => $Item) 198 $Output .= '<a href="?Period='.$Index.'">'.$Item['caption'].'</a> '; 199 $Output .= '<br>'; 200 $Output .= '<a href="?TimeSpecify=1">Přesnější nastavení...</a><br>'; 201 } else { 202 $Output .= '<table cellspacing="0" cellpadding="2" border="0" style="margin: 0px auto;">'; 203 $Output .= '<tr><td>Počátek:</td><td>'.$this->EditTime('TimeStart').'</td></tr>'; 204 $Output .= '<tr><td>Konec:</td><td>'.$this->EditTime('TimeEnd').'</td></tr>'; 205 $Output .= '</table>'; 206 $Output .= '<a href="?TimeSpecify=0">Jednoduché nastavení...</a><br>'; 207 } 208 $Output .= '<br/>'; 209 return($Output); 210 211 } 212 213 function Show() 214 { 215 global $Config; 216 217 $Debug = 0; 218 foreach($Config['DefaultVariables'] as $Index => $Variable) 219 { 220 if(!array_key_exists($Index, $_SESSION)) $_SESSION[$Index] = $Variable; 221 if(array_key_exists($Index, $_GET)) $_SESSION[$Index] = $_GET[$Index]; 222 if(array_key_exists($Index, $_POST)) $_SESSION[$Index] = $_POST[$Index]; 223 //$$Index = $_SESSION[$Index]; 224 } 225 226 $Output = '<div style="text-align: center"><div class="Title">'.$Config['Web']['Title'].'</div>'; 227 228 $Result = $this->Database->select('measure', 'Id', '(`Enabled`=1) AND '. 229 '((`PermissionView`="all") OR (`PermissionView`="'.gethostbyaddr($_SERVER['REMOTE_ADDR']).'")) '. 230 'AND (`Id`='.($_SESSION['Measure'] * 1).')'); 231 if($Result->num_rows == 0) 232 $_SESSION['Measure'] = $Config['DefaultVariables']['Measure']; 233 234 $Output .= $this->ShowTimeRange(); 235 $Output .= $this->ShowGraph(); 236 $Output .= '<br/>'; 237 $Output .= $this->ShowMeasureTable(); 238 $Output .= '</div>'; 239 240 ShowPage($Output); 241 } 242 } 243 244 $Application = new Application(); 245 $Application->Start(); 246 $MainView = new MainView($Application->Database); 247 $MainView->Show(); 5 $Core = new Core(); 6 $Core->Run(); -
trunk/style/style.css
r14 r69 321 321 width: auto; 322 322 } 323 324 .BaseTable 325 { 326 margin: 2px auto 2px auto; 327 border-width: 1px; 328 border-color: black; 329 border-style: solid; 330 border-collapse: collapse; 331 } 332 333 .BaseTable tr td 334 { 335 border-width: 1px; 336 border-color: black; 337 border-style: solid; 338 padding: 2px; 339 text-align: center; 340 } 341 342 .BaseTable tr th 343 { 344 border-width: 1px; 345 border-color: black; 346 border-style: solid; 347 padding: 2px; 348 background-color: #F0F0F0; 349 text-align: center; 350 }
Note:
See TracChangeset
for help on using the changeset viewer.
