- Timestamp:
- Apr 7, 2020, 12:55:39 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Global.php
r54 r55 3 3 function HumanDate($Time) 4 4 { 5 return (date('j.n.Y', $Time));5 return date('j.n.Y', $Time); 6 6 } 7 7 8 8 function HumanTime($Time) 9 9 { 10 return (date('H:i:s', $Time));10 return date('H:i:s', $Time); 11 11 } 12 12 … … 16 16 $Time = HumanTime($Time); 17 17 if ($Time != '00:00:00') $Output .= ' '.$Time; 18 return ($Output);18 return $Output; 19 19 } 20 20 … … 28 28 function ProcessURL() 29 29 { 30 if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))30 if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER)) 31 31 $PathString = $_SERVER['REDIRECT_QUERY_STRING']; 32 32 else $PathString = ''; 33 if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);33 if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1); 34 34 $PathItems = explode('/', $PathString); 35 if (array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false))35 if (array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false)) 36 36 $_SERVER['QUERY_STRING'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1); 37 37 else $_SERVER['QUERY_STRING'] = ''; 38 38 parse_str($_SERVER['QUERY_STRING'], $_GET); 39 return ($PathItems);39 return $PathItems; 40 40 } 41 41 … … 44 44 $Result = array(); 45 45 $Parts = explode('&', $QueryString); 46 foreach ($Parts as $Part)47 { 48 if ($Part != '')49 { 50 if (!strpos($Part, '=')) $Part .= '=';46 foreach ($Parts as $Part) 47 { 48 if ($Part != '') 49 { 50 if (!strpos($Part, '=')) $Part .= '='; 51 51 $Item = explode('=', $Part); 52 52 $Result[$Item[0]] = $Item[1]; 53 53 } 54 54 } 55 return ($Result);55 return $Result; 56 56 } 57 57 … … 59 59 { 60 60 $Parts = array(); 61 foreach ($QueryStringArray as $Index => $Item)61 foreach ($QueryStringArray as $Index => $Item) 62 62 { 63 63 if ($Index != 'lvm') $Parts[] = $Index.'='.$Item; 64 64 } 65 return (implode('&', $Parts));65 return implode('&', $Parts); 66 66 } 67 67 … … 77 77 $PageCount = floor($TotalCount / $ItemPerPage) + 1; 78 78 79 if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;80 if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;81 if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;82 if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;79 if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0; 80 if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1; 81 if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0; 82 if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1; 83 83 $CurrentPage = $_SESSION['Page']; 84 84 … … 87 87 88 88 $Result = ''; 89 if ($PageCount > 1)90 { 91 if ($CurrentPage > 0)89 if ($PageCount > 1) 90 { 91 if ($CurrentPage > 0) 92 92 { 93 93 $QueryItems['page'] = 0; … … 98 98 $PagesMax = $PageCount - 1; 99 99 $PagesMin = 0; 100 if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;101 if ($PagesMin < ($CurrentPage - $Around))100 if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around; 101 if ($PagesMin < ($CurrentPage - $Around)) 102 102 { 103 103 $Result.= ' ... '; 104 104 $PagesMin = $CurrentPage - $Around; 105 105 } 106 for ($i = $PagesMin; $i <= $PagesMax; $i++)107 { 108 if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';106 for ($i = $PagesMin; $i <= $PagesMax; $i++) 107 { 108 if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> '; 109 109 else { 110 110 $QueryItems['page'] = $i; … … 112 112 } 113 113 } 114 if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';115 if ($CurrentPage < ($PageCount - 1))114 if ($PagesMax < ($PageCount - 1)) $Result .= ' ... '; 115 if ($CurrentPage < ($PageCount - 1)) 116 116 { 117 117 $QueryItems['page'] = ($CurrentPage + 1); … … 122 122 } 123 123 $Result = '<div style="text-align: center">'.$Result.'</div>'; 124 return (array('SQLLimit' => ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage,124 return array('SQLLimit' => ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage, 125 125 'Page' => $CurrentPage, 126 126 'Output' => $Result, 127 ) );127 ); 128 128 } 129 129 … … 135 135 global $OrderDirSQL, $OrderArrowImage, $Config; 136 136 137 if (array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol'];138 if (array_key_exists('OrderDir', $_GET) and (array_key_exists($_GET['OrderDir'], $OrderArrowImage)))137 if (array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol']; 138 if (array_key_exists('OrderDir', $_GET) and (array_key_exists($_GET['OrderDir'], $OrderArrowImage))) 139 139 $_SESSION['OrderDir'] = $_GET['OrderDir']; 140 if (!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $DefaultColumn;141 if (!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $DefaultOrder;140 if (!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $DefaultColumn; 141 if (!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $DefaultOrder; 142 142 143 143 // Check OrderCol 144 144 $Found = false; 145 foreach ($Columns as $Column)146 { 147 if ($Column['Name'] == $_SESSION['OrderCol'])145 foreach ($Columns as $Column) 146 { 147 if ($Column['Name'] == $_SESSION['OrderCol']) 148 148 { 149 149 $Found = true; … … 151 151 } 152 152 } 153 if ($Found == false)153 if ($Found == false) 154 154 { 155 155 $_SESSION['OrderCol'] = $DefaultColumn; … … 157 157 } 158 158 // Check OrderDir 159 if (($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1)) $_SESSION['OrderDir'] = 0;159 if (($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1)) $_SESSION['OrderDir'] = 0; 160 160 161 161 $Result = ''; 162 162 $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']); 163 foreach ($Columns as $Index => $Column)163 foreach ($Columns as $Index => $Column) 164 164 { 165 165 $QueryItems['OrderCol'] = $Column['Name']; 166 166 $QueryItems['OrderDir'] = 1 - $_SESSION['OrderDir']; 167 if ($Column['Name'] == $_SESSION['OrderCol']) $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.167 if ($Column['Name'] == $_SESSION['OrderCol']) $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'. 168 168 Link2('/images/'.$OrderArrowImage[$_SESSION['OrderDir']]).'" alt="order arrow"/>'; 169 169 else $ArrowImage = ''; 170 if ($Column['Name'] == '') $Result .= '<th>'.$Column['Title'].'</th>';170 if ($Column['Name'] == '') $Result .= '<th>'.$Column['Title'].'</th>'; 171 171 else $Result .= '<th><a href="?'.SetQueryStringArray($QueryItems).'">'.$Column['Title'].$ArrowImage.'</a></th>'; 172 172 } 173 return (array(173 return array( 174 174 'SQL' => ' ORDER BY `'.$_SESSION['OrderCol'].'` '.$OrderDirSQL[$_SESSION['OrderDir']], 175 175 'Output' => '<tr>'.$Result.'</tr>', 176 176 'Column' => $_SESSION['OrderCol'], 177 177 'Direction' => $_SESSION['OrderDir'], 178 ) );178 ); 179 179 } 180 180 … … 182 182 { 183 183 list($Usec, $Sec) = explode(' ', microtime()); 184 return ( (float)$Usec + (float)$Sec);184 return (float)$Usec + (float)$Sec; 185 185 } 186 186 … … 322 322 $Output .= '<div class="filter-num-box">'. 323 323 '<div class="label-box">'.$Item['Title'].'</div>'. 324 '<input value="'.$_SESSION[$Item['Name']].'" onkeyup="if (event.keyCode!=9) upf(\''.$Item['Name'].'\',$(this).val(),(event.keyCode==13?0:1)); '.324 '<input value="'.$_SESSION[$Item['Name']].'" onkeyup="if (event.keyCode!=9) upf(\''.$Item['Name'].'\',$(this).val(),(event.keyCode==13?0:1)); '. 325 325 '" id="'.$Item['Name'].'" autocomplete="off" type="text"/>'. 326 326 '</div> '; … … 350 350 $Output .= '<div class="filter-num-box">'. 351 351 '<div class="label-box">'.$Item['Title'].'</div>'. 352 '<input value="'.$_SESSION[$Item['Name'].'od'].'" onkeyup="if (event.keyCode!=9) upf(\''.$Item['Name'].'od\',$(this).val(),(event.keyCode==13?0:1)); '.352 '<input value="'.$_SESSION[$Item['Name'].'od'].'" onkeyup="if (event.keyCode!=9) upf(\''.$Item['Name'].'od\',$(this).val(),(event.keyCode==13?0:1)); '. 353 353 '" id="'.$Item['Name'].'od" autocomplete="off" type="text"/>'. 354 354 '<div class="label-box">-</div>'. 355 355 '<input value="'.$_SESSION[$Item['Name'].'do'].'" onkeyup="'. 356 'if (event.keyCode!=9) upf(\''.$Item['Name'].'do\',$(this).val(),(event.keyCode==13?0:1));" '.356 'if (event.keyCode!=9) upf(\''.$Item['Name'].'do\',$(this).val(),(event.keyCode==13?0:1));" '. 357 357 'id="'.$Item['Name'].'do" autocomplete="off" type="text"/>'. 358 358 '<div class="label-box">'.$Item['Units'].'</div>'. … … 368 368 { 369 369 $Where = ''; 370 foreach ($this->Items as $Item)370 foreach ($this->Items as $Item) 371 371 { 372 372 if ($Item['DbName'] != '') -
trunk/Modules/Dance/Dance.php
r40 r55 39 39 $this->Title = 'Tanec - Tance - '.$this->Title; 40 40 $Output = ''; 41 if (count($this->System->PathItems) > 1)41 if (count($this->System->PathItems) > 1) 42 42 { 43 43 $id = $this->System->PathItems[1] * 1; … … 60 60 $Output .= '<tr><th>Český název</th><th>Anglický název</th><th>Detail</th></tr>'; 61 61 $DbResult = $this->Database->select('DanceFigure', '*', '(`Dance`='.$id.')'); 62 while ($DanceFigure = $DbResult->fetch_assoc())62 while ($DanceFigure = $DbResult->fetch_assoc()) 63 63 { 64 64 $Output .= '<tr>'. … … 74 74 $Output .= '<tr><th>Název</th><th>Skupina</th><th>Odkaz</th></tr>'; 75 75 $DbResult = $this->Database->select('Resource', '*, (SELECT Name FROM ResourceGroup WHERE ResourceGroup.Id=Resource.Group) AS GroupName', '(`Dance`='.$id.')'); 76 while ($DbRow = $DbResult->fetch_assoc())76 while ($DbRow = $DbResult->fetch_assoc()) 77 77 { 78 78 $Output .= '<tr>'. … … 86 86 /* 87 87 $DbResult2 = $this->Database->select('ResourceGroup', '*'); 88 while ($ResourceGroup = $DbResult2->fetch_assoc())88 while ($ResourceGroup = $DbResult2->fetch_assoc()) 89 89 { 90 90 $Output .= '<th>'.$ResourceGroup['Name'].'</th>'; … … 92 92 93 93 $DbResult2 = $this->Database->select('ResourceGroup', '*'); 94 while ($ResourceGroup = $DbResult2->fetch_assoc())94 while ($ResourceGroup = $DbResult2->fetch_assoc()) 95 95 { 96 96 $Output .= '<td>'; 97 while ($Resource = $DbResult3->fetch_assoc())97 while ($Resource = $DbResult3->fetch_assoc()) 98 98 { 99 99 $Output .= '<a href="'.$Resource['URL'].'">'.$Resource['Name'].'</a> '; … … 122 122 $Output .= '<tr><th>Název</th><th>Skupina</th><th>Detail</th></tr>'; 123 123 $DbResult = $this->Database->select('Dance', '*, (SELECT Name FROM DanceGroup WHERE DanceGroup.Id=Dance.Group) AS GroupName', '1 ORDER BY `Name`'); 124 while ($Dance = $DbResult->fetch_assoc())124 while ($Dance = $DbResult->fetch_assoc()) 125 125 { 126 126 $Output .= '<tr>'. … … 132 132 $Output .= '</table>'; 133 133 134 return ($Output);134 return $Output; 135 135 } 136 136 } … … 149 149 $this->Title = 'Taneční figura - Tance - '.$this->Title; 150 150 $Output = ''; 151 if (count($this->System->PathItems) > 1)151 if (count($this->System->PathItems) > 1) 152 152 { 153 153 $id = $this->System->PathItems[1] * 1; … … 169 169 $Output .= '<tr><th>Skupina videí</th><th></th><th>Detail</th></tr>'; 170 170 $DbResult = $this->Database->select('DanceFigure', '*', '(`Dance`='.$id.')'); 171 while ($DanceFigure = $DbResult->fetch_assoc())171 while ($DanceFigure = $DbResult->fetch_assoc()) 172 172 { 173 173 $Output .= '<tr>'. … … 181 181 /* 182 182 $DbResult2 = $this->Database->select('ResourceGroup', '*'); 183 while ($ResourceGroup = $DbResult2->fetch_assoc())183 while ($ResourceGroup = $DbResult2->fetch_assoc()) 184 184 { 185 185 $Output .= '<th>'.$ResourceGroup['Name'].'</th>'; … … 187 187 188 188 $DbResult2 = $this->Database->select('ResourceGroup', '*'); 189 while ($ResourceGroup = $DbResult2->fetch_assoc())189 while ($ResourceGroup = $DbResult2->fetch_assoc()) 190 190 { 191 191 $Output .= '<td>'; 192 while ($Resource = $DbResult3->fetch_assoc())192 while ($Resource = $DbResult3->fetch_assoc()) 193 193 { 194 194 $Output .= '<a href="'.$Resource['URL'].'">'.$Resource['Name'].'</a> '; … … 217 217 $Output .= '<tr><th>Název</th><th>Skupina</th><th>Tanec</th><th>Detail</th></tr>'; 218 218 $DbResult = $this->Database->select('DanceFigure', '*, (SELECT Dance.Name FROM Dance WHERE Dance.Id=DanceFigure.Dance) AS DanceName', '1 ORDER BY `NameCz`'); 219 while ($DbRow = $DbResult->fetch_assoc())219 while ($DbRow = $DbResult->fetch_assoc()) 220 220 { 221 221 $Output .= '<tr>'. … … 228 228 $Output .= '</table>'; 229 229 230 return ($Output);231 } 232 } 230 return $Output; 231 } 232 } -
trunk/Modules/Event/Event.php
r52 r55 117 117 $Result = 1; 118 118 } else $Result = 0; 119 return ($Result);119 return $Result; 120 120 } 121 121 } -
trunk/Modules/Event/EventPage.php
r52 r55 79 79 '(SELECT EventSource.URL FROM EventSource WHERE EventSource.Id = Event.Source) AS SourceURL FROM Event) AS T WHERE (T.Hidden=0) AND '. 80 80 $Where.$Order['SQL'].$PageList['SQLLimit']); 81 while ($Event = $DbResult->fetch_assoc())81 while ($Event = $DbResult->fetch_assoc()) 82 82 { 83 83 $Output .= '<tr>'. … … 102 102 $Output .= '<div><a href="'.$this->System->Link('/udalosti/rss/').'"><img src="'.$this->System->Link('/images/rss20.png').'" alt="rss20"/></a></div>'; 103 103 } 104 return ($Output);104 return $Output; 105 105 } 106 106 } … … 138 138 $this->Title = 'Událost - Události - '.$this->Title; 139 139 $Output = ''; 140 if (count($this->System->PathItems) > 2)140 if (count($this->System->PathItems) > 2) 141 141 { 142 142 $id = $this->System->PathItems[2] * 1; … … 199 199 $DbResult = $this->Database->select('Event', '*, (SELECT EventSource.Name FROM EventSource WHERE EventSource.Id = Event.Source) AS SourceName, '. 200 200 '(SELECT EventSource.URL FROM EventSource WHERE EventSource.Id = Event.Source) AS SourceURL', '`Hidden`=0 ORDER BY `TimeFrom` DESC LIMIT 30'); 201 while ($Event = $DbResult->fetch_assoc())201 while ($Event = $DbResult->fetch_assoc()) 202 202 { 203 203 $Title = $Event['Title']; -
trunk/Modules/Event/Import/JoeClub.php
r52 r55 45 45 { 46 46 $Output = ''; 47 if ($Event->Link == '') return ($Output);47 if ($Event->Link == '') return $Output; 48 48 $Content = file_get_contents($Event->Link); 49 49 … … 72 72 $Time = substr($Time, 0, strpos($Time, '–')); 73 73 74 if ($Time == '') return(NULL);74 if ($Time == '') return NULL; 75 75 $Time = str_replace('@', '', $Time); 76 76 -
trunk/Modules/Meet/Meet.php
r47 r55 34 34 function HumanDateTimeToTime($DateTime) 35 35 { 36 if ($DateTime == '') return(NULL);36 if ($DateTime == '') return NULL; 37 37 $DateTime = str_replace('. ', '.', $DateTime); 38 38 $Parts = explode(' ', $DateTime); … … 44 44 } else $TimeParts = array(0, 0, 0); 45 45 $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[0], $DateParts[2]); 46 return ($Result);46 return $Result; 47 47 } 48 48 49 49 function HumanDateToTime($Date) 50 50 { 51 if ($Date == '') return(NULL);52 return (HumanDateTimeToTime($Date.' 0:0:0'));51 if ($Date == '') return NULL; 52 return HumanDateTimeToTime($Date.' 0:0:0'); 53 53 } 54 54 … … 60 60 $ret = html_entity_decode($str, ENT_COMPAT, 'UTF-8'); 61 61 $p2 = 0; 62 for (;;)62 for (;;) 63 63 { 64 64 $p = strpos($ret, $prefix, $p2); … … 105 105 function is_alpha($Char) 106 106 { 107 return (( ($Char >= 'a') and ($Char <= 'z')) or (($Char >= 'A') and ($Char <= 'Z')));107 return (($Char >= 'a') and ($Char <= 'z')) or (($Char >= 'A') and ($Char <= 'Z')); 108 108 } 109 109 … … 116 116 { 117 117 $Result = ''; 118 for (;;)118 for (;;) 119 119 { 120 120 $Pos = strpos($Text, $Needle); … … 142 142 { 143 143 $Result = ''; 144 for (;;)144 for (;;) 145 145 { 146 146 $Pos = strpos($Text, $Needle); … … 432 432 $Result = 1; 433 433 } else $Result = 0; 434 return ($Result);435 } 436 } 434 return $Result; 435 } 436 } -
trunk/Modules/Meet/MeetPage.php
r49 r55 84 84 '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL FROM MeetItem) AS T WHERE (T.Hidden=0) AND '. 85 85 $Where.$Order['SQL'].$PageList['SQLLimit']); 86 while ($MeetItem = $DbResult->fetch_assoc())86 while ($MeetItem = $DbResult->fetch_assoc()) 87 87 { 88 88 $Output .= '<tr>'. … … 109 109 $Output .= '<div><a href="'.$this->System->Link('/seznamka/rss/').'"><img src="'.$this->System->Link('/images/rss20.png').'" alt="rss20"/></a></div>'; 110 110 } 111 return ($Output);111 return $Output; 112 112 } 113 113 } … … 145 145 $this->Title = 'Inzerát - Seznamka - '.$this->Title; 146 146 $Output = ''; 147 if (count($this->System->PathItems) > 2)147 if (count($this->System->PathItems) > 2) 148 148 { 149 149 $id = $this->System->PathItems[2] * 1; … … 211 211 $DbResult = $this->Database->select('MeetItem', '*, (SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName, '. 212 212 '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL', '`Hidden`=0 ORDER BY `Time` DESC LIMIT 30'); 213 while ($MeetItem = $DbResult->fetch_assoc())213 while ($MeetItem = $DbResult->fetch_assoc()) 214 214 { 215 215 $Title = $MeetItem['Name']; -
trunk/Modules/Movie/Movie.php
r46 r55 66 66 $Output .= '</tr>'; 67 67 $DbResult = $this->Database->select('Movie', '*', $Where.$Order['SQL'].$PageList['SQLLimit']); 68 while ($Movie = $DbResult->fetch_assoc())68 while ($Movie = $DbResult->fetch_assoc()) 69 69 { 70 70 $Output .= '<tr>'. … … 80 80 $Output .= $PageList['Output']; 81 81 82 return ($Output);82 return $Output; 83 83 } 84 84 } -
trunk/Modules/RSS/RSS.php
r37 r55 27 27 $this->RSSChannels[$Channel['Channel']] = $Channel; 28 28 29 if (is_null($Pos)) $this->RSSChannelsPos[] = $Channel['Channel'];29 if (is_null($Pos)) $this->RSSChannelsPos[] = $Channel['Channel']; 30 30 else { 31 31 array_splice($this->RSSChannelsPos, $Pos, 0, $Channel['Channel']); … … 42 42 { 43 43 $Output = ''; 44 foreach ($this->RSSChannels as $Channel)44 foreach ($this->RSSChannels as $Channel) 45 45 { 46 //if ($this->System->User->Licence($Channel['Permission']))46 //if ($this->System->User->Licence($Channel['Permission'])) 47 47 $Output .= ' <link rel="alternate" title="'.$Channel['Title'].'" href="'. 48 48 $this->System->Link('/rss/?channel='.$Channel['Channel']).'" type="application/rss+xml" />'; 49 49 } 50 return ($Output);50 return $Output; 51 51 } 52 52 } … … 58 58 $this->ClearPage = true; 59 59 60 if (array_key_exists('channel', $_GET)) $ChannelName = $_GET['channel'];60 if (array_key_exists('channel', $_GET)) $ChannelName = $_GET['channel']; 61 61 else $ChannelName = ''; 62 if (array_key_exists('token', $_GET)) $Token = $_GET['token'];62 if (array_key_exists('token', $_GET)) $Token = $_GET['token']; 63 63 else $Token = ''; 64 if (array_key_exists($ChannelName, $this->System->ModuleManager->Modules['RSS']->RSSChannels))64 if (array_key_exists($ChannelName, $this->System->ModuleManager->Modules['RSS']->RSSChannels)) 65 65 { 66 66 $Channel = $this->System->ModuleManager->Modules['RSS']->RSSChannels[$ChannelName]; 67 if ($this->System->User->CheckPermission($Channel['Permission']['Module'], $Channel['Permission']['Operation']) or67 if ($this->System->User->CheckPermission($Channel['Permission']['Module'], $Channel['Permission']['Operation']) or 68 68 $this->System->User->CheckToken($Channel['Permission']['Module'], $Channel['Permission']['Operation'], $Token)) 69 69 { 70 if (is_string($Channel['Callback'][0]))70 if (is_string($Channel['Callback'][0])) 71 71 { 72 72 $Class = new $Channel['Callback'][0]($this->System); … … 76 76 } else $Output = 'Nemáte oprávnění'; 77 77 } else $Output = 'Kanál nenalezen'; 78 return ($Output);78 return $Output; 79 79 } 80 80 } -
trunk/Modules/School/School.php
r37 r55 39 39 $Output .= '</tr>'; 40 40 $DbResult = $this->Database->select('School', '*', '1 ORDER BY `Name`'); 41 while ($School = $DbResult->fetch_assoc())41 while ($School = $DbResult->fetch_assoc()) 42 42 { 43 43 $Output .= '<tr>'. … … 49 49 $Output .= '</table>'; 50 50 51 return ($Output);51 return $Output; 52 52 } 53 53 } -
trunk/Packages/Common/AppModule.php
r37 r55 77 77 function Install() 78 78 { 79 if ($this->Installed) return;79 if ($this->Installed) return; 80 80 $List = array(); 81 81 $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotInstalled)); … … 89 89 function Uninstall() 90 90 { 91 if (!$this->Installed) return;91 if (!$this->Installed) return; 92 92 $this->Stop(); 93 93 $this->Installed = false; … … 100 100 function Upgrade() 101 101 { 102 if (!$this->Installed) return;103 if ($this->InstalledVersion == $this->Version) return;102 if (!$this->Installed) return; 103 if ($this->InstalledVersion == $this->Version) return; 104 104 $List = array(); 105 105 $this->Manager->EnumSuperiorDependenciesCascade($this, $List, array(ModuleCondition::Installed)); … … 117 117 function Start() 118 118 { 119 if ($this->Running) return;120 if (!$this->Installed) return;119 if ($this->Running) return; 120 if (!$this->Installed) return; 121 121 $List = array(); 122 122 $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotRunning)); … … 128 128 function Stop() 129 129 { 130 if (!$this->Running) return;130 if (!$this->Running) return; 131 131 $this->Running = false; 132 132 $List = array(); … … 144 144 function Enable() 145 145 { 146 if ($this->Enabled) return;147 if (!$this->Installed) return;146 if ($this->Enabled) return; 147 if (!$this->Installed) return; 148 148 $List = array(); 149 149 $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotEnabled)); … … 154 154 function Disable() 155 155 { 156 if (!$this->Enabled) return;156 if (!$this->Enabled) return; 157 157 $this->Stop(); 158 158 $this->Enabled = false; … … 203 203 function Perform($List, $Actions, $Conditions = array(ModuleCondition::All)) 204 204 { 205 foreach ($List as $Index => $Module)206 { 207 if (in_array(ModuleCondition::All, $Conditions) or205 foreach ($List as $Index => $Module) 206 { 207 if (in_array(ModuleCondition::All, $Conditions) or 208 208 ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or 209 209 (!$Module->Running and in_array(ModuleCondition::NotRunning, $Conditions)) or … … 213 213 (!$Module->Enabled and in_array(ModuleCondition::NotEnabled, $Conditions))) 214 214 { 215 foreach ($Actions as $Action)215 foreach ($Actions as $Action) 216 216 { 217 if ($Action == ModuleAction::Start) $Module->Start();218 if ($Action == ModuleAction::Stop) $Module->Stop();219 if ($Action == ModuleAction::Install) $Module->Install();220 if ($Action == ModuleAction::Uninstall) $Module->Uninstall();221 if ($Action == ModuleAction::Enable) $Module->Enable();222 if ($Action == ModuleAction::Disable) $Module->Disable();223 if ($Action == ModuleAction::Upgrade) $Module->Upgrade();217 if ($Action == ModuleAction::Start) $Module->Start(); 218 if ($Action == ModuleAction::Stop) $Module->Stop(); 219 if ($Action == ModuleAction::Install) $Module->Install(); 220 if ($Action == ModuleAction::Uninstall) $Module->Uninstall(); 221 if ($Action == ModuleAction::Enable) $Module->Enable(); 222 if ($Action == ModuleAction::Disable) $Module->Disable(); 223 if ($Action == ModuleAction::Upgrade) $Module->Upgrade(); 224 224 } 225 225 } … … 229 229 function EnumDependenciesCascade($Module, &$List, $Conditions = array(ModuleCondition::All)) 230 230 { 231 foreach ($Module->Dependencies as $Dependency)232 { 233 if (!array_key_exists($Dependency, $this->Modules))231 foreach ($Module->Dependencies as $Dependency) 232 { 233 if (!array_key_exists($Dependency, $this->Modules)) 234 234 throw new Exception(sprintf(T('Module "%s" dependency "%s" not found'), $Module->Name, $Dependency)); 235 235 $DepModule = $this->Modules[$Dependency]; 236 if (in_array(ModuleCondition::All, $Conditions) or236 if (in_array(ModuleCondition::All, $Conditions) or 237 237 ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or 238 238 (!$Module->Running and in_array(ModuleCondition::NotRunning, $Conditions)) or … … 250 250 function EnumSuperiorDependenciesCascade($Module, &$List, $Conditions = array(ModuleCondition::All)) 251 251 { 252 foreach ($this->Modules as $RefModule)253 { 254 if (in_array($Module->Name, $RefModule->Dependencies) and252 foreach ($this->Modules as $RefModule) 253 { 254 if (in_array($Module->Name, $RefModule->Dependencies) and 255 255 (in_array(ModuleCondition::All, $Conditions) or 256 256 ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or … … 270 270 { 271 271 $this->LoadModules(); 272 if (file_exists($this->FileName)) $this->LoadState();272 if (file_exists($this->FileName)) $this->LoadState(); 273 273 $this->StartEnabled(); 274 274 } … … 315 315 function ModulePresent($Name) 316 316 { 317 return (array_key_exists($Name, $this->Modules));317 return array_key_exists($Name, $this->Modules); 318 318 } 319 319 320 320 function ModuleEnabled($Name) 321 321 { 322 return (array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Enabled);322 return array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Enabled; 323 323 } 324 324 325 325 function ModuleRunning($Name) 326 326 { 327 return (array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Running);327 return array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Running; 328 328 } 329 329 … … 331 331 function SearchModuleById($Id) 332 332 { 333 foreach ($this->Modules as $Module)333 foreach ($this->Modules as $Module) 334 334 { 335 335 //DebugLog($Module->Name.' '.$Module->Id); 336 if ($Module->Id == $Id) return($Module->Name);337 } 338 return ('');336 if ($Module->Id == $Id) return $Module->Name; 337 } 338 return ''; 339 339 } 340 340 … … 343 343 $ConfigModules = array(); 344 344 include($this->FileName); 345 foreach ($ConfigModules as $Mod)346 { 347 if (array_key_exists($Mod['Name'], $this->Modules))345 foreach ($ConfigModules as $Mod) 346 { 347 if (array_key_exists($Mod['Name'], $this->Modules)) 348 348 { 349 349 $this->Modules[$Mod['Name']] = $this->Modules[$Mod['Name']]; … … 358 358 { 359 359 $Data = array(); 360 foreach ($this->Modules as $Module)360 foreach ($this->Modules as $Module) 361 361 { 362 362 $Data[] = array('Name' => $Module->Name, 'Enabled' => $Module->Enabled, … … 381 381 { 382 382 $List = scandir($Directory); 383 foreach ($List as $Item)384 { 385 if (is_dir($Directory.'/'.$Item) and ($Item != '.') and ($Item != '..') and ($Item != '.svn'))383 foreach ($List as $Item) 384 { 385 if (is_dir($Directory.'/'.$Item) and ($Item != '.') and ($Item != '..') and ($Item != '.svn')) 386 386 { 387 387 include_once($Directory.'/'.$Item.'/'.$Item.'.php'); … … 394 394 function LoadModules() 395 395 { 396 if (method_exists($this->OnLoadModules[0], $this->OnLoadModules[1]))396 if (method_exists($this->OnLoadModules[0], $this->OnLoadModules[1])) 397 397 $this->OnLoadModules(); 398 398 else $this->LoadModulesFromDir($this->ModulesDir); -
trunk/Packages/Common/Common.php
r37 r55 61 61 62 62 $Result = ''; 63 if (array_key_exists('all', $QueryItems))63 if (array_key_exists('all', $QueryItems)) 64 64 { 65 65 $PageCount = 1; … … 72 72 } 73 73 74 if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;75 if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;76 if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;77 if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;74 if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0; 75 if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1; 76 if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0; 77 if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1; 78 78 $CurrentPage = $_SESSION['Page']; 79 79 … … 81 81 82 82 $Result = ''; 83 if ($PageCount > 1)83 if ($PageCount > 1) 84 84 { 85 if ($CurrentPage > 0)85 if ($CurrentPage > 0) 86 86 { 87 87 $QueryItems['page'] = 0; … … 92 92 $PagesMax = $PageCount - 1; 93 93 $PagesMin = 0; 94 if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;95 if ($PagesMin < ($CurrentPage - $Around))94 if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around; 95 if ($PagesMin < ($CurrentPage - $Around)) 96 96 { 97 97 $Result.= ' ... '; 98 98 $PagesMin = $CurrentPage - $Around; 99 99 } 100 for ($i = $PagesMin; $i <= $PagesMax; $i++)100 for ($i = $PagesMin; $i <= $PagesMax; $i++) 101 101 { 102 if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';102 if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> '; 103 103 else { 104 104 $QueryItems['page'] = $i; … … 106 106 } 107 107 } 108 if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';109 if ($CurrentPage < ($PageCount - 1))108 if ($PagesMax < ($PageCount - 1)) $Result .= ' ... '; 109 if ($CurrentPage < ($PageCount - 1)) 110 110 { 111 111 $QueryItems['page'] = ($CurrentPage + 1); … … 116 116 } 117 117 $QueryItems['all'] = '1'; 118 if ($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';118 if ($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>'; 119 119 120 120 $Result = '<div style="text-align: center">'.$Result.'</div>'; 121 121 $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage; 122 122 $this->Page = $CurrentPage; 123 return ($Result);123 return $Result; 124 124 } 125 125 } -
trunk/Packages/Common/Config.php
r37 r55 12 12 function ReadValue($Name) 13 13 { 14 if (!is_array($Name)) $Name = explode('/', $Name);14 if (!is_array($Name)) $Name = explode('/', $Name); 15 15 $Last = array_pop($Name); 16 16 $Data = &$this->Data; 17 foreach ($Name as $Item)17 foreach ($Name as $Item) 18 18 { 19 19 $Data = &$Data[$Item]; 20 20 } 21 return ($Data[$Last]);21 return $Data[$Last]; 22 22 } 23 23 24 24 function WriteValue($Name, $Value) 25 25 { 26 if (!is_array($Name)) $Name = explode('/', $Name);26 if (!is_array($Name)) $Name = explode('/', $Name); 27 27 $Last = array_pop($Name); 28 28 $Data = &$this->Data; 29 foreach ($Name as $Item)29 foreach ($Name as $Item) 30 30 { 31 31 $Data = &$Data[$Item]; … … 38 38 $ConfigData = array(); 39 39 include $FileName; 40 foreach ($this->Data as $Index => $Item)40 foreach ($this->Data as $Index => $Item) 41 41 { 42 if (array_key_exits($Index, $ConfigData))42 if (array_key_exits($Index, $ConfigData)) 43 43 $this->Data[$Index] = $ConfigData[$Index]; 44 44 } … … 52 52 function GetAsArray() 53 53 { 54 return ($this->Data);54 return $this->Data; 55 55 } 56 56 } -
trunk/Packages/Common/Database.php
r37 r55 11 11 function fetch_assoc() 12 12 { 13 return ($this->PDOStatement->fetch(PDO::FETCH_ASSOC));13 return $this->PDOStatement->fetch(PDO::FETCH_ASSOC); 14 14 } 15 15 16 16 function fetch_array() 17 17 { 18 return ($this->PDOStatement->fetch(PDO::FETCH_BOTH));18 return $this->PDOStatement->fetch(PDO::FETCH_BOTH); 19 19 } 20 20 21 21 function fetch_row() 22 22 { 23 return ($this->PDOStatement->fetch(PDO::FETCH_NUM));23 return $this->PDOStatement->fetch(PDO::FETCH_NUM); 24 24 } 25 25 } … … 54 54 function Connect($Host, $User, $Password, $Database) 55 55 { 56 if ($this->Type == 'mysql') $ConnectionString = 'mysql:host='.$Host.';dbname='.$Database;57 else if ($this->Type == 'pgsql') $ConnectionString = 'pgsql:dbname='.$Database.';host='.$Host;56 if ($this->Type == 'mysql') $ConnectionString = 'mysql:host='.$Host.';dbname='.$Database; 57 else if ($this->Type == 'pgsql') $ConnectionString = 'pgsql:dbname='.$Database.';host='.$Host; 58 58 else $ConnectionString = ''; 59 59 try { … … 74 74 function Connected() 75 75 { 76 return (isset($this->PDO));76 return isset($this->PDO); 77 77 } 78 78 … … 84 84 function query($Query) 85 85 { 86 if (!$this->Connected()) throw new Exception(T('Not connected to database'));87 if (($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true)) $QueryStartTime = microtime();86 if (!$this->Connected()) throw new Exception(T('Not connected to database')); 87 if (($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true)) $QueryStartTime = microtime(); 88 88 $this->LastQuery = $Query; 89 if (($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true))89 if (($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true)) 90 90 $Duration = ' ; '.round(microtime() - $QueryStartTime, 4). ' s'; 91 if ($this->LogSQLQuery == true)91 if ($this->LogSQLQuery == true) 92 92 file_put_contents($this->LogFile, $Query.$Duration."\n", FILE_APPEND); 93 if ($this->ShowSQLQuery == true)93 if ($this->ShowSQLQuery == true) 94 94 echo('<div style="border-bottom-width: 1px; border-bottom-style: solid; '. 95 95 'padding-bottom: 3px; padding-top: 3px; font-size: 12px; font-family: Arial;">'.$Query.$Duration.'</div>'."\n"); 96 96 $Result = new DatabaseResult(); 97 97 $Result->PDOStatement = $this->PDO->query($Query); 98 if ($Result->PDOStatement)98 if ($Result->PDOStatement) 99 99 { 100 100 $Result->num_rows = $Result->PDOStatement->rowCount(); … … 104 104 $this->Error = $this->PDO->errorInfo(); 105 105 $this->Error = $this->Error[2]; 106 if (($this->Error != '') and ($this->ShowSQLError == true))106 if (($this->Error != '') and ($this->ShowSQLError == true)) 107 107 echo('<div><strong>SQL Error: </strong>'.$this->Error.'<br />'.$Query.'</div>'); 108 108 throw new Exception('SQL Error: '.$this->Error.', Query: '.$Query); 109 109 } 110 return ($Result);110 return $Result; 111 111 } 112 112 113 113 function select($Table, $What = '*', $Condition = 1) 114 114 { 115 return ($this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition));115 return $this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition); 116 116 } 117 117 … … 125 125 $Name = ''; 126 126 $Values = ''; 127 foreach ($Data as $Key => $Value)127 foreach ($Data as $Key => $Value) 128 128 { 129 129 $Name .= ',`'.$Key.'`'; 130 if (!in_array($Value, $this->Functions))130 if (!in_array($Value, $this->Functions)) 131 131 { 132 if (is_null($Value)) $Value = 'NULL';132 if (is_null($Value)) $Value = 'NULL'; 133 133 else $Value = $this->PDO->quote($Value); 134 134 } … … 144 144 { 145 145 $Values = ''; 146 foreach ($Data as $Key => $Value)147 { 148 if (!in_array($Value, $this->Functions))146 foreach ($Data as $Key => $Value) 147 { 148 if (!in_array($Value, $this->Functions)) 149 149 { 150 if (is_null($Value)) $Value = 'NULL';150 if (is_null($Value)) $Value = 'NULL'; 151 151 else $Value = $this->PDO->quote($Value); 152 152 } … … 161 161 $Name = ''; 162 162 $Values = ''; 163 foreach ($Data as $Key => $Value)164 { 165 if (!in_array($Value, $this->Functions))163 foreach ($Data as $Key => $Value) 164 { 165 if (!in_array($Value, $this->Functions)) 166 166 { 167 if (is_null($Value)) $Value = 'NULL';167 if (is_null($Value)) $Value = 'NULL'; 168 168 else $Value = $this->PDO->quote($Value); 169 169 } … … 185 185 function real_escape_string($Text) 186 186 { 187 return (addslashes($Text));187 return addslashes($Text); 188 188 } 189 189 190 190 function quote($Text) 191 191 { 192 return ($this->PDO->quote($Text));192 return $this->PDO->quote($Text); 193 193 } 194 194 … … 205 205 function TimeToMysqlDateTime($Time) 206 206 { 207 if ($Time == NULL) return(NULL);208 else return (date('Y-m-d H:i:s', $Time));207 if ($Time == NULL) return NULL; 208 else return date('Y-m-d H:i:s', $Time); 209 209 } 210 210 211 211 function TimeToMysqlDate($Time) 212 212 { 213 if ($Time == NULL) return(NULL);214 else return (date('Y-m-d', $Time));213 if ($Time == NULL) return NULL; 214 else return date('Y-m-d', $Time); 215 215 } 216 216 217 217 function TimeToMysqlTime($Time) 218 218 { 219 if ($Time == NULL) return(NULL);220 else return (date('H:i:s', $Time));219 if ($Time == NULL) return NULL; 220 else return date('H:i:s', $Time); 221 221 } 222 222 223 223 function MysqlDateTimeToTime($DateTime) 224 224 { 225 if ($DateTime == '') return(NULL);225 if ($DateTime == '') return NULL; 226 226 $Parts = explode(' ', $DateTime); 227 227 $DateParts = explode('-', $Parts[0]); 228 228 $TimeParts = explode(':', $Parts[1]); 229 229 $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]); 230 return ($Result);230 return $Result; 231 231 } 232 232 233 233 function MysqlDateToTime($Date) 234 234 { 235 if ($Date == '') return(NULL);236 return (MysqlDateTimeToTime($Date.' 0:0:0'));235 if ($Date == '') return NULL; 236 return MysqlDateTimeToTime($Date.' 0:0:0'); 237 237 } 238 238 239 239 function MysqlTimeToTime($Time) 240 240 { 241 if ($Time == '') return(NULL);242 return (MysqlDateTimeToTime('0000-00-00 '.$Time));243 } 241 if ($Time == '') return NULL; 242 return MysqlDateTimeToTime('0000-00-00 '.$Time); 243 } -
trunk/Packages/Common/Error.php
r37 r55 45 45 ); 46 46 47 if (($this->UserErrors & $Number))47 if (($this->UserErrors & $Number)) 48 48 { 49 49 // Error was suppressed with the @-operator 50 if (0 === error_reporting())50 if (0 === error_reporting()) 51 51 { 52 52 return false; … … 58 58 $Backtrace[0]['line'] = $LineNumber; 59 59 $this->Report($Backtrace); 60 //if ((E_ERROR | E_PARSE) & $Number)60 //if ((E_ERROR | E_PARSE) & $Number) 61 61 die(); 62 62 } … … 82 82 'An internal error occurred!<br/>'. 83 83 'Administrator will be notified and the problem will be investigated and fixed soon.'.'<br/><br/>'; 84 if ($this->ShowError == true)84 if ($this->ShowError == true) 85 85 $Output .= '<pre>'.$Message.'</pre><br/>'; 86 86 $Output .= '</body></html>'; … … 92 92 $Date = date('Y-m-d H:i:s'); 93 93 $Error = '# '.$Date."\n"; 94 foreach ($Backtrace as $Item)94 foreach ($Backtrace as $Item) 95 95 { 96 if (!array_key_exists('line', $Item)) $Item['line'] = '';97 if (!array_key_exists('file', $Item)) $Item['file'] = '';96 if (!array_key_exists('line', $Item)) $Item['line'] = ''; 97 if (!array_key_exists('file', $Item)) $Item['file'] = ''; 98 98 99 99 $Error .= ' '.$Item['file'].'('.$Item['line'].")\t".$Item['function']; 100 100 $Arguments = ''; 101 if (array_key_exists('args', $Item) and is_array($Item['args']))102 foreach ($Item['args'] as $Item)101 if (array_key_exists('args', $Item) and is_array($Item['args'])) 102 foreach ($Item['args'] as $Item) 103 103 { 104 if (is_object($Item)) ;105 else if (is_array($Item)) $Arguments .= "'".serialize($Item)."',";104 if (is_object($Item)) ; 105 else if (is_array($Item)) $Arguments .= "'".serialize($Item)."',"; 106 106 else $Arguments .= "'".$Item."',"; 107 107 } 108 if (strlen($Arguments) > 0) $Error .= '('.substr($Arguments, 0, -1).')';108 if (strlen($Arguments) > 0) $Error .= '('.substr($Arguments, 0, -1).')'; 109 109 $Error .= "\n"; 110 110 } 111 111 $Error .= "\n"; 112 112 113 foreach ($this->OnError as $OnError)113 foreach ($this->OnError as $OnError) 114 114 call_user_func($OnError, $Error); 115 115 } -
trunk/Packages/Common/Image.php
r37 r55 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 imagegif ($this->Image, $FileName);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); … … 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 $this->Image = imagecreatefromgif ($FileName);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); … … 112 112 function GetWidth() 113 113 { 114 return (imagesx($this->Image));114 return imagesx($this->Image); 115 115 } 116 116 117 117 function GetHeight() 118 118 { 119 return (imagesy($this->Image));119 return imagesy($this->Image); 120 120 } 121 121 … … 127 127 function ConvertColor($Color) 128 128 { 129 return (imagecolorallocate($this->Image, ($Color >> 16) & 0xff, ($Color >> 8) & 0xff, $Color & 0xff));129 return imagecolorallocate($this->Image, ($Color >> 16) & 0xff, ($Color >> 8) & 0xff, $Color & 0xff); 130 130 } 131 131 -
trunk/Packages/Common/Locale.php
r37 r55 20 20 function Translate($Text, $Group = '') 21 21 { 22 if (array_key_exists($Text, $this->Data[$Group]) and ($this->Data[$Group][$Text] != ''))23 return ($this->Data[$Group][$Text]);24 else return ($Text);22 if (array_key_exists($Text, $this->Data[$Group]) and ($this->Data[$Group][$Text] != '')) 23 return $this->Data[$Group][$Text]; 24 else return $Text; 25 25 } 26 26 … … 28 28 { 29 29 $Key = array_search($Text, $this->Data[$Group]); 30 if (($Key === FALSE) or ($this->Data[$Group][$Key] == '')) return($Text);31 else return ($Key);30 if (($Key === FALSE) or ($this->Data[$Group][$Key] == '')) return $Text; 31 else return $Key; 32 32 } 33 33 } … … 47 47 { 48 48 $FileName = $this->Dir.'/'.$Language.'.php'; 49 if (file_exists($FileName)) {49 if (file_exists($FileName)) { 50 50 include_once($FileName); 51 51 $ClassName = 'LocaleText'.$Language; … … 59 59 // Search for php files 60 60 $FileList = scandir($Path); 61 foreach ($FileList as $FileName)61 foreach ($FileList as $FileName) 62 62 { 63 63 $FullName = $Path.'/'.$FileName; 64 if (($FileName == '.') or ($FileName == '..')) ; // Skip virtual items65 else if (substr($FileName, 0, 1) == '.') ; // Skip Linux hidden files66 else if (is_dir($FullName)) $this->AnalyzeCode($FullName);67 else if (file_exists($FullName))68 { 69 if (substr($FullName, -4) == '.php')64 if (($FileName == '.') or ($FileName == '..')) ; // Skip virtual items 65 else if (substr($FileName, 0, 1) == '.') ; // Skip Linux hidden files 66 else if (is_dir($FullName)) $this->AnalyzeCode($FullName); 67 else if (file_exists($FullName)) 68 { 69 if (substr($FullName, -4) == '.php') 70 70 { 71 71 $Content = file_get_contents($FullName); 72 72 // Search occurence of T() function 73 while (strpos($Content, 'T(') !== false)73 while (strpos($Content, 'T(') !== false) 74 74 { 75 75 $Previous = strtolower(substr($Content, strpos($Content, 'T(') - 1, 1)); … … 77 77 $Ord = ord($Previous); 78 78 //echo($Ord.','); 79 if (!(($Ord >= ord('a')) and ($Ord <= ord('z'))))79 if (!(($Ord >= ord('a')) and ($Ord <= ord('z')))) 80 80 { 81 81 // Do for non-alpha previous character 82 82 $Original = substr($Content, 0, strpos($Content, ')')); 83 83 $Original2 = ''; 84 if ((substr($Original, 0, 1) == "'") and (substr($Original, -1, 1) == "'"))84 if ((substr($Original, 0, 1) == "'") and (substr($Original, -1, 1) == "'")) 85 85 $Original2 = substr($Original, 1, -1); 86 if ((substr($Original, 0, 1) == '"') and (substr($Original, -1, 1) == '"'))86 if ((substr($Original, 0, 1) == '"') and (substr($Original, -1, 1) == '"')) 87 87 $Original2 = substr($Original, 1, -1); 88 if ($Original2 != '')88 if ($Original2 != '') 89 89 { 90 if (!array_key_exists($Original2, $this->Texts->Data))90 if (!array_key_exists($Original2, $this->Texts->Data)) 91 91 $this->Texts->Data[$Original2] = ''; 92 92 } … … 109 109 ' $this->Title = \''.$this->Texts->Title.'\';'."\n". 110 110 ' $this->Data = array('."\n"; 111 foreach ($this->Texts->Data as $Index => $Item)111 foreach ($this->Texts->Data as $Index => $Item) 112 112 { 113 113 $Content .= " '".$Index."' => '".$Item."',\n"; … … 122 122 { 123 123 $DbResult = $Database->select('Language', '*', 'Code='.$Database->quote($LangCode)); 124 if ($DbResult->num_rows > 0)124 if ($DbResult->num_rows > 0) 125 125 { 126 126 $Language = $DbResult->fetch_assoc(); 127 127 $this->Texts->Data = array(); 128 128 $DbResult = $Database->select('Locale', '`Original`, `Translated`', '`Language`='.$Language['Id']); 129 while ($DbRow = $DbResult->fetch_assoc())129 while ($DbRow = $DbResult->fetch_assoc()) 130 130 $this->Texts->Data[$DbRow['Original']] = $DbRow['Translated']; 131 131 } … … 135 135 { 136 136 $DbResult = $Database->select('Language', '*', 'Code='.$Database->quote($LangCode)); 137 if ($DbResult->num_rows > 0)137 if ($DbResult->num_rows > 0) 138 138 { 139 139 $Language = $DbResult->fetch_assoc(); 140 140 $Database->delete('Locale', '`Language`='.$Language['Id']); 141 foreach ($this->Texts->Data as $Index => $Item)141 foreach ($this->Texts->Data as $Index => $Item) 142 142 $Database->query('INSERT INTO `Locale` (`Language`,`Original`,`Translated`) '. 143 143 'VALUES('.$Language['Id'].','.$Database->quote($Index).','.$Database->quote($Item).')'); … … 148 148 { 149 149 $DbResult = $Database->select('Language', '*', '`Code`='.$Database->quote($LangCode)); 150 if ($DbResult->num_rows > 0)150 if ($DbResult->num_rows > 0) 151 151 { 152 152 $Language = $DbResult->fetch_assoc(); 153 foreach ($this->Texts->Data as $Index => $Item)153 foreach ($this->Texts->Data as $Index => $Item) 154 154 { 155 155 $DbResult = $Database->select('Locale', '*', '(`Original` ='.$Database->quote($Index). 156 156 ') AND (`Language`='.($Language['Id']).')'); 157 if ($DbResult->num_rows > 0)157 if ($DbResult->num_rows > 0) 158 158 $Database->update('Locale', '(`Language`='.($Language['Id']).') AND '. 159 159 '(`Original` ='.$Database->quote($Index).')', array('Translated' => $Item)); … … 188 188 $this->Available = array(); 189 189 $FileList = scandir($this->Dir); 190 foreach ($FileList as $FileName)191 { 192 if (substr($FileName, -4) == '.php')190 foreach ($FileList as $FileName) 191 { 192 if (substr($FileName, -4) == '.php') 193 193 { 194 194 $Code = substr($FileName, 0, -4); … … 206 206 $Locale->AnalyzeCode($Directory); 207 207 $FileList = scandir($this->Dir); 208 foreach ($FileList as $FileName)209 { 210 if (substr($FileName, -4) == '.php')208 foreach ($FileList as $FileName) 209 { 210 if (substr($FileName, -4) == '.php') 211 211 { 212 212 $FileLocale = new LocaleFile($this->System); … … 215 215 216 216 // Add new 217 foreach ($Locale->Texts->Data as $Index => $Item)218 if (!array_key_exists($Index, $FileLocale->Texts->Data))217 foreach ($Locale->Texts->Data as $Index => $Item) 218 if (!array_key_exists($Index, $FileLocale->Texts->Data)) 219 219 $FileLocale->Texts->Data[$Index] = $Item; 220 220 // Remove old 221 foreach ($FileLocale->Texts->Data as $Index => $Item)222 if (!array_key_exists($Index, $Locale->Texts->Data))221 foreach ($FileLocale->Texts->Data as $Index => $Item) 222 if (!array_key_exists($Index, $Locale->Texts->Data)) 223 223 unset($FileLocale->Texts->Data[$Index]); 224 224 $FileLocale->UpdateToDatabase($this->System->Database, $FileLocale->Texts->Code); … … 232 232 function LoadLocale($Code) 233 233 { 234 if (array_key_exists($Code, $this->Available))234 if (array_key_exists($Code, $this->Available)) 235 235 { 236 236 $this->CurrentLocale->Dir = $this->Dir; … … 245 245 global $GlobalLocaleManager; 246 246 247 if (isset($GlobalLocaleManager)) return($GlobalLocaleManager->CurrentLocale->Texts->Translate($Text, $Group));248 else return ($Text);249 } 247 if (isset($GlobalLocaleManager)) return $GlobalLocaleManager->CurrentLocale->Texts->Translate($Text, $Group); 248 else return $Text; 249 } -
trunk/Packages/Common/Mail.php
r37 r55 69 69 function Organization($org) 70 70 { 71 if (trim($org != '')) $this->xheaders['Organization'] = $org;71 if (trim($org != '')) $this->xheaders['Organization'] = $org; 72 72 } 73 73 74 74 function Priority($Priority) 75 75 { 76 if (!intval($Priority)) return(false);77 78 if (!isset($this->priorities[$Priority - 1])) return(false);76 if (!intval($Priority)) return false; 77 78 if (!isset($this->priorities[$Priority - 1])) return false; 79 79 80 80 $this->xheaders['X-Priority'] = $this->priorities[$Priority - 1]; 81 return (true);81 return true; 82 82 } 83 83 … … 96 96 function Send() 97 97 { 98 if (count($this->Bodies) == 0) throw new Exception(T('Mail message need at least one text body'));98 if (count($this->Bodies) == 0) throw new Exception(T('Mail message need at least one text body')); 99 99 100 100 $Body = $this->BuildAttachment($this->BuildBody()); … … 103 103 $this->Headers['CC'] = ''; 104 104 $this->Headers['BCC'] = ''; 105 foreach ($this->Recipients as $Index => $Recipient)106 { 107 if ($Recipient['Type'] == 'SendCombined')108 { 109 if ($Index > 0) $To .= ', ';105 foreach ($this->Recipients as $Index => $Recipient) 106 { 107 if ($Recipient['Type'] == 'SendCombined') 108 { 109 if ($Index > 0) $To .= ', '; 110 110 $To .= $Recipient['Address']; 111 111 } else 112 if ($Recipient['Type'] == 'Send')113 { 114 if ($Index > 0) $To .= ', ';112 if ($Recipient['Type'] == 'Send') 113 { 114 if ($Index > 0) $To .= ', '; 115 115 $To .= $Recipient['Name'].' <'.$Recipient['Address'].'>'; 116 116 } else 117 if ($Recipient['Type'] == 'Copy')118 { 119 if ($Index > 0) $this->Headers['CC'] .= ', ';117 if ($Recipient['Type'] == 'Copy') 118 { 119 if ($Index > 0) $this->Headers['CC'] .= ', '; 120 120 $this->Headers['CC'] .= $Recipient['Name'].' <'.$To['Address'].'>'; 121 121 } else 122 if ($Recipient['Type'] == 'HiddenCopy')123 { 124 if ($Index > 0) $this->Headers['BCC'] .= ', ';122 if ($Recipient['Type'] == 'HiddenCopy') 123 { 124 if ($Index > 0) $this->Headers['BCC'] .= ', '; 125 125 $this->Headers['BCC'] .= $Recipient['Name'].' <'.$To['Address'].'>'; 126 126 } 127 127 } 128 if ($To == '') throw new Exception(T('Mail message need at least one recipient address'));128 if ($To == '') throw new Exception(T('Mail message need at least one recipient address')); 129 129 130 130 $this->Headers['Mime-Version'] = '1.0'; 131 131 132 if ($this->AgentIdent != '') $this->Headers['X-Mailer'] = $this->AgentIdent;133 if ($this->ReplyTo != '') $this->Headers['Reply-To'] = $this->ReplyTo;134 if ($this->From != '') $this->Headers['From'] = $this->From;132 if ($this->AgentIdent != '') $this->Headers['X-Mailer'] = $this->AgentIdent; 133 if ($this->ReplyTo != '') $this->Headers['Reply-To'] = $this->ReplyTo; 134 if ($this->From != '') $this->Headers['From'] = $this->From; 135 135 136 136 $Headers = ''; 137 foreach ($this->Headers as $Header => $Value)138 { 139 if (($Header != 'Subject') and ($Value != '')) $Headers .= $Header.': '.$Value."\n";137 foreach ($this->Headers as $Header => $Value) 138 { 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(T('Mail message missing Subject'));144 if ($this->Subject == '') throw new Exception(T('Mail message missing Subject')); 145 145 146 146 147 147 $res = mail($To, $this->Subject, $Body, $Headers); 148 return ($res);148 return $res; 149 149 } 150 150 151 151 function ValidEmail($Address) 152 152 { 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))155 return (true);156 else return (false);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)) 155 return true; 156 else return false; 157 157 } 158 158 159 159 function CheckAdresses($Addresses) 160 160 { 161 foreach ($Addresses as $Address)162 { 163 if (!$this->ValidEmail($Address))161 foreach ($Addresses as $Address) 162 { 163 if (!$this->ValidEmail($Address)) 164 164 throw new Exception(sprintf(T('Mail message invalid address %s'), $Address)); 165 165 } … … 168 168 private function ContentEncoding($Charset) 169 169 { 170 if ($Charset != CHARSET_ASCII) return('8bit');171 else return ('7bit');170 if ($Charset != CHARSET_ASCII) return '8bit'; 171 else return '7bit'; 172 172 } 173 173 174 174 private function BuildAttachment($Body) 175 175 { 176 if (count($this->Attachments) > 0)176 if (count($this->Attachments) > 0) 177 177 { 178 178 $this->Headers['Content-Type'] = "multipart/mixed;\n boundary=\"PHP-mixed-".$this->Boundary."\""; … … 181 181 $Result .= $Body; 182 182 183 foreach ($this->Attachments as $Attachment)183 foreach ($this->Attachments as $Attachment) 184 184 { 185 185 $FileName = $Attachment['FileName']; … … 187 187 $ContentType = $Attachment['FileType']; 188 188 $Disposition = $Attachment['Disposition']; 189 if ($Attachment['Type'] == 'File')189 if ($Attachment['Type'] == 'File') 190 190 { 191 if (!file_exists($FileName))191 if (!file_exists($FileName)) 192 192 throw new Exception(sprintf(T('Mail message attached file %s can\'t be found'), $FileName)); 193 193 $Data = file_get_contents($FileName); 194 194 } else 195 if ($Attachment['Type'] == 'Data') $Data = $Attachment['Data'];195 if ($Attachment['Type'] == 'Data') $Data = $Attachment['Data']; 196 196 else $Data = ''; 197 197 … … 203 203 } 204 204 } else $Result = $Body; 205 return ($Result);205 return $Result; 206 206 } 207 207 … … 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.'"'; … … 221 221 222 222 223 foreach ($this->Bodies as $Body)224 { 225 if (count($this->Bodies) > 1) $Result .= "\n\n".'--PHP-alt-'.$this->Boundary."\n";223 foreach ($this->Bodies as $Body) 224 { 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 227 "\nContent-Transfer-Encoding: ".$this->ContentEncoding($Body['Charset'])."\n\n".$Body['Content']."\n"; 228 228 } 229 return ($Result);229 return $Result; 230 230 } 231 231 } -
trunk/Packages/Common/NetworkAddress.php
r37 r55 14 14 function GetNetMask() 15 15 { 16 return (0xffffffff ^ ((1 << (32 - $this->Prefix)) - 1));16 return 0xffffffff ^ ((1 << (32 - $this->Prefix)) - 1); 17 17 } 18 18 19 19 function AddressToString() 20 20 { 21 return (implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255))));21 return implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255))); 22 22 } 23 23 … … 37 37 $To->Address = $From->Address + $HostMask; 38 38 $To->Prefix = 32; 39 return (array('From' => $From, 'To' => $To));39 return array('From' => $From, 'To' => $To); 40 40 } 41 41 … … 43 43 { 44 44 $this->Prefix = $NewPrefix; 45 if ($this->Prefix > 32) $this->Prefix = 32;46 if ($this->Prefix < 0) $this->Prefix = 0;45 if ($this->Prefix > 32) $this->Prefix = 32; 46 if ($this->Prefix < 0) $this->Prefix = 0; 47 47 $this->Address = $this->Address & $this->GetNetMask(); 48 48 } … … 51 51 { 52 52 $UpperNetmask = $this->GetNetMask(); 53 if (($this->Prefix < $Address->Prefix) and (($Address->Address & $UpperNetmask) == ($this->Address & $UpperNetmask))) $Result = true;53 if (($this->Prefix < $Address->Prefix) and (($Address->Address & $UpperNetmask) == ($this->Address & $UpperNetmask))) $Result = true; 54 54 else $Result = false; 55 55 //echo($Address->AddressToString().'/'.$Address->Prefix.' in '.$this->AddressToString().'/'.$this->Prefix.' '.$Result."\n"); 56 return ($Result);56 return $Result; 57 57 } 58 58 } … … 71 71 function AddressToString() 72 72 { 73 return (inet_ntop($this->Address));73 return inet_ntop($this->Address); 74 74 } 75 75 … … 83 83 $Result = array(); 84 84 $Data = array_reverse(unpack('C*', $this->Address)); 85 foreach ($Data as $Item)85 foreach ($Data as $Item) 86 86 { 87 87 … … 89 89 $Result[] = dechex(($Item >> 4) & 15); 90 90 } 91 return ($Result);91 return $Result; 92 92 } 93 93 -
trunk/Packages/Common/Page.php
r37 r55 18 18 function Show() 19 19 { 20 return ('');20 return ''; 21 21 } 22 22 … … 24 24 { 25 25 $Output = $this->Show(); 26 return ($Output);26 return $Output; 27 27 } 28 28 29 29 function SystemMessage($Title, $Text) 30 30 { 31 return (call_user_func_array($this->OnSystemMessage, array($Title, $Text)));31 return call_user_func_array($this->OnSystemMessage, array($Title, $Text)); 32 32 } 33 33 } -
trunk/Packages/Common/PrefixMultiplier.php
r37 r55 74 74 function TruncateDigits($Value, $Digits = 4) 75 75 { 76 for ($II = 2; $II > -6; $II--)76 for ($II = 2; $II > -6; $II--) 77 77 { 78 if ($Value >= pow(10, $II))78 if ($Value >= pow(10, $II)) 79 79 { 80 if ($Digits < ($II + 1)) $RealDigits = $II + 1;80 if ($Digits < ($II + 1)) $RealDigits = $II + 1; 81 81 else $RealDigits = $Digits; 82 82 $Value = round($Value / pow(10, $II - $RealDigits + 1)) * pow(10, $II - $RealDigits + 1); … … 84 84 } 85 85 } 86 return ($Value);86 return $Value; 87 87 } 88 88 … … 93 93 $Negative = ($Value < 0); 94 94 $Value = abs($Value); 95 if (($Unit == '') and ($PrefixType != 'Time'))96 return ($this->TruncateDigits($Value, $Digits));95 if (($Unit == '') and ($PrefixType != 'Time')) 96 return $this->TruncateDigits($Value, $Digits); 97 97 98 98 $I = $PrefixMultipliers[$PrefixType]['BaseIndex']; 99 if ($Value == 0) return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);99 if ($Value == 0) return $Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit; 100 100 101 if ($Value > 1)101 if ($Value > 1) 102 102 { 103 while ((($I + 1) <= count($PrefixMultipliers[$PrefixType]['Definition'])) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + 1][2]) > 1))103 while ((($I + 1) <= count($PrefixMultipliers[$PrefixType]['Definition'])) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + 1][2]) > 1)) 104 104 $I = $I + 1; 105 105 } else 106 if ($Value < 1)106 if ($Value < 1) 107 107 { 108 while ((($I - 1) >= 0) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]) < 1))108 while ((($I - 1) >= 0) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]) < 1)) 109 109 $I = $I - 1; 110 110 } … … 113 113 // Truncate digits count 114 114 $Value = $this->TruncateDigits($Value, $Digits); 115 if ($Negative) $Value = -$Value;116 return ($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);115 if ($Negative) $Value = -$Value; 116 return $Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit; 117 117 } 118 118 } -
trunk/Packages/Common/RSS.php
r37 r55 29 29 " <pubDate>".date('r')."</pubDate>\n". 30 30 " <ttl>20</ttl>\n"; 31 foreach ($this->Items as $Item)31 foreach ($this->Items as $Item) 32 32 { 33 33 $Result .= " <item>\n". … … 40 40 $Result .= " </channel>\n". 41 41 "</rss>"; 42 return ($Result);42 return $Result; 43 43 } 44 44 } -
trunk/Packages/Common/Setup.php
r37 r55 29 29 '<input type="submit" name="login" value="'.T('Login').'"/>'. 30 30 '</form>'; 31 return ($Output);31 return $Output; 32 32 } 33 33 … … 37 37 38 38 $Output .= 'Je připojení k databázi: '.$this->YesNo[$this->UpdateManager->Database->Connected()].'<br/>'; 39 if ($this->UpdateManager->Database->Connected())39 if ($this->UpdateManager->Database->Connected()) 40 40 { 41 41 $Output .= 'Je instalováno: '.$this->YesNo[$this->UpdateManager->IsInstalled()].'<br/>'; 42 if ($this->UpdateManager->IsInstalled())42 if ($this->UpdateManager->IsInstalled()) 43 43 $Output .= 'Je aktuální: '.$this->YesNo[$this->UpdateManager->IsUpToDate()].'<br/>'. 44 44 'Verze databáze: '.$this->UpdateManager->GetDbVersion().'<br/>'; 45 45 $Output .= 'Verze databáze kódu: '.$this->UpdateManager->Revision.'<br/>'; 46 if ($this->UpdateManager->IsInstalled())47 { 48 if (!$this->UpdateManager->IsUpToDate())46 if ($this->UpdateManager->IsInstalled()) 47 { 48 if (!$this->UpdateManager->IsUpToDate()) 49 49 $Output .= '<a href="?action=upgrade">'.T('Upgrade').'</a> '; 50 50 $Output .= '<a href="?action=insert_sample_data">Vložit vzorová data</a> '; … … 59 59 $Output .= '<a href="'.$this->System->Link('/').'">'.T('Go to main page').'</a> '; 60 60 $Output .= ''; 61 return ($Output);61 return $Output; 62 62 } 63 63 … … 73 73 74 74 $Output = ''; 75 if (isset($this->Config))76 { 77 if (!array_key_exists('SystemPassword', $_SESSION)) $_SESSION['SystemPassword'] = '';78 if (array_key_exists('login', $_POST)) $_SESSION['SystemPassword'] = $_POST['SystemPassword'];79 if (sha1($_SESSION['SystemPassword']) != $this->Config['SystemPassword'])75 if (isset($this->Config)) 76 { 77 if (!array_key_exists('SystemPassword', $_SESSION)) $_SESSION['SystemPassword'] = ''; 78 if (array_key_exists('login', $_POST)) $_SESSION['SystemPassword'] = $_POST['SystemPassword']; 79 if (sha1($_SESSION['SystemPassword']) != $this->Config['SystemPassword']) 80 80 { 81 81 $Output .= $this->LoginPanel(); 82 82 } else 83 83 { 84 if (array_key_exists('action', $_GET)) $Action = $_GET['action'];84 if (array_key_exists('action', $_GET)) $Action = $_GET['action']; 85 85 else $Action = ''; 86 if ($Action == 'logout')86 if ($Action == 'logout') 87 87 { 88 88 $_SESSION['SystemPassword'] = ''; … … 90 90 $Output .= $this->LoginPanel(); 91 91 } else 92 if ($Action == 'models')92 if ($Action == 'models') 93 93 { 94 94 $this->System->FormManager->UpdateSQLMeta(); 95 95 } else 96 if ($Action == 'upgrade')96 if ($Action == 'upgrade') 97 97 { 98 98 $Output .= '<h3>Povýšení</h3>'; … … 105 105 $Output .= $this->ControlPanel(); 106 106 } else 107 if ($Action == 'install')107 if ($Action == 'install') 108 108 { 109 109 $Output .= '<h3>Instalace</h3>'; … … 114 114 $Output .= $this->ControlPanel(); 115 115 } else 116 if ($Action == 'uninstall')116 if ($Action == 'uninstall') 117 117 { 118 118 $Output .= '<h3>Odinstalace</h3>'; … … 120 120 $Output .= $this->ControlPanel(); 121 121 } else 122 if ($Action == 'reload_modules')122 if ($Action == 'reload_modules') 123 123 { 124 124 $Output .= '<h3>Znovunačtení seznamu modulů</h3>'; … … 127 127 $Output .= $this->ControlPanel(); 128 128 } else 129 if ($Action == 'insert_sample_data')129 if ($Action == 'insert_sample_data') 130 130 { 131 131 $Output .= '<h3>Vložení vzorových dat</h3>'; … … 133 133 $Output .= $this->ControlPanel(); 134 134 } else 135 if ($Action == 'modules')135 if ($Action == 'modules') 136 136 { 137 137 $Output .= $this->ShowModules(); 138 138 } else 139 if ($Action == 'configure_save')139 if ($Action == 'configure_save') 140 140 { 141 141 $Output .= $this->ConfigSave($this->Config); 142 142 $Output .= $this->ControlPanel(); 143 143 } else 144 if ($Action == 'configure')144 if ($Action == 'configure') 145 145 { 146 146 $Output .= $this->PrepareConfig($this->Config); … … 152 152 } else 153 153 { 154 if (array_key_exists('configure_save', $_POST))154 if (array_key_exists('configure_save', $_POST)) 155 155 { 156 156 $Output .= $this->ConfigSave(array()); … … 160 160 } 161 161 } 162 return ($Output);162 return $Output; 163 163 } 164 164 … … 166 166 { 167 167 $Output = ''; 168 if (array_key_exists('op', $_GET)) $Operation = $_GET['op'];168 if (array_key_exists('op', $_GET)) $Operation = $_GET['op']; 169 169 else $Operation = ''; 170 if ($Operation == 'install')170 if ($Operation == 'install') 171 171 { 172 172 $this->System->ModuleManager->Modules[$_GET['name']]->Install(); … … 174 174 $Output .= 'Modul '.$_GET['name'].' instalován<br/>'; 175 175 } else 176 if ($Operation == 'uninstall')176 if ($Operation == 'uninstall') 177 177 { 178 178 $this->System->ModuleManager->Modules[$_GET['name']]->Uninstall(); … … 180 180 $Output .= 'Modul '.$_GET['name'].' odinstalován<br/>'; 181 181 } else 182 if ($Operation == 'enable')182 if ($Operation == 'enable') 183 183 { 184 184 $this->System->ModuleManager->Modules[$_GET['name']]->Enable(); … … 186 186 $Output .= 'Modul '.$_GET['name'].' povolen<br/>'; 187 187 } else 188 if ($Operation == 'disable')188 if ($Operation == 'disable') 189 189 { 190 190 $this->System->ModuleManager->Modules[$_GET['name']]->Disable(); … … 192 192 $Output .= 'Modul '.$_GET['name'].' zakázán<br/>'; 193 193 } else 194 if ($Operation == 'upgrade')194 if ($Operation == 'upgrade') 195 195 { 196 196 $this->System->ModuleManager->Modules[$_GET['name']]->Upgrade(); … … 200 200 $Output .= '<h3>Správa modulů</h3>'; 201 201 $Output .= $this->ShowList(); 202 return ($Output);202 return $Output; 203 203 } 204 204 … … 221 221 array('Name' => '', 'Title' => 'Akce'), 222 222 )); 223 foreach ($this->System->ModuleManager->Modules as $Module)224 { 225 if (($Module->Dependencies) > 0) $Dependencies = implode(',', $Module->Dependencies);223 foreach ($this->System->ModuleManager->Modules as $Module) 224 { 225 if (($Module->Dependencies) > 0) $Dependencies = implode(',', $Module->Dependencies); 226 226 else $Dependencies = ' '; 227 227 $Actions = ''; 228 if ($Module->Installed == true)228 if ($Module->Installed == true) 229 229 { 230 230 $Actions .= ' <a href="?action=modules&op=uninstall&name='.$Module->Name.'">Odinstalovat</a>'; 231 if ($Module->Enabled == true) $Actions .= ' <a href="?action=modules&op=disable&name='.$Module->Name.'">Zakázat</a>';231 if ($Module->Enabled == true) $Actions .= ' <a href="?action=modules&op=disable&name='.$Module->Name.'">Zakázat</a>'; 232 232 else $Actions .= ' <a href="?action=modules&op=enable&name='.$Module->Name.'">Povolit</a>'; 233 if ($Module->InstalledVersion != $Module->Version) $Actions .= ' <a href="?action=modules&op=upgrade&name='.$Module->Name.'">Povýšit</a>';233 if ($Module->InstalledVersion != $Module->Version) $Actions .= ' <a href="?action=modules&op=upgrade&name='.$Module->Name.'">Povýšit</a>'; 234 234 } else $Actions .= ' <a href="?action=modules&op=install&name='.$Module->Name.'">Instalovat</a>'; 235 235 … … 244 244 $Output .= $Pageing->Show(); 245 245 //$Output .= '<p><a href="?A=SaveToDb">Uložit do databáze</a></p>'; 246 return ($Output);246 return $Output; 247 247 } 248 248 … … 250 250 { 251 251 $Output = ''; 252 if (!file_exists($this->ConfigDir.'/Config.php') and !is_writable($this->ConfigDir))252 if (!file_exists($this->ConfigDir.'/Config.php') and !is_writable($this->ConfigDir)) 253 253 $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože složka "'.$this->ConfigDir.'" není povolená pro zápis!'; 254 if (file_exists($this->ConfigDir.'/Config.php') and !is_writable($this->ConfigDir.'/Config.php'))254 if (file_exists($this->ConfigDir.'/Config.php') and !is_writable($this->ConfigDir.'/Config.php')) 255 255 $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože soubor "'.$this->ConfigDir.'/Config.php" není povolen pro zápis!'; 256 256 $Output .= '<h3>Nastavení systému</h3>'. 257 257 '<form action="?action=configure_save" method="post">'. 258 258 '<table>'; 259 foreach ($this->ConfigDefinition as $Def)259 foreach ($this->ConfigDefinition as $Def) 260 260 { 261 261 $PathParts = explode('/', $Def['Name']); 262 262 $TempConfig = &$Config; 263 foreach ($PathParts as $Part)264 if (array_key_exists($Part, $TempConfig))263 foreach ($PathParts as $Part) 264 if (array_key_exists($Part, $TempConfig)) 265 265 { 266 266 $TempConfig = &$TempConfig[$Part]; 267 267 } 268 if (!is_array($TempConfig)) $Value = $TempConfig;268 if (!is_array($TempConfig)) $Value = $TempConfig; 269 269 else $Value = $Def['Default']; 270 270 $Output .= '<tr><td>'.$Def['Title'].'</td><td>'; 271 if ($Def['Type'] == 'String') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';272 if ($Def['Type'] == 'Password') $Output .= '<input type="password" name="'.$Def['Name'].'"/>';273 if ($Def['Type'] == 'PasswordEncoded') $Output .= '<input type="password" name="'.$Def['Name'].'"/>';274 if ($Def['Type'] == 'Integer') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';275 if ($Def['Type'] == 'Float') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';276 if ($Def['Type'] == 'Boolean') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';277 if ($Def['Type'] == 'Array') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.implode(',', $Value).'"/>';271 if ($Def['Type'] == 'String') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>'; 272 if ($Def['Type'] == 'Password') $Output .= '<input type="password" name="'.$Def['Name'].'"/>'; 273 if ($Def['Type'] == 'PasswordEncoded') $Output .= '<input type="password" name="'.$Def['Name'].'"/>'; 274 if ($Def['Type'] == 'Integer') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>'; 275 if ($Def['Type'] == 'Float') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>'; 276 if ($Def['Type'] == 'Boolean') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>'; 277 if ($Def['Type'] == 'Array') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.implode(',', $Value).'"/>'; 278 278 } 279 279 $Output .= '</td></tr>'. … … 281 281 '</table>'. 282 282 '</form>'; 283 return ($Output);283 return $Output; 284 284 } 285 285 … … 287 287 { 288 288 $Config = $DefaultConfig; 289 foreach ($this->ConfigDefinition as $Def)289 foreach ($this->ConfigDefinition as $Def) 290 290 { 291 291 $Value = null; 292 if ($Def['Type'] == 'String') if(array_key_exists($Def['Name'], $_POST))292 if ($Def['Type'] == 'String') if (array_key_exists($Def['Name'], $_POST)) 293 293 $Value = $_POST[$Def['Name']]; 294 if ($Def['Type'] == 'Password') if(array_key_exists($Def['Name'], $_POST) and ($_POST[$Def['Name']] != ''))294 if ($Def['Type'] == 'Password') if (array_key_exists($Def['Name'], $_POST) and ($_POST[$Def['Name']] != '')) 295 295 $Value = $_POST[$Def['Name']]; 296 if ($Def['Type'] == 'PasswordEncoded') if(array_key_exists($Def['Name'], $_POST) and ($_POST[$Def['Name']] != ''))296 if ($Def['Type'] == 'PasswordEncoded') if (array_key_exists($Def['Name'], $_POST) and ($_POST[$Def['Name']] != '')) 297 297 $Value = sha1($_POST[$Def['Name']]); 298 if ($Def['Type'] == 'Integer') if(array_key_exists($Def['Name'], $_POST))298 if ($Def['Type'] == 'Integer') if (array_key_exists($Def['Name'], $_POST)) 299 299 $Value = $_POST[$Def['Name']]; 300 if ($Def['Type'] == 'Float') if(array_key_exists($Def['Name'], $_POST))300 if ($Def['Type'] == 'Float') if (array_key_exists($Def['Name'], $_POST)) 301 301 $Value = $_POST[$Def['Name']]; 302 if ($Def['Type'] == 'Boolean') if(array_key_exists($Def['Name'], $_POST))302 if ($Def['Type'] == 'Boolean') if (array_key_exists($Def['Name'], $_POST)) 303 303 $Value = $_POST[$Def['Name']]; 304 if ($Def['Type'] == 'Array') if(array_key_exists($Def['Name'], $_POST))304 if ($Def['Type'] == 'Array') if (array_key_exists($Def['Name'], $_POST)) 305 305 $Value = explode(',', $_POST[$Def['Name']]); 306 if (!is_null($Value))306 if (!is_null($Value)) 307 307 { 308 308 $PathParts = explode('/', $Def['Name']); 309 309 $TempConfig = &$Config; 310 foreach ($PathParts as $Part)310 foreach ($PathParts as $Part) 311 311 { 312 312 $TempConfig = &$TempConfig[$Part]; 313 313 } 314 if (!is_array($TempConfig)) $TempConfig = $Value;314 if (!is_array($TempConfig)) $TempConfig = $Value; 315 315 else $Value = $Def['Default']; 316 316 } … … 319 319 file_put_contents($this->ConfigDir.'/Config.php', $ConfigText); 320 320 $Output = 'Konfigurace nastavena<br/>'; 321 return ($Output);321 return $Output; 322 322 } 323 323 … … 327 327 "\$IsDeveloper = array_key_exists('REMOTE_ADDR', \$_SERVER) and in_array(\$_SERVER['REMOTE_ADDR'], array('127.0.0.1'));\n\n"; 328 328 329 foreach ($this->ConfigDefinition as $Def)329 foreach ($this->ConfigDefinition as $Def) 330 330 { 331 331 $PathParts = explode('/', $Def['Name']); 332 332 $Output .= "\$Config"; 333 foreach ($PathParts as $Part)333 foreach ($PathParts as $Part) 334 334 $Output .= "['".$Part."']"; 335 335 $TempConfig = &$Config; 336 336 $Output .= ' = '; 337 foreach ($PathParts as $Part)338 if (array_key_exists($Part, $TempConfig))337 foreach ($PathParts as $Part) 338 if (array_key_exists($Part, $TempConfig)) 339 339 { 340 340 $TempConfig = &$TempConfig[$Part]; 341 341 } 342 if (!is_array($TempConfig)) $Value = $TempConfig;342 if (!is_array($TempConfig)) $Value = $TempConfig; 343 343 else $Value = $Def['Default']; 344 if ($Def['Type'] == 'Array')344 if ($Def['Type'] == 'Array') 345 345 { 346 346 $Output .= ' array('; 347 foreach ($Value as $Index => $Item)347 foreach ($Value as $Index => $Item) 348 348 $Output .= '\''.$Item.'\', '; 349 349 $Output .= ')'; … … 353 353 } 354 354 $Output .= "\n\n"; 355 return ($Output);355 return $Output; 356 356 } 357 357 } … … 362 362 { 363 363 $Output = ''; 364 if (!$this->Database->Connected()) $Output .= T('Can\'t connect to database').'<br>';364 if (!$this->Database->Connected()) $Output .= T('Can\'t connect to database').'<br>'; 365 365 else { 366 if (!$this->System->Setup->UpdateManager->IsInstalled())366 if (!$this->System->Setup->UpdateManager->IsInstalled()) 367 367 $Output .= T('System requires database initialization').'<br>'; 368 368 else 369 if (!$this->System->Setup->UpdateManager->IsUpToDate())369 if (!$this->System->Setup->UpdateManager->IsUpToDate()) 370 370 $Output .= T('System requires database upgrade').'<br>'; 371 371 } 372 372 $Output .= sprintf(T('Front page was not configured. Continue to %s'), '<a href="'.$this->System->Link('/setup/').'">'.T('setup').'</a>'); 373 return ($Output);373 return $Output; 374 374 } 375 375 } … … 402 402 function CheckState() 403 403 { 404 return($this->Database->Connected() and $this->UpdateManager->IsInstalled() and405 $this->UpdateManager->IsUpToDate() );404 $this->Database->Connected() and $this->UpdateManager->IsInstalled() and 405 $this->UpdateManager->IsUpToDate(); 406 406 } 407 407 … … 435 435 { 436 436 $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->UpdateManager->VersionTable.'"'); 437 return ($DbResult->num_rows > 0);437 return $DbResult->num_rows > 0; 438 438 } 439 439 … … 443 443 $this->UpdateManager->Trace = $Updates->Get(); 444 444 $Output = $this->UpdateManager->Upgrade(); 445 return ($Output);445 return $Output; 446 446 } 447 447 } -
trunk/Packages/Common/Table.php
r37 r55 7 7 function Show() 8 8 { 9 return ('');9 return ''; 10 10 } 11 11 } … … 15 15 function GetCell($Y, $X) 16 16 { 17 return ('');17 return ''; 18 18 } 19 19 … … 28 28 function RowsCount() 29 29 { 30 return (0);30 return 0; 31 31 } 32 32 } … … 38 38 function GetCell($Y, $X) 39 39 { 40 return ($this->Cells[$Y][$X]);40 return $this->Cells[$Y][$X]; 41 41 } 42 42 43 43 function RowsCount() 44 44 { 45 return (count($this->Cells));45 return count($this->Cells); 46 46 } 47 47 } … … 55 55 function GetCell($Y, $X) 56 56 { 57 return ($this->Cells[$Y][$X]);57 return $this->Cells[$Y][$X]; 58 58 } 59 59 … … 62 62 $this->Cells = array(); 63 63 $DbResult = $this->Database->query($this->Query); 64 while ($DbRow = $DbResult->fetch_row())64 while ($DbRow = $DbResult->fetch_row()) 65 65 { 66 66 $this->Cells[] = $DbRow; … … 75 75 function RowsCount() 76 76 { 77 return (count($this->Cells));77 return count($this->Cells); 78 78 } 79 79 } … … 114 114 { 115 115 $this->Columns = array(); 116 foreach ($Columns as $Column)116 foreach ($Columns as $Column) 117 117 { 118 118 $NewCol = new TableColumn(); … … 121 121 $this->Columns[] = $NewCol; 122 122 } 123 if (count($this->Columns) > 0)123 if (count($this->Columns) > 0) 124 124 $this->DefaultColumn = $this->Columns[0]->Name; 125 125 else $this->DefaultColumn = ''; … … 131 131 $Output .= $this->GetOrderHeader(); 132 132 $this->Table->BeginRead(); 133 for ($Y = 0; $Y < $this->Table->RowsCount(); $Y++)133 for ($Y = 0; $Y < $this->Table->RowsCount(); $Y++) 134 134 { 135 135 $Output .= '<tr>'; 136 136 137 for ($X = 0; $X < count($this->Columns); $X++)137 for ($X = 0; $X < count($this->Columns); $X++) 138 138 { 139 139 $Cell = $this->Table->GetCell($Y, $X); 140 if ($Cell == '') $Output .= '<td> </td>';140 if ($Cell == '') $Output .= '<td> </td>'; 141 141 else $Output .= '<td>'.$Cell.'</td>'; 142 142 } … … 145 145 $this->Table->EndRead(); 146 146 $Output .= '</table>'; 147 return ($Output);147 return $Output; 148 148 } 149 149 150 150 function GetOrderHeader() 151 151 { 152 if (array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol'];153 if (array_key_exists('OrderDir', $_GET)) $_SESSION['OrderDir'] = $_GET['OrderDir'];154 if (!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $this->DefaultColumn;155 if (!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $this->DefaultOrder;152 if (array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol']; 153 if (array_key_exists('OrderDir', $_GET)) $_SESSION['OrderDir'] = $_GET['OrderDir']; 154 if (!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $this->DefaultColumn; 155 if (!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $this->DefaultOrder; 156 156 157 157 // Check OrderCol 158 158 $Found = false; 159 foreach ($this->Columns as $Column)159 foreach ($this->Columns as $Column) 160 160 { 161 if ($Column->Name == $_SESSION['OrderCol'])161 if ($Column->Name == $_SESSION['OrderCol']) 162 162 { 163 163 $Found = true; … … 165 165 } 166 166 } 167 if ($Found == false)167 if ($Found == false) 168 168 { 169 169 $_SESSION['OrderCol'] = $this->DefaultColumn; … … 171 171 } 172 172 // Check OrderDir 173 if (($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1))173 if (($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1)) 174 174 $_SESSION['OrderDir'] = 0; 175 175 176 176 $Result = ''; 177 177 $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']); 178 foreach ($this->Columns as $Index => $Column)178 foreach ($this->Columns as $Index => $Column) 179 179 { 180 180 $QueryItems['OrderCol'] = $Column->Name; 181 181 $QueryItems['OrderDir'] = 1 - $_SESSION['OrderDir']; 182 if ($Column->Name == $_SESSION['OrderCol'])182 if ($Column->Name == $_SESSION['OrderCol']) 183 183 $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.$this->OrderArrowImage[$_SESSION['OrderDir']].'" alt="order arrow">'; 184 184 else $ArrowImage = ''; 185 if ($Column->Name == '') $Result .= '<th>'.$Column->Title.'</th>';185 if ($Column->Name == '') $Result .= '<th>'.$Column->Title.'</th>'; 186 186 else $Result .= '<th><a href="?'.SetQueryStringArray($QueryItems).'">'.$Column->Title.$ArrowImage.'</a></th>'; 187 187 } … … 190 190 $this->OrderDirection = $_SESSION['OrderDir']; 191 191 192 return ('<tr>'.$Result.'</tr>');192 return '<tr>'.$Result.'</tr>'; 193 193 } 194 194 } -
trunk/Packages/Common/UTF8.php
r37 r55 529 529 { 530 530 $Result = ''; 531 for ($I = 0; $I < strlen($String); $I++)531 for ($I = 0; $I < strlen($String); $I++) 532 532 { 533 if (ord($String[$I]) < 128) $Result .= $String[$I];534 else if (ord($String[$I]) > 127)533 if (ord($String[$I]) < 128) $Result .= $String[$I]; 534 else if (ord($String[$I]) > 127) 535 535 { 536 536 $Result .= $this->CharTable[$Charset][ord($String[$I])]; 537 537 } 538 538 } 539 return ($Result);539 return $Result; 540 540 } 541 541 … … 544 544 $Result = ''; 545 545 $UTFPrefix = ''; 546 for ($I = 0; $I < strlen($String); $I++)546 for ($I = 0; $I < strlen($String); $I++) 547 547 { 548 if (ord($String{$I}) & 0x80) // UTF control character548 if (ord($String{$I}) & 0x80) // UTF control character 549 549 { 550 if (ord($String{$I}) & 0x40) // First550 if (ord($String{$I}) & 0x40) // First 551 551 { 552 if ($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset]));552 if ($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset])); 553 553 $UTFPrefix = $String{$I}; 554 554 } … … 556 556 } else 557 557 { 558 if ($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset]));558 if ($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset])); 559 559 $UTFPrefix = ''; 560 560 $Result .= $String{$I}; 561 561 } 562 562 } 563 return ($Result);563 return $Result; 564 564 } 565 565 } -
trunk/Packages/Common/Update.php
r37 r55 23 23 $DbResult = $this->Database->select($this->VersionTable, '*', 'Id=1'); 24 24 $Version = $DbResult->fetch_assoc(); 25 return ($Version['Revision']);25 return $Version['Revision']; 26 26 } 27 27 … … 29 29 { 30 30 $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"'); 31 return ($DbResult->num_rows > 0);31 return $DbResult->num_rows > 0; 32 32 } 33 33 34 34 function IsUpToDate() 35 35 { 36 return ($this->Revision <= $this->GetDbVersion());36 return $this->Revision <= $this->GetDbVersion(); 37 37 } 38 38 … … 41 41 $DbRevision = $this->GetDbVersion(); 42 42 $Output = 'Počáteční revize databáze: '.$DbRevision.'<br/>'; 43 while ($this->Revision > $DbRevision)43 while ($this->Revision > $DbRevision) 44 44 { 45 45 $TraceItem = $this->Trace[$DbRevision]; … … 54 54 $TraceItem['Revision'].' WHERE `Id`=1'); 55 55 } 56 return ($Output);56 return $Output; 57 57 } 58 58 … … 79 79 echo($Query.';<br/>'); 80 80 flush(); 81 return ($this->Database->query($Query));81 return $this->Database->query($Query); 82 82 } 83 83 } -
trunk/Packages/Common/VarDumper.php
r37 r55 49 49 self::$_depth=$depth; 50 50 self::dumpInternal($var,0); 51 if ($highlight)51 if ($highlight) 52 52 { 53 53 $result=highlight_string("<?php\n".self::$_output,true); … … 60 60 private static function dumpInternal($var,$level) 61 61 { 62 switch (gettype($var))62 switch (gettype($var)) 63 63 { 64 64 case 'boolean': … … 84 84 break; 85 85 case 'array': 86 if (self::$_depth<=$level)86 if (self::$_depth<=$level) 87 87 self::$_output.='array(...)'; 88 else if (empty($var))88 else if (empty($var)) 89 89 self::$_output.='array()'; 90 90 else … … 93 93 $spaces=str_repeat(' ',$level*4); 94 94 self::$_output.="array\n".$spaces.'('; 95 foreach ($keys as $key)95 foreach ($keys as $key) 96 96 { 97 97 self::$_output.="\n".$spaces." [$key] => "; … … 102 102 break; 103 103 case 'object': 104 if (($id=array_search($var,self::$_objects,true))!==false)104 if (($id=array_search($var,self::$_objects,true))!==false) 105 105 self::$_output.=get_class($var).'#'.($id+1).'(...)'; 106 else if (self::$_depth<=$level)106 else if (self::$_depth<=$level) 107 107 self::$_output.=get_class($var).'(...)'; 108 108 else … … 114 114 $spaces=str_repeat(' ',$level*4); 115 115 self::$_output.="$className#$id\n".$spaces.'('; 116 foreach ($keys as $key)116 foreach ($keys as $key) 117 117 { 118 118 $keyDisplay=strtr(trim($key),array("\0"=>':')); -
trunk/View.php
r39 r55 27 27 28 28 // TODO: Move to external code 29 if (isset($this->System->Config['Web']['FormatHTML']))29 if (isset($this->System->Config['Web']['FormatHTML'])) 30 30 $this->FormatHTML = $this->System->Config['Web']['FormatHTML']; 31 if (isset($this->System->Config['Web']['ShowRuntimeInfo']))31 if (isset($this->System->Config['Web']['ShowRuntimeInfo'])) 32 32 $this->ShowRuntimeInfo = $this->System->Config['Web']['ShowRuntimeInfo']; 33 if (isset($this->System->Config['Web']['Charset']))33 if (isset($this->System->Config['Web']['Charset'])) 34 34 $this->Encoding = $this->System->Config['Web']['Charset']; 35 if (isset($this->System->Config['Web']['Style']))35 if (isset($this->System->Config['Web']['Style'])) 36 36 $this->Style = $this->System->Config['Web']['Style']; 37 37 } … … 39 39 function SystemMessage($Title, $Text) 40 40 { 41 return ('<table align="center"><tr><td><div class="SystemMessage"><h3>'.$Title.'</h3><div>'.$Text.'</div></div></td></tr></table>');41 return '<table align="center"><tr><td><div class="SystemMessage"><h3>'.$Title.'</h3><div>'.$Text.'</div></div></td></tr></table>'; 42 42 //ShowFooter(); 43 43 //die(); … … 46 46 function ShowNavigation($Page) 47 47 { 48 if (array_key_exists('REQUEST_URI', $_SERVER))48 if (array_key_exists('REQUEST_URI', $_SERVER)) 49 49 $ScriptName = $_SERVER['REQUEST_URI']; 50 50 else $ScriptName = ''; 51 while (strpos($ScriptName, '//') !== false)51 while (strpos($ScriptName, '//') !== false) 52 52 $ScriptName = str_replace('//', '/', $ScriptName); 53 if (strpos($ScriptName, '?') !== false)53 if (strpos($ScriptName, '?') !== false) 54 54 $ScriptName = substr($ScriptName, 0, strrpos($ScriptName, '?')); 55 55 $ScriptName = substr($ScriptName, strlen($this->System->Link(''))); 56 if (substr($ScriptName, -1, 1) == '/') $ScriptName = substr($ScriptName, 0, -1);56 if (substr($ScriptName, -1, 1) == '/') $ScriptName = substr($ScriptName, 0, -1); 57 57 58 58 $Output = ''; 59 while ($Page)59 while ($Page) 60 60 { 61 61 $Output = ' > <a href="'.$this->System->Link($ScriptName).'/">'.$Page->ShortTitle.'</a>'.$Output; 62 62 63 if (class_exists($Page->ParentClass))63 if (class_exists($Page->ParentClass)) 64 64 { 65 65 $PageClass = $Page->ParentClass; … … 69 69 } 70 70 $Output = substr($Output, 6); 71 return ($Output);71 return $Output; 72 72 } 73 73 … … 80 80 81 81 $BodyParam = ''; 82 if (isset($Page->Load)) $BodyParam .= ' onload="'.$Page->Load.'"';83 if (isset($Page->Unload)) $BodyParam .= ' onunload="'.$Page->Unload.'"';82 if (isset($Page->Load)) $BodyParam .= ' onload="'.$Page->Load.'"'; 83 if (isset($Page->Unload)) $BodyParam .= ' onunload="'.$Page->Unload.'"'; 84 84 $Output = '<?xml version="1.0" encoding="'.$this->Encoding.'"?>'."\n". 85 85 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'. … … 96 96 // Show page headers 97 97 $Bar = ''; 98 foreach ($this->System->PageHeaders as $Item)98 foreach ($this->System->PageHeaders as $Item) 99 99 $Output .= call_user_func($Item); 100 100 101 101 $Output .= '</head><body'.$BodyParam.'>'; 102 102 $Output .= $this->System->ShowMenu(); 103 if ($this->BasicHTML == false)103 if ($this->BasicHTML == false) 104 104 { 105 105 //$Output .= '<div class="MainTitle">'.$Title.'</div>'; … … 107 107 $Output .= '<div class="MainTitle"><span class="MenuItem"><strong>Navigace :: </strong> '.$Navigation.'</span><div class="MenuItem2">'; 108 108 $Bar = ''; 109 foreach ($this->System->Bars['Top'] as $BarItem)109 foreach ($this->System->Bars['Top'] as $BarItem) 110 110 $Bar .= call_user_func($BarItem); 111 if (trim($Bar) != '') $Output .= $Bar;111 if (trim($Bar) != '') $Output .= $Bar; 112 112 else $Output .= ' '; 113 113 $Output .= '</div></div>'; 114 114 } 115 return ($Output);115 return $Output; 116 116 } 117 117 … … 122 122 $Time = round(GetMicrotime() - $ScriptTimeStart, 2); 123 123 $Output = ''; 124 if ($this->BasicHTML == false)124 if ($this->BasicHTML == false) 125 125 { 126 126 $Output .= '<div class="Footer">'. … … 129 129 $Output .= ' <a href="https://app.zdechov.net/tanec/">Zdrojový kód</a> '; 130 130 //$Output .= ' Verze: '.$Revision.' ('.HumanDate($ReleaseTime).') '; 131 if ($this->ShowRuntimeInfo == true)131 if ($this->ShowRuntimeInfo == true) 132 132 { 133 133 $Output .= ' Doba generování: '.$Time.' s / '.ini_get('max_execution_time').' s '. … … 137 137 } 138 138 $Output .= '</body></html>'; 139 return ($Output);139 return $Output; 140 140 } 141 141 … … 145 145 146 146 $Output = $Page->Show(); 147 if ($Page->ClearPage == false)147 if ($Page->ClearPage == false) 148 148 { 149 149 $Output = $this->ShowHeader($Page).$Output.$this->ShowFooter(); 150 if ($this->FormatHTML == true) $Output = $this->FormatOutput($Output);151 } 152 return ($Output);150 if ($this->FormatHTML == true) $Output = $this->FormatOutput($Output); 151 } 152 return $Output; 153 153 } 154 154 … … 159 159 $Page->Database = $this->Database; 160 160 $Page->FormatHTML = $this->FormatHTML; 161 return ($Page);161 return $Page; 162 162 } 163 163 … … 168 168 $nn = 0; 169 169 $n = 0; 170 while ($s != '')170 while ($s != '') 171 171 { 172 172 $start = strpos($s, '<'); 173 173 $end = strpos($s, '>'); 174 if ($start != 0)174 if ($start != 0) 175 175 { 176 176 $end = $start - 1; … … 178 178 } 179 179 $line = trim(substr($s, $start, $end + 1)); 180 if (strlen($line) > 0)181 if ($line[0] == '<')182 { 183 if ($s[$start + 1] == '/')180 if (strlen($line) > 0) 181 if ($line[0] == '<') 182 { 183 if ($s[$start + 1] == '/') 184 184 { 185 185 $n = $n - 2; … … 187 187 } else 188 188 { 189 if (strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);189 if (strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1); 190 190 else $cmd = substr($line, 1, strlen($line) - 2); 191 191 //echo('['.$cmd.']'); 192 if (strpos($s, '</'.$cmd.'>')) $n = $n + 2;192 if (strpos($s, '</'.$cmd.'>')) $n = $n + 2; 193 193 } 194 194 }// else $line = '['.$line.']'; 195 //if ($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));196 if ($line != '') $out .= (str_repeat(' ', $nn).$line."\n");195 //if ($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n")); 196 if ($line != '') $out .= (str_repeat(' ', $nn).$line."\n"); 197 197 $s = substr($s, $end + 1, strlen($s)); 198 198 $nn = $n; 199 199 } 200 return ($out);200 return $out; 201 201 } 202 202 } -
trunk/index.php
r54 r55 16 16 require_once('Modules/Event/EventPage.php'); 17 17 18 if (isset($_SERVER['REMOTE_ADDR'])) session_start();18 if (isset($_SERVER['REMOTE_ADDR'])) session_start(); 19 19 20 20 class ApplicationTanec extends Application … … 40 40 function IsAdmin() 41 41 { 42 return (array_key_exists('IsAdmin', $_SESSION) and ($_SESSION['IsAdmin'] == 1));42 return array_key_exists('IsAdmin', $_SESSION) and ($_SESSION['IsAdmin'] == 1); 43 43 } 44 44 45 45 function Link($URL) 46 46 { 47 return ($this->Config['BaseURL'].$URL);47 return $this->Config['BaseURL'].$URL; 48 48 } 49 49 50 50 function AbsoluteLink($URL) 51 51 { 52 return ($this->Config['HostName'].$this->Config['BaseURL'].$URL);52 return $this->Config['HostName'].$this->Config['BaseURL'].$URL; 53 53 } 54 54 … … 56 56 { 57 57 $Output = '<div>'; 58 foreach ($this->MainMenu as $MenuItem)58 foreach ($this->MainMenu as $MenuItem) 59 59 { 60 60 $Output .= '<a href="'.$this->Link($MenuItem['Link']).'">'.$MenuItem['Title'].'</a> '; 61 61 } 62 62 $Output .= '</div>'; 63 return ($Output);63 return $Output; 64 64 } 65 65 66 66 function ProcessURL() 67 67 { 68 if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))68 if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER)) 69 69 $PathString = $_SERVER['REDIRECT_QUERY_STRING']; 70 70 else $PathString = ''; 71 if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);71 if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1); 72 72 $PathItems = explode('/', $PathString); 73 if (array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false))73 if (array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false)) 74 74 $_SERVER['QUERY_STRING'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1); 75 75 else $_SERVER['QUERY_STRING'] = ''; 76 76 parse_str($_SERVER['QUERY_STRING'], $_GET); 77 return ($PathItems);77 return $PathItems; 78 78 } 79 79 80 80 function RegisterPage($Path, $Handler) 81 81 { 82 if (is_array($Path))82 if (is_array($Path)) 83 83 { 84 84 $Page = &$this->Pages; 85 85 $LastKey = array_pop($Path); 86 foreach ($Path as $PathItem)86 foreach ($Path as $PathItem) 87 87 { 88 88 $Page = &$Page[$PathItem]; 89 89 } 90 if (!is_array($Page)) $Page = array('' => $Page);90 if (!is_array($Page)) $Page = array('' => $Page); 91 91 $Page[$LastKey] = $Handler; 92 92 } else $this->Pages[$Path] = $Handler; … … 115 115 function SearchPage($PathItems, $Pages) 116 116 { 117 if (count($PathItems) > 0) $PathItem = $PathItems[0];117 if (count($PathItems) > 0) $PathItem = $PathItems[0]; 118 118 else $PathItem = ''; 119 if (array_key_exists($PathItem, $Pages))120 { 121 if (is_array($Pages[$PathItem]))119 if (array_key_exists($PathItem, $Pages)) 120 { 121 if (is_array($Pages[$PathItem])) 122 122 { 123 123 array_shift($PathItems); 124 return ($this->SearchPage($PathItems, $Pages[$PathItem]));125 } else return ($Pages[$PathItem]);126 } else return ('');124 return $this->SearchPage($PathItems, $Pages[$PathItem]); 125 } else return $Pages[$PathItem]; 126 } else return ''; 127 127 } 128 128 129 129 function PageNotFound() 130 130 { 131 return ('Page '.implode('/', $this->PathItems).' not found.');131 return 'Page '.implode('/', $this->PathItems).' not found.'; 132 132 } 133 133 … … 138 138 /* @var $Page Page */ 139 139 $ClassName = $this->SearchPage($this->PathItems, $this->Pages); 140 if ($ClassName != '')140 if ($ClassName != '') 141 141 { 142 142 $Page = new $ClassName($this); … … 150 150 { 151 151 $this->RunCommon(); 152 if ($this->ShowPage)152 if ($this->ShowPage) 153 153 { 154 154 $this->PathItems = ProcessURL(); … … 191 191 { 192 192 Header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); 193 return ('<h3 align="center">Požadovaná stránka neexistuje.</h3>');193 return '<h3 align="center">Požadovaná stránka neexistuje.</h3>'; 194 194 } 195 195 } … … 208 208 'Disallow: /*?'."\n". 209 209 'Sitemap: '.$this->System->AbsoluteLink('/sitemap.xml'); 210 return ($Result);210 return $Result; 211 211 } 212 212 } … … 259 259 260 260 $Result .= '</urlset>'; 261 return ($Result);261 return $Result; 262 262 } 263 263 }
Note:
See TracChangeset
for help on using the changeset viewer.