Changeset 7 for trunk/Global.php
- Timestamp:
- Apr 14, 2020, 11:13:32 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Global.php
r1 r7 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 … … 9 9 { 10 10 list($Usec, $Sec) = explode(" ", microtime()); 11 return ( (float)$Usec + (float)$Sec);11 return (float)$Usec + (float)$Sec; 12 12 } 13 13 14 14 function MakeLink($Target, $Title) 15 15 { 16 return ('<a href="'.$Target.'">'.$Title.'</a>');16 return '<a href="'.$Target.'">'.$Title.'</a>'; 17 17 } 18 18 … … 21 21 $Result = '<table cellspacing="0" class="BasicTable">'; 22 22 $Result .= '<tr>'; 23 foreach ($Table['Header'] as $Item)23 foreach ($Table['Header'] as $Item) 24 24 $Result .= '<th>'.$Item.'</th>'; 25 25 $Result .= '</tr>'; 26 foreach ($Table['Rows'] as $Row)26 foreach ($Table['Rows'] as $Row) 27 27 { 28 28 $Result .= '<tr>'; 29 foreach ($Row as $Item)29 foreach ($Row as $Item) 30 30 $Result .= '<td>'.$Item.'</td>'; 31 31 $Result .= '</tr>'; 32 32 } 33 33 $Result .= '</table>'; 34 return ($Result);34 return $Result; 35 35 } 36 36 … … 44 44 ); 45 45 46 foreach ($Class as $Index => $Item)46 foreach ($Class as $Index => $Item) 47 47 { 48 if (!array_key_exists($Index, $Values)) $Values[$Index] = $Item['Default'];49 switch ($Item['Type'])48 if (!array_key_exists($Index, $Values)) $Values[$Index] = $Item['Default']; 49 switch ($Item['Type']) 50 50 { 51 51 case 'Boolean': 52 if ($Values[$Index] == 0) $Checked = ''; else $Checked = ' checked="yes"';52 if ($Values[$Index] == 0) $Checked = ''; else $Checked = ' checked="yes"'; 53 53 $Edit = '<input type="checkbox" name="'.$Index.'"'.$Checked.'>'; 54 54 break; … … 65 65 } 66 66 $Output = '<h3>Tabulka '.$ClassName.'</h3>'.Table($Table).MakeLink('?Operation=Add2', 'Přidat'); 67 return ($Output);67 return $Output; 68 68 } 69 69 70 70 function ProcessURL() 71 71 { 72 if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))72 if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER)) 73 73 $PathString = $_SERVER['REDIRECT_QUERY_STRING']; 74 74 else $PathString = ''; 75 if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);75 if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1); 76 76 $PathItems = explode('/', $PathString); 77 if (array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false))77 if (array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false)) 78 78 $_SERVER['QUERY_STRING'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1); 79 79 else $_SERVER['QUERY_STRING'] = ''; 80 80 parse_str($_SERVER['QUERY_STRING'], $_GET); 81 return ($PathItems);81 return $PathItems; 82 82 } 83 83 … … 86 86 $Result = array(); 87 87 $Parts = explode('&', $QueryString); 88 foreach ($Parts as $Part)88 foreach ($Parts as $Part) 89 89 { 90 if ($Part != '')90 if ($Part != '') 91 91 { 92 if (!strpos($Part, '=')) $Part .= '=';92 if (!strpos($Part, '=')) $Part .= '='; 93 93 $Item = explode('=', $Part); 94 94 $Result[$Item[0]] = $Item[1]; 95 95 } 96 96 } 97 return ($Result);97 return $Result; 98 98 } 99 99 … … 101 101 { 102 102 $Parts = array(); 103 foreach ($QueryStringArray as $Index => $Item)103 foreach ($QueryStringArray as $Index => $Item) 104 104 { 105 105 $Parts[] = $Index.'='.$Item; 106 106 } 107 return (implode('&', $Parts));107 return implode('&', $Parts); 108 108 } 109 109 110 110 function GetRemoteAddress() 111 111 { 112 if (array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR'];112 if (array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR']; 113 113 else $IP = '0.0.0.0'; 114 return ($IP);114 return $IP; 115 115 }
Note:
See TracChangeset
for help on using the changeset viewer.