Changeset 738 for trunk/Common
- Timestamp:
- Apr 14, 2015, 10:20:16 PM (10 years ago)
- Location:
- trunk/Common
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/AppModule.php
r731 r738 1 1 <?php 2 2 3 /* This implementation will not support installation from remote source. Just 3 /* This implementation will not support installation from remote source. Just 4 4 * installation of already presented modules mainly to persistence preparation. 5 5 */ … … 7 7 class ModuleType 8 8 { 9 10 11 9 const System = 0; 10 const Normal = 1; 11 const Application = 2; 12 12 } 13 13 … … 40 40 var $Title; 41 41 var $Version; 42 var $License; 42 var $License; 43 43 var $Creator; 44 44 var $HomePage; … … 58 58 var $Manager; 59 59 var $OnChange; 60 60 61 61 function __construct(System $System) 62 62 { … … 74 74 $this->Type = ModuleType::Normal; 75 75 } 76 76 77 77 function Install() 78 78 { … … 82 82 $this->Manager->Perform($List, array(ModuleAction::Install), array(ModuleCondition::NotInstalled)); 83 83 $this->DoInstall(); 84 85 86 87 } 88 84 $this->Installed = true; 85 $this->InstalledVersion = $this->Version; 86 $this->Manager->Modules[$this->Name] = $this; 87 } 88 89 89 function Uninstall() 90 90 { … … 97 97 $this->DoUninstall(); 98 98 } 99 99 100 100 function Upgrade() 101 101 { … … 106 106 $this->DoUpgrade(); 107 107 } 108 108 109 109 function Reinstall() 110 110 { … … 113 113 $this->Install(); 114 114 } 115 115 116 116 function Start() 117 117 { 118 118 if($this->Running) return; 119 if(!$this->Installed) return; 119 if(!$this->Installed) return; 120 120 $List = array(); 121 121 $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotRunning)); 122 122 $this->Manager->Perform($List, array(ModuleAction::Start), array(ModuleCondition::NotRunning)); 123 123 $this->DoStart(); 124 125 } 126 124 $this->Running = true; 125 } 126 127 127 function Stop() 128 128 { 129 if(!$this->Running) return;129 if(!$this->Running) return; 130 130 $this->Running = false; 131 132 131 $List = array(); 132 $this->Manager->EnumSuperiorDependenciesCascade($this, $List, array(ModuleCondition::Running)); 133 133 $this->Manager->Perform($List, array(ModuleAction::Stop), array(ModuleCondition::Running)); 134 $this->DoStop();135 } 136 134 $this->DoStop(); 135 } 136 137 137 function Restart() 138 138 { … … 140 140 $this->Start(); 141 141 } 142 142 143 143 function Enable() 144 144 { … … 150 150 $this->Enabled = true; 151 151 } 152 152 153 153 function Disable() 154 154 { … … 160 160 $this->Manager->Perform($List, array(ModuleAction::Disable), array(ModuleCondition::Enabled)); 161 161 } 162 162 163 163 protected function DoStart() 164 164 { 165 165 } 166 166 167 167 protected function DoStop() 168 { 168 { 169 169 } 170 170 … … 172 172 { 173 173 } 174 174 175 175 protected function DoUninstall() 176 176 { … … 179 179 180 180 /* Manage installed modules */ 181 class AppModuleManager 181 class AppModuleManager 182 182 { 183 183 var $Modules; … … 185 185 var $FileName; 186 186 var $OnLoadModules; 187 187 188 188 function __construct(System $System) 189 189 { 190 190 $this->Modules = array(); 191 191 $this->System = &$System; 192 $this->FileName = 'Config/Modules.php'; 193 } 194 192 $this->FileName = 'Config/Modules.php'; 193 } 194 195 195 function Perform($List, $Actions, $Conditions = array(ModuleCondition::All)) 196 196 { … … 217 217 } 218 218 } 219 219 220 220 function EnumDependenciesCascade($Module, &$List, $Conditions = array(ModuleCondition::All)) 221 221 { … … 236 236 } 237 237 } 238 238 239 239 function EnumSuperiorDependenciesCascade($Module, &$List, $Conditions = array(ModuleCondition::All)) 240 240 { 241 241 foreach($this->Modules as $RefModule) 242 242 { 243 if(in_array($Module->Name, $RefModule->Dependencies) and 243 if(in_array($Module->Name, $RefModule->Dependencies) and 244 244 (in_array(ModuleCondition::All, $Conditions) or 245 245 ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or … … 255 255 } 256 256 } 257 257 258 258 function Start() 259 259 { … … 262 262 $this->StartEnabled(); 263 263 } 264 264 265 265 function StartAll() 266 266 { 267 267 $this->Perform($this->Modules, array(ModuleAction::Start)); 268 268 } 269 269 270 270 function StartEnabled() 271 271 { … … 277 277 $this->Perform($this->Modules, array(ModuleAction::Stop)); 278 278 } 279 279 280 280 function UninstallAll() 281 281 { … … 283 283 $this->SaveState(); 284 284 } 285 285 286 286 function ModulePresent($Name) 287 287 { 288 288 return(array_key_exists($Name, $this->Modules)); 289 289 } 290 290 291 291 /* @return Module */ 292 292 function SearchModuleById($Id) … … 299 299 return(''); 300 300 } 301 301 302 302 function LoadState() 303 303 { 304 304 $ConfigModules = array(); 305 305 include($this->FileName); 306 306 foreach($ConfigModules as $Mod) … … 312 312 $this->Modules[$Mod['Name']]->Installed = $Mod['Installed']; 313 313 $this->Modules[$Mod['Name']]->InstalledVersion = $Mod['Version']; 314 } 315 } 316 } 317 314 } 315 } 316 } 317 318 318 function SaveState() 319 319 { … … 321 321 foreach($this->Modules as $Module) 322 322 { 323 $Data[] = array('Name' => $Module->Name, 'Enabled' => $Module->Enabled, 323 $Data[] = array('Name' => $Module->Name, 'Enabled' => $Module->Enabled, 324 324 'Version' => $Module->Version, 'Installed' => $Module->Installed); 325 325 } 326 326 file_put_contents($this->FileName, "<?php \n\n\$ConfigModules = ".var_export($Data, true).";\n"); 327 327 } 328 328 329 329 function RegisterModule(AppModule $Module) 330 330 { … … 333 333 $Module->OnChange = &$this->OnModuleChange; 334 334 } 335 335 336 336 function UnregisterModule(AppModule $Module) 337 337 { 338 338 unset($this->Modules[array_search($Module, $this->Modules)]); 339 339 } 340 340 341 341 function LoadModulesFromDir($Directory) 342 342 { 343 $List = scandir($Directory);343 $List = scandir($Directory); 344 344 foreach($List as $Item) 345 345 { … … 352 352 } 353 353 } 354 354 355 355 function LoadModules() 356 356 { 357 357 if(method_exists($this->OnLoadModules[0], $this->OnLoadModules[1])) 358 358 $this->OnLoadModules(); 359 359 else $this->LoadModulesFromDir(dirname(__FILE__).'/../Modules'); -
trunk/Common/Application.php
r578 r738 3 3 class Application 4 4 { 5 6 7 8 9 10 11 5 var $Name; 6 var $System; 7 8 function Run() 9 { 10 11 } 12 12 } -
trunk/Common/Base.php
r565 r738 11 11 { 12 12 $this->System = &$System; 13 $this->Database = &$System->Database; 13 $this->Database = &$System->Database; 14 14 } 15 15 } … … 17 17 class Model extends Base 18 18 { 19 19 20 20 } 21 21 22 22 class View extends Base 23 23 { 24 24 25 25 } 26 26 27 27 class Controller extends Base 28 28 { 29 29 30 30 } -
trunk/Common/Config.php
r593 r738 1 1 <?php 2 2 3 class Config 3 class Config 4 4 { 5 5 var $Data; 6 6 7 7 function __construct() 8 8 { 9 9 $this->Data = array(); 10 10 } 11 11 12 12 function ReadValue($Name) 13 13 { 14 15 16 17 18 19 20 21 return($Data[$Last]); 14 if(!is_array($Name)) $Name = explode('/', $Name); 15 $Last = array_pop($Name); 16 $Data = &$this->Data; 17 foreach($Name as $Item) 18 { 19 $Data = &$Data[$Item]; 20 } 21 return($Data[$Last]); 22 22 } 23 23 24 24 function WriteValue($Name, $Value) 25 25 { 26 27 28 29 30 31 32 26 if(!is_array($Name)) $Name = explode('/', $Name); 27 $Last = array_pop($Name); 28 $Data = &$this->Data; 29 foreach($Name as $Item) 30 { 31 $Data = &$Data[$Item]; 32 } 33 33 $Data[$Item] = $Value; 34 34 } 35 35 36 36 function LoadFromFile($FileName) 37 37 { 38 38 $ConfigData = array(); 39 39 include $FileName; 40 40 foreach($this->Data as $Index => $Item) 41 41 { 42 42 if(array_key_exits($Index, $ConfigData)) 43 43 $this->Data[$Index] = $ConfigData[$Index]; 44 44 } 45 } 46 45 } 46 47 47 function SaveToFile($FileName) 48 48 { 49 49 file_put_contents($FileName, "<?php \n\n\$ConfigData = ".var_export($this->Data, true).";\n"); 50 50 } 51 51 52 52 function GetAsArray() 53 53 { 54 54 return($this->Data); 55 55 } 56 56 } -
trunk/Common/Form/Form.php
r737 r738 50 50 { 51 51 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) 52 52 $this->Values[$Index] = $Item['Default']; 53 53 } 54 54 } … … 62 62 function GetValue($Index, $Event = 'OnView') 63 63 { 64 65 66 67 68 69 70 71 72 73 74 64 $Item = $this->Definition['Items'][$Index]; 65 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 66 { 67 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 68 $this->FormManager->Type->RegisterType($Item['Type'], '', $this->FormManager->FormTypes[$Item['Type']]); 69 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 70 $UseType = 'OneToMany'; 71 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 72 $UseType = 'Enumeration'; 73 } else $UseType = $Item['Type']; 74 return $this->FormManager->Type->ExecuteTypeEvent($UseType, $Event, 75 75 array('Value' => $this->Values[$Index], 'Name' => $Index, 76 76 'Type' => $Item['Type'], 'Values' => $this->Values, … … 163 163 if(array_key_exists($Index, $this->ValuesValidate) and 164 164 $this->ValuesValidate[$Index]) { 165 166 167 165 $Format = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'GetValidationFormat', array()); 166 if($Format != '') $Caption .= '<br/><small>'.$Format.'</small>'; 167 $Caption = '<span style="color:red;">'.$Caption.'</span>'; 168 168 } 169 169 if(!$this->FormManager->Type->IsHidden($UseType)) … … 305 305 { 306 306 if(isset($Item['Default'])) { 307 308 309 307 if(isset($Item['Null']) and ($Item['Null'] == true)) 308 $Values[$Index] = null; 309 else $Values[$Index] = $Item['Default']; 310 310 } 311 311 } … … 342 342 if(!$this->FormManager->Type->ExecuteTypeEvent($UseType, 'Validate', 343 343 $Parameters)) { 344 345 344 $this->ValuesValidate[$Index] = true; 345 $Valid = false; 346 346 } 347 347 } -
trunk/Common/Form/Types/Base.php
r606 r738 44 44 return(addslashes($Value)); 45 45 } 46 46 47 47 function OnFilterName($Item) 48 48 { 49 if(array_key_exists('SQL', $Item) and ($Item['SQL'] != '')) 49 if(array_key_exists('SQL', $Item) and ($Item['SQL'] != '')) 50 50 $SQL = '('.$Item['SQL'].') AS '; 51 51 else $SQL = ''; … … 55 55 function OnFilterNameQuery($Item) 56 56 { 57 if(array_key_exists('SQL', $Item) and ($Item['SQL'] != '')) 57 if(array_key_exists('SQL', $Item) and ($Item['SQL'] != '')) 58 58 $Output = '('.$Item['SQL'].') AS `'.$Item['Name'].'`, ('.$Item['SQL'].') AS `'.$Item['Name'].'_Filter`'; 59 59 else $Output = '`'.$Item['Name'].'`, `'.$Item['Name'].'` AS `'.$Item['Name'].'_Filter`'; 60 60 return($Output); 61 61 } 62 62 63 63 function Validate($Item) 64 64 { 65 65 return(true); 66 66 } 67 67 68 68 function GetValidationFormat() 69 69 { 70 70 return(''); 71 71 } 72 72 } -
trunk/Common/Form/Types/Boolean.php
r548 r738 21 21 function OnLoad($Item) 22 22 { 23 if(array_key_exists($Item['Name'], $_POST)) return(1); 23 if(array_key_exists($Item['Name'], $_POST)) return(1); 24 24 else return(0); 25 25 } -
trunk/Common/Form/Types/Enumeration.php
r548 r738 18 18 $Type = $this->FormManager->Type->GetTypeDefinition($Item['Type']); 19 19 $Output = '<select name="'.$Item['Name'].'">'; 20 if(array_key_exists('Null', $Item) and $Item['Null']) 20 if(array_key_exists('Null', $Item) and $Item['Null']) 21 21 { 22 22 if($Item['Value'] == NULL) $Selected = ' selected="1"'; else $Selected = ''; … … 37 37 return($_POST[$Item['Name']]); 38 38 } 39 39 40 40 function OnLoadDb($Item) 41 41 { -
trunk/Common/Form/Types/Hidden.php
r548 r738 10 10 $this->Hidden = true; 11 11 } 12 12 13 13 function OnView($Item) 14 14 { -
trunk/Common/Form/Types/IPv4Address.php
r606 r738 21 21 return($_POST[$Item['Name']]); 22 22 } 23 23 24 24 function Validate($Item) 25 25 { 26 27 26 if($Item['Null'] and ($Item['Value'] == '')) return(true); 27 return(filter_var($Item['Value'], FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4))); 28 28 } 29 29 30 30 function GetValidationFormat() 31 31 { 32 33 } 32 return('x.x.x.x kde x je hodnota 0..255'); 33 } 34 34 } -
trunk/Common/Form/Types/IPv6Address.php
r606 r738 21 21 return($_POST[$Item['Name']]); 22 22 } 23 23 24 24 function Validate($Item) 25 25 { 26 27 26 if($Item['Null'] and ($Item['Value'] == '')) return(true); 27 return(filter_var($Item['Value'], FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6))); 28 28 } 29 29 30 30 function GetValidationFormat() 31 31 { 32 32 return('xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx kde x je hexa hodnota 0..f'); 33 33 } 34 34 } -
trunk/Common/Form/Types/Image.php
r631 r738 2 2 3 3 class TypeImage extends TypeString 4 { 4 { 5 5 function OnView($Item) 6 6 { 7 7 global $System; 8 8 9 9 return('<img src="'.$System->Link('/images/favicons/'.$Item['Value']).'"/> '.$Item['Value']); 10 10 } -
trunk/Common/Form/Types/Integer.php
r611 r738 23 23 return($_POST[$Item['Name']]); 24 24 } 25 25 26 26 function Validate($Item) 27 27 { 28 29 28 if($Item['Null'] and ($Item['Value'] == '')) return(true); 29 return(preg_match('/^\-*[0-9\.]+$/', $Item['Value'])); 30 30 } 31 31 32 32 function GetValidationFormat() 33 33 { 34 35 } 34 return('číselná hodnota'); 35 } 36 36 } -
trunk/Common/Form/Types/MacAddress.php
r683 r738 32 32 function Validate($Item) 33 33 { 34 35 34 if($Item['Null'] and ($Item['Value'] == '')) return(true); 35 return(preg_match('/^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$/', $Item['Value'])); 36 36 } 37 37 38 38 function GetValidationFormat() 39 39 { 40 40 return('XX:XX:XX:XX:XX:XX kde X je hexa hodnota 0..F'); 41 41 } 42 42 } -
trunk/Common/Form/Types/Password.php
r548 r738 27 27 $Result = $_POST[$Item['Name']]; 28 28 /* 29 if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]); 29 if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]); 30 30 else 31 31 { … … 41 41 return($Result); 42 42 } 43 43 44 44 function OnSaveDb($Item) 45 45 { 46 if($Item['Value'] == '') return(''); 46 if($Item['Value'] == '') return(''); 47 47 else { 48 48 $PasswordHash = new PasswordHash(); … … 50 50 } 51 51 } 52 52 53 53 function OnLoadDb($Item) 54 54 { -
trunk/Common/Form/Types/RandomHash.php
r548 r738 10 10 $this->Hidden = true; 11 11 } 12 12 13 13 function OnView($Item) 14 14 { -
trunk/Common/Global.php
r729 r738 25 25 26 26 $MonthNames = array('', 'Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 27 27 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'); 28 28 29 29 $UnitNames = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB'); … … 58 58 function HumanDate($Time) 59 59 { 60 60 if($Time != '') { 61 61 $Date = explode(' ', $Time); 62 62 $Parts = explode('-', $Date[0]); 63 63 if($Date != '0000-00-00') return(($Parts[2]*1).'.'.($Parts[1]*1).'.'.$Parts[0]); 64 64 else return(' '); 65 65 } else return(' '); 66 66 } 67 67 … … 106 106 { 107 107 return(array( 108 109 110 111 112 113 108 'Year' => date('Y', $Time), 109 'Month' => date('n', $Time), 110 'Day' => date('j', $Time), 111 'Hour' => date('h', $Time), 112 'Minute' => date('i', $Time), 113 'Second' => date('s', $Time) 114 114 )); 115 115 } … … 143 143 class Paging 144 144 { 145 146 147 148 149 150 151 152 153 154 155 156 157 145 var $TotalCount; 146 var $ItemPerPage; 147 var $Around; 148 var $SQLLimit; 149 var $Page; 150 151 function __construct() 152 { 153 global $System; 154 155 $this->ItemPerPage = $System->Config['Web']['ItemsPerPage']; 156 $this->Around = $System->Config['Web']['VisiblePagingItems']; 157 } 158 158 159 159 function Show() … … 356 356 function IsInternetAddr() 357 357 { 358 359 360 358 global $Config; 359 360 $Result = true; 361 361 $RemoteAddr = GetRemoteAddress(); 362 362 foreach($Config['Web']['IntranetSubnets'] as $Subnet) … … 364 364 if(substr($RemoteAddr, 0, strlen($Subnet)) == $Subnet) 365 365 { 366 367 366 $Result = false; 367 break; 368 368 } 369 369 } … … 467 467 function pack_array($v, $a) 468 468 { 469 470 } 471 469 return call_user_func_array('pack', array_merge(array($v), (array)$a)); 470 } 471 -
trunk/Common/Image.php
r548 r738 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/Common/Mail.php
r579 r738 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 } … … 97 97 { 98 98 if(count($this->Bodies) == 0) throw new Exception('Mail: Need at least one text body'); 99 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') … … 127 127 } 128 128 if($To == '') throw new Exception('Mail: Need at least one recipient address'); 129 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 144 if($this->Subject == '') throw new Exception('Mail: Missing Subject'); 145 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 165 } 166 } 167 161 foreach($Addresses as $Address) 162 { 163 if(!$this->ValidEmail($Address)) 164 throw new Exception('Mail: Invalid address '.$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)) 191 if(!file_exists($FileName)) 192 192 throw new Exception('Mail: Attached file '.$FileName.' can\'t be found'); 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/Common/NetworkAddress.php
r705 r738 60 60 class NetworkAddressIPv6 61 61 { 62 63 62 var $Address; 63 var $Prefix; 64 64 65 66 67 68 69 65 function __construct() 66 { 67 $this->Address = 0; 68 $this->Prefix = 0; 69 } 70 70 71 71 function AddressToString() 72 72 { 73 73 return(inet_ntop($this->Address)); 74 74 } 75 75 76 76 function AddressFromString($Value) 77 77 { 78 78 $this->Address = inet_pton($Value); 79 79 } 80 80 81 81 function GetOctets() 82 82 { 83 84 85 86 83 $Result = array(); 84 $Data = array_reverse(unpack('C*', $this->Address)); 85 foreach($Data as $Item) 86 { 87 87 88 89 90 91 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 97 98 99 100 101 102 103 104 105 106 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/Common/Page.php
r729 r738 15 15 var $Encoding; 16 16 var $Style; 17 17 18 18 function __construct($System) 19 19 { 20 20 parent::__construct($System); 21 21 22 22 $this->FormatHTML = false; 23 23 $this->ShowRuntimeInfo = false; 24 24 $this->Encoding = 'utf-8'; 25 25 $this->Style = 'new'; 26 26 27 27 // TODO: Move to external code 28 28 if(isset($this->System->Config['Web']['FormatHTML'])) … … 35 35 $this->Style = $this->System->Config['Web']['Style']; 36 36 } 37 37 38 38 function Show() 39 39 { 40 40 return(''); 41 41 } 42 42 43 43 function SystemMessage($Title, $Text) 44 { 44 { 45 45 return('<table align="center"><tr><td><div class="SystemMessage"><h3>'.$Title.'</h3><div>'.$Text.'</div></div></td></tr></table>'); 46 46 //ShowFooter(); … … 50 50 function ShowHeader($Title, $Path) 51 51 { 52 52 if(array_key_exists('REQUEST_URI', $_SERVER)) 53 53 $ScriptName = $_SERVER['REQUEST_URI']; 54 54 else $ScriptName = ''; 55 55 while(strpos($ScriptName, '//') !== false) 56 56 $ScriptName = str_replace('//', '/', $ScriptName); … … 62 62 $Navigation = ''; 63 63 while($Page) 64 { 64 { 65 65 $Navigation = ' > <a href="'.$this->System->Link($ScriptName).'/">'.$Page->ShortTitle.'</a>'.$Navigation; 66 66 67 67 if(class_exists($Page->ParentClass)) 68 68 { … … 71 71 $ScriptName = substr($ScriptName, 0, strrpos($ScriptName, '/')); 72 72 } else $Page = null; 73 } 73 } 74 74 $Navigation = substr($Navigation, 6); 75 75 … … 89 89 //$Output .= '<div class="MainTitle">'.$Title.'</div>'; 90 90 $Output .= '<div class="MainTitle"><span class="MenuItem"><strong>Navigace :: </strong> '.$Navigation.'</span><div class="MenuItem2">'; 91 92 91 foreach($this->System->Bars['Top'] as $BarItem) 92 $Output .= call_user_func($BarItem); 93 93 $Output .= '</div></div>'; 94 94 } … … 99 99 { 100 100 global $ScriptTimeStart, $Revision, $ReleaseTime; 101 101 102 102 $Time = round(GetMicrotime() - $ScriptTimeStart, 2); 103 103 $Output = ''; … … 112 112 } 113 113 $Output .= '</body></html>'; 114 return($Output); 114 return($Output); 115 115 } 116 116 … … 122 122 // $Output = 'Chyba: '.$E->getMessage(); 123 123 //} 124 if($this->ClearPage == false) 124 if($this->ClearPage == false) 125 125 { 126 126 $Output = $this->ShowHeader($this->FullTitle, $this->ShortTitle).$Output; … … 130 130 echo($Output); 131 131 } 132 132 133 133 function NewPage($ClassName) 134 134 { … … 156 156 } 157 157 $line = trim(substr($s, $start, $end + 1)); 158 if(strlen($line) > 0) 158 if(strlen($line) > 0) 159 159 if($line[0] == '<') 160 160 { 161 if($s[$start + 1] == '/') 161 if($s[$start + 1] == '/') 162 162 { 163 163 $n = $n - 2; 164 164 $nn = $n; 165 } else 165 } else 166 166 { 167 167 if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1); … … 169 169 //echo('['.$cmd.']'); 170 170 if(strpos($s, '</'.$cmd.'>')) $n = $n + 2; 171 } 171 } 172 172 }// else $line = '['.$line.']'; 173 173 //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n")); -
trunk/Common/RSS.php
r548 r738 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 36 35 ' <pubDate>'.date('r',$Item['Time'])."</pubDate>\n". 36 ' <link>'.$Item['Link']."</link>\n". 37 37 " </item>\n"; 38 38 } -
trunk/Common/Setup/FullInstall.php
r592 r738 9 9 CREATE DEFINER=`centrala`@`localhost` FUNCTION `CompareNetworkPrefix`(Address1 INT(11) UNSIGNED, Address2 INT(11) UNSIGNED, Size INT(11)) RETURNS tinyint(1) 10 10 RETURN Address1 & (-1 << (32 - Size)) = Address2 & (-1 << (32 - Size)); 11 11 12 12 -- 13 13 -- Struktura tabulky `ChatHistory` … … 2033 2033 $Manager->Execute("INSERT INTO `SystemVersion` (`Id`, `Revision`) VALUES 2034 2034 (1, 495);"); 2035 2035 2036 2036 } 2037 2037 -
trunk/Common/Setup/Setup.php
r737 r738 69 69 function Show() 70 70 { 71 72 73 74 75 76 77 78 79 71 global $ConfigDefinition, $DatabaseRevision, $Config, $Updates; 72 73 $this->UpdateManager = $this->System->Setup->UpdateManager; 74 $DefaultConfig = new DefaultConfig(); 75 $this->ConfigDefinition = $DefaultConfig->Get(); 76 $this->DatabaseRevision = $DatabaseRevision; 77 $this->Config = &$Config; 78 79 $Output = ''; 80 80 if(isset($this->Config)) 81 81 { … … 105 105 $Output .= $this->System->Setup->Upgrade(); 106 106 } catch (Exception $E) { 107 108 109 107 $Output .= $this->SystemMessage('Chyba aktualizace', 'Došlo k chybě v SQL dotazu při aktualizaci: <br/>'.$E->getMessage()); 108 } 109 $Output .= $this->ControlPanel(); 110 110 } else 111 111 if($Action == 'install') … … 353 353 class PageSetupRedirect extends Page 354 354 { 355 356 357 358 359 360 361 362 363 364 365 366 367 368 355 function Show() 356 { 357 $Output = ''; 358 if(!$this->Database->Connected()) $Output .= 'Nelze se připojit k databázi.<br>'; 359 else { 360 if(!$this->System->Setup->UpdateManager->IsInstalled()) 361 $Output .= 'Systém vyžaduje instalaci databáze.<br>'; 362 else 363 if(!$this->System->Setup->UpdateManager->IsUpToDate()) 364 $Output .= 'Systém vyžaduje aktualizaci databáze.<br>'; 365 } 366 $Output .= 'Pokračujte <a href="'.$this->System->Link('/setup/').'">zde</a>'; 367 return($Output); 368 } 369 369 } 370 370 … … 404 404 function Install() 405 405 { 406 406 global $DatabaseRevision; 407 407 408 408 $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemVersion` ( -
trunk/Common/Setup/Update.php
r725 r738 9 9 var $Database; 10 10 var $InstallMethod; 11 11 12 12 function __construct() 13 13 { 14 15 16 17 18 14 $this->Revision = 0; 15 $this->Trace = array(); 16 $this->VersionTable = 'SystemVersion'; 17 $this->InstallMethod = 'FullInstall'; 18 $this->InsertSampleDataMethod = 'InsertSampleData'; 19 19 } 20 20 21 21 function GetDbVersion() 22 22 { 23 24 $Version = $DbResult->fetch_assoc(); 23 $DbResult = $this->Database->select($this->VersionTable, '*', 'Id=1'); 24 $Version = $DbResult->fetch_assoc(); 25 25 return($Version['Revision']); 26 26 } 27 27 28 28 function IsInstalled() 29 { 29 { 30 30 debug_backtrace(); 31 32 return($DbResult->num_rows > 0); 31 $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"'); 32 return($DbResult->num_rows > 0); 33 33 } 34 34 35 35 function IsUpToDate() 36 36 { 37 37 return($this->Revision <= $this->GetDbVersion()); 38 38 } 39 39 40 40 function Upgrade() 41 41 { 42 43 $Output = 'Počáteční revize databáze: '.$DbRevision.'<br/>';44 42 $DbRevision = $this->GetDbVersion(); 43 $Output = 'Počáteční revize databáze: '.$DbRevision.'<br/>'; 44 while($this->Revision > $DbRevision) 45 45 { 46 47 48 // Show applied SQL queries immediatelly 49 50 51 46 $TraceItem = $this->Trace[$DbRevision]; 47 $Output .= 'Aktualizace na verzi '.$TraceItem['Revision'].':<br/>'; 48 // Show applied SQL queries immediatelly 49 echo($Output); 50 $Output = ''; 51 $RevUpdate = $TraceItem['Function']; 52 52 $RevUpdate($this); 53 54 55 56 57 return($Output); 53 $DbRevision = $TraceItem['Revision']; 54 $this->Database->query('UPDATE `'.$this->VersionTable.'` SET `Revision`= '. 55 $TraceItem['Revision'].' WHERE `Id`=1'); 56 } 57 return($Output); 58 58 } 59 59 60 60 function Install() 61 { 62 $InstallMethod = $this->InstallMethod;63 64 61 { 62 $InstallMethod = $this->InstallMethod; 63 $InstallMethod($this); 64 $this->Update(); 65 65 } 66 66 67 67 function Uninstall() 68 68 { 69 69 70 70 } 71 71 72 72 function InsertSampleData() 73 { 74 $InstallMethod = $this->InsertSampleDataMethod;75 73 { 74 $InstallMethod = $this->InsertSampleDataMethod; 75 $InstallMethod($this); 76 76 } 77 77 78 78 function Execute($Query) 79 79 { 80 81 82 80 echo($Query.';<br/>'); 81 flush(); 82 return($this->Database->query($Query)); 83 83 } 84 84 } -
trunk/Common/Setup/Updates.php
r736 r738 538 538 function UpdateTo627($Manager) 539 539 { 540 541 540 $Manager->Execute('ALTER TABLE `FinanceInvoice` CHANGE `TimeCreation` `Time` DATETIME NOT NULL DEFAULT "0000-00-00 00:00:00";'); 541 $Manager->Execute('ALTER TABLE `FinanceYear` ADD `Closed` INT NOT NULL ;'); 542 542 } 543 543 544 544 function UpdateTo632($Manager) 545 545 { 546 546 $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceInvoiceOperationRel` ( 547 547 `Id` int(11) NOT NULL AUTO_INCREMENT, 548 548 `Invoice` int(11) NOT NULL, … … 559 559 function UpdateTo633($Manager) 560 560 { 561 561 $Manager->Execute('ALTER TABLE `UserOnline` ADD `StayLoggedHash` VARCHAR( 40 ) NOT NULL ;'); 562 562 } 563 563 564 564 function UpdateTo645($Manager) 565 565 { 566 566 $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceVATType` ( 567 567 `Id` int(11) NOT NULL, 568 568 `Name` varchar(255) NOT NULL, … … 578 578 function UpdateTo646($Manager) 579 579 { 580 580 $Manager->Execute('CREATE TABLE IF NOT EXISTS `Contract` ( 581 581 `Id` int(11) NOT NULL AUTO_INCREMENT, 582 582 `BillCode` varchar(255) NOT NULL, … … 614 614 function UpdateTo647($Manager) 615 615 { 616 616 $Manager->Execute('ALTER TABLE `EmployeeSalary` ADD FOREIGN KEY ( `Employee` ) REFERENCES `Employee` ( 617 617 `Id` 618 618 ) ON DELETE RESTRICT ON UPDATE RESTRICT ;'); … … 649 649 function UpdateTo656($Manager) 650 650 { 651 651 $Manager->Execute('CREATE TABLE IF NOT EXISTS `Measure` ( 652 652 `Id` int(11) NOT NULL AUTO_INCREMENT, 653 653 `Name` varchar(255) NOT NULL, … … 708 708 function UpdateTo657($Manager) 709 709 { 710 710 $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkInterfaceUpDown` ( 711 711 `Id` int(11) NOT NULL AUTO_INCREMENT, 712 712 `Time` datetime NOT NULL, … … 873 873 if($DbResult->num_rows > 0) 874 874 { 875 875 $DbRow = $DbResult->fetch_assoc(); 876 876 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 877 877 "VALUES (NULL , 'Oblíbené položky nabídky', ".$DbRow['Id'].", '".$ActionId."', '1');"); … … 887 887 function UpdateTo688($Manager) 888 888 { 889 889 // Convert monthly plus payment for consumption to regular service 890 890 $DbResult = $Manager->Execute('SELECT `MonthlyPlus`, `Member` FROM `MemberPayment` WHERE `MonthlyPlus` > 0'); 891 891 while($DbRow = $DbResult->fetch_assoc) … … 935 935 936 936 function UpdateTo710($Manager) 937 { 937 { 938 938 $Manager->Execute('RENAME TABLE `StockItem` TO `StockSerialNumber`;'); 939 939 $Manager->Execute('UPDATE `Action` SET `URL`="/is/?t=StockSerialNumber&a=list",`Title`="Sériová čísla" WHERE `URL`="/is/?t=StockItem&a=list";'); 940 940 941 941 // StockMove 942 942 $Manager->Execute('CREATE TABLE IF NOT EXISTS `StockMove` ( … … 949 949 `File` int(11) DEFAULT NULL 950 950 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 951 951 952 952 $Manager->Execute('ALTER TABLE `StockMove` 953 953 ADD PRIMARY KEY (`Id`), ADD KEY `DocumentLine` (`DocumentLine`), ADD KEY `StockFrom` (`StockFrom`), ADD KEY `StockTo` (`StockTo`), ADD KEY `File` (`File`);'); 954 954 955 955 $Manager->Execute('ALTER TABLE `StockMove` 956 956 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); 957 957 958 958 $Manager->Execute('ALTER TABLE `StockMove` 959 959 ADD CONSTRAINT `StockMove_ibfk_1` FOREIGN KEY (`StockFrom`) REFERENCES `Stock` (`Id`), 960 960 ADD CONSTRAINT `StockMove_ibfk_2` FOREIGN KEY (`StockTo`) REFERENCES `Stock` (`Id`), 961 961 ADD CONSTRAINT `StockMove_ibfk_3` FOREIGN KEY (`DocumentLine`) REFERENCES `DocumentLine` (`Id`);'); 962 962 963 963 // StockMoveItem 964 964 $Manager->Execute('CREATE TABLE IF NOT EXISTS `StockMoveItem` ( … … 970 970 `UnitPrice` int(11) NOT NULL 971 971 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 972 972 973 973 $Manager->Execute('ALTER TABLE `StockMoveItem` 974 974 ADD PRIMARY KEY (`Id`), ADD KEY `Product` (`Product`), ADD KEY `StockMove` (`StockMove`);'); 975 975 976 976 $Manager->Execute('ALTER TABLE `StockMoveItem` 977 977 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); … … 979 979 $Manager->Execute('ALTER TABLE `StockMoveItem` 980 980 ADD CONSTRAINT `StockMoveItem_ibfk_2` FOREIGN KEY (`Product`) REFERENCES `Product` (`Id`), 981 ADD CONSTRAINT `StockMoveItem_ibfk_1` FOREIGN KEY (`StockMove`) REFERENCES `StockMove` (`Id`);'); 981 ADD CONSTRAINT `StockMoveItem_ibfk_1` FOREIGN KEY (`StockMove`) REFERENCES `StockMove` (`Id`);'); 982 982 983 983 // IS menu item … … 989 989 if($DbResult->num_rows > 0) 990 990 { 991 991 $DbRow = $DbResult->fetch_assoc(); 992 992 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 993 993 "VALUES (NULL , 'Skladové pohyby', ".$DbRow['Id'].", '".$ActionId."', '1');"); … … 997 997 function UpdateTo715($Manager) 998 998 { 999 1000 1001 1002 1003 1004 999 $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP FOREIGN KEY `StockSerialNumber_ibfk_6`;'); 1000 $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP `Segment`'); 1001 $Manager->Execute('ALTER TABLE `Member` DROP `NetworkSegment`'); 1002 $Manager->Execute('DROP TABLE `NetworkSegment`'); 1003 $Manager->Execute('DELETE FROM `MenuItem` WHERE `Name`="Úseky sítě"'); 1004 $Manager->Execute('DELETE FROM `Action` WHERE `Title`="Úseky sítě"'); 1005 1005 } 1006 1006 1007 1007 function UpdateTo718($Manager) 1008 { 1008 { 1009 1009 $Manager->Execute('CREATE TABLE IF NOT EXISTS `Company` ( 1010 1010 `Id` int(11) NOT NULL, … … 1027 1027 if($DbResult->num_rows > 0) 1028 1028 { 1029 1029 $DbRow = $DbResult->fetch_assoc(); 1030 1030 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1031 1031 "VALUES (NULL , 'Firmy', ".$DbRow['Id'].", '".$ActionId."', '1');"); … … 1034 1034 1035 1035 function UpdateTo719($Manager) 1036 { 1036 { 1037 1037 $Manager->Execute('ALTER TABLE `FinanceOperation` ADD `Direction` INT NOT NULL AFTER `Cash`;'); 1038 1038 $Manager->Execute('UPDATE `FinanceOperation` SET `Direction` = 1 WHERE `Value` >= 0 ;'); 1039 1039 $Manager->Execute('UPDATE `FinanceOperation` SET `Direction` = -1 WHERE `Value` < 0 ;'); 1040 1040 $Manager->Execute('UPDATE `FinanceOperation` SET `Value` = -`Value` WHERE `Value` < 0 ;'); 1041 // Set missing FinanceOperation DocumentLine according BillCode 1041 // Set missing FinanceOperation DocumentLine according BillCode 1042 1042 $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 1 WHERE (`BillCode` LIKE "PP%") AND (`DocumentLine` IS NULL)'); 1043 1043 $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 2 WHERE (`BillCode` LIKE "VP%") AND (`DocumentLine` IS NULL)'); 1044 1044 $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 3 WHERE (`BillCode` LIKE "BV%") AND (`DocumentLine` IS NULL)'); 1045 1045 $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 4 WHERE (`BillCode` LIKE "PR%") AND (`DocumentLine` IS NULL)'); 1046 1046 1047 1047 // IS menu item 1048 1048 $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Příjmy a výdaje"'); 1049 1049 if($DbResult->num_rows > 0) 1050 1050 { 1051 1051 $DbRow = $DbResult->fetch_assoc(); 1052 1052 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , 1053 1053 `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES ( 1054 1054 NULL , "", "Příjem do pokladny", "1", "/is/?t=FinanceTreasuryIn&a=list", NULL , NULL , NULL , "1");'); 1055 1055 $ActionId = $Manager->Database->insert_id; 1056 1056 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1057 1057 "VALUES (NULL , 'Příjem do pokladny', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1058 1058 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , … … 1060 1060 NULL , "", "Výdej z pokladny", "1", "/is/?t=FinanceTreasuryOut&a=list", NULL , NULL , NULL , "1");'); 1061 1061 $ActionId = $Manager->Database->insert_id; 1062 1062 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1063 1063 "VALUES (NULL , 'Výdej z pokladny', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1064 1064 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , … … 1066 1066 NULL , "", "Příjem na účet", "1", "/is/?t=FinanceAccountIn&a=list", NULL , NULL , NULL , "1");'); 1067 1067 $ActionId = $Manager->Database->insert_id; 1068 1068 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1069 1069 "VALUES (NULL , 'Příjem na účet', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1070 1070 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , … … 1072 1072 NULL , "", "Výdej z účtu", "1", "/is/?t=FinanceAccountOut&a=list", NULL , NULL , NULL , "1");'); 1073 1073 $ActionId = $Manager->Database->insert_id; 1074 1074 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1075 1075 "VALUES (NULL , 'Výdej z účtu', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1076 1076 } … … 1079 1079 function UpdateTo720($Manager) 1080 1080 { 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1081 $Manager->Execute('ALTER TABLE `FinanceInvoice` ADD `Direction` INT NOT NULL AFTER `TimePayment`;'); 1082 $Manager->Execute('UPDATE `FinanceInvoice` SET `Direction` = 1 WHERE `Value` >= 0 ;'); 1083 $Manager->Execute('UPDATE `FinanceInvoice` SET `Direction` = -1 WHERE `Value` < 0 ;'); 1084 $Manager->Execute('UPDATE `FinanceInvoice` SET `Value` = -`Value` WHERE `Value` < 0 ;'); 1085 // Set missing FinanceInvoice DocumentLine according BillCode 1086 $Manager->Execute('UPDATE `FinanceInvoice` SET `DocumentLine` = 5 WHERE (`BillCode` LIKE "PF%") AND (`DocumentLine` IS NULL)'); 1087 $Manager->Execute('UPDATE `FinanceInvoice` SET `DocumentLine` = 6 WHERE (`BillCode` LIKE "VF%") AND (`DocumentLine` IS NULL)'); 1088 1089 // IS menu item 1090 $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Závazky a pohledávky"'); 1091 if($DbResult->num_rows > 0) 1092 { 1093 $DbRow = $DbResult->fetch_assoc(); 1094 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , 1095 1095 `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES ( 1096 1096 NULL , "", "Příjaté", "1", "/is/?t=FinanceInvoiceIn&a=list", NULL , NULL , NULL , "1");'); 1097 1098 1099 1100 1101 1097 $ActionId = $Manager->Database->insert_id; 1098 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1099 "VALUES (NULL , 'Přijaté', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1100 1101 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , 1102 1102 `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES ( 1103 1103 NULL , "", "Vydané", "1", "/is/?t=FinanceInvoiceOut&a=list", NULL , NULL , NULL , "1");'); 1104 1105 1106 1107 1104 $ActionId = $Manager->Database->insert_id; 1105 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1106 "VALUES (NULL , 'Vydané', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1107 } 1108 1108 } 1109 1109 1110 1110 function UpdateTo722($Manager) 1111 1111 { 1112 1112 $Manager->Execute('ALTER TABLE `Service` DROP `CustomerCount`;'); 1113 1113 } 1114 1114 1115 1115 function UpdateTo725($Manager) 1116 1116 { 1117 1118 1119 1120 $SearchText = 'Připojení k síti'; 1121 1122 1123 1124 1125 $Text = explode('-', $Text); 1126 1127 1128 1129 1130 1131 1132 1133 1134 $SearchText = 'Připojení k Internetu'; 1135 1136 1137 1138 1139 $Text = explode('-', $Text); 1140 1141 1142 1143 1144 1145 1146 1147 1148 1117 // Text column of invoices is not used. Text from invoice items is taken instead. 1118 $DbResult = $Manager->Execute('ALTER TABLE `FinanceInvoice` DROP `Text`;'); 1119 1120 $SearchText = 'Připojení k síti'; 1121 $DbResult = $Manager->Execute('SELECT * FROM `FinanceInvoiceItem` WHERE `Description` LIKE "'.$SearchText.' za období%";'); 1122 while($DbRow = $DbResult->fetch_assoc()) 1123 { 1124 $Text = trim(substr($DbRow['Description'], strlen($SearchText.' za období') + 1)); 1125 $Text = explode('-', $Text); 1126 $PeriodFrom = explode('.', trim($Text[0])); 1127 $PeriodFrom = $PeriodFrom[2].'-'.$PeriodFrom[1].'-'.$PeriodFrom[0]; 1128 $PeriodTo = explode('.', trim($Text[1])); 1129 $PeriodTo = $PeriodTo[2].'-'.$PeriodTo[1].'-'.$PeriodTo[0]; 1130 $Manager->Execute('UPDATE `FinanceInvoice` SET `PeriodFrom`="'.$PeriodFrom.'", `PeriodTo`="'.$PeriodTo.'" WHERE `Id`='.$DbRow['FinanceInvoice']); 1131 } 1132 $DbResult = $Manager->Execute('UPDATE `FinanceInvoiceItem` SET `Description` = "'.$SearchText.'" WHERE `Description` LIKE "'.$SearchText.' za období%";'); 1133 1134 $SearchText = 'Připojení k Internetu'; 1135 $DbResult = $Manager->Execute('SELECT * FROM `FinanceInvoiceItem` WHERE `Description` LIKE "'.$SearchText.' za období%";'); 1136 while($DbRow = $DbResult->fetch_assoc()) 1137 { 1138 $Text = trim(substr($DbRow['Description'], strlen($SearchText.' za období') + 1)); 1139 $Text = explode('-', $Text); 1140 $PeriodFrom = explode('.', trim($Text[0])); 1141 $PeriodFrom = $PeriodFrom[2].'-'.$PeriodFrom[1].'-'.$PeriodFrom[0]; 1142 $Text[1] = trim($Text[1]); 1143 if(strpos($Text[1], ' ') !== false) $Text[1] = substr($Text[1], 0, strpos($Text[1], ' ')); 1144 $PeriodTo = explode('.', trim($Text[1])); 1145 $PeriodTo = $PeriodTo[2].'-'.$PeriodTo[1].'-'.$PeriodTo[0]; 1146 $Manager->Execute('UPDATE `FinanceInvoice` SET `PeriodFrom`="'.$PeriodFrom.'", `PeriodTo`="'.$PeriodTo.'" WHERE `Id`='.$DbRow['FinanceInvoice']); 1147 } 1148 $DbResult = $Manager->Execute('UPDATE `FinanceInvoiceItem` SET `Description` = "'.$SearchText.'" WHERE `Description` LIKE "'.$SearchText.' za období%";'); 1149 1149 } 1150 1150 1151 1151 function UpdateTo726($Manager) 1152 1152 { 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1153 $Manager->Execute('ALTER TABLE `ServiceCustomerRel` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;'); 1154 $Manager->Execute('ALTER TABLE `ServiceCustomerRel` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;'); 1155 $Manager->Execute('ALTER TABLE `ServiceCustomerRel` DROP FOREIGN KEY `ServiceCustomerRel_ibfk_4`;'); 1156 $Manager->Execute('ALTER TABLE `ServiceCustomerRel` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;'); 1157 $Manager->Execute('ALTER TABLE `ServiceCustomerRel` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `ServiceCustomerRel`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;'); 1158 1159 $Manager->Execute('ALTER TABLE `Service` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;'); 1160 $Manager->Execute('ALTER TABLE `Service` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;'); 1161 $Manager->Execute('ALTER TABLE `Service` DROP FOREIGN KEY `Service_ibfk_2`;'); 1162 $Manager->Execute('ALTER TABLE `Service` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;'); 1163 $Manager->Execute('ALTER TABLE `Service` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `Service`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;'); 1164 1165 $Manager->Execute('ALTER TABLE `FinanceCharge` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;'); 1166 $Manager->Execute('ALTER TABLE `FinanceCharge` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;'); 1167 $Manager->Execute('ALTER TABLE `FinanceCharge` DROP FOREIGN KEY `FinanceCharge_ibfk_1`;'); 1168 $Manager->Execute('ALTER TABLE `FinanceCharge` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;'); 1169 $Manager->Execute('ALTER TABLE `FinanceCharge` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `FinanceCharge`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;'); 1170 1171 $Manager->Execute('ALTER TABLE `MemberPayment` DROP `NetworkDevice`;'); 1172 1172 } 1173 1173 … … 1175 1175 { 1176 1176 $Manager->Execute('ALTER TABLE `FinanceBankAccount` ADD `AutoImport` INT NOT NULL ;'); 1177 1177 1178 1178 $Manager->Execute('CREATE TABLE IF NOT EXISTS `Scheduler` ( 1179 1179 `Id` int(11) NOT NULL, … … 1189 1189 $Manager->Execute('ALTER TABLE `Scheduler` 1190 1190 ADD PRIMARY KEY (`Id`);'); 1191 1191 1192 1192 $Manager->Execute('ALTER TABLE `Scheduler` 1193 1193 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); … … 1201 1201 if($DbResult->num_rows > 0) 1202 1202 { 1203 1203 $DbRow = $DbResult->fetch_assoc(); 1204 1204 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1205 1205 "VALUES (NULL , 'Plánovač', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1206 1206 } 1207 1207 1208 1208 $Manager->Execute('INSERT INTO `Module` (`Id`, `Name`, `Title`) VALUES (NULL, "Plánovač", "Scheduler");'); 1209 1209 } … … 1211 1211 function UpdateTo730($Manager) 1212 1212 { 1213 1213 $Manager->Execute('CREATE TABLE IF NOT EXISTS `SchedulerAction` ( 1214 1214 `Id` int(11) NOT NULL AUTO_INCREMENT, 1215 1215 `Name` varchar(255) NOT NULL, 1216 1216 `Class` varchar(255) NOT NULL, 1217 1218 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 1217 PRIMARY KEY (`Id`) 1218 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 1219 1219 $Manager->Execute('ALTER TABLE `Scheduler` CHANGE `Class` `Action` INT(11) NOT NULL;'); 1220 1220 $Manager->Execute("ALTER TABLE `Scheduler` ADD INDEX ( `Action` ) "); … … 1226 1226 function UpdateTo731($Manager) 1227 1227 { 1228 1229 1228 // NetworkDomain 1229 $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkDomain` ( 1230 1230 `Id` int(11) NOT NULL, 1231 1231 `Name` varchar(255) NOT NULL, … … 1252 1252 if($DbResult->num_rows > 0) 1253 1253 { 1254 1255 1256 1257 } 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1254 $DbRow = $DbResult->fetch_assoc(); 1255 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1256 "VALUES (NULL , 'Síťová doména', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1257 } 1258 1259 // Model additions 1260 $Manager->Execute('ALTER TABLE `Model` ADD `Title` VARCHAR(255) NOT NULL , '. 1261 'ADD `Query` VARCHAR(255) NOT NULL , '. 1262 'ADD `DefaultSortColumn` VARCHAR(255) NOT NULL , '. 1263 'ADD `DefaultSortOrder` INT NOT NULL ;'); 1264 1265 // ModelField 1266 $Manager->Execute('CREATE TABLE IF NOT EXISTS `ModelField` ( 1267 `Id` int(11) NOT NULL, 1268 `Name` varchar(255) NOT NULL, 1269 `Model` int(11) NOT NULL, 1270 `Query` varchar(255) NOT NULL, 1271 `Type` varchar(255) NOT NULL, 1272 `Title` varchar(255) NOT NULL, 1273 `DefaultValue` varchar(255) NOT NULL, 1274 `IsNull` int(11) NOT NULL, 1275 `Suffix` varchar(255) NOT NULL 1276 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 1277 1278 $Manager->Execute('ALTER TABLE `ModelField` 1279 ADD PRIMARY KEY (`Id`), ADD KEY `Model` (`Model`);'); 1280 1281 $Manager->Execute('ALTER TABLE `ModelField` 1282 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); 1283 1284 $Manager->Execute('ALTER TABLE `ModelField` 1285 ADD CONSTRAINT `ModelField_ibfk_1` FOREIGN KEY (`Model`) REFERENCES `Model` (`Id`);'); 1286 1287 // Module additions 1288 $Manager->Execute('ALTER TABLE `Module` ADD `Version` VARCHAR(255) NOT NULL , '. 1289 'ADD `Creator` VARCHAR(255) NOT NULL , '. 1290 'ADD `License` VARCHAR(255) NOT NULL , '. 1291 'ADD `Installed` INT NOT NULL , '. 1292 'ADD `HomePage` VARCHAR(255) NOT NULL , '. 1293 'ADD `Description` TEXT NOT NULL ;'); 1294 1295 // ModuleLink 1296 $Manager->Execute('CREATE TABLE IF NOT EXISTS `ModuleLink` ( 1297 1297 `Id` int(11) NOT NULL, 1298 1298 `Module` int(11) NOT NULL, … … 1305 1305 1306 1306 $Manager->Execute('ALTER TABLE `ModuleLink` 1307 1307 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); 1308 1308 } 1309 1309 1310 1310 function UpdateTo735($Manager) 1311 1311 { 1312 1312 $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkFreeAccess` ( 1313 1313 `Id` int(11) NOT NULL, 1314 1314 `IPAddress` varchar(255) NOT NULL, 1315 1315 `Time` datetime NOT NULL 1316 1316 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'); 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 $Manager->Execute('INSERT INTO `Scheduler` (`Id`, `Name`, `Enabled`, `Action`, 1329 `Log`, `LastExecutedTime`, `ScheduledTime`, `Period`) VALUES (NULL, "Internet zdarma", 1330 1331 1317 1318 $Manager->Execute('ALTER TABLE `NetworkFreeAccess` 1319 ADD PRIMARY KEY (`Id`);'); 1320 1321 $Manager->Execute('ALTER TABLE `NetworkFreeAccess` 1322 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;'); 1323 1324 $Manager->Execute('ALTER TABLE `NetworkFreeAccess` ADD `Configured` INT NOT NULL ;'); 1325 $DbResult = $Manager->Execute('INSERT INTO `SchedulerAction` (`Id`, `Name`, `Class`) VALUES '. 1326 '(NULL, "Konfigurace internetu zdarma", "ScheduleConfigureFreeAccess");'); 1327 $ActionId = $Manager->Database->insert_id; 1328 $Manager->Execute('INSERT INTO `Scheduler` (`Id`, `Name`, `Enabled`, `Action`, 1329 `Log`, `LastExecutedTime`, `ScheduledTime`, `Period`) VALUES (NULL, "Internet zdarma", 1330 1, '.$ActionId.', "", NULL, "", 5);'); 1331 $Manager->Execute('ALTER TABLE `Scheduler` CHANGE `ScheduledTime` `ScheduledTime` DATETIME NULL;'); 1332 1332 } 1333 1333 1334 1334 function UpdateTo736($Manager) 1335 1335 { 1336 1336 $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkLinkType` ( 1337 1337 `Id` int(11) NOT NULL, 1338 1338 `Name` varchar(255) NOT NULL … … 1399 1399 697 => array('Revision' => 707, 'Function' => 'UpdateTo707'), 1400 1400 707 => array('Revision' => 710, 'Function' => 'UpdateTo710'), 1401 1401 710 => array('Revision' => 715, 'Function' => 'UpdateTo715'), 1402 1402 715 => array('Revision' => 718, 'Function' => 'UpdateTo718'), 1403 1403 718 => array('Revision' => 719, 'Function' => 'UpdateTo719'), 1404 1405 1406 1407 1408 1409 1410 1411 1412 1404 719 => array('Revision' => 720, 'Function' => 'UpdateTo720'), 1405 720 => array('Revision' => 722, 'Function' => 'UpdateTo722'), 1406 722 => array('Revision' => 725, 'Function' => 'UpdateTo725'), 1407 725 => array('Revision' => 726, 'Function' => 'UpdateTo726'), 1408 726 => array('Revision' => 729, 'Function' => 'UpdateTo729'), 1409 729 => array('Revision' => 730, 'Function' => 'UpdateTo730'), 1410 730 => array('Revision' => 731, 'Function' => 'UpdateTo731'), 1411 731 => array('Revision' => 735, 'Function' => 'UpdateTo735'), 1412 735 => array('Revision' => 736, 'Function' => 'UpdateTo736'), 1413 1413 )); 1414 1414 } -
trunk/Common/Table.php
r636 r738 1 1 <?php 2 2 3 class Control 3 class Control 4 4 { 5 6 5 var $Name; 6 7 7 function Show() 8 8 { 9 9 return(''); 10 10 } 11 11 } … … 13 13 class Table 14 14 { 15 16 17 18 15 function GetCell($Y, $X) 16 { 17 return(''); 18 } 19 19 20 21 22 23 24 25 26 27 20 function BeginRead() 21 { 22 } 23 24 function EndRead() 25 { 26 } 27 28 28 function RowsCount() 29 29 { 30 30 return(0); 31 31 } 32 32 } … … 34 34 class TableMemory extends Table 35 35 { 36 37 38 39 40 41 36 var $Cells; 37 38 function GetCell($Y, $X) 39 { 40 return($this->Cells[$Y][$X]); 41 } 42 42 43 43 function RowsCount() 44 44 { 45 45 return(count($this->Cells)); 46 46 } 47 47 } … … 49 49 class TableSQL extends Table 50 50 { 51 52 53 var $Cells; 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 51 var $Query; 52 var $Database; 53 var $Cells; 54 55 function GetCell($Y, $X) 56 { 57 return($this->Cells[$Y][$X]); 58 } 59 60 function BeginRead() 61 { 62 $this->Cells = array(); 63 $DbResult = $this->Database->query($this->Query); 64 while($DbRow = $DbResult->fetch_row()) 65 { 66 $this->Cells[] = $DbRow; 67 } 68 } 69 70 function EndRead() 71 { 72 $this->Cells = array(); 73 } 74 74 75 75 function RowsCount() 76 76 { 77 77 return(count($this->Cells)); 78 78 } 79 79 } … … 81 81 class TableColumn 82 82 { 83 84 83 var $Name; 84 var $Title; 85 85 } 86 86 … … 96 96 var $DefaultOrder; 97 97 var $Table; 98 98 99 99 function __construct() 100 100 { 101 102 103 104 101 global $System; 102 103 $this->Columns = array(); 104 $this->Table = new TableMemory(); 105 105 $this->OrderDirSQL = array('ASC', 'DESC'); 106 $this->OrderArrowImage = array($System->Link('/images/sort_asc.png'), 106 $this->OrderArrowImage = array($System->Link('/images/sort_asc.png'), 107 107 $System->Link('/images/sort_desc.png')); 108 108 $this->DefaultOrder = 0; 109 109 } 110 110 111 111 function SetColumns($Columns) 112 112 { 113 114 115 116 117 118 119 120 121 122 123 113 $this->Columns = array(); 114 foreach($Columns as $Column) 115 { 116 $NewCol = new TableColumn(); 117 $NewCol->Name = $Column['Name']; 118 $NewCol->Title = $Column['Title']; 119 $this->Columns[] = $NewCol; 120 } 121 if(count($this->Columns) > 0) 122 $this->DefaultColumn = $this->Columns[0]->Name; 123 else $this->DefaultColumn = ''; 124 124 } 125 125 126 126 function Show() 127 127 { 128 129 130 131 132 133 134 135 136 137 138 if($Cell == '') $Output .= '<td> </td>'; 139 140 } 141 142 143 144 128 $Output = '<table class="WideTable">'; 129 $Output .= $this->GetOrderHeader(); 130 $this->Table->BeginRead(); 131 for($Y = 0; $Y < $this->Table->RowsCount(); $Y++) 132 { 133 $Output .= '<tr>'; 134 135 for($X = 0; $X < count($this->Columns); $X++) 136 { 137 $Cell = $this->Table->GetCell($Y, $X); 138 if($Cell == '') $Output .= '<td> </td>'; 139 else $Output .= '<td>'.$Cell.'</td>'; 140 } 141 $Output .= '</tr>'; 142 } 143 $this->Table->EndRead(); 144 $Output .= '</table>'; 145 145 return($Output); 146 146 } 147 147 148 148 function GetOrderHeader() 149 149 { … … 152 152 if(!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $this->DefaultColumn; 153 153 if(!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $this->DefaultOrder; 154 154 155 155 // Check OrderCol 156 156 $Found = false; … … 159 159 if($Column->Name == $_SESSION['OrderCol']) 160 160 { 161 $Found = true; 161 $Found = true; 162 162 break; 163 163 } … … 169 169 } 170 170 // Check OrderDir 171 if(($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1)) 171 if(($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1)) 172 172 $_SESSION['OrderDir'] = 0; 173 173 174 174 $Result = ''; 175 175 $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']); … … 178 178 $QueryItems['OrderCol'] = $Column->Name; 179 179 $QueryItems['OrderDir'] = 1 - $_SESSION['OrderDir']; 180 if($Column->Name == $_SESSION['OrderCol']) 180 if($Column->Name == $_SESSION['OrderCol']) 181 181 $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.$this->OrderArrowImage[$_SESSION['OrderDir']].'" alt="order arrow">'; 182 182 else $ArrowImage = ''; … … 187 187 $this->OrderColumn = $_SESSION['OrderCol']; 188 188 $this->OrderDirection = $_SESSION['OrderDir']; 189 189 190 190 return($Result); 191 191 } -
trunk/Common/UTF8.php
r635 r738 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 37 $this->CharTable = array( 38 38 'iso2' => array( 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 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 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 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 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 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/Common/VCL/Database.php
r666 r738 58 58 if(method_exists($this->OnRowDraw[0], $this->OnRowDraw[1])) 59 59 $DbRow = call_user_func($this->OnRowDraw, $DbRow); 60 60 $this->Rows[] = $DbRow; 61 61 $VisibleItemCount = $VisibleItemCount + 1; 62 62 }
Note:
See TracChangeset
for help on using the changeset viewer.