Changeset 874 for trunk/Packages/Common
- Timestamp:
- Apr 6, 2020, 11:56:19 PM (5 years ago)
- Location:
- trunk/Packages/Common
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/AppModule.php
r873 r874 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 … … 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 -
trunk/Packages/Common/Common.php
r873 r874 125 125 $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage; 126 126 $this->Page = $CurrentPage; 127 return ($Result);127 return $Result; 128 128 } 129 129 } -
trunk/Packages/Common/Config.php
r873 r874 19 19 $Data = &$Data[$Item]; 20 20 } 21 return ($Data[$Last]);21 return $Data[$Last]; 22 22 } 23 23 … … 52 52 function GetAsArray() 53 53 { 54 return ($this->Data);54 return $this->Data; 55 55 } 56 56 } -
trunk/Packages/Common/Database.php
r873 r874 7 7 { 8 8 list($usec, $sec) = explode(" ", microtime()); 9 return ( (float)$usec + (float)$sec);9 return (float)$usec + (float)$sec; 10 10 } 11 11 … … 17 17 function fetch_assoc() 18 18 { 19 return ($this->PDOStatement->fetch(PDO::FETCH_ASSOC));19 return $this->PDOStatement->fetch(PDO::FETCH_ASSOC); 20 20 } 21 21 22 22 function fetch_array() 23 23 { 24 return ($this->PDOStatement->fetch(PDO::FETCH_BOTH));24 return $this->PDOStatement->fetch(PDO::FETCH_BOTH); 25 25 } 26 26 27 27 function fetch_row() 28 28 { 29 return ($this->PDOStatement->fetch(PDO::FETCH_NUM));29 return $this->PDOStatement->fetch(PDO::FETCH_NUM); 30 30 } 31 31 } … … 81 81 function Connected() 82 82 { 83 return (isset($this->PDO));83 return isset($this->PDO); 84 84 } 85 85 … … 119 119 throw new Exception('SQL Error: '.$this->Error.', Query: '.$Query); 120 120 } 121 return ($Result);121 return $Result; 122 122 } 123 123 124 124 function select($Table, $What = '*', $Condition = 1) 125 125 { 126 return ($this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition));126 return $this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition); 127 127 } 128 128 … … 154 154 $Name = substr($Name, 1); 155 155 $Values = substr($Values, 1); 156 return ('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')');156 return 'INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')'; 157 157 } 158 158 … … 175 175 } 176 176 $Values = substr($Values, 2); 177 return ('UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')');177 return 'UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')'; 178 178 } 179 179 … … 206 206 function real_escape_string($Text) 207 207 { 208 return (addslashes($Text));208 return addslashes($Text); 209 209 } 210 210 211 211 function quote($Text) 212 212 { 213 return ($this->PDO->quote($Text));213 return $this->PDO->quote($Text); 214 214 } 215 215 … … 239 239 function TimeToMysqlDateTime($Time) 240 240 { 241 if ($Time == NULL) return (NULL);242 else return (date('Y-m-d H:i:s', $Time));241 if ($Time == NULL) return NULL; 242 else return date('Y-m-d H:i:s', $Time); 243 243 } 244 244 245 245 function TimeToMysqlDate($Time) 246 246 { 247 if ($Time == NULL) return (NULL);248 else return (date('Y-m-d', $Time));247 if ($Time == NULL) return NULL; 248 else return date('Y-m-d', $Time); 249 249 } 250 250 251 251 function TimeToMysqlTime($Time) 252 252 { 253 if ($Time == NULL) return (NULL);254 else return (date('H:i:s', $Time));253 if ($Time == NULL) return NULL; 254 else return date('H:i:s', $Time); 255 255 } 256 256 257 257 function MysqlDateTimeToTime($DateTime) 258 258 { 259 if ($DateTime == '') return (NULL);259 if ($DateTime == '') return NULL; 260 260 $Parts = explode(' ', $DateTime); 261 261 $DateParts = explode('-', $Parts[0]); 262 262 $TimeParts = explode(':', $Parts[1]); 263 263 $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]); 264 return ($Result);264 return $Result; 265 265 } 266 266 267 267 function MysqlDateToTime($Date) 268 268 { 269 if ($Date == '') return (NULL);270 return (MysqlDateTimeToTime($Date.' 0:0:0'));269 if ($Date == '') return NULL; 270 return MysqlDateTimeToTime($Date.' 0:0:0'); 271 271 } 272 272 273 273 function MysqlTimeToTime($Time) 274 274 { 275 if ($Time == '') return (NULL);276 return (MysqlDateTimeToTime('0000-00-00 '.$Time));277 } 275 if ($Time == '') return NULL; 276 return MysqlDateTimeToTime('0000-00-00 '.$Time); 277 } -
trunk/Packages/Common/Image.php
r873 r874 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
r873 r874 21 21 { 22 22 if (array_key_exists($Text, $this->Data[$Group]) and ($this->Data[$Group][$Text] != '')) 23 return ($this->Data[$Group][$Text]);24 else return ($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 } … … 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
r873 r874 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 … … 146 146 147 147 $res = mail($To, $this->Subject, $Body, $Headers); 148 return ($res);148 return $res; 149 149 } 150 150 … … 153 153 if (ereg(".*<(.+)>", $Address, $regs)) $Address = $regs[1]; 154 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);155 return true; 156 else return false; 157 157 } 158 158 … … 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 … … 203 203 } 204 204 } else $Result = $Body; 205 return ($Result);205 return $Result; 206 206 } 207 207 … … 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
r873 r874 16 16 function GetNetMask() 17 17 { 18 return (( (1 << IPV4_BIT_WIDTH) - 1) ^ ((1 << (IPV4_BIT_WIDTH - $this->Prefix)) - 1));18 return ((1 << IPV4_BIT_WIDTH) - 1) ^ ((1 << (IPV4_BIT_WIDTH - $this->Prefix)) - 1); 19 19 } 20 20 21 21 function AddressToString() 22 22 { 23 return (implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255))));23 return implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255))); 24 24 } 25 25 … … 39 39 $To->Address = $From->Address + $HostMask; 40 40 $To->Prefix = IPV4_BIT_WIDTH; 41 return (array('From' => $From, 'To' => $To));41 return array('From' => $From, 'To' => $To); 42 42 } 43 43 … … 55 55 if (($this->Prefix < $Address->Prefix) and (($Address->Address & $UpperNetmask) == ($this->Address & $UpperNetmask))) $Result = true; 56 56 else $Result = false; 57 return ($Result);57 return $Result; 58 58 } 59 59 } … … 74 74 function GetNetMask() 75 75 { 76 return (Int128Xor(Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH)), IntToInt128(1)),77 Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH - $this->Prefix)), IntToInt128(1))) );76 return Int128Xor(Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH)), IntToInt128(1)), 77 Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH - $this->Prefix)), IntToInt128(1))); 78 78 } 79 79 80 80 function AddressToString() 81 81 { 82 return (inet_ntop($this->Address));82 return inet_ntop($this->Address); 83 83 } 84 84 … … 106 106 $Result[] = dechex(($Item >> 4) & 15); 107 107 } 108 return ($Result);108 return $Result; 109 109 } 110 110 … … 129 129 if (($this->Prefix < $Address->Prefix) and ((Int128Equal(Int128And($Address->Address, $UpperNetmask), Int128And($this->Address, $UpperNetmask))))) $Result = true; 130 130 else $Result = false; 131 return ($Result);131 return $Result; 132 132 } 133 133 } -
trunk/Packages/Common/Page.php
r873 r874 20 20 function Show() 21 21 { 22 return ('');22 return ''; 23 23 } 24 24 … … 26 26 { 27 27 $Output = $this->Show(); 28 return ($Output);28 return $Output; 29 29 } 30 30 31 31 function SystemMessage($Title, $Text) 32 32 { 33 return (call_user_func_array($this->OnSystemMessage, array($Title, $Text)));33 return call_user_func_array($this->OnSystemMessage, array($Title, $Text)); 34 34 } 35 35 } -
trunk/Packages/Common/PrefixMultiplier.php
r873 r874 84 84 } 85 85 } 86 return ($Value);86 return $Value; 87 87 } 88 88 … … 94 94 $Value = abs($Value); 95 95 if (($Unit == '') and ($PrefixType != 'Time')) 96 return ($this->TruncateDigits($Value, $Digits));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 101 if ($Value > 1) … … 114 114 $Value = $this->TruncateDigits($Value, $Digits); 115 115 if ($Negative) $Value = -$Value; 116 return ($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);116 return $Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit; 117 117 } 118 118 } -
trunk/Packages/Common/Process.php
r873 r874 47 47 function IsRunning() 48 48 { 49 return (is_resource($this->Handle));49 return is_resource($this->Handle); 50 50 } 51 51 } -
trunk/Packages/Common/RSS.php
r873 r874 39 39 $Result .= " </channel>\n". 40 40 "</rss>"; 41 return ($Result);41 return $Result; 42 42 } 43 43 } -
trunk/Packages/Common/Setup.php
r873 r874 29 29 '<input type="submit" name="login" value="'.T('Login').'"/>'. 30 30 '</form>'; 31 return ($Output);31 return $Output; 32 32 } 33 33 … … 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 … … 160 160 } 161 161 } 162 return ($Output);162 return $Output; 163 163 } 164 164 … … 200 200 $Output .= '<h3>Správa modulů</h3>'; 201 201 $Output .= $this->ShowList(); 202 return ($Output);202 return $Output; 203 203 } 204 204 … … 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 … … 281 281 '</table>'. 282 282 '</form>'; 283 return ($Output);283 return $Output; 284 284 } 285 285 … … 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 … … 353 353 } 354 354 $Output .= "\n\n"; 355 return ($Output);355 return $Output; 356 356 } 357 357 } … … 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 return $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
r873 r874 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 … … 75 75 function RowsCount() 76 76 { 77 return (count($this->Cells));77 return count($this->Cells); 78 78 } 79 79 } … … 145 145 $this->Table->EndRead(); 146 146 $Output .= '</table>'; 147 return ($Output);147 return $Output; 148 148 } 149 149 … … 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
r873 r874 537 537 } 538 538 } 539 return ($Result);539 return $Result; 540 540 } 541 541 … … 561 561 } 562 562 } 563 return ($Result);563 return $Result; 564 564 } 565 565 } -
trunk/Packages/Common/Update.php
r873 r874 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 … … 56 56 $TraceItem['Revision'].' WHERE `Id`=1'); 57 57 } 58 return ($Output);58 return $Output; 59 59 } 60 60 … … 81 81 echo($Query.';<br/>'); 82 82 flush(); 83 return ($this->Database->query($Query));83 return $this->Database->query($Query); 84 84 } 85 85 }
Note:
See TracChangeset
for help on using the changeset viewer.