Changeset 729
- Timestamp:
- Jan 12, 2015, 12:20:30 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/System.php
r657 r729 24 24 var $ShowPage; 25 25 var $Setup; 26 var $CommandLine; 26 27 27 28 function __construct() … … 38 39 if(substr($this->RootURLFolder, -10, 10) == '/index.php') 39 40 $this->RootURLFolder = substr($this->RootURLFolder, 0, -10); 41 $this->CommandLine = array(); 40 42 } 41 43 … … 132 134 } 133 135 134 function Run ()136 function RunCommon() 135 137 { 136 138 global $Database, $ScriptTimeStart, $ConfigFileName, $Mail, $Type, … … 177 179 if($this->Setup->CheckState()) 178 180 { 179 $this->ModuleManager->Start(); 180 } 181 $this->ModuleManager->Start(); 182 } 183 } 184 185 function Run() 186 { 187 $this->RunCommon(); 181 188 if($this->ShowPage) 182 189 { … … 186 193 } 187 194 195 function RunCommandLine() 196 { 197 global $argv; 198 199 $this->RunCommon(); 200 if(count($argv) > 1) 201 { 202 if(array_key_exists($argv[1], $this->CommandLine)) 203 { 204 $Command = $this->CommandLine[$argv[1]]; 205 if(is_string($Command['Callback'][0])) 206 { 207 $Class = new $Command['Callback'][0]($this); 208 $Output = $Class->$Command['Callback'][1](); 209 } else $Output = call_user_func($Command['Callback']); 210 echo($Output); 211 } else echo('Command "'.$argv[1].'" not supported.'."\n"); 212 } 213 //print_r($argv); 214 } 215 216 function RegisterCommandLine($Name, $Callback) 217 { 218 $this->CommandLine[$Name] = array('Name' => $Name, 'Callback' => $Callback); 219 } 220 188 221 function RegisterPageBar($Name) 189 222 { -
trunk/Application/Version.php
r728 r729 1 1 <?php 2 2 3 $Revision = 72 8; // Subversion revision4 $DatabaseRevision = 72 6; // SQL structure revision5 $ReleaseTime = strtotime('2015-01- 05');3 $Revision = 729; // Subversion revision 4 $DatabaseRevision = 729; // SQL structure revision 5 $ReleaseTime = strtotime('2015-01-11'); -
trunk/Common/Global.php
r727 r729 443 443 if(substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1); 444 444 $PathItems = explode('/', $PathString); 445 if( strpos($_SERVER['REQUEST_URI'], '?') !== false)445 if(array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false)) 446 446 $_SERVER['QUERY_STRING'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1); 447 447 else $_SERVER['QUERY_STRING'] = ''; -
trunk/Common/Page.php
r635 r729 50 50 function ShowHeader($Title, $Path) 51 51 { 52 $ScriptName = $_SERVER['REQUEST_URI']; 52 if(array_key_exists('REQUEST_URI', $_SERVER)) 53 $ScriptName = $_SERVER['REQUEST_URI']; 54 else $ScriptName = ''; 53 55 while(strpos($ScriptName, '//') !== false) 54 56 $ScriptName = str_replace('//', '/', $ScriptName); -
trunk/Common/Setup/Updates.php
r726 r729 1170 1170 1171 1171 $Manager->Execute('ALTER TABLE `MemberPayment` DROP `NetworkDevice`;'); 1172 } 1173 1174 function UpdateTo729($Manager) 1175 { 1176 $Manager->Execute('ALTER TABLE `FinanceBankAccount` ADD `AutoImport` INT NOT NULL ;'); 1177 1178 $Manager->Execute('CREATE TABLE IF NOT EXISTS `Scheduler` ( 1179 `Id` int(11) NOT NULL, 1180 `Name` varchar(255) NOT NULL, 1181 `Enabled` int(11) NOT NULL, 1182 `Class` varchar(255) NOT NULL, 1183 `Log` mediumtext NOT NULL, 1184 `LastExecutedTime` datetime DEFAULT NULL, 1185 `ScheduledTime` datetime NOT NULL, 1186 `Period` int(11) NOT NULL 1187 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 1188 1189 $Manager->Execute('ALTER TABLE `Scheduler` 1190 ADD PRIMARY KEY (`Id`);'); 1191 1192 $Manager->Execute('ALTER TABLE `Scheduler` 1193 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); 1194 1195 // IS menu item 1196 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , 1197 `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES ( 1198 NULL , "", "Plánovač", "1", "/is/?t=Scheduler&a=list", NULL , NULL , NULL , "1");'); 1199 $ActionId = $Manager->Database->insert_id; 1200 $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Systém"'); 1201 if($DbResult->num_rows > 0) 1202 { 1203 $DbRow = $DbResult->fetch_assoc(); 1204 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1205 "VALUES (NULL , 'Plánovač', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1206 } 1207 1208 $Manager->Execute('INSERT INTO `Module` (`Id`, `Name`, `Title`) VALUES (NULL, "Plánovač", "Scheduler");'); 1172 1209 } 1173 1210 … … 1233 1270 722 => array('Revision' => 725, 'Function' => 'UpdateTo725'), 1234 1271 725 => array('Revision' => 726, 'Function' => 'UpdateTo726'), 1272 726 => array('Revision' => 729, 'Function' => 'UpdateTo729'), 1235 1273 )); 1236 1274 } -
trunk/Modules/Finance/Finance.php
r728 r729 380 380 'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`FinanceOperation`.`Value` * `FinanceOperation`.`Direction`) FROM `FinanceOperation` '. 381 381 'WHERE `FinanceOperation`.`BankAccount`=#Id)'), 382 'AutoImport' => array('Type' => 'Boolean', 'Caption' => 'Automaticky stahovat z banky', 'Default' => ''), 382 383 ), 383 384 'ItemActions' => array( -
trunk/Modules/FinanceBankAPI/FinanceBankAPI.php
r639 r729 4 4 include_once(dirname(__FILE__).'/ImportPS.php'); 5 5 include_once(dirname(__FILE__).'/ImportFio.php'); 6 include_once(dirname(__FILE__).'/../Scheduler/Scheduler.php'); 6 7 7 8 class ModuleFinanceBankAPI extends AppModule … … 15 16 $this->License = 'GNU/GPLv3'; 16 17 $this->Description = 'Communication through API to various banks, manual file import'; 17 $this->Dependencies = array('Finance' );18 $this->Dependencies = array('Finance', 'Scheduler'); 18 19 } 19 20 … … 58 59 59 60 $this->System->RegisterPage(array('finance', 'import-api'), 'PageImportAPI'); 60 $this->System->RegisterPage(array('finance', 'import-soubor'), 'PageImportFile'); 61 $this->System->RegisterPage(array('finance', 'import-soubor'), 'PageImportFile'); 61 62 } 62 63 … … 81 82 } 82 83 } 84 85 class ScheduleBankImport extends SchedulerTask 86 { 87 function Execute() 88 { 89 $Output = ''; 90 $DbResult = $this->Database->select('FinanceBankAccount', 'Id', '(AutoImport=1) AND ((TimeEnd IS NULL) OR (TimeEnd > NOW()))'); 91 while($DbRow = $DbResult->fetch_assoc()) 92 { 93 $Page = new PageImportAPI($this->System); 94 $Output .= $Page->Show(); 95 } 96 return($Output); 97 } 98 } -
trunk/Modules/User/User.php
r711 r729 66 66 $this->OnlineStateTimeout = 600; // in seconds 67 67 $this->PasswordHash = new PasswordHash(); 68 $this->User = array('Id' => null, 'Member' => null); 68 69 } 69 70 … … 694 695 function TopBarCallback() 695 696 { 696 if($this->System->User->User['Id'] == null) 697 if($this->System->User->User['Id'] == null) 698 { 697 699 $Output = '<a href="'.$this->System->Link('/user/?Action=LoginForm').'">Přihlášení</a> '. 698 700 '<a href="'.$this->System->Link('/user/?Action=UserRegister').'">Registrace</a>'; 699 else $Output = $this->System->User->User['Name']. 701 } else 702 { 703 $Output = $this->System->User->User['Name']. 700 704 ' <a href="'.$this->System->Link('/user/?Action=UserMenu').'">Nabídka</a>'. 701 705 ' <a href="'.$this->System->Link('/user/?Action=Logout').'">Odhlásit</a>'; 702 // <a href="'.$this->System->Link('/?Action=UserOptions').'">Nastavení</a>'; 706 // <a href="'.$this->System->Link('/?Action=UserOptions').'">Nastavení</a>'; 707 } 703 708 return($Output); 704 709 }
Note:
See TracChangeset
for help on using the changeset viewer.